private void addPerspectiveListener(IWorkbenchWindow window) { IPerspectiveListener perspectiveListener = new PerspectiveListener(); window.addPerspectiveListener(perspectiveListener); // triggers the event for the currently open perspective, if there is // any IWorkbenchPage activePage = window.getActivePage(); if (activePage != null) { IPerspectiveDescriptor currentPerspective = window.getActivePage() .getPerspective(); if (currentPerspective != null) { perspectiveListener.perspectiveActivated(activePage, currentPerspective); } } }
/** * Attaches the perspective listener to active window * * @param listener */ public static void addPerspectiveListener(IPerspectiveListener listener) { IWorkbench workbench = Activator.getDefault().getWorkbench(); IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); window.addPerspectiveListener(listener); }
@Override public void removePerspectiveListener(IPerspectiveListener listener) { }
@Override public void addPerspectiveListener(IPerspectiveListener listener) { }