1 11 package org.eclipse.ui.internal; 12 13 import org.eclipse.core.runtime.Platform; 14 import org.eclipse.jface.util.ListenerList; 15 import org.eclipse.jface.util.SafeRunnable; 16 import org.eclipse.ui.*; 17 18 21 public class PerspectiveListenerListOld { 22 private ListenerList listeners = new ListenerList(); 23 26 public PerspectiveListenerListOld() { 27 super(); 28 } 29 32 public void addPerspectiveListener(IPerspectiveListener l) { 33 listeners.add(l); 34 } 35 38 public void firePerspectiveActivated(final IWorkbenchPage page, final IPerspectiveDescriptor perspective) { 39 Object [] array = listeners.getListeners(); 40 for (int nX = 0; nX < array.length; nX ++) { 41 final IPerspectiveListener l = (IPerspectiveListener)array[nX]; 42 Platform.run(new SafeRunnable() { 43 public void run() { 44 l.perspectiveActivated(page, perspective); 45 } 46 }); 47 } 48 } 49 52 public void firePerspectiveChanged(final IWorkbenchPage page, final IPerspectiveDescriptor perspective, final String changeId) { 53 Object [] array = listeners.getListeners(); 54 for (int nX = 0; nX < array.length; nX ++) { 55 final IPerspectiveListener l = (IPerspectiveListener)array[nX]; 56 Platform.run(new SafeRunnable() { 57 public void run() { 58 l.perspectiveChanged(page, perspective, changeId); 59 } 60 }); 61 } 62 } 63 67 public void firePerspectiveChanged(final IWorkbenchPage page, final IPerspectiveDescriptor perspective, final IWorkbenchPartReference partRef, final String changeId) { 68 Object [] array = listeners.getListeners(); 69 for (int nX = 0; nX < array.length; nX ++) { 70 if (array[nX] instanceof IPerspectiveListener2) { 71 final IPerspectiveListener2 l2 = (IPerspectiveListener2) array[nX]; 72 Platform.run(new SafeRunnable() { 73 public void run() { 74 l2.perspectiveChanged(page, perspective, partRef, changeId); 75 } 76 }); 77 } 78 } 79 } 80 83 public void removePerspectiveListener(IPerspectiveListener l) { 84 listeners.remove(l); 85 } 86 } 87 | Popular Tags |