Java Code Examples for org.eclipse.ui.IWorkbenchPartSite#getPage()
The following examples show how to use
org.eclipse.ui.IWorkbenchPartSite#getPage() .
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: TMinGenericEditorTest.java From tm4e with Eclipse Public License 1.0 | 6 votes |
@After public void tearDown() { final IEditorPart currentEditor = editor; if (currentEditor != null) { final IWorkbenchPartSite currentSite = currentEditor.getSite(); if (currentSite != null) { final IWorkbenchPage currentPage = currentSite.getPage(); if (currentPage != null) { currentPage.closeEditor(currentEditor, false); } } } editor = null; f.delete(); f = null; }
Example 2
Source File: OpenEditorAction.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Override public void run() { if (inputFile == null) { return; } IWorkbenchPartSite workbenchPartSite = derivedSourceView.getSite(); IWorkbenchPage workbenchPage = workbenchPartSite.getPage(); try { IEditorPart editorPart = workbenchPage.openEditor(new FileEditorInput(inputFile), COMPILATION_UNIT_EDITOR_ID, true, IWorkbenchPage.MATCH_ID | IWorkbenchPage.MATCH_INPUT); if (selectedRegion != null) { ((ITextEditor) editorPart).selectAndReveal(selectedRegion.getOffset(), selectedRegion.getLength()); } } catch (PartInitException partInitException) { throw new WrappedRuntimeException(partInitException); } }
Example 3
Source File: JavaEditor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * Makes sure that the editor's folding state is correct the next time * it becomes visible. If it already is visible, it toggles the folding * state. If not, it either registers a part listener to toggle folding * when the editor becomes visible, or cancels an already registered * runner. */ public void runWhenNextVisible() { // if there is one already: toggling twice is the identity if (fFoldingRunner != null) { fFoldingRunner.cancel(); return; } IWorkbenchPartSite site= getSite(); if (site != null) { IWorkbenchPage page= site.getPage(); if (!page.isPartVisible(JavaEditor.this)) { // if we're not visible - defer until visible fPage= page; fFoldingRunner= this; page.addPartListener(this); return; } } // we're visible - run now toggleFolding(); }
Example 4
Source File: WorkingSetFilterActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public WorkingSetFilterActionGroup(IWorkbenchPartSite site, IPropertyChangeListener changeListener) { Assert.isNotNull(site); Assert.isNotNull(changeListener); fChangeListener= changeListener; fWorkbenchPage= site.getPage(); fAllowWindowWorkingSetByDefault= true; fClearWorkingSetAction= new ClearWorkingSetAction(this); fSelectWorkingSetAction= new SelectWorkingSetAction(this, site); fEditWorkingSetAction= new EditWorkingSetAction(this, site); fWorkingSetListener= new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { doPropertyChange(event); } }; fWorkingSetFilter= new WorkingSetFilter(); IWorkingSetManager manager= PlatformUI.getWorkbench().getWorkingSetManager(); manager.addPropertyChangeListener(fWorkingSetListener); if (useWindowWorkingSetByDefault()) { setWorkingSet(site.getPage().getAggregateWorkingSet(), false); } }
Example 5
Source File: NewTextSearchActionGroup.java From Pydev with Eclipse Public License 1.0 | 6 votes |
public NewTextSearchActionGroup(IViewPart part) { Assert.isNotNull(part); IWorkbenchPartSite site = part.getSite(); fSelectionProvider = site.getSelectionProvider(); fPage = site.getPage(); fOpenPropertiesDialog = new PropertyDialogAction(site, fSelectionProvider); fOpenAction = new OpenFileAction(fPage); ISelection selection = fSelectionProvider.getSelection(); if (selection instanceof IStructuredSelection) { fOpenPropertiesDialog.selectionChanged((IStructuredSelection) selection); } else { fOpenPropertiesDialog.selectionChanged(selection); } }
Example 6
Source File: NewTextSearchActionGroup.java From Pydev with Eclipse Public License 1.0 | 6 votes |
public NewTextSearchActionGroup(IViewPart part) { Assert.isNotNull(part); IWorkbenchPartSite site = part.getSite(); fSelectionProvider = site.getSelectionProvider(); fPage = site.getPage(); fOpenPropertiesDialog = new PropertyDialogAction(site, fSelectionProvider); fOpenAction = new OpenFileAction(fPage); ISelection selection = fSelectionProvider.getSelection(); if (selection instanceof IStructuredSelection) { fOpenPropertiesDialog.selectionChanged((IStructuredSelection) selection); } else { fOpenPropertiesDialog.selectionChanged(selection); } }
Example 7
Source File: SourceGraphView.java From n4js with Eclipse Public License 1.0 | 5 votes |
private void updateActiveEditor() { final IWorkbenchPartSite site = getSite(); final IWorkbenchPage page = site != null ? site.getPage() : null; final IEditorPart eddy = page != null ? page.getActiveEditor() : null; final XtextEditor xeddy = eddy instanceof XtextEditor ? (XtextEditor) eddy : null; if (activeEditor != xeddy) { activeEditor = xeddy; onActiveEditorChanged(); } }
Example 8
Source File: EditorDocumentUndoChange.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
public EditorDocumentUndoChange(String name, ITextEditor editor, UndoEdit undoEdit, boolean doSave) { this.name = name; IWorkbenchPartSite site = editor.getSite(); this.page = site.getPage(); this.editorID = site.getId(); this.editorInput = editor.getEditorInput(); this.undoEdit = undoEdit; this.doSave = doSave; }
Example 9
Source File: CallHierarchyViewPart.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
static CallHierarchyViewPart findAndShowCallersView(IWorkbenchPartSite site) { IWorkbenchPage workbenchPage = site.getPage(); CallHierarchyViewPart callersView = null; try { callersView = (CallHierarchyViewPart) workbenchPage.showView(CallHierarchyViewPart.ID_CALL_HIERARCHY); } catch (PartInitException e) { JavaPlugin.log(e); } return callersView; }
Example 10
Source File: TestUtils.java From dawnsci with Eclipse Public License 1.0 | 5 votes |
/** * Gets the page, even during startup. * @return the page */ public static IWorkbenchPage getPage(IWorkbenchPartSite site) { if (site != null) { IWorkbenchPage page = site.getPage(); if (page != null) return page; } IWorkbenchPage activePage = getActivePage(); if (activePage!=null) return activePage; return getDefaultPage(); }