01: /*
02: The contents of this file are subject to the Mozilla Public License Version 1.1
03: (the "License"); you may not use this file except in compliance with the
04: License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
05:
06: Software distributed under the License is distributed on an "AS IS" basis,
07: WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
08: for the specific language governing rights and
09: limitations under the License.
10:
11: The Original Code is "The Columba Project"
12:
13: The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
14: Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
15:
16: All Rights Reserved.
17: */
18: package org.columba.core.scripting.extensions;
19:
20: import java.util.Enumeration;
21: import java.util.Map;
22: import java.util.TreeMap;
23: import java.util.Vector;
24:
25: /**
26: @author Celso Pinto (cpinto@yimports.com)
27: */
28: public class ExtensionPointManager {
29: /*TODO add javadocs */
30: private Map extensionPoints = null;
31: private static ExtensionPointManager self = null;
32:
33: private ExtensionPointManager() {
34: extensionPoints = new TreeMap();
35:
36: initDefaultExtensionPoints();
37: }
38:
39: private void initDefaultExtensionPoints() {
40: addExtensionPoint(new MenuExtensionPoint());
41: addExtensionPoint(new ToolbarExtensionPoint());
42: }
43:
44: public static ExtensionPointManager getInstance() {
45: if (self == null)
46: self = new ExtensionPointManager();
47:
48: return self;
49: }
50:
51: public void addExtensionPoint(AbstractExtensionPoint point) {
52: extensionPoints.put(point.getId(), point);
53: }
54:
55: public void removeExtensionPoint(String id) {
56: extensionPoints.remove(id);
57: }
58:
59: public AbstractExtensionPoint getExtensionPoint(String id) {
60: return (AbstractExtensionPoint) extensionPoints.get(id);
61: }
62:
63: public Enumeration enumExtensionPoints() {
64: return (new Vector(extensionPoints.values())).elements();
65: }
66:
67: }
|