1 11 package org.eclipse.ui.internal; 12 13 import org.eclipse.ui.*; 14 15 18 public class WWinPerspectiveService implements IPerspectiveService { 19 private WorkbenchWindow workbenchWindow; 20 private PerspectiveListenerList perspectiveListeners = new PerspectiveListenerList(); 21 24 public WWinPerspectiveService(WorkbenchWindow window) { 25 super(); 26 this.workbenchWindow = window; 27 } 28 34 public void addPerspectiveListener(IInternalPerspectiveListener listener) { 35 perspectiveListeners.addPerspectiveListener(listener); 36 } 37 40 protected void firePerspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) { 41 perspectiveListeners.firePerspectiveActivated(page, perspective); 42 } 43 46 protected void firePerspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) { 47 perspectiveListeners.firePerspectiveChanged(page, perspective, changeId); 48 } 49 52 protected void firePerspectiveClosed(IWorkbenchPage page, IPerspectiveDescriptor perspective) { 53 perspectiveListeners.firePerspectiveClosed(page, perspective); 54 } 55 58 protected void firePerspectiveOpened(IWorkbenchPage page, IPerspectiveDescriptor perspective) { 59 perspectiveListeners.firePerspectiveOpened(page, perspective); 60 } 61 66 public IPerspectiveDescriptor getActivePerspective() { 67 IWorkbenchPage page = workbenchWindow.getActivePage(); 68 if (page == null) 69 return null; 70 else 71 return page.getPerspective(); 72 } 73 79 public void removePerspectiveListener(IInternalPerspectiveListener listener) { 80 perspectiveListeners.removePerspectiveListener(listener); 81 } 82 } 83 | Popular Tags |