/** * Creates a perspective tracker for the given window. * Subclasses should override <code>update(IPerspectiveDescriptor)</code> * to get notified of perspective changes. * * @param window the window to track */ protected PerspectiveTracker(IWorkbenchWindow window) { Assert.isNotNull(window); this.window = window; window.addPageListener(this); window.addPerspectiveListener(this); }
public PagePartSelectionTracker(IWorkbenchPage page, String partId) { super(partId); setPage(page); page.addPartListener(this); page.getWorkbenchWindow().addPerspectiveListener(this); String secondaryId = null; int indexOfColon; if ((indexOfColon = partId.indexOf(':')) != -1) { secondaryId = partId.substring(indexOfColon + 1); partId = partId.substring(0, indexOfColon); } IViewReference part = page.findViewReference(partId, secondaryId); if (part != null && part.getView(false) != null) { setPart(part.getView(false), false); } }
private void commonInit(IViewSite site) { site.getPage().addPartListener((IPartListener2) this); site.getWorkbenchWindow().addPageListener(this); site.getWorkbenchWindow().addPerspectiveListener(this); }
@Override public void init(IViewSite site, IMemento memento) throws PartInitException { super.init(site, memento); PREF_STATE_MEMENTO = PREF_STATE_MEMENTO + site.getId(); IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore(); String string = store.getString(PREF_STATE_MEMENTO); if(string.length() > 0) { try (ByteArrayInputStream bin = new ByteArrayInputStream(string.getBytes()); InputStreamReader reader = new InputStreamReader(bin);) { XMLMemento stateMemento = XMLMemento.createReadRoot(reader); setMemento(stateMemento); } catch (WorkbenchException e) { } catch (IOException e1) { } } IMemento mem = getMemento(); // check the weights to makes sure they are valid -- bug 154025 setLastSashWeights(DEFAULT_SASH_WEIGHTS); if (mem != null) { int[] weights = getWeights(mem); if (weights != null) { setLastSashWeights(weights); } } site.getWorkbenchWindow().addPerspectiveListener(this); }
/** * Creates a new <code>ToggleEditorsVisibilityAction</code> * * @param window the window */ public ToggleEditorsVisibilityAction(IWorkbenchWindow window) { super(window); setText(WorkbenchMessages.ToggleEditor_hideEditors); setActionDefinitionId("org.eclipse.ui.window.hideShowEditors"); //$NON-NLS-1$ // @issue missing action id setToolTipText(WorkbenchMessages.ToggleEditor_toolTip); window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.TOGGLE_EDITORS_VISIBILITY_ACTION); window.addPerspectiveListener(this); }
/** * Constructs and updates the action. * * @param page the workbench page * @param inContextMenu <code>true</code> iff this action is shown in the context menu of a breadcrumb * * @since 3.7 */ public ToggleBreadcrumbAction(IWorkbenchPage page, boolean inContextMenu) { super(JavaEditorMessages.getBundleForConstructedKeys(), inContextMenu ? "ToggleBreadcrumbAction.Hide." : "ToggleBreadcrumbAction.", //$NON-NLS-1$ //$NON-NLS-2$ inContextMenu ? IAction.AS_PUSH_BUTTON : IAction.AS_CHECK_BOX); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.TOGGLE_BREADCRUMB_ACTION); fPage= page; if (!inContextMenu) { JavaPluginImages.setToolImageDescriptors(this, "toggle_breadcrumb.png"); //$NON-NLS-1$ fPage.getWorkbenchWindow().addPerspectiveListener(this); } update(); }
/** * Constructs and updates the action. * * @param page the workbench page * @param inContextMenu <code>true</code> iff this action is shown in the context menu of a breadcrumb * * @since 3.7 */ public ToggleBreadcrumbAction(IWorkbenchPage page, boolean inContextMenu) { super(JavaEditorMessages.getBundleForConstructedKeys(), inContextMenu ? "ToggleBreadcrumbAction.Hide." : "ToggleBreadcrumbAction.", //$NON-NLS-1$ //$NON-NLS-2$ inContextMenu ? IAction.AS_PUSH_BUTTON : IAction.AS_CHECK_BOX); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.TOGGLE_BREADCRUMB_ACTION); fPage= page; if (!inContextMenu) { JavaPluginImages.setToolImageDescriptors(this, "toggle_breadcrumb.png"); //$NON-NLS-1$ fPage.getWorkbenchWindow().addPerspectiveListener(this); } update(); }
getSite().getWorkbenchWindow().addPerspectiveListener(new IPerspectiveListener2() {
configurer.getWindow().addPerspectiveListener(new PerspectiveAdapter() { @Override public void perspectiveActivated(IWorkbenchPage page,
/** * Creates a service for the given window * * @param window the window to attach this service to */ ViewContextService(IWorkbenchWindow window) { fWindow = window; fContextService = PlatformUI.getWorkbench().getAdapter(IContextService.class); fDebugContextService = DebugUITools.getDebugContextManager().getContextService(fWindow); loadContextToViewExtensions(); applyUserViewBindings(); loadPerspectives(); window.addPerspectiveListener(this); getDebugContextService().addDebugContextListener(this); IEclipsePreferences node = InstanceScope.INSTANCE.getNode(DebugUIPlugin.getUniqueIdentifier()); if (node != null) { node.addPreferenceChangeListener(this); } fContextService.addContextManagerListener(this); if (fWindow != null) { IWorkbenchPage page = fWindow.getActivePage(); if (page != null) { fActivePerspective = page.getPerspective(); } } }
getSite().getWorkbenchWindow().addPerspectiveListener(this);