KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > core > scripting > extensions > ExtensionPointManager


1 /*
2   The contents of this file are subject to the Mozilla Public License Version 1.1
3   (the "License"); you may not use this file except in compliance with the
4   License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
5   
6   Software distributed under the License is distributed on an "AS IS" basis,
7   WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
8   for the specific language governing rights and
9   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 JavaDoc;
21 import java.util.Map JavaDoc;
22 import java.util.TreeMap JavaDoc;
23 import java.util.Vector JavaDoc;
24
25
26 /**
27   @author Celso Pinto (cpinto@yimports.com)
28  */

29 public class ExtensionPointManager
30 {
31   /*TODO add javadocs */
32   private Map JavaDoc extensionPoints = null;
33   private static ExtensionPointManager self = null;
34   
35   private ExtensionPointManager()
36   {
37     extensionPoints = new TreeMap JavaDoc();
38     
39     initDefaultExtensionPoints();
40   }
41   
42   private void initDefaultExtensionPoints()
43   {
44     addExtensionPoint(new MenuExtensionPoint());
45     addExtensionPoint(new ToolbarExtensionPoint());
46   }
47   
48   public static ExtensionPointManager getInstance()
49   {
50     if (self == null)
51       self = new ExtensionPointManager();
52       
53     return self;
54   }
55   
56   public void addExtensionPoint(AbstractExtensionPoint point)
57   {
58     extensionPoints.put(point.getId(),point);
59   }
60   
61   public void removeExtensionPoint(String JavaDoc id)
62   {
63     extensionPoints.remove(id);
64   }
65   
66   public AbstractExtensionPoint getExtensionPoint(String JavaDoc id)
67   {
68     return (AbstractExtensionPoint)extensionPoints.get(id);
69   }
70   
71   public Enumeration JavaDoc enumExtensionPoints()
72   {
73     return (new Vector JavaDoc(extensionPoints.values())).elements();
74   }
75   
76 }
77
Popular Tags