blob: fa79bd4347b41b6a2adb55f6272935c381b3b59f [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2000, 2003 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.ant.ui.internal.editor.outline;
import java.util.ArrayList;
import java.util.Iterator;
/**
* XMLCore.java
*/
public class XMLCore {
private static XMLCore inst;
public static XMLCore getDefault() {
if (inst == null) {
inst= new XMLCore();
}
return inst;
}
private ArrayList fModelChangeListeners= new ArrayList();
private XMLCore() { }
public void addDocumentModelListener(IDocumentModelListener listener) {
synchronized (fModelChangeListeners) {
fModelChangeListeners.add(listener);
}
}
public void removeDocumentModelListener(IDocumentModelListener listener) {
synchronized (fModelChangeListeners) {
fModelChangeListeners.remove(listener);
}
}
public void notifyDocumentModelListeners(DocumentModelChangeEvent event) {
Iterator i;
synchronized (fModelChangeListeners) {
i= new ArrayList(fModelChangeListeners).iterator();
}
while (i.hasNext()) {
((IDocumentModelListener)i.next()).documentModelChanged(event);
}
}
}