~ubuntu-branches/ubuntu/utopic/eclipse-eclox/utopic

« back to all changes in this revision

Viewing changes to eclox.ui/src/eclox/ui/editor/editors/AbstractEditor.java

  • Committer: Package Import Robot
  • Author(s): Graham Inggs
  • Date: 2013-07-07 20:33:10 UTC
  • Revision ID: package-import@ubuntu.com-20130707203310-a44yw80gqtc2s9ob
Tags: upstream-0.10.0
ImportĀ upstreamĀ versionĀ 0.10.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*******************************************************************************
 
2
 * Copyright (C) 2003-2007, 2013, Guillaume Brocker
 
3
 * 
 
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
 
8
 *
 
9
 * Contributors:
 
10
 *     Guillaume Brocker - Initial API and implementation
 
11
 *
 
12
 ******************************************************************************/ 
 
13
 
 
14
package eclox.ui.editor.editors;
 
15
 
 
16
import java.util.Collection;
 
17
import java.util.HashSet;
 
18
import java.util.Iterator;
 
19
 
 
20
/**
 
21
 * Implements the IEditor for all listener management and notification
 
22
 * aspects
 
23
 * 
 
24
 * @author Guillaume Brocker
 
25
 */
 
26
public abstract class AbstractEditor implements IEditor {
 
27
        
 
28
        /**
 
29
         * the registery of listeners
 
30
         */
 
31
        private Collection listeners = new HashSet();
 
32
 
 
33
        /**
 
34
         * @see eclox.ui.editor.editors.IEditor#addListener(eclox.ui.editor.editors.IEditorListener)
 
35
         */
 
36
        public void addListener(IEditorListener listener) {
 
37
                listeners.add(listener);
 
38
        }
 
39
 
 
40
        /**
 
41
         * @see eclox.ui.editor.editors.IEditor#removeListener(eclox.ui.editor.editors.IEditorListener)
 
42
         */
 
43
        public void removeListener(IEditorListener listener) {
 
44
                listeners.remove(listener);
 
45
        }
 
46
        
 
47
        /**
 
48
         * Notifies registered listeners that the dirty state of the editor changed.
 
49
         */
 
50
        protected void fireEditorChanged() {
 
51
                Iterator        i = listeners.iterator();
 
52
                while( i.hasNext() ) {
 
53
                        IEditorListener listener = (IEditorListener) i.next();
 
54
                        
 
55
                        listener.editorChanged(this);
 
56
                }
 
57
        }
 
58
 
 
59
}