1 11 package org.eclipse.debug.ui.memory; 12 13 import org.eclipse.core.runtime.ISafeRunnable; 14 import org.eclipse.core.runtime.ListenerList; 15 import org.eclipse.core.runtime.SafeRunner; 16 import org.eclipse.debug.internal.ui.DebugUIPlugin; 17 18 26 public abstract class AbstractMemoryRenderingBindingsProvider implements IMemoryRenderingBindingsProvider { 27 28 private ListenerList fListeners; 30 31 34 public void addListener(IMemoryRenderingBindingsListener listener) { 35 if (fListeners == null) { 36 fListeners = new ListenerList(); 37 } 38 fListeners.add(listener); 39 } 40 43 public void removeListener(IMemoryRenderingBindingsListener listener) { 44 if (fListeners != null) { 45 fListeners.remove(listener); 46 } 47 } 48 49 52 protected void fireBindingsChanged() { 53 if (fListeners == null) { 54 return; 55 } 56 57 Object [] listeners = fListeners.getListeners(); 58 59 for (int i=0; i<listeners.length; i++) { 60 if (listeners[i] instanceof IMemoryRenderingBindingsListener) { 61 final IMemoryRenderingBindingsListener listener = (IMemoryRenderingBindingsListener)listeners[i]; 62 ISafeRunnable runnable = new ISafeRunnable () { 63 public void handleException(Throwable exception) { 64 DebugUIPlugin.log(exception); 65 } 66 public void run() throws Exception { 67 listener.memoryRenderingBindingsChanged(); 68 }}; 69 SafeRunner.run(runnable); 70 } 71 } 72 } 73 } 74 | Popular Tags |