1
/*******************************************************************************
2
* Copyright (C) 2003-2007, 2013, Guillaume Brocker
4
* All rights reserved. This program and the accompanying materials
5
* are made available under the terms of the Eclipse Public License v1.0
6
* which accompanies this distribution, and is available at
7
* http://www.eclipse.org/legal/epl-v10.html
10
* Guillaume Brocker - Initial API and implementation
12
******************************************************************************/
14
package eclox.ui.editor.editors;
16
import java.util.Collection;
17
import java.util.HashSet;
18
import java.util.Iterator;
21
* Implements the IEditor for all listener management and notification
24
* @author Guillaume Brocker
26
public abstract class AbstractEditor implements IEditor {
29
* the registery of listeners
31
private Collection listeners = new HashSet();
34
* @see eclox.ui.editor.editors.IEditor#addListener(eclox.ui.editor.editors.IEditorListener)
36
public void addListener(IEditorListener listener) {
37
listeners.add(listener);
41
* @see eclox.ui.editor.editors.IEditor#removeListener(eclox.ui.editor.editors.IEditorListener)
43
public void removeListener(IEditorListener listener) {
44
listeners.remove(listener);
48
* Notifies registered listeners that the dirty state of the editor changed.
50
protected void fireEditorChanged() {
51
Iterator i = listeners.iterator();
52
while( i.hasNext() ) {
53
IEditorListener listener = (IEditorListener) i.next();
55
listener.editorChanged(this);