1 11 package org.eclipse.ant.internal.ui.editor.outline; 12 13 import java.util.ArrayList ; 14 import java.util.Iterator ; 15 import java.util.List ; 16 17 20 public class XMLCore { 21 22 private static XMLCore inst; 23 24 public static XMLCore getDefault() { 25 if (inst == null) { 26 inst= new XMLCore(); 27 } 28 29 return inst; 30 } 31 32 private List fModelChangeListeners= new ArrayList (); 33 34 private XMLCore() { } 35 36 public void addDocumentModelListener(IDocumentModelListener listener) { 37 synchronized (fModelChangeListeners) { 38 fModelChangeListeners.add(listener); 39 } 40 } 41 42 public void removeDocumentModelListener(IDocumentModelListener listener) { 43 synchronized (fModelChangeListeners) { 44 fModelChangeListeners.remove(listener); 45 } 46 } 47 48 public void notifyDocumentModelListeners(DocumentModelChangeEvent event) { 49 Iterator i; 50 synchronized (fModelChangeListeners) { 51 i= new ArrayList (fModelChangeListeners).iterator(); 52 } 53 while (i.hasNext()) { 54 ((IDocumentModelListener)i.next()).documentModelChanged(event); 55 } 56 } 57 } 58 | Popular Tags |