blob: feb16dfc875ee93c5898f7a7a7db1f92d36ddd9d [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2000, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.ant.internal.ui.model;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class AntModelCore {
private static AntModelCore inst;
public static AntModelCore getDefault() {
if (inst == null) {
inst= new AntModelCore();
}
return inst;
}
private List fModelChangeListeners= new ArrayList();
private AntModelCore() { }
public void addAntModelListener(IAntModelListener listener) {
synchronized (fModelChangeListeners) {
fModelChangeListeners.add(listener);
}
}
public void removeAntModelListener(IAntModelListener listener) {
synchronized (fModelChangeListeners) {
fModelChangeListeners.remove(listener);
}
}
public void notifyAntModelListeners(AntModelChangeEvent event) {
Iterator i;
synchronized (fModelChangeListeners) {
i= new ArrayList(fModelChangeListeners).iterator();
}
while (i.hasNext()) {
((IAntModelListener)i.next()).antModelChanged(event);
}
}
}