1 11 package org.eclipse.compare.internal; 12 13 import org.eclipse.compare.CompareConfiguration; 14 import org.eclipse.compare.structuremergeviewer.ICompareInput; 15 import org.eclipse.core.runtime.*; 16 import org.eclipse.jface.util.IPropertyChangeListener; 17 import org.eclipse.jface.util.PropertyChangeEvent; 18 import org.eclipse.jface.viewers.Viewer; 19 import org.eclipse.swt.widgets.Composite; 20 21 25 public abstract class OutlineViewerCreator { 26 27 30 public static final String PROP_INPUT = "org.eclipse.compare.OutlineInput"; 32 private ListenerList listeners = new ListenerList(ListenerList.IDENTITY); 33 34 42 public abstract Viewer findStructureViewer(Viewer oldViewer, ICompareInput input, 43 Composite parent, CompareConfiguration configuration); 44 45 public abstract boolean hasViewerFor(Object input); 46 47 public void addPropertyChangeListener(IPropertyChangeListener listener) { 48 listeners.add(listener); 49 } 50 51 public void removePropertyChangeListener(IPropertyChangeListener listener) { 52 listeners.remove(listener); 53 } 54 55 public void fireInputChange(Object oldInput, Object newInput) { 56 Object [] list = listeners.getListeners(); 57 final PropertyChangeEvent event = new PropertyChangeEvent(this, PROP_INPUT, oldInput, newInput); 58 for (int i = 0; i < list.length; i++) { 59 final IPropertyChangeListener listener = (IPropertyChangeListener)list[i]; 60 SafeRunner.run(new ISafeRunnable() { 61 public void run() throws Exception { 62 listener.propertyChange(event); 63 } 64 public void handleException(Throwable exception) { 65 } 67 }); 68 } 69 } 70 71 public abstract Object getInput(); 72 73 } 74 | Popular Tags |