Java Code Examples for org.eclipse.ui.IWorkbenchPartReference#getPart()
The following examples show how to use
org.eclipse.ui.IWorkbenchPartReference#getPart() .
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
Source File: MOOSETreeCompositeView.java From ice with Eclipse Public License 1.0 | 6 votes |
/** * This is called when an editor has been closed. This method clears the * {@link #editor} and empties the contents of this view if the currently * active editor was closed. */ @Override public void partClosed(IWorkbenchPartReference partRef) { IWorkbenchPart part = partRef.getPart(false); if (part == editor) { // Clear the input to the TreeViewer. setInput(new TreeComposite(), null); // Unset the reference to the currently active editor. editor = null; } return; }
Example 2
Source File: ICEResourceView.java From ice with Eclipse Public License 1.0 | 6 votes |
/** * This function is called whenever a Workbench part gains focus. Here, we * are only interested if the part is an ICEFormEditor. When a new * ICEFormEditor is activated, sync the view with the activated editor. */ @Override public void partActivated(IWorkbenchPartReference partRef) { // If the activated editor is an ICEFormEditor different from the known // active ICEFormEditor, call the method to update the currently active // editor and affected UI pieces. IWorkbenchPart part = partRef.getPart(false); if (part != null && part instanceof ICEFormEditor) { ICEFormEditor activeEditor = (ICEFormEditor) part; if (activeEditor != editor) { setActiveEditor(activeEditor); } } return; }
Example 3
Source File: MeshElementTreeView.java From ice with Eclipse Public License 1.0 | 6 votes |
/** * This function is called whenever a Workbench part is closed. Here, we are * only interested if the part is an ICEFormEditor. Get the Form from the * editor. Clear the elements from the tree view. * * @param partRef * The workbench part calling this function. * * @see IPartListener2#partClosed(IWorkbenchPartReference) */ @Override public void partClosed(IWorkbenchPartReference partRef) { logger.info("MeshElementTreeView Message: Called partClosed(" + partRef.getId() + ")"); if (partRef.getId().equals(ICEFormEditor.ID)) { // Get the closed editor ICEFormEditor activeEditor = (ICEFormEditor) partRef.getPart(false); // Get the form from the editor Form activeForm = ((ICEFormInput) activeEditor.getEditorInput()) .getForm(); // If this is the most recently active form, clear the TreeViewer. if (activeForm.getItemID() == lastFormItemID) { elementTreeViewer.setInput(null); elementTreeViewer.refresh(); elementTreeViewer.getTree().redraw(); } } return; }
Example 4
Source File: DisplayOverlay.java From gama with GNU General Public License v3.0 | 5 votes |
@Override public void partClosed(final IWorkbenchPartReference partRef) { final IWorkbenchPart part = partRef.getPart(false); if (view.equals(part)) { close(); } }
Example 5
Source File: RenameRefactoringPopup.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public void partActivated(IWorkbenchPartReference partRef) { IWorkbenchPart fPart = editor.getEditorSite().getPart(); if (partRef.getPart(false) == fPart) { updateVisibility(); } }
Example 6
Source File: RenameRefactoringPopup.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public void partDeactivated(IWorkbenchPartReference partRef) { IWorkbenchPart fPart = editor.getEditorSite().getPart(); if (popup != null && !popup.isDisposed() && partRef.getPart(false) == fPart) { popup.setVisible(false); } }
Example 7
Source File: DisplayOverlay.java From gama with GNU General Public License v3.0 | 5 votes |
@Override public void partDeactivated(final IWorkbenchPartReference partRef) { final IWorkbenchPart part = partRef.getPart(false); if (view.equals(part) && !referenceComposite.isDisposed() && !referenceComposite.isVisible()) { WorkbenchHelper.run(doHide); } }
Example 8
Source File: AbstractTimeGraphView.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override public void partHidden(IWorkbenchPartReference partRef) { IWorkbenchPart part = partRef.getPart(false); if (part != null && part == AbstractTimeGraphView.this) { Display.getDefault().asyncExec(() -> { if (fTimeEventFilterDialog != null) { fTimeEventFilterDialog.close(); } }); } }
Example 9
Source File: DisplayOverlay.java From gama with GNU General Public License v3.0 | 5 votes |
@Override public void partVisible(final IWorkbenchPartReference partRef) { final IWorkbenchPart part = partRef.getPart(false); if (view.equals(part)) { WorkbenchHelper.run(doDisplay); } }
Example 10
Source File: DerivedSourceView.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Override public void partHidden(IWorkbenchPartReference workbenchPartReference) { super.partHidden(workbenchPartReference); if (workbenchPartReference.getId().equals(getSite().getId())) { workspace.removeResourceChangeListener(this); } if (getWorkbenchPartSelection() != null && workbenchPartReference.getPart(false) == getWorkbenchPartSelection().getWorkbenchPart()) { selectedSource = null; openEditorAction.setInputFile(null); openEditorAction.setSelectedRegion(null); setWorkbenchPartSelection(null); setContentDescription(""); setInput(""); } }
Example 11
Source File: EditorUtils.java From typescript.java with MIT License | 5 votes |
public static ITextEditor getEditor(IWorkbenchPartReference ref) { IWorkbenchPart part = ref.getPart(true);// ref.getPage().getActivePart(); if (part != null && part instanceof ITextEditor) { return (ITextEditor) part; } return null; }
Example 12
Source File: BoxDecoratorPartListener.java From gama with GNU General Public License v3.0 | 4 votes |
private IBoxEnabledEditor getEditor(final IWorkbenchPartReference ref) { final IWorkbenchPart part = ref.getPart(false); if (part == null) { return null; } return part instanceof IBoxEnabledEditor ? (IBoxEnabledEditor) part : null; }
Example 13
Source File: EditorPartListener.java From saros with GNU General Public License v2.0 | 4 votes |
@Override public void partInputChanged(IWorkbenchPartReference partRef) { final IWorkbenchPart part = partRef.getPart(false); if (part instanceof IEditorPart) editorManager.partInputChanged((IEditorPart) part); }
Example 14
Source File: EditorPartListener.java From saros with GNU General Public License v2.0 | 4 votes |
@Override public void partOpened(IWorkbenchPartReference partRef) { final IWorkbenchPart part = partRef.getPart(false); if (part instanceof IEditorPart) editorManager.partOpened((IEditorPart) part); }
Example 15
Source File: RefreshingPartListener.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
protected boolean isMatchingPart(IWorkbenchPartReference partRef) { IWorkbenchPart visiblePart = partRef.getPart(false); return part == visiblePart; }
Example 16
Source File: SyncGraphvizExportHandler.java From gef with Eclipse Public License 2.0 | 4 votes |
@Override public void partActivated(IWorkbenchPartReference partRef) { IWorkbenchPart part = partRef.getPart(false); checkActiveEditorAndExportGraph(part); }
Example 17
Source File: OccurrencesSearchResultPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public void partClosed(IWorkbenchPartReference partRef) { if (partRef instanceof IEditorReference && partRef.getPart(true) == fActiveEditor) { uninstallOnActiveEditor(); } }
Example 18
Source File: EditorPartListener.java From saros with GNU General Public License v2.0 | 4 votes |
@Override public void partActivated(IWorkbenchPartReference partRef) { final IWorkbenchPart part = partRef.getPart(false); if (part instanceof IEditorPart) editorManager.partActivated((IEditorPart) part); }
Example 19
Source File: RenameInformationPopup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public void partDeactivated(IWorkbenchPartReference partRef) { IWorkbenchPart fPart= fEditor.getEditorSite().getPart(); if (fPopup != null && ! fPopup.isDisposed() && partRef.getPart(false) == fPart) { fPopup.setVisible(false); } }
Example 20
Source File: EditorPartListener.java From saros with GNU General Public License v2.0 | 4 votes |
@Override public void partBroughtToTop(IWorkbenchPartReference partRef) { final IWorkbenchPart part = partRef.getPart(false); if (part instanceof IEditorPart) editorManager.partActivated((IEditorPart) part); }