1 11 package org.eclipse.debug.ui; 12 13 import org.eclipse.core.runtime.IAdaptable; 14 import org.eclipse.core.runtime.ISafeRunnable; 15 import org.eclipse.core.runtime.ListenerList; 16 import org.eclipse.core.runtime.SafeRunner; 17 import org.eclipse.debug.core.model.IBreakpoint; 18 import org.eclipse.debug.internal.ui.DebugUIPlugin; 19 import org.eclipse.debug.internal.ui.views.breakpoints.OtherBreakpointCategory; 20 import org.eclipse.jface.util.IPropertyChangeListener; 21 import org.eclipse.jface.util.PropertyChangeEvent; 22 23 30 public abstract class AbstractBreakpointOrganizerDelegate implements IBreakpointOrganizerDelegate { 31 32 private ListenerList fListeners = new ListenerList(); 34 35 38 public void addBreakpoint(IBreakpoint breakpoint, IAdaptable category) { 39 } 41 42 45 public void addPropertyChangeListener(IPropertyChangeListener listener) { 46 fListeners.add(listener); 47 } 48 49 56 public boolean canAdd(IBreakpoint breakpoint, IAdaptable category) { 57 return category instanceof OtherBreakpointCategory; 58 } 59 60 67 public boolean canRemove(IBreakpoint breakpoint, IAdaptable category) { 68 return category instanceof OtherBreakpointCategory; 69 } 70 71 74 public void dispose() { 75 fListeners = new ListenerList(); 76 } 77 78 81 public void removeBreakpoint(IBreakpoint breakpoint, IAdaptable category) { 82 } 84 85 88 public void removePropertyChangeListener(IPropertyChangeListener listener) { 89 fListeners.remove(listener); 90 } 91 92 97 protected void fireCategoryChanged(IAdaptable category) { 98 if (fListeners.isEmpty()) { 99 return; 100 } 101 final PropertyChangeEvent event = new PropertyChangeEvent(this, P_CATEGORY_CHANGED, category, null); 102 Object [] listeners = fListeners.getListeners(); 103 for (int i = 0; i < listeners.length; i++) { 104 final IPropertyChangeListener listener = (IPropertyChangeListener) listeners[i]; 105 ISafeRunnable runnable = new ISafeRunnable() { 106 public void handleException(Throwable exception) { 107 DebugUIPlugin.log(exception); 108 } 109 public void run() throws Exception { 110 listener.propertyChange(event); 111 } 112 }; 113 SafeRunner.run(runnable); 114 } 115 } 116 117 120 public IAdaptable[] getCategories() { 121 return null; 122 } 123 } 124 | Popular Tags |