KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > intro > config > IntroConfigurer


1 /***************************************************************************************************
2  * Copyright (c) 2006 IBM Corporation and others. All rights reserved. This program and the
3  * accompanying materials are made available under the terms of the Eclipse Public License v1.0
4  * which accompanies this distribution, and is available at
5  * http://www.eclipse.org/legal/epl-v10.html
6  *
7  * Contributors: IBM Corporation - initial API and implementation
8  **************************************************************************************************/

9
10 package org.eclipse.ui.intro.config;
11
12 import java.util.Map JavaDoc;
13
14 import org.eclipse.ui.internal.intro.impl.IntroPlugin;
15 import org.eclipse.ui.intro.IIntroSite;
16
17
18 /**
19  * Classes that extend this abstract class are used to configure <code>CustomizableIntroPart</code>.
20  * Since it is possible for multiple products to use the same intro configuration, this class allows
21  * them to customize some aspects of the intro content so that it looks different for different
22  * products even though they all share the same intro implementation and content.
23  *
24  * @since 3.2
25  */

26
27 public abstract class IntroConfigurer {
28
29     /**
30      * The identifier of the named group where the configurer can contribute local tool bar actions.
31      *
32      * @see #init(IIntroSite, Map)
33      */

34     public static final String JavaDoc TB_ADDITIONS = "additions"; //$NON-NLS-1$
35

36     protected Map JavaDoc themeProperties;
37     protected IIntroSite site;
38
39     /**
40      * Provides the opportunity for the configurer to contribute to the action bars and to fetch
41      * presentation theme properties.
42      *
43      * @param site
44      * the intro part's site
45      * @param themeProperties
46      * properties of the current theme that can be used by the configurer, or
47      * <code>null</code> if no theme is currently active or the active theme has no
48      * properties.
49      */

50     public void init(IIntroSite site, Map JavaDoc themeProperties) {
51         this.themeProperties = themeProperties;
52         this.site = site;
53     }
54
55     /**
56      * Returns the value of the theme property with a given name.
57      *
58      * @param name
59      * the theme property name
60      * @return the value of the property or <code>null</code> if property is not found, the theme
61      * does not have properties or no theme is currently active.
62      */

63
64     protected String JavaDoc getThemeProperty(String JavaDoc name) {
65         if (themeProperties == null)
66             return null;
67         String JavaDoc value = (String JavaDoc)themeProperties.get(name);
68         if (value!=null)
69             value = IntroPlugin.getDefault().getIntroModelRoot().resolveVariables(value);
70         return value;
71     }
72
73     /**
74      * Returns the value of the variable defined by the configurer. This variable can appear in XML
75      * content files in attribute names and values of elements. Whenever $variable$ is encountered
76      * in the content, it is evaluated using this class by passing 'variable' to this method and
77      * substituting the result in the content.
78      *
79      * @param variableName
80      * the name of the substitution variable
81      * @return the value to substitute in place of a variable or <code>null</code> if the variable
82      * cannot be resolved.
83      */

84     public abstract String JavaDoc getVariable(String JavaDoc variableName);
85
86     /**
87      * Returns the children of computed groups. Groups marked as computed will be completed at run
88      * time when the group is asked to provide children.
89      *
90      * @param pageId
91      * the identifier of the page in which this group appears
92      * @param groupId
93      * the identifier of the group group within the page
94      * @return an array of intro elements for this group. Each intro element should contain only
95      * legal elements and attributes according to the intro content schema. Returns an empty
96      * array for no children.
97      */

98     public abstract IntroElement[] getGroupChildren(String JavaDoc pageId, String JavaDoc groupId);
99
100     /**
101      * Returns an array of elements that will be used to build launch bar short cut links. Override
102      * this method if the intro launch bar has been marked as computed.
103      *
104      * @return an array of elements that will be used to dynamically build shortcut links.
105      */

106     public IntroElement[] getLaunchBarShortcuts() {
107         return new IntroElement[] {};
108     }
109
110     /**
111      * Resolves an incomplete path in the form "page_id/@" where page_id represents the identifier
112      * of the target page. The configurator should complete the path according to its internal
113      * resolution mechanism. The final path must point at an anchor in the referenced page.
114      *
115      * @param extensionId
116      * the id specified for the config extension
117      * @param path
118      * the incomplete path specified for the config extension
119      * @return the complete path that points at the anchor element in the referenced page, or
120      * <code>null</code> if the path cannot be resolved or the extension should be hidden.
121      */

122     public abstract String JavaDoc resolvePath(String JavaDoc extensionId, String JavaDoc path);
123
124     /**
125      * Returns the style value that will be mixed in with the original style of the extension.
126      * Themes can use this feature to render certain extensions differently.
127      *
128      * @param pageId
129      * the identifier of the target page that this extension is contributed into
130      * @param extensionId
131      * the identifier of the extension to provide the mixin style for.
132      * @return the style to add to the original extension style or <code>null</code> if no mixin
133      * style is found for this extension.
134      */

135     public String JavaDoc getMixinStyle(String JavaDoc pageId, String JavaDoc extensionId) {
136         return null;
137     }
138 }
Popular Tags