Java Code Examples for org.eclipse.ui.IEditorPart#equals()

The following examples show how to use org.eclipse.ui.IEditorPart#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public void selectionChanged(final IWorkbenchPart part, final ISelection selection) {
    if (selection instanceof StructuredSelection && !tableViewer.getTable().isDisposed()) {
        final Object selectedEP = ((StructuredSelection) selection).getFirstElement();
        if (selectedEP instanceof IGraphicalEditPart) {
            final IEditorPart editorPart = getSite().getPage().getActiveEditor();
            if (editorPart instanceof DiagramEditor && !editorPart.equals(tableViewer.getInput())) {
                selectionProvider = editorPart.getEditorSite().getSelectionProvider();
                tableViewer.setInput(editorPart);
                exportAction.setReport(getReportFromEditor(editorPart));
                linkAction.setEditor((DiagramEditor) editorPart);
            } else if (editorPart != null && editorPart.equals(tableViewer.getInput())) {
                tableViewer.refresh();
            }
            tableViewer.getTable().layout(true, true);
        }
    }
}
 
Example 2
private String checkEditorAndGetId(IEditorPart editor) {
	if (editor == null)
		return null;
	for (IEditorReference ref : activePage.getEditorReferences()) {
		if (editor.equals(ref.getEditor(false))) {
			return ref.getId();
		}
	}
	return null;
}
 
Example 3
/**
 * Tells whether this is the active editor in the active page.
 *
 * @return <code>true</code> if this is the active editor in the active page
 * @see IWorkbenchPage#getActiveEditor
 */
protected final boolean isActiveEditor() {
	IWorkbenchWindow window= getSite().getWorkbenchWindow();
	IWorkbenchPage page= window.getActivePage();
	if (page == null)
		return false;
	IEditorPart activeEditor= page.getActiveEditor();
	return activeEditor != null && activeEditor.equals(this);
}
 
Example 4
@Override
public void selectionChanged(final IWorkbenchPart part, final ISelection selection) {
    if (selection instanceof StructuredSelection
            && !tableViewer.getTable().isDisposed()) {
        final Object selectedEP = ((StructuredSelection) selection)
                .getFirstElement();
        if (selectedEP instanceof IGraphicalEditPart) {
            final IEditorPart editorPart = getSite().getPage().getActiveEditor();
            if (editorPart != null) {
                if (!editorPart.equals(tableViewer.getInput())) {
                    selectionProvider = editorPart.getEditorSite()
                            .getSelectionProvider();
                    tableViewer.setInput(editorPart);
                } else {
                    tableViewer.refresh();
                }
            }
            tableViewer.getTable().layout(true, true);
        }

        // change Validate Action
        final IWorkbenchPage activePage = PlatformUI.getWorkbench()
                .getActiveWorkbenchWindow().getActivePage();

        // tableViewer.setInput(activePage.getActiveEditor());
        validateAction = new ValidationViewAction();
        validateAction.setActivePage(activePage);
        validateAction.setTableViewer(tableViewer);
        tableViewer.refresh();
    }
}