org.eclipse.ui.IViewReference Java Examples
The following examples show how to use
org.eclipse.ui.IViewReference.
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: SystemCallLatencyStatisticsTableAnalysisTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Opens a latency table */ @Before public void createTree() { /* * Open latency view */ SWTBotUtils.openView(PRIMARY_VIEW_ID, SECONDARY_VIEW_ID); SWTWorkbenchBot bot = new SWTWorkbenchBot(); SWTBotView viewBot = bot.viewById(PRIMARY_VIEW_ID); final IViewReference viewReference = viewBot.getViewReference(); IViewPart viewPart = UIThreadRunnable.syncExec(new Result<IViewPart>() { @Override public IViewPart run() { return viewReference.getView(true); } }); assertTrue("Could not instanciate view", viewPart instanceof SegmentStoreStatisticsView); fTreeBot = viewBot.bot().tree(); assertNotNull(fTreeBot); }
Example #2
Source File: ShowViewScanner.java From workspacemechanic with Eclipse Public License 1.0 | 6 votes |
public boolean evaluate() { if (!PlatformUI.isWorkbenchRunning()) { return true; } final IWorkbench workbench = PlatformUI.getWorkbench(); if (workbench == null) { return true; } final Set<String> remaining = Sets.newHashSet(list); Display.getDefault().syncExec(new Runnable() { public void run() { for (IWorkbenchWindow workbenchWindow : workbench.getWorkbenchWindows()) { for (IWorkbenchPage workbenchPage : workbenchWindow.getPages()) { for (IViewReference viewReference : workbenchPage.getViewReferences()) { remaining.remove(viewReference.getId()); } } } } }); return remaining.isEmpty(); }
Example #3
Source File: CodeCheckerContext.java From CodeCheckerEclipsePlugin with Eclipse Public License 1.0 | 6 votes |
/** * The refresher for Custom ReportList View. If secondary id is empty, * it checks if a refresh really needs to happen and if so updates every * custom view for the current project. If secondary-id is not empty, * it will search for the secondary-id custom view and * updates that particular one. * * @param pages the page list for the currently active workbench windows. * @param project the project, the user change his/her view to * @param secondaryId id of the {@link ReportListViewCustom} the refresh * @param considerProjectChange false if the refresh should always happen despite of no real need to force refresh */ private void refreshCustom(IWorkbenchPage[] pages, IProject project, String secondaryId, boolean considerProjectChange) { for(IWorkbenchPage page : pages) { for (IViewReference vp : page.getViewReferences()) { if (vp.getId().equals(ReportListViewCustom.ID)) { ReportListViewCustom rlvc = (ReportListViewCustom) vp.getView(true); if(secondaryId.isEmpty() && rlvc.getViewSite().getSecondaryId() != null) { if (!considerProjectChange || this.activeProject != project) { rlvc.onEditorChanged(project); } } else if(rlvc.getViewSite().getSecondaryId() != null && rlvc.getViewSite().getSecondaryId().equals(secondaryId)){ rlvc.onEditorChanged(project); return; } } } } }
Example #4
Source File: TestLanguageServers.java From wildwebdeveloper with Eclipse Public License 2.0 | 6 votes |
@Before public void setUpProject() throws Exception { ScopedPreferenceStore prefs = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.lsp4e"); prefs.putValue("org.eclipse.wildwebdeveloper.angular.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.jsts.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.css.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.html.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.json.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.xml.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.yaml.file.logging.enabled", Boolean.toString(true)); this.project = ResourcesPlugin.getWorkspace().getRoot().getProject(getClass().getName() + System.nanoTime()); project.create(null); project.open(null); IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); for (IViewReference ref : activePage.getViewReferences()) { activePage.hideView(ref); } }
Example #5
Source File: TestTypeScript.java From wildwebdeveloper with Eclipse Public License 2.0 | 6 votes |
@Before public void setUpProject() throws Exception { ScopedPreferenceStore prefs = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.lsp4e"); prefs.putValue("org.eclipse.wildwebdeveloper.angular.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.jsts.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.css.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.html.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.json.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.xml.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.yaml.file.logging.enabled", Boolean.toString(true)); this.project = ResourcesPlugin.getWorkspace().getRoot().getProject(getClass().getName() + System.nanoTime()); project.create(null); project.open(null); IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); for (IViewReference ref : activePage.getViewReferences()) { activePage.hideView(ref); } }
Example #6
Source File: AllCleanRule.java From wildwebdeveloper with Eclipse Public License 2.0 | 6 votes |
@Override protected void starting(Description description) { super.starting(description); IIntroPart intro = PlatformUI.getWorkbench().getIntroManager().getIntro(); if (intro != null) { PlatformUI.getWorkbench().getIntroManager().closeIntro(intro); } IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); for (IViewReference ref : activePage.getViewReferences()) { activePage.hideView(ref); } ScopedPreferenceStore prefs = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.lsp4e"); prefs.putValue("org.eclipse.wildwebdeveloper.angular.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.jsts.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.css.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.html.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.json.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.xml.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.yaml.file.logging.enabled", Boolean.toString(true)); clearProjects(); }
Example #7
Source File: PatternDensityViewTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Set the density viewer * * @throws SecurityException * If a security manager is present and any the wrong class is * loaded or the class loader is not the same as its ancestor's * loader. * * @throws NoSuchFieldException * Field not available * @throws IllegalAccessException * Field is inaccessible * @throws IllegalArgumentException * the object is not the correct class type */ public void setDensityViewer() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { SWTBotView viewBot = fBot.viewById(VIEW_ID); final IViewReference viewReference = viewBot.getViewReference(); IViewPart viewPart = UIThreadRunnable.syncExec(new Result<IViewPart>() { @Override public IViewPart run() { return viewReference.getView(true); } }); assertNotNull(viewPart); if (!(viewPart instanceof PatternDensityView)) { fail("Could not instanciate view"); } fDensityView = (PatternDensityView) viewPart; /* * Use reflection to access the table viewer */ final Field field = AbstractSegmentStoreDensityView.class.getDeclaredField("fTableViewer"); field.setAccessible(true); fDensityViewer = (AbstractSegmentStoreTableViewer) field.get(fDensityView); fDensityChart = viewBot.bot().widget(WidgetOfType.widgetOfType(Chart.class)); assertNotNull(fDensityViewer); }
Example #8
Source File: RenameSelectionState.java From typescript.java with MIT License | 6 votes |
public RenameSelectionState(Object element) { fElement = element; fParts = new ArrayList<>(); fSelections = new ArrayList<>(); IWorkbenchWindow dw = JavaScriptPlugin.getActiveWorkbenchWindow(); if (dw == null) { fDisplay = null; return; } fDisplay = dw.getShell().getDisplay(); IWorkbenchPage page = dw.getActivePage(); if (page == null) return; IViewReference vrefs[] = page.getViewReferences(); for (int i = 0; i < vrefs.length; i++) { consider(vrefs[i].getPart(false)); } IEditorReference refs[] = page.getEditorReferences(); for (int i = 0; i < refs.length; i++) { consider(refs[i].getPart(false)); } }
Example #9
Source File: AbstractImportAndReadSmokeTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Gets a view part based on view title * * @param viewTile * a view title * @return the view part */ protected IViewPart getViewPart(final String viewTile) { final IViewPart[] vps = new IViewPart[1]; UIThreadRunnable.syncExec(new VoidResult() { @Override public void run() { IViewReference[] viewRefs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences(); for (IViewReference viewRef : viewRefs) { IViewPart vp = viewRef.getView(true); if (vp.getTitle().equals(viewTile)) { vps[0] = vp; return; } } } }); return vps[0]; }
Example #10
Source File: ImportAndReadPcapTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
private static IViewPart getViewPart(final String viewTile) { final IViewPart[] vps = new IViewPart[1]; UIThreadRunnable.syncExec(new VoidResult() { @Override public void run() { IViewReference[] viewRefs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences(); for (IViewReference viewRef : viewRefs) { IViewPart vp = viewRef.getView(true); if (vp.getTitle().equals(viewTile)) { vps[0] = vp; return; } } } }); return vps[0]; }
Example #11
Source File: ImportAndReadPcapTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
private static IViewReference getViewPartRef(final String viewTile) { final IViewReference[] vrs = new IViewReference[1]; UIThreadRunnable.syncExec(new VoidResult() { @Override public void run() { IViewReference[] viewRefs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences(); for (IViewReference viewRef : viewRefs) { IViewPart vp = viewRef.getView(true); if (vp.getTitle().equals(viewTile)) { vrs[0] = viewRef; return; } } } }); return vrs[0]; }
Example #12
Source File: CodeCheckerContext.java From CodeCheckerEclipsePlugin with Eclipse Public License 1.0 | 6 votes |
/** * The refresher for Current ReportList View. * * @param pages the page list for the currently active workbench windows * @param project the project, the user change his/her view to * @param filename the filename * @param considerViewerRefresh false if the refresh should always happen despite of no real need to force refresh */ private void refreshCurrent(IWorkbenchPage[] pages, IProject project, String filename, boolean considerViewerRefresh) { for(IWorkbenchPage page : pages) { for (IViewReference vp : page.getViewReferences()) { if (vp.getId().equals(ReportListView.ID)) { ReportListView rlv = (ReportListView) vp.getView(true); if (!considerViewerRefresh || rlv.getViewerRefresh()) { rlv.onEditorChanged(project, filename); } else { rlv.setViewerRefresh(true); } } } } }
Example #13
Source File: AbstractPerspectiveChecker.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Gets the perspective and checks if all the views specified in the list * are present in the perspective */ @Test public void testPerspectiveForViews() { SWTBotUtils.switchToPerspective(fPerspectiveId); WaitUtils.waitForJobs(); for (final String viewID : fViewIds) { List<SWTBotView> view = fBot.views(new BaseMatcher<String>() { @Override public boolean matches(Object item) { if (!(item instanceof IViewReference)) { return false; } IViewReference reference = (IViewReference) item; return reference.getId().equals(viewID); } @Override public void describeTo(Description description) { } }); assertEquals("view " + viewID + " is present", 1, view.size()); } }
Example #14
Source File: TmfAlignmentSynchronizer.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Get a view that corresponds to the alignment information. The view is * meant to be used as a "reference" for other views to align on. Heuristics * are applied to choose the best view. For example, the view has to be * visible. It also will prioritize the view with lowest time axis offset * because most of the interesting data should be in the time widget. * * @param alignmentInfo * alignment information * @param blackListedView * an optional black listed view that will not be used as * reference (useful for a view that just got created) * @return the reference view */ private static ITmfTimeAligned getReferenceView(TmfTimeViewAlignmentInfo alignmentInfo, TmfView blackListedView) { IWorkbenchWindow workbenchWindow = getWorkbenchWindow(alignmentInfo.getShell()); if (workbenchWindow == null || workbenchWindow.getActivePage() == null) { // Only time aligned views that are part of a workbench window are supported return null; } IWorkbenchPage page = workbenchWindow.getActivePage(); int lowestTimeAxisOffset = Integer.MAX_VALUE; ITmfTimeAligned referenceView = null; for (IViewReference ref : page.getViewReferences()) { IViewPart view = ref.getView(false); if (view != blackListedView && isTimeAlignedView(view)) { if (isCandidateForReferenceView((TmfView) view, alignmentInfo, lowestTimeAxisOffset)) { referenceView = (ITmfTimeAligned) view; lowestTimeAxisOffset = getClampedTimeAxisOffset(referenceView.getTimeViewAlignmentInfo()); } } } return referenceView; }
Example #15
Source File: TmfAlignmentSynchronizer.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Get the narrowest view that corresponds to the given alignment information. */ private static TmfView getNarrowestView(TmfTimeViewAlignmentInfo alignmentInfo) { IWorkbenchWindow workbenchWindow = getWorkbenchWindow(alignmentInfo.getShell()); if (workbenchWindow == null || workbenchWindow.getActivePage() == null) { // Only time aligned views that are part of a workbench window are supported return null; } IWorkbenchPage page = workbenchWindow.getActivePage(); int narrowestWidth = Integer.MAX_VALUE; TmfView narrowestView = null; for (IViewReference ref : page.getViewReferences()) { IViewPart view = ref.getView(false); if (isTimeAlignedView(view)) { TmfView tmfView = (TmfView) view; if (isCandidateForNarrowestView(tmfView, alignmentInfo, narrowestWidth)) { narrowestWidth = ((ITmfTimeAligned) tmfView).getAvailableWidth(getClampedTimeAxisOffset(alignmentInfo)); narrowestWidth = getClampedTimeAxisWidth(alignmentInfo, narrowestWidth); narrowestView = tmfView; } } } return narrowestView; }
Example #16
Source File: SystemCallLatencyTableAnalysisTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
@Override protected AbstractSegmentStoreTableView openTable() { /* * Open latency view */ SWTBotUtils.openView(PRIMARY_VIEW_ID, SECONDARY_VIEW_ID); SWTBotView viewBot = fBot.viewById(PRIMARY_VIEW_ID); final IViewReference viewReference = viewBot.getViewReference(); IViewPart viewPart = UIThreadRunnable.syncExec(new Result<IViewPart>() { @Override public IViewPart run() { return viewReference.getView(true); } }); assertTrue("Could not instanciate view", viewPart instanceof SegmentStoreTableView); return (SegmentStoreTableView) viewPart; }
Example #17
Source File: ImportAndReadKernelSmokeTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
private static IViewPart getViewPart(final String viewTile) { final IViewPart[] vps = new IViewPart[1]; UIThreadRunnable.syncExec(new VoidResult() { @Override public void run() { IViewReference[] viewRefs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences(); for (IViewReference viewRef : viewRefs) { IViewPart vp = viewRef.getView(true); if (vp.getTitle().equals(viewTile)) { vps[0] = vp; return; } } } }); return vps[0]; }
Example #18
Source File: SwtGui.java From gama with GNU General Public License v3.0 | 6 votes |
/** * Method setSelectedAgent() * * @see msi.gama.common.interfaces.IGui#setSelectedAgent(msi.gama.metamodel.agent.IAgent) */ @Override public void setSelectedAgent(final IAgent a) { WorkbenchHelper.asyncRun(() -> { if (WorkbenchHelper.getPage() == null) { return; } if (a == null) { return; } try { final InspectDisplayOutput output = new InspectDisplayOutput(a); output.launch(a.getScope()); } catch (final GamaRuntimeException g) { g.addContext("In opening the agent inspector"); GAMA.reportError(GAMA.getRuntimeScope(), g, false); } final IViewReference r = WorkbenchHelper.getPage().findViewReference(IGui.AGENT_VIEW_ID, ""); if (r != null) { WorkbenchHelper.getPage().bringToTop(r.getPart(true)); } }); }
Example #19
Source File: SwtGui.java From gama with GNU General Public License v3.0 | 6 votes |
@Override public void closeSimulationViews(final IScope scope, final boolean openModelingPerspective, final boolean immediately) { WorkbenchHelper.run(() -> { final IWorkbenchPage page = WorkbenchHelper.getPage(); final IViewReference[] views = page.getViewReferences(); for (final IViewReference view : views) { final IViewPart part = view.getView(false); if (part instanceof IGamaView) { DEBUG.OUT("Closing " + view.getId()); ((IGamaView) part).close(scope); } } if (openModelingPerspective) { DEBUG.OUT("Deleting simulation perspective and opening immediately the modeling perspective = " + immediately); PerspectiveHelper.deleteCurrentSimulationPerspective(); PerspectiveHelper.openModelingPerspective(immediately, false); } getStatus(scope).neutralStatus("No simulation running"); }); }
Example #20
Source File: InvasiveThemeHijacker.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
protected void hijackOutline() { IWorkbenchPage page = UIUtils.getActivePage(); if (page != null) { IViewReference[] refs = page.getViewReferences(); for (IViewReference ref : refs) { if (ref.getId().equals(IPageLayout.ID_OUTLINE)) { hijackView(ref.getView(false), false); return; } } } }
Example #21
Source File: InvasiveThemeHijacker.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public void partActivated(IWorkbenchPartReference partRef) { if (partRef instanceof IViewReference) { IViewReference viewRef = (IViewReference) partRef; String id = viewRef.getId(); if ("org.eclipse.ui.console.ConsoleView".equals(id) || "org.eclipse.jdt.ui.TypeHierarchy".equals(id) //$NON-NLS-1$ //$NON-NLS-2$ || "org.eclipse.jdt.callhierarchy.view".equals(id)) //$NON-NLS-1$ { final IViewPart part = viewRef.getView(false); Display.getCurrent().asyncExec(new Runnable() { public void run() { hijackView(part, false); } }); return; } } if (partRef instanceof IEditorReference) { hijackOutline(); } }
Example #22
Source File: InvasiveThemeHijacker.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public void partClosed(IWorkbenchPartReference partRef) { if (partRef instanceof IEditorReference) { IEditorPart part = (IEditorPart) partRef.getPart(false); if (part instanceof MultiPageEditorPart) { MultiPageEditorPart multi = (MultiPageEditorPart) part; if (pageListener != null) { multi.getSite().getSelectionProvider().removeSelectionChangedListener(pageListener); } } } // If it's a search view, remove any query listeners for it! else if (partRef instanceof IViewReference) { IViewPart view = (IViewPart) partRef.getPart(false); if (queryListeners.containsKey(view)) { NewSearchUI.removeQueryListener(queryListeners.remove(view)); } } }
Example #23
Source File: RenameSelectionState.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public RenameSelectionState(Object element) { fElement= element; fParts= new ArrayList<IWorkbenchPart>(); fSelections= new ArrayList<IStructuredSelection>(); IWorkbenchWindow dw = JavaPlugin.getActiveWorkbenchWindow(); if (dw == null) { fDisplay= null; return; } fDisplay= dw.getShell().getDisplay(); IWorkbenchPage page = dw.getActivePage(); if (page == null) return; IViewReference vrefs[]= page.getViewReferences(); for(int i= 0; i < vrefs.length; i++) { consider(vrefs[i].getPart(false)); } IEditorReference refs[]= page.getEditorReferences(); for(int i= 0; i < refs.length; i++) { consider(refs[i].getPart(false)); } }
Example #24
Source File: UIUtil.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * Gets the ViewPart with the specified id * * @param id * the id of view part * * @return Returns the view part, or null if not found */ public static IViewPart getView( String id ) { IWorkbenchPage tPage = PlatformUI.getWorkbench( ) .getActiveWorkbenchWindow( ) .getActivePage( ); IViewReference[] v = tPage.getViewReferences( ); int i; for ( i = 0; i < v.length; i++ ) { if ( v[i].getId( ).equals( id ) ) return (IViewPart) v[i].getPart( true ); } return null; }
Example #25
Source File: UIUtils.java From Pydev with Eclipse Public License 1.0 | 6 votes |
public static ViewPart getView(String viewId, boolean forceVisible) { IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); try { if (workbenchWindow == null) { return null; } IWorkbenchPage page = workbenchWindow.getActivePage(); if (forceVisible) { return (ViewPart) page.showView(viewId, null, IWorkbenchPage.VIEW_VISIBLE); } else { IViewReference viewReference = page.findViewReference(viewId); if (viewReference != null) { //if it's there, return it (but don't restore it if it's still not there). //when made visible, it'll handle things properly later on. return (ViewPart) viewReference.getView(false); } } } catch (Exception e) { Log.log(e); } return null; }
Example #26
Source File: ScriptConsole.java From Pydev with Eclipse Public License 1.0 | 6 votes |
/** * @param page the page where the console view is * @param restore whether we should try to restore it * @return a list with the parts containing the console */ private static List<IViewPart> getConsoleParts(IWorkbenchPage page, boolean restore) { List<IViewPart> consoleParts = new ArrayList<IViewPart>(); IViewReference[] viewReferences = page.getViewReferences(); for (IViewReference ref : viewReferences) { if (ref.getId().equals(IConsoleConstants.ID_CONSOLE_VIEW)) { IViewPart part = ref.getView(restore); if (part != null) { consoleParts.add(part); if (restore) { return consoleParts; } } } } return consoleParts; }
Example #27
Source File: PyCodeCoverageView.java From Pydev with Eclipse Public License 1.0 | 6 votes |
/** * Gets the py code coverage view. May only be called in the UI thread. If the view is not visible, if createIfNotThere * is true, it's made visible. * * Note that it may return null if createIfNotThere == false and the view is not currently shown or if not in the * UI thread. */ public static PyCodeCoverageView getView(boolean createIfNotThere) { IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); try { if (workbenchWindow == null) { return null; } IWorkbenchPage page = workbenchWindow.getActivePage(); if (createIfNotThere) { return (PyCodeCoverageView) page.showView(PY_COVERAGE_VIEW_ID, null, IWorkbenchPage.VIEW_ACTIVATE); } else { IViewReference viewReference = page.findViewReference(PY_COVERAGE_VIEW_ID); if (viewReference != null) { //if it's there, return it (but don't restore it if it's still not there). //when made visible, it'll handle things properly later on. return (PyCodeCoverageView) viewReference.getView(false); } } } catch (Exception e) { Log.log(e); } return null; }
Example #28
Source File: Utilities.java From jbt with Apache License 2.0 | 6 votes |
/** * Returns a IViewPart by its class. If cannot be found, returns null. */ public static IViewPart getView(Class c) { IWorkbenchPage page = getMainWindowActivePage(); if (page != null) { IViewReference[] views = page.getViewReferences(); for (int i = 0; i < views.length; i++) { if (views[i].getView(true) != null) { if (c.isInstance(views[i].getView(false))) { return views[i].getView(false); } } } } return null; }
Example #29
Source File: OpenBrowserOperation.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void openAsView(IWorkbenchPage page) throws PartInitException { WebBrowserView view = null; IViewReference findViewReference = page.findViewReference(WebBrowserView.WEB_BROWSER_VIEW_ID, WebBrowserUtil.encodeStyle(id, IWorkbenchBrowserSupport.AS_VIEW)); if (findViewReference == null) { view = (WebBrowserView) page.showView(WebBrowserView.WEB_BROWSER_VIEW_ID, WebBrowserUtil.encodeStyle(id, IWorkbenchBrowserSupport.AS_VIEW), IWorkbenchPage.VIEW_CREATE); } else { view = (WebBrowserView) findViewReference.getView(true); } if (name != null && name.length() > 0) { view.setBrowserViewName(name); } if (view != null) { view.setURL(url.toExternalForm()); if (bringPartToTop) { page.bringToTop(view); } } }
Example #30
Source File: CompareView.java From olca-app with Mozilla Public License 2.0 | 6 votes |
public static void clear() { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); if (page == null) return; for (IViewReference viewRef : page.getViewReferences()) { if (!ID.equals(viewRef.getId())) continue; CompareView view = (CompareView) viewRef.getView(false); if (view == null) return; view.commit = null; view.currentSelection = null; view.input = null; view.viewer.setInput(new ArrayList<>()); } }