--- a/core/com.nokia.carbide.discovery.ui/META-INF/MANIFEST.MF Wed Jul 14 12:01:27 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/META-INF/MANIFEST.MF Wed Jul 14 15:00:33 2010 -0500
@@ -17,15 +17,10 @@
org.eclipse.equinox.p2.repository;bundle-version="2.0.0",
org.eclipse.equinox.p2.engine;bundle-version="2.0.0",
com.nokia.cpp.utils.ui;bundle-version="1.0.0",
+ com.nokia.cpp.utils.core;bundle-version="1.0.0",
org.eclipse.jface.text,
org.eclipse.ui.editors,
- org.eclipse.ui.forms;bundle-version="3.5.0",
- org.eclipse.core.databinding,
- org.eclipse.core.databinding.beans,
- org.eclipse.core.databinding.observable,
- org.eclipse.core.databinding.property,
- org.eclipse.jface.databinding,
- com.ibm.icu
+ org.eclipse.ui.forms;bundle-version="3.5.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: Nokia
--- a/core/com.nokia.carbide.discovery.ui/plugin.xml Wed Jul 14 12:01:27 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/plugin.xml Wed Jul 14 15:00:33 2010 -0500
@@ -48,19 +48,22 @@
<extension
point="com.nokia.carbide.discovery.ui.portalPage">
<portalPage
- class="com.nokia.carbide.internal.discovery.ui.view.HomePage">
+ class="com.nokia.carbide.internal.discovery.ui.view.InstallExtensionsPage"
+ rank="50">
</portalPage>
</extension>
<extension
point="com.nokia.carbide.discovery.ui.portalPage">
<portalPage
- class="com.nokia.carbide.internal.discovery.ui.view.InstallExtensionsPage">
+ class="com.nokia.carbide.internal.discovery.ui.view.HomePage"
+ rank="1">
</portalPage>
</extension>
<extension
point="com.nokia.carbide.discovery.ui.portalPage">
<portalPage
- class="com.nokia.carbide.internal.discovery.ui.view.SupportPage">
+ class="com.nokia.carbide.internal.discovery.ui.view.SupportPage"
+ rank="100">
</portalPage>
</extension>
--- a/core/com.nokia.carbide.discovery.ui/schema/portalPage.exsd Wed Jul 14 12:01:27 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/schema/portalPage.exsd Wed Jul 14 15:00:33 2010 -0500
@@ -59,6 +59,13 @@
</appinfo>
</annotation>
</attribute>
+ <attribute name="rank" type="string">
+ <annotation>
+ <documentation>
+ relative ordering of pages in the navigation bar (1-100)
+ </documentation>
+ </annotation>
+ </attribute>
</complexType>
</element>
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/editor/PortalEditor.java Wed Jul 14 12:01:27 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/editor/PortalEditor.java Wed Jul 14 15:00:33 2010 -0500
@@ -16,7 +16,10 @@
*/
package com.nokia.carbide.internal.discovery.ui.editor;
+import java.text.MessageFormat;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -50,6 +53,7 @@
import com.nokia.carbide.discovery.ui.Messages;
import com.nokia.carbide.internal.discovery.ui.extension.IPortalPage;
import com.nokia.carbide.internal.discovery.ui.extension.IPortalPage.IActionBar;
+import com.nokia.cpp.internal.api.utils.core.Pair;
import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
public class PortalEditor extends EditorPart {
@@ -68,22 +72,44 @@
public PortalEditor() {
resources = new ArrayList<Resource>();
- getPortalPages();
+ loadPortalPages();
pageToControlMap = new HashMap<IPortalPage, Control>();
}
- private void getPortalPages() {
- uninitializedPages = new ArrayList<IPortalPage>();
+ private void loadPortalPages() {
+ List<Pair<IPortalPage, Integer>> pageExtensions = new ArrayList<Pair<IPortalPage,Integer>>();
IConfigurationElement[] elements =
Platform.getExtensionRegistry().getConfigurationElementsFor(Activator.PLUGIN_ID + ".portalPage"); //$NON-NLS-1$
for (IConfigurationElement element : elements) {
try {
- uninitializedPages.add((IPortalPage) element.createExecutableExtension("class")); //$NON-NLS-1$
+ IPortalPage portalPage = (IPortalPage) element.createExecutableExtension("class"); //$NON-NLS-1$
+ String rankString = element.getAttribute("rank"); //$NON-NLS-1$
+ int rank = Integer.MAX_VALUE;
+ if (rankString != null) {
+ try {
+ rank = Integer.parseInt(rankString);
+ }
+ catch (NumberFormatException e) {
+ Activator.logError(MessageFormat.format("Could not get rank for portal page {0}",
+ portalPage.getClass().getName()), e);
+ }
+ }
+ pageExtensions.add(new Pair<IPortalPage, Integer>(portalPage, rank));
}
catch (CoreException e) {
Activator.logError(Messages.PortalEditor_PageLoadError, e);
}
}
+ Collections.sort(pageExtensions, new Comparator<Pair<IPortalPage, Integer>>() {
+ @Override
+ public int compare(Pair<IPortalPage, Integer> o1, Pair<IPortalPage, Integer> o2) {
+ return o1.second.compareTo(o2.second);
+ }
+ });
+ uninitializedPages = new ArrayList<IPortalPage>();
+ for (Pair<IPortalPage, Integer> pair : pageExtensions) {
+ uninitializedPages.add(pair.first);
+ }
}
@Override