org.eclipse.ui.IPerspectiveDescriptor Java Examples
The following examples show how to use
org.eclipse.ui.IPerspectiveDescriptor.
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: TestsPdeAbapGitStagingUtil.java From ADT_Frontend with MIT License | 6 votes |
public AbapGitStagingView initializeView() throws PartInitException{ AbapGitStagingView view; IWorkbenchPage activePage = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage(); IPerspectiveDescriptor abapPerspective = PlatformUI.getWorkbench() .getPerspectiveRegistry() .findPerspectiveWithId("com.sap.adt.ui.AbapPerspective"); //$NON-NLS-1$ activePage.setPerspective(abapPerspective); view = ((AbapGitStagingView) PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getActivePage().showView(AbapGitStagingView.VIEW_ID)); view.init(view.getViewSite()); Shell shell = new Shell(Display.getDefault().getActiveShell()); Composite parent = new Composite(shell, SWT.NONE); view.createPartControl(parent); return view; }
Example #2
Source File: PerspectiveImportService.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
private int isPerspectiveInsideStack(IPerspectiveDescriptor pd){ int idx = -1; if (pd != null) { List<MPerspective> perspectivesInStack; MPerspectiveStack mPerspectiveStack = getPerspectiveStack(); perspectivesInStack = mPerspectiveStack.getChildren(); for (MPerspective perspectiveInStack : perspectivesInStack) { if (pd.getId().equals(perspectiveInStack.getElementId())) { idx++; break; } } } return idx; }
Example #3
Source File: PerspectiveImportService.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
@Override public int deletePerspective(String perspectiveId){ IPerspectiveRegistry iPerspectiveRegistry = PlatformUI.getWorkbench().getPerspectiveRegistry(); MApplication mApplication = getService(MApplication.class); IPerspectiveDescriptor existingPerspectiveDescriptor = iPerspectiveRegistry.findPerspectiveWithId(perspectiveId); int idx = -1; if (existingPerspectiveDescriptor != null) { idx = closePerspective(existingPerspectiveDescriptor); //NOT WORKING IF PERSPECTIVE IS PREDEFINED - workaround with generics iPerspectiveRegistry.deletePerspective(existingPerspectiveDescriptor); PerspectiveImportService.genericInvokMethod(iPerspectiveRegistry, "removeSnippet", MSnippetContainer.class, String.class, mApplication, existingPerspectiveDescriptor.getId()); } return idx; }
Example #4
Source File: GhidraLaunchDelegate.java From ghidra with Apache License 2.0 | 6 votes |
/** * Handles extra things that should happen when we are launching in debug mode. */ private static void handleDebugMode() { Display.getDefault().asyncExec(() -> { // Switch to debug perspective if (PlatformUI.getWorkbench() != null) { IPerspectiveDescriptor descriptor = PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId( IDebugUIConstants.ID_DEBUG_PERSPECTIVE); EclipseMessageUtils.getWorkbenchPage().setPerspective(descriptor); } // Start PyDev debugger if (PyDevUtils.isSupportedPyDevInstalled()) { try { PyDevUtils.startPyDevRemoteDebugger(); } catch (OperationNotSupportedException e) { EclipseMessageUtils.error( "Failed to start the PyDev remote debugger. PyDev version is not supported."); } } }); }
Example #5
Source File: TestsPdeAbapGitRepositoriesUtil.java From ADT_Frontend with MIT License | 6 votes |
public AbapGitView initializeView() throws PartInitException { AbapGitView view; IWorkbenchPage activePage = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage(); IPerspectiveDescriptor abapPerspective = PlatformUI.getWorkbench() .getPerspectiveRegistry() .findPerspectiveWithId("com.sap.adt.ui.AbapPerspective"); //$NON-NLS-1$ activePage.setPerspective(abapPerspective); view = ((AbapGitView) PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getActivePage().showView(AbapGitView.ID)); view.init(view.getViewSite()); Shell shell = new Shell(Display.getDefault().getActiveShell()); Composite parent = new Composite(shell, SWT.NONE); view.createPartControl(parent); return view; }
Example #6
Source File: UIHelper.java From tlaplus with MIT License | 6 votes |
/** * Determines if given perspective is shown * * @param id * @return true if the perspective with current id is shown, false otherwise */ public static boolean isPerspectiveShown(String perspectiveId) { if (perspectiveId == null || perspectiveId.equals("")) { return false; } IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows(); for (int i = 0; i < workbenchWindows.length; i++) { IPerspectiveDescriptor[] openPerspectives = workbenchWindows[i].getActivePage().getOpenPerspectives(); for (int j = 0; j < openPerspectives.length; j++) { if (perspectiveId.equals(openPerspectives[j].getId())) { return true; } } } return false; }
Example #7
Source File: PerspektiveImportHandler.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
@SuppressWarnings("restriction") private IPerspectiveDescriptor savePerspectiveToRegistryLegacy(MPerspective perspective){ IPerspectiveRegistry perspectiveRegistry = (PerspectiveRegistry) PlatformUI.getWorkbench().getPerspectiveRegistry(); IPerspectiveDescriptor pd = perspectiveRegistry.findPerspectiveWithId(perspective.getElementId()); if (pd == null) { ((PerspectiveRegistry) perspectiveRegistry).addPerspective(perspective); pd = perspectiveRegistry.findPerspectiveWithId(perspective.getElementId()); } else { LoggerFactory.getLogger(PerspektiveImportHandler.class) .error("perspective descriptor already exists for perspective id: " + perspective.getElementId()); } return pd; }
Example #8
Source File: ApplicationActionBarAdvisor.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
/** * Create a new action for opening a perspective * * @param perspectiveDescriptor * the perspective to be opened */ OpenPerspectiveAction(IPerspectiveDescriptor perspectiveDescriptor, String name, String icon){ super(perspectiveDescriptor.getLabel()); setId(perspectiveDescriptor.getId()); if (!StringTool.isNothing(icon)) { setImageDescriptor(perspectiveDescriptor.getImageDescriptor()); } else { setImageDescriptor(perspectiveDescriptor.getImageDescriptor()); } setToolTipText((StringTool.isNothing(name) ? perspectiveDescriptor.getLabel() : name) + StringTool.space + Messages.ApplicationActionBarAdvisor_10); this.perspectiveDescriptor = perspectiveDescriptor; }
Example #9
Source File: BonitaPerspectivesUtils.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * Switch to the perspective with id given as parameter * * @param perspectiveID */ public static synchronized void switchToPerspective(final String perspectiveID) { final IWorkbench workbench = PlatformUI.getWorkbench(); final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); if (window != null) { final IWorkbenchPage activePage = window.getActivePage(); if (activePage != null) { final IPerspectiveDescriptor activePerspective = activePage.getPerspective(); if (activePerspective == null || !activePerspective.getId().equals(perspectiveID)) { final IPerspectiveRegistry registry = workbench.getPerspectiveRegistry(); final IWorkbenchPage page = window.getActivePage(); final IPerspectiveDescriptor desc = registry.findPerspectiveWithId(perspectiveID); page.setPerspective(desc); } } } }
Example #10
Source File: OpenWSDLEditorAction.java From tesb-studio-se with Apache License 2.0 | 6 votes |
public void run(IIntroSite site, Properties params) { PlatformUI.getWorkbench().getIntroManager().closeIntro(PlatformUI.getWorkbench().getIntroManager().getIntro()); IPerspectiveDescriptor currentPerspective = site.getPage().getPerspective(); if (!PERSPECTIVE_ID.equals(currentPerspective.getId())) { // show required perspective IWorkbenchWindow workbenchWindow = site.getWorkbenchWindow(); try { workbenchWindow.getWorkbench().showPerspective(PERSPECTIVE_ID, workbenchWindow); } catch (WorkbenchException e) { ExceptionHandler.process(e); return; } } // find repository node repositoryNode = (RepositoryNode) RepositorySeekerManager.getInstance().searchRepoViewNode(params.getProperty("nodeId"), false); if (null != repositoryNode) { // expand/select node item RepositoryManagerHelper.getRepositoryView().getViewer().setSelection(new StructuredSelection(repositoryNode)); init(repositoryNode); doRun(); } }
Example #11
Source File: CommonEditorPlugin.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) { if (changeId.equals(IWorkbenchPage.CHANGE_VIEW_HIDE)) { if (findView(page, OUTLINE_VIEW_ID) == null) { setCommandState(false); } } else if (changeId.equals(IWorkbenchPage.CHANGE_VIEW_SHOW)) { if (findView(page, OUTLINE_VIEW_ID) != null) { setCommandState(true); } } }
Example #12
Source File: GdtPlugin.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
/** * Adds the new wizards to the current perspective displayed in <code>activeWorkbenchWindow</code>, if they've not * been added already. Adds listeners on the window so that the same is done whenever the user switches perspectives * in the window. * * Note: This method can only be called once the workbench has been started. */ private void maybeAddNewWizardActionsToWindow(IWorkbenchWindow activeWorkbenchWindow) { if (activeWorkbenchWindow == null) { return; } activeWorkbenchWindow.addPerspectiveListener(perspectiveListener); WorkbenchPage activePage = (WorkbenchPage) activeWorkbenchWindow.getActivePage(); if (activePage == null) { return; } IPerspectiveDescriptor perspectiveDesc = activePage.getPerspective(); maybeAddNewWizardActionsToPerspective(activePage, perspectiveDesc); }
Example #13
Source File: ResetSimulationPerspective.java From gama with GNU General Public License v3.0 | 6 votes |
@Override public Object execute(final ExecutionEvent event) throws ExecutionException { final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event); if (activeWorkbenchWindow != null) { final WorkbenchPage page = (WorkbenchPage) activeWorkbenchWindow.getActivePage(); if (page != null) { final IPerspectiveDescriptor descriptor = page.getPerspective(); if (descriptor != null) { final String message = "Resetting the perspective will reload the current experiment. Do you want to proceed ?"; final boolean result = MessageDialog.open(MessageDialog.QUESTION, activeWorkbenchWindow.getShell(), "Reset experiment perspective", message, SWT.SHEET); if (!result) { return null; } page.resetPerspective(); GAMA.reloadFrontmostExperiment(); } } } return null; }
Example #14
Source File: PerspectiveHelper.java From gama with GNU General Public License v3.0 | 6 votes |
public static void cleanPerspectives() { final EModelService e = PlatformUI.getWorkbench().getService(EModelService.class); final MApplication a = PlatformUI.getWorkbench().getService(MApplication.class); final List<PerspectiveImpl> perspectives = e.findElements(a, PerspectiveImpl.class, EModelService.ANYWHERE, element -> matches(element.getElementId())); for ( final PerspectiveImpl p : perspectives ) { // DEBUG.OUT("Dirty perspective implementation found and removed: " + p.getElementId()); p.getParent().getChildren().remove(p); } final IPerspectiveRegistry reg = PlatformUI.getWorkbench().getPerspectiveRegistry(); for ( final IPerspectiveDescriptor desc : reg.getPerspectives() ) { if ( matches(desc.getId()) ) { // DEBUG.OUT("Dirty perspective descriptor found and removed: " + desc.getId()); reg.deletePerspective(desc); } } // DEBUG.OUT("Current perspectives: " + listCurrentPerspectives()); }
Example #15
Source File: GraphicalEditorWithFlyoutPalette.java From birt with Eclipse Public License 1.0 | 5 votes |
public String getBreadcrumbPreferenceKey( ) { IPerspectiveDescriptor perspective = getSite( ).getPage( ) .getPerspective( ); if ( perspective == null ) return null; return EDITOR_SHOW_BREADCRUMB + "." + perspective.getId( ); //$NON-NLS-1$ }
Example #16
Source File: CleanupHelper.java From gama with GNU General Public License v3.0 | 5 votes |
@Override public void perspectiveChanged(final IWorkbenchPage p, final IPerspectiveDescriptor d, final String c) { if (c.equals(IWorkbenchPage.CHANGE_RESET_COMPLETE)) { perspectiveActivated(p, d); } }
Example #17
Source File: BonitaPerspectivesUtils.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @param perspectiveID * @return if the active perspective is the one with the ID perspectiveID */ public static boolean isPerspectiveWithIDActive(final String perspectiveID) { final IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (activeWorkbenchWindow != null) { final IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage(); if (activePage != null) { final IPerspectiveDescriptor perspective = activePage.getPerspective(); if (perspective != null) { return perspective.getId().equals(perspectiveID); } } } return false; }
Example #18
Source File: PerspectiveImportService.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
public int closePerspective(IPerspectiveDescriptor iPerspectiveDescriptor){ int idx = isPerspectiveInsideStack(iPerspectiveDescriptor); if (idx > -1) { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .closePerspective(iPerspectiveDescriptor, true, false); } return idx; }
Example #19
Source File: ToggleBreadcrumbAction.java From birt with Eclipse Public License 1.0 | 5 votes |
public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) { boolean isChecked= fStore.getBoolean(getPreferenceKey()); if (isChecked != isChecked()) { Boolean value= Boolean.valueOf(isChecked); fStore.firePropertyChangeEvent(getPreferenceKey(), value, value); } }
Example #20
Source File: ToggleBreadcrumbAction.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Returns the preference key for the breadcrumb. The * value depends on the current perspective. * * @return the preference key or <code>null</code> if there's no perspective */ private String getPreferenceKey() { IPerspectiveDescriptor perspective= fPage.getPerspective(); if (perspective == null) return null; return GraphicalEditorWithFlyoutPalette.EDITOR_SHOW_BREADCRUMB + "." + perspective.getId(); //$NON-NLS-1$ }
Example #21
Source File: UIUtils.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Returns the active perspective descriptor if there is one. * * @return the active perspective descriptor; <code>null</code> in case it could not be resolved. */ public static IPerspectiveDescriptor getActivePerspectiveDescriptor() { IWorkbenchPage activePage = getActivePage(); if (activePage != null) { return activePage.getPerspective(); } return null; }
Example #22
Source File: UIUtils.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Returns the active perspective id if there is one * * @return the active perspective id; <code>null</code> in case it could not be resolved. */ public static String getActivePerspectiveId() { IPerspectiveDescriptor perspective = getActivePerspectiveDescriptor(); if (perspective != null) { return perspective.getId(); } return null; }
Example #23
Source File: PerspectiveHelper.java From gama with GNU General Public License v3.0 | 5 votes |
public static SimulationPerspectiveDescriptor getActiveSimulationPerspective() { final IPerspectiveDescriptor d = getActivePerspective(); if ( d instanceof SimulationPerspectiveDescriptor ) { return (SimulationPerspectiveDescriptor) d; } else { return null; } }
Example #24
Source File: PerspectiveHelper.java From gama with GNU General Public License v3.0 | 5 votes |
public final static Boolean keepTray() { final IPerspectiveDescriptor d = getActivePerspective(); if ( d instanceof SimulationPerspectiveDescriptor ) { return ((SimulationPerspectiveDescriptor) d).keepTray(); } else { return true; } }
Example #25
Source File: PerspectiveHelper.java From gama with GNU General Public License v3.0 | 5 votes |
public final static Boolean keepControls() { final IPerspectiveDescriptor d = getActivePerspective(); if ( d instanceof SimulationPerspectiveDescriptor ) { return ((SimulationPerspectiveDescriptor) d).keepControls(); } else { return true; } }
Example #26
Source File: PerspectiveHelper.java From gama with GNU General Public License v3.0 | 5 votes |
public final static Boolean keepToolbars() { final IPerspectiveDescriptor d = getActivePerspective(); if ( d instanceof SimulationPerspectiveDescriptor ) { return ((SimulationPerspectiveDescriptor) d).keepToolbars(); } else { return null; } }
Example #27
Source File: PerspectiveHelper.java From gama with GNU General Public License v3.0 | 5 votes |
public final static Boolean keepTabs() { final IPerspectiveDescriptor d = getActivePerspective(); if ( d instanceof SimulationPerspectiveDescriptor ) { return ((SimulationPerspectiveDescriptor) d).keepTabs; } else { return true; } }
Example #28
Source File: PerspectiveHelper.java From gama with GNU General Public License v3.0 | 5 votes |
private static IPerspectiveDescriptor findOrBuildPerspectiveWithId(final String id) { if ( currentSimulationPerspective != null && currentSimulationPerspective.getId().equals(id) ) { return currentSimulationPerspective; } final PerspectiveRegistry pr = (PerspectiveRegistry) getPerspectiveRegistry(); IPerspectiveDescriptor tempDescriptor = pr.findPerspectiveWithId(id); if ( tempDescriptor == null ) { getPerspectiveRegistry() .revertPerspective(getPerspectiveRegistry().findPerspectiveWithId(PERSPECTIVE_SIMULATION_ID)); tempDescriptor = new SimulationPerspectiveDescriptor(id); } return tempDescriptor; }
Example #29
Source File: PerspectiveImportService.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
@Override public void openPerspective(IPerspectiveDescriptor iPerspectiveDescriptor){ try { IWorkbenchWindow win = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); PlatformUI.getWorkbench().showPerspective(iPerspectiveDescriptor.getId(), win); } catch (WorkbenchException e) { LoggerFactory.getLogger(PerspectiveImportService.class) .error("cannot open perspective [{}]", iPerspectiveDescriptor.getId(), e); } }
Example #30
Source File: RcpWindowAdvisor.java From olca-app with Mozilla Public License 2.0 | 5 votes |
private boolean isStandardPerspective() { IWorkbench wb = PlatformUI.getWorkbench(); IWorkbenchWindow win = wb.getActiveWorkbenchWindow(); IWorkbenchPage page = win.getActivePage(); IPerspectiveDescriptor perspective = page.getPerspective(); return perspective.getId().equals(RcpPerspective.ID); }