Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDejan Gloszic2006-02-10 00:25:42 +0000
committerDejan Gloszic2006-02-10 00:25:42 +0000
commit32aee92ff606e635ddfa0f0a5c08bbe3e437a3a9 (patch)
tree234e961e1871d7c83beff8592aba4a33faa77d29 /org.eclipse.ui.intro
parent045f60cde766d1b467d923ea03db0ecf31c18723 (diff)
downloadeclipse.platform.ua-32aee92ff606e635ddfa0f0a5c08bbe3e437a3a9.tar.gz
eclipse.platform.ua-32aee92ff606e635ddfa0f0a5c08bbe3e437a3a9.tar.xz
eclipse.platform.ua-32aee92ff606e635ddfa0f0a5c08bbe3e437a3a9.zip
*** empty log message ***
Diffstat (limited to 'org.eclipse.ui.intro')
-rw-r--r--org.eclipse.ui.intro/plugin.xml16
-rw-r--r--org.eclipse.ui.intro/schema/config.exsd7
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarElement.java29
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarShortcut.java22
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPartPresentation.java1
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/shared/CustomizeCommand.java7
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/shared/SharedIntroConfigurer.java59
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/shared/WelcomeCustomizationPreferencePage.java13
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IntroConfigurer.java36
9 files changed, 150 insertions, 40 deletions
diff --git a/org.eclipse.ui.intro/plugin.xml b/org.eclipse.ui.intro/plugin.xml
index 1d001b9fb..9d7786b57 100644
--- a/org.eclipse.ui.intro/plugin.xml
+++ b/org.eclipse.ui.intro/plugin.xml
@@ -57,18 +57,12 @@
<implementation
kind="swt">
</implementation>
+ <launchBar
+ location="fastview"
+ bg="#c6c3e8"
+ dynamic="true">
+ </launchBar>
</presentation>
</config>
</extension>
- <extension
- id="introData"
- point="org.eclipse.core.runtime.applications">
- <application>
- <run class="org.eclipse.ui.internal.intro.shared.IntroDataApplication"/>
- </application>
- </extension>
-
-
-
-
</plugin>
diff --git a/org.eclipse.ui.intro/schema/config.exsd b/org.eclipse.ui.intro/schema/config.exsd
index 654cd28ca..0b94b0e26 100644
--- a/org.eclipse.ui.intro/schema/config.exsd
+++ b/org.eclipse.ui.intro/schema/config.exsd
@@ -217,6 +217,13 @@ The content file is parsed at run time by the intro framework. Based on the sett
</documentation>
</annotation>
</attribute>
+ <attribute name="dynamic" type="boolean" use="default" value="false">
+ <annotation>
+ <documentation>
+ an optional boolean flag that indicates whether the launch bar shortcuts will be computed dynamically by the intro configurer. When set to &lt;code&gt;true&lt;/code&gt;, static &lt;code&gt;shortcut&lt;/code&gt; elements are ignored.
+ </documentation>
+ </annotation>
+ </attribute>
</complexType>
</element>
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarElement.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarElement.java
index 3302c9776..50ab594eb 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarElement.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarElement.java
@@ -18,6 +18,8 @@ import org.eclipse.swt.SWT;
import org.eclipse.ui.IWorkbenchPreferenceConstants;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.intro.impl.util.ImageUtil;
+import org.eclipse.ui.intro.config.IntroConfigurer;
+import org.eclipse.ui.intro.config.IntroElement;
/**
* An Intro Config component captures launch bar information. It can have
@@ -158,12 +160,27 @@ public class IntroLaunchBarElement extends AbstractIntroElement {
*/
private void createShortcuts() {
shortcuts = new ArrayList();
- IConfigurationElement[] children = getCfgElement().getChildren(
- IntroLaunchBarShortcut.TAG_SHORTCUT);
- for (int i = 0; i < children.length; i++) {
- IConfigurationElement child = children[i];
- IntroLaunchBarShortcut shortcut = new IntroLaunchBarShortcut(child);
- shortcuts.add(shortcut);
+ IntroModelRoot model = getModelRoot();
+ IntroConfigurer configurer = model!=null?model.getConfigurer():null;
+
+ String dvalue = getCfgElement().getAttribute("dynamic"); //$NON-NLS-1$
+ boolean dynamic = dvalue!=null && dvalue.equalsIgnoreCase("true"); //$NON-NLS-1$
+
+ if (dynamic && configurer!=null) {
+ IntroElement [] children = configurer.getLaunchBarShortcuts();
+ for (int i=0; i<children.length; i++) {
+ IntroLaunchBarShortcut shortcut = new IntroLaunchBarShortcut(getCfgElement(), children[i]);
+ shortcuts.add(shortcut);
+ }
+ }
+ else {
+ IConfigurationElement[] children = getCfgElement().getChildren(
+ IntroLaunchBarShortcut.TAG_SHORTCUT);
+ for (int i = 0; i < children.length; i++) {
+ IConfigurationElement child = children[i];
+ IntroLaunchBarShortcut shortcut = new IntroLaunchBarShortcut(child);
+ shortcuts.add(shortcut);
+ }
}
}
} \ No newline at end of file
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarShortcut.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarShortcut.java
index 3c58c1654..7ca0953c7 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarShortcut.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarShortcut.java
@@ -13,6 +13,7 @@ package org.eclipse.ui.internal.intro.impl.model;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.internal.intro.impl.util.ImageUtil;
+import org.eclipse.ui.intro.config.IntroElement;
/**
* An Intro Config component that captures launch bar shortcut information.
@@ -26,7 +27,14 @@ public class IntroLaunchBarShortcut extends AbstractIntroElement {
private static final String ATT_TOOLTIP = "tooltip"; //$NON-NLS-1$
private static final String ATT_ICON = "icon"; //$NON-NLS-1$
private static final String ATT_URL = "url"; //$NON-NLS-1$
-
+
+ private IntroElement ielement;
+
+ IntroLaunchBarShortcut(IConfigurationElement element, IntroElement ielement) {
+ super(element);
+ this.ielement = ielement;
+ }
+
IntroLaunchBarShortcut(IConfigurationElement element) {
super(element);
}
@@ -35,6 +43,12 @@ public class IntroLaunchBarShortcut extends AbstractIntroElement {
public int getType() {
return AbstractIntroElement.LAUNCH_BAR_SHORTCUT;
}
+
+ private String getAttribute(String name) {
+ if (ielement!=null)
+ return ielement.getAttribute(name);
+ return getCfgElement().getAttribute(name);
+ }
/**
* Returns the URL of this shortcut.
@@ -42,7 +56,7 @@ public class IntroLaunchBarShortcut extends AbstractIntroElement {
* @return
*/
public String getURL() {
- return getCfgElement().getAttribute(ATT_URL);
+ return getAttribute(ATT_URL);
}
/**
@@ -51,7 +65,7 @@ public class IntroLaunchBarShortcut extends AbstractIntroElement {
* @return
*/
public String getToolTip() {
- return getCfgElement().getAttribute(ATT_TOOLTIP);
+ return getAttribute(ATT_TOOLTIP);
}
/**
@@ -60,7 +74,7 @@ public class IntroLaunchBarShortcut extends AbstractIntroElement {
* @return
*/
private String getIcon() {
- return getCfgElement().getAttribute(ATT_ICON);
+ return getAttribute(ATT_ICON);
}
/**
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPartPresentation.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPartPresentation.java
index 3317d1ec6..668bd8cf1 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPartPresentation.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPartPresentation.java
@@ -178,6 +178,7 @@ public class IntroPartPresentation extends AbstractIntroElement {
"launchBar"); //$NON-NLS-1$
if (children.length > 0) {
launchBar = new IntroLaunchBarElement(children[0]);
+ launchBar.setParent(this);
if (children.length > 1)
Log
.warning("Mutiple Intro Launch bars defined when only one is allowed. Only first one was loaded. "); //$NON-NLS-1$
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/shared/CustomizeCommand.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/shared/CustomizeCommand.java
index 86451a926..e4445fda6 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/shared/CustomizeCommand.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/shared/CustomizeCommand.java
@@ -50,15 +50,16 @@ public class CustomizeCommand implements IIntroAction {
return null;
String id = element.getAttribute("id"); //$NON-NLS-1$
String label = element.getAttribute("name"); //$NON-NLS-1$
- String className = element.getAttribute("class"); //$NON-NLS-1$
+ String className = "org.eclipse.ui.internal.intro.shared.WelcomeCustomizationPreferencePage"; //$NON-NLS-1$
if (id == null || label == null || className == null)
return null;
return new PreferenceNode(id, label, null, className) {
public void createPage() {
- super.createPage();
- WelcomeCustomizationPreferencePage page = (WelcomeCustomizationPreferencePage) getPage();
+ WelcomeCustomizationPreferencePage page = new WelcomeCustomizationPreferencePage();
+ page.setTitle(getLabelText());
page.setCurrentPage(pageId);
+ setPage(page);
}
};
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/shared/SharedIntroConfigurer.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/shared/SharedIntroConfigurer.java
index 8cbb8c35b..d19913679 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/shared/SharedIntroConfigurer.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/shared/SharedIntroConfigurer.java
@@ -124,6 +124,21 @@ public class SharedIntroConfigurer extends IntroConfigurer implements ISharedInt
return new IntroElement[0];
}
+ public IntroElement[] getLaunchBarShortcuts() {
+ ArrayList links = new ArrayList();
+ String ids = getVariable(VAR_INTRO_ROOT_PAGES);
+ if (ids != null) {
+ StringTokenizer stok = new StringTokenizer(ids, ","); //$NON-NLS-1$
+ while (stok.hasMoreTokens()) {
+ String id = stok.nextToken().trim();
+ IntroElement page = createLaunchBarShortcut(id);
+ if (page != null)
+ links.add(page);
+ }
+ }
+ return (IntroElement[]) links.toArray(new IntroElement[links.size()]);
+ }
+
private IntroElement[] getRootPageLinks(boolean standby) {
ArrayList links = new ArrayList();
String ids = getVariable(VAR_INTRO_ROOT_PAGES);
@@ -154,11 +169,13 @@ public class SharedIntroConfigurer extends IntroConfigurer implements ISharedInt
return (IntroElement[]) links.toArray(new IntroElement[links.size()]);
}
+
+
private IntroElement[] getCustomizeContent(String pageId) {
IntroElement clink = new IntroElement("link"); //$NON-NLS-1$
clink
.setAttribute(
- "url", "http://org.eclipse.ui.intro/runAction?pluginId=org.eclipse.ui.intro&class=org.eclipse.ui.intro.shared.CustomizeCommand&pageId=" + pageId); //$NON-NLS-1$ //$NON-NLS-2$
+ "url", "http://org.eclipse.ui.intro/runAction?pluginId=org.eclipse.ui.intro&class=org.eclipse.ui.internal.intro.shared.CustomizeCommand&pageId=" + pageId); //$NON-NLS-1$ //$NON-NLS-2$
clink.setAttribute("label", Messages.SharedIntroConfigurer_customize_label); //$NON-NLS-1$
clink.setAttribute("id", "customize"); //$NON-NLS-1$ //$NON-NLS-2$
IntroElement text = new IntroElement("text"); //$NON-NLS-1$
@@ -240,6 +257,38 @@ public class SharedIntroConfigurer extends IntroConfigurer implements ISharedInt
return null;
}
+ private IntroElement createLaunchBarShortcut(String id) {
+ if (id.equals(ID_OVERVIEW))
+ return createShortcutLink(
+ "icons/full/obj16/overview16.png", Messages.SharedIntroConfigurer_overview_nav, //$NON-NLS-1$
+ id);
+ if (id.equals(ID_FIRSTSTEPS))
+ return createShortcutLink(
+ "icons/full/obj16/firststeps16.png", Messages.SharedIntroConfigurer_firststeps_nav, //$NON-NLS-1$
+ id);
+ if (id.equals(ID_TUTORIALS))
+ return createShortcutLink(
+ "icons/full/obj16/tutorials16.png", Messages.SharedIntroConfigurer_tutorials_nav, //$NON-NLS-1$
+ id);
+ if (id.equals(ID_SAMPLES))
+ return createShortcutLink(
+ "icons/full/obj16/samples16.png", Messages.SharedIntroConfigurer_samples_nav, //$NON-NLS-1$
+ id);
+ if (id.equals(ID_WHATSNEW))
+ return createShortcutLink(
+ "icons/full/obj16/whatsnew16.png", Messages.SharedIntroConfigurer_whatsnew_nav, //$NON-NLS-1$
+ id);
+ if (id.equals(ID_MIGRATE))
+ return createShortcutLink(
+ "icons/full/obj16/migrate16.png", Messages.SharedIntroConfigurer_migrate_nav, //$NON-NLS-1$
+ id);
+ if (id.equals(ID_WEBRESOURCES))
+ return createShortcutLink(
+ "icons/full/obj16/webresources16.png", Messages.SharedIntroConfigurer_webresources_nav, //$NON-NLS-1$
+ id);
+ return null;
+ }
+
private IntroElement createRootLink(String name, String url, String id, String imgId, String imgSrc,
String imgAlt, String imgText) {
IntroElement element = new IntroElement("link"); //$NON-NLS-1$
@@ -267,6 +316,14 @@ public class SharedIntroConfigurer extends IntroConfigurer implements ISharedInt
return element;
}
+ private IntroElement createShortcutLink(String icon, String tooltip, String id) {
+ IntroElement element = new IntroElement("shortcut"); //$NON-NLS-1$
+ element.setAttribute("icon", icon); //$NON-NLS-1$
+ element.setAttribute("tooltip", tooltip); //$NON-NLS-1$
+ element.setAttribute("url", "http://org.eclipse.ui.intro/showPage?id=" + id); //$NON-NLS-1$ //$NON-NLS-2$
+ return element;
+ }
+
private void initialize() {
// add intro data for this product first
String dataFile = getVariable(VAR_INTRO_DATA);
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/shared/WelcomeCustomizationPreferencePage.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/shared/WelcomeCustomizationPreferencePage.java
index e081b42fc..e6c937677 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/shared/WelcomeCustomizationPreferencePage.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/shared/WelcomeCustomizationPreferencePage.java
@@ -87,6 +87,7 @@ public class WelcomeCustomizationPreferencePage extends PreferencePage implement
private static final String INTRO_BACKGROUND_IMAGE = "INTRO_BACKGROUND_IMAGE"; //$NON-NLS-1$
private static final String INTRO_BACKGROUND_IMAGE_LIST = "INTRO_BACKGROUND_IMAGE_LIST";//$NON-NLS-1$
private TabFolder tabFolder;
+ private String firstPageId;
private Composite pageContainer;
private TableViewer backgrounds;
private TableViewer available;
@@ -352,6 +353,7 @@ public class WelcomeCustomizationPreferencePage extends PreferencePage implement
createPageContainer();
addRootPages();
updateWidgetsFromData();
+ selectFirstPage();
}
private void addRootPages() {
@@ -910,14 +912,21 @@ public class WelcomeCustomizationPreferencePage extends PreferencePage implement
else
target.setInput(targetGd);
}
-
+
public void setCurrentPage(String pageId) {
+ firstPageId = pageId;
+ }
+
+ private void selectFirstPage() {
+ if (firstPageId==null)
+ return;
TabItem [] items = tabFolder.getItems();
for (int i=0; i<items.length; i++) {
TabItem item = items[i];
PageData pd = (PageData)item.getData("pageData"); //$NON-NLS-1$
- if (pd!=null && pd.getId().equals(pageId)) {
+ if (pd!=null && pd.getId().equals(firstPageId)) {
tabFolder.setSelection(i);
+ onTabChange(item);
return;
}
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IntroConfigurer.java b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IntroConfigurer.java
index 6cc7d53bf..df3e6563d 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IntroConfigurer.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IntroConfigurer.java
@@ -17,7 +17,6 @@ package org.eclipse.ui.intro.config;
* products even though they all share the same intro implementation and content.
*
* @since 3.2
- *
*/
public abstract class IntroConfigurer {
@@ -48,17 +47,28 @@ public abstract class IntroConfigurer {
* array for no children.
*/
public abstract IntroElement[] getGroupChildren(String pageId, String groupId);
-/**
- * Resolves an incomplete path in the form "page_id/@" where page_id
- * represents the identifier of the target page. The configurator
- * should complete the path according to its internal resolution
- * mechanism. The final path must point at an anchor in the
- * referenced page.
- * @param extensionId the id specified for the config extension
- * @param path the incomplete path specified for the config extension
- * @return the complete path that points at the anchor element
- * in the referenced page, or <code>null</code> if the path
- * cannot be resolved or the extension should be hidden.
- */
+
+ /**
+ * Returns an array of elements that will be used to build launch bar short cut links. Override
+ * this method if the intro launch bar has been marked as dynamic.
+ *
+ * @return an array of elements that will be used to dynamically build shortcut links.
+ */
+ public IntroElement[] getLaunchBarShortcuts() {
+ return new IntroElement[] {};
+ }
+
+ /**
+ * Resolves an incomplete path in the form "page_id/@" where page_id represents the identifier
+ * of the target page. The configurator should complete the path according to its internal
+ * resolution mechanism. The final path must point at an anchor in the referenced page.
+ *
+ * @param extensionId
+ * the id specified for the config extension
+ * @param path
+ * the incomplete path specified for the config extension
+ * @return the complete path that points at the anchor element in the referenced page, or
+ * <code>null</code> if the path cannot be resolved or the extension should be hidden.
+ */
public abstract String resolvePath(String extensionId, String path);
} \ No newline at end of file

Back to the top