01: /*******************************************************************************
02: * Copyright (c) 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.internal.intro.impl.model;
11:
12: import java.util.HashMap;
13: import java.util.Map;
14:
15: /**
16: * This package maintains the mapping between extension ids in the registry and extension ids
17: * as defined in extension files. It also allows a configurer to change the page which will be
18: * displayed when the welcome screen is shown.
19: */
20:
21: public class ExtensionMap {
22:
23: private static ExtensionMap instance;
24: private static String startPage;
25: private Map extensions = new HashMap();
26:
27: private ExtensionMap() {
28:
29: }
30:
31: /**
32: * Get the one and only instance of this class
33: * @return
34: */
35: static public ExtensionMap getInstance() {
36: if (instance == null) {
37: instance = new ExtensionMap();
38: }
39: return instance;
40: }
41:
42: /**
43: * Save an association beteen an anchorId and pluginId
44: * @param anchorId the id of an anchor
45: * @param pluginId the plugin which contributed that anchor
46: */
47: public void putPluginId(String anchorId, String pluginId) {
48: if (anchorId != null) {
49: extensions.put(anchorId, pluginId);
50: }
51: }
52:
53: /**
54: * Lookup in which plugin
55: * @param anchorId
56: * @return the plugin which contributed that anchor
57: */
58: public String getPluginId(String anchorId) {
59: return (String) extensions.get(anchorId);
60: }
61:
62: /**
63: * Clear the map and content page
64: */
65: public void clear() {
66: extensions = new HashMap();
67: startPage = null;
68: }
69:
70: /**
71: * called to determine if the configurer has overriden the start page
72: * @return the new start page or null.
73: */
74: public String getStartPage() {
75: return startPage;
76: }
77:
78: /**
79: * Allows a configurer to override the page which is displayed when
80: * the welcome screen is first shown
81: * @param contentPage
82: */
83: public void setStartPage(String contentPage) {
84: startPage = contentPage;
85: }
86:
87: }
|