Binary file core/com.nokia.carbide.discovery.ui/icons/debug.png has changed
--- a/core/com.nokia.carbide.discovery.ui/plugin.xml Tue Jul 27 15:28:19 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/plugin.xml Tue Jul 27 15:29:41 2010 -0500
@@ -49,23 +49,42 @@
<extension
point="com.nokia.carbide.discovery.ui.portalPage">
<portalPage
- class="com.nokia.carbide.internal.discovery.ui.view.InstallExtensionsPortalExtension"
- id="installExtensionsPage"
+ id="com.nokia.carbide.discovery.ui.customizePage"
+ image="icons/icon-discovery.png"
order="50"
- rank="50">
+ title="Customize">
+ </portalPage>
+ <portalPage
+ id="com.nokia.carbide.discovery.ui.homePage"
+ image="icons/Carbide_c_icon_16x16.png"
+ order="1"
+ title="Home">
</portalPage>
<portalPage
- class="com.nokia.carbide.internal.discovery.ui.view.HomePage"
- id="homePage"
- order="1"
- rank="1">
+ id="com.nokia.carbide.discovery.ui.supportPage"
+ image="icons/debug.png"
+ order="100"
+ title="Support">
</portalPage>
- <portalPage
+ </extension>
+ <extension
+ point="com.nokia.carbide.discovery.ui.portalPageLayer">
+ <portalPageLayer
+ class="com.nokia.carbide.internal.discovery.ui.view.HomePage"
+ pageId="com.nokia.carbide.discovery.ui.homePage">
+ </portalPageLayer>
+ <portalPageLayer
class="com.nokia.carbide.internal.discovery.ui.view.SupportPage"
- id="supportPage"
- order="100"
- rank="100">
- </portalPage>
+ pageId="com.nokia.carbide.discovery.ui.homePage">
+ </portalPageLayer>
+ <portalPageLayer
+ class="com.nokia.carbide.internal.discovery.ui.view.SupportPage"
+ pageId="com.nokia.carbide.discovery.ui.supportPage">
+ </portalPageLayer>
+ <portalPageLayer
+ class="com.nokia.carbide.internal.discovery.ui.view.InstallExtensionsPortalExtension"
+ pageId="com.nokia.carbide.discovery.ui.customizePage">
+ </portalPageLayer>
</extension>
</plugin>
--- a/core/com.nokia.carbide.discovery.ui/schema/portalPage.exsd Tue Jul 27 15:28:19 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/schema/portalPage.exsd Tue Jul 27 15:29:41 2010 -0500
@@ -49,13 +49,30 @@
<element name="portalPage">
<complexType>
- <attribute name="class" type="string" use="required">
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ identifier for the page
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="title" type="string" use="required">
<annotation>
<documentation>
-
+ title used in the navigation bar
</documentation>
<appinfo>
- <meta.attribute kind="java" basedOn=":com.nokia.carbide.internal.discovery.ui.extension.IPortalExtension"/>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="image" type="string" use="required">
+ <annotation>
+ <documentation>
+ 16x16 image used in the navigation bar
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="resource"/>
</appinfo>
</annotation>
</attribute>
@@ -66,13 +83,6 @@
</documentation>
</annotation>
</attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- identifier for the page - required for multi-layer pages
- </documentation>
- </annotation>
- </attribute>
</complexType>
</element>
--- a/core/com.nokia.carbide.discovery.ui/schema/portalPageLayer.exsd Tue Jul 27 15:28:19 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/schema/portalPageLayer.exsd Tue Jul 27 15:29:41 2010 -0500
@@ -55,17 +55,10 @@
</documentation>
<appinfo>
- <meta.attribute kind="java" basedOn=":com.nokia.carbide.internal.discovery.ui.extension.IPortalExtension"/>
+ <meta.attribute kind="java" basedOn=":com.nokia.carbide.internal.discovery.ui.extension.IPortalPageLayer"/>
</appinfo>
</annotation>
</attribute>
- <attribute name="order" type="string">
- <annotation>
- <documentation>
- relative ordering of layers in a page navigation bar (integer used to sort layers)
- </documentation>
- </annotation>
- </attribute>
<attribute name="pageId" type="string" use="required">
<annotation>
<documentation>
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/editor/ActionUIUpdater.java Tue Jul 27 15:28:19 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/editor/ActionUIUpdater.java Tue Jul 27 15:29:41 2010 -0500
@@ -19,7 +19,7 @@
import java.util.ArrayList;
import java.util.List;
-import com.nokia.carbide.internal.discovery.ui.extension.IPortalExtension.IActionUIUpdater;
+import com.nokia.carbide.internal.discovery.ui.extension.IPortalPageLayer.IActionUIUpdater;
class ActionUIUpdater implements IActionUIUpdater {
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/editor/NavigationBar.java Tue Jul 27 15:28:19 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/editor/NavigationBar.java Tue Jul 27 15:29:41 2010 -0500
@@ -76,8 +76,8 @@
public void addNavButton(NavigationBar bar, PortalPage page) {
Button b = new Button(bar, SWT.TOGGLE | SWT.FLAT);
b.setFont(buttonFont);
- b.setText(page.getPortalExtension().getText());
- b.setImage(portalEditor.createImage(page.getPortalExtension().getImageDescriptor(), 16, 16));
+ b.setText(page.getTitle());
+ b.setImage(portalEditor.createImage(page.getImageDescriptor(), 16, 16));
b.addSelectionListener(listener);
RowDataFactory.swtDefaults().applyTo(b);
buttonToPageMap.put(b, page);
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/editor/PortalEditor.java Tue Jul 27 15:28:19 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/editor/PortalEditor.java Tue Jul 27 15:29:41 2010 -0500
@@ -20,7 +20,9 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -38,7 +40,6 @@
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.graphics.Resource;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
@@ -49,12 +50,12 @@
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.EditorPart;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
import com.nokia.carbide.discovery.ui.Activator;
import com.nokia.carbide.discovery.ui.Messages;
import com.nokia.carbide.internal.discovery.ui.extension.IPortalEditor;
-import com.nokia.carbide.internal.discovery.ui.extension.IPortalExtension;
-import com.nokia.carbide.internal.discovery.ui.extension.IPortalExtension.IActionBar;
+import com.nokia.carbide.internal.discovery.ui.extension.IPortalPageLayer;
import com.nokia.cpp.internal.api.utils.core.Pair;
import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
@@ -75,30 +76,51 @@
loadPortalPages();
}
+ private Map<String, List<IPortalPageLayer>> loadPortalLayers() {
+ Map<String, List<IPortalPageLayer>> pageIdToExtensionsMap = new HashMap<String, List<IPortalPageLayer>>();
+ IConfigurationElement[] elements =
+ Platform.getExtensionRegistry().getConfigurationElementsFor(Activator.PLUGIN_ID + ".portalPageLayer"); //$NON-NLS-1$
+ for (IConfigurationElement element : elements) {
+ String pageId = element.getAttribute("pageId"); //$NON-NLS-1$
+ try {
+ IPortalPageLayer extension = (IPortalPageLayer) element.createExecutableExtension("class"); //$NON-NLS-1$
+ if (!pageIdToExtensionsMap.containsKey(pageId))
+ pageIdToExtensionsMap.put(pageId, new ArrayList<IPortalPageLayer>());
+ pageIdToExtensionsMap.get(pageId).add(extension);
+ } catch (CoreException e) {
+ Activator.logError(MessageFormat.format(Messages.PortalEditor_PageLoadError, pageId), e);
+ }
+ }
+ return pageIdToExtensionsMap;
+ }
+
private void loadPortalPages() {
+ Map<String, List<IPortalPageLayer>> portalLayersMap = loadPortalLayers();
List<Pair<PortalPage, Integer>> pageList = new ArrayList<Pair<PortalPage, Integer>>();
IConfigurationElement[] elements =
Platform.getExtensionRegistry().getConfigurationElementsFor(Activator.PLUGIN_ID + ".portalPage"); //$NON-NLS-1$
for (IConfigurationElement element : elements) {
- try {
- IPortalExtension portalExtension = (IPortalExtension) element.createExecutableExtension("class"); //$NON-NLS-1$
- String id = element.getAttribute("id"); //$NON-NLS-1$
- String orderString = element.getAttribute("order"); //$NON-NLS-1$
- int order = Integer.MAX_VALUE;
- if (orderString != null) {
- try {
- order = Integer.parseInt(orderString);
- }
- catch (NumberFormatException e) {
- Activator.logError(MessageFormat.format(Messages.PortalEditor_PageRankError,
- portalExtension.getClass().getName()), e);
- }
+ String id = element.getAttribute("id"); //$NON-NLS-1$
+ int order = Integer.MAX_VALUE;
+ String orderString = element.getAttribute("order"); //$NON-NLS-1$
+ if (orderString != null) {
+ try {
+ order = Integer.parseInt(orderString);
+ }
+ catch (NumberFormatException e) {
+ Activator.logError(MessageFormat.format(Messages.PortalEditor_PageRankError, id), e);
}
- pageList.add(new Pair<PortalPage, Integer>(new PortalPage(portalExtension, id), order));
- }
- catch (CoreException e) {
- Activator.logError(Messages.PortalEditor_PageLoadError, e);
}
+ String title = element.getAttribute("title"); //$NON-NLS-1$
+ String imageFilePath = element.getAttribute("image"); //$NON-NLS-1$
+ String pluginId = element.getContributor().getName();
+ ImageDescriptor imageDesc = AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, imageFilePath);
+ List<IPortalPageLayer> portalLayers = portalLayersMap.get(id);
+ if (portalLayers == null || portalLayers.isEmpty()) {
+ Activator.logError(MessageFormat.format("Could not load portal page because no layers were found for id: {0}", id), null);
+ }
+ PortalPage portalPage = new PortalPage(title, imageDesc, id, portalLayers);
+ pageList.add(new Pair<PortalPage, Integer>(portalPage, order));
}
Collections.sort(pageList, new Comparator<Pair<PortalPage, Integer>>() {
@Override
@@ -160,40 +182,11 @@
private void createStackComposite(Composite parent, NavigationBar bar) {
stackComposite = new StackComposite(parent, backgroundParent);
for (PortalPage page : pages) {
- page.setControl(createPage(page.getPortalExtension()));
+ page.createPageComposite(stackComposite, this);
}
GridDataFactory.fillDefaults().grab(true, true).applyTo(stackComposite);
}
- private Control createPage(IPortalExtension page) {
- Composite pageComposite = new SharedBackgroundComposite(stackComposite, backgroundParent);
- GridLayoutFactory.fillDefaults().numColumns(2).spacing(20, 0).extendedMargins(20, 20, 20, 0).applyTo(pageComposite);
- ActionUIUpdater updater = new ActionUIUpdater();
- IActionBar[] commandBars = page.createCommandBars(this, updater);
- if (commandBars.length > 0) {
- Composite taskComposite = new SharedBackgroundComposite(pageComposite, backgroundParent);
- GridLayoutFactory.fillDefaults().applyTo(taskComposite);
- GridDataFactory.fillDefaults().grab(false, true).applyTo(taskComposite);
- for (IActionBar actionBar : commandBars) {
- Control control = createTaskBarControl(taskComposite, actionBar, updater);
- GridDataFactory.fillDefaults().minSize(150, SWT.DEFAULT).grab(true, false).indent(0, 0).applyTo(control);
- }
- }
- Composite pageControl = new RoundedCornerComposite(pageComposite, backgroundParent,
- null, pageComposite.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- GridLayoutFactory.fillDefaults().margins(2, 2).applyTo(pageControl);
- GridDataFactory.fillDefaults().grab(true, true).applyTo(pageControl);
- Control control = page.createControl(pageControl, this);
- GridDataFactory.fillDefaults().grab(true, true).applyTo(control);
- return pageComposite;
- }
-
- private Control createTaskBarControl(Composite clientArea, IActionBar actionBar, ActionUIUpdater updater) {
- TaskBar taskBar = new TaskBar(clientArea, this, actionBar);
- updater.addTaskBar(taskBar);
- return taskBar;
- }
-
private NavigationBar createNavigationBar(Composite parent) {
NavigationBar bar = new NavigationBar(this, parent);
for (PortalPage page : pages) {
@@ -205,9 +198,9 @@
void showPage(PortalPage page) {
if (!page.isInitialized()) {
- page.getPortalExtension().init();
+ page.initialize();
}
- stackComposite.showControl(page.getControl());
+ stackComposite.showControl(page.getPageControl());
}
private void applyBG(final Composite composite) {
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/editor/PortalPage.java Tue Jul 27 15:28:19 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/editor/PortalPage.java Tue Jul 27 15:29:41 2010 -0500
@@ -16,45 +16,183 @@
*/
package com.nokia.carbide.internal.discovery.ui.editor;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import com.nokia.carbide.internal.discovery.ui.extension.IPortalExtension;
+import com.nokia.carbide.internal.discovery.ui.extension.IPortalPageLayer;
+import com.nokia.carbide.internal.discovery.ui.extension.IPortalPageLayer.IActionBar;
-public class PortalPage {
+public class PortalPage implements IActionBar {
+
+ private class ChangeLayerAction extends Action {
+ private Layer layer;
+
+ private ChangeLayerAction(Layer layer) {
+ super(layer.getLayer().getTitle());
+ this.layer = layer;
+ }
+
+ public void run() {
+ setCurrentLayer(layer);
+ }
+
+ public boolean isEnabled() {
+ return !layer.equals(currentLayer);
+ }
+ }
- private IPortalExtension portalExtension;
- private String pageId;
- private Control control;
- private boolean initialized;
-
- public PortalPage(IPortalExtension portalExtension, String pageId) {
- this.portalExtension = portalExtension;
- this.pageId = pageId;
+ private class Layer {
+ private IPortalPageLayer layer;
+ private boolean initialized;
+ private Control control;
+
+ public Layer(IPortalPageLayer layer) {
+ this.layer = layer;
+ }
+
+ public IPortalPageLayer getLayer() {
+ return layer;
+ }
+
+ public void initialize() {
+ layer.init();
+ this.initialized = true;
+ }
+
+ public boolean isInitialized() {
+ return initialized;
+ }
+
+ public void setControl(Control control) {
+ this.control = control;
+ }
+
+ public Control getControl() {
+ return control;
+ }
}
- public IPortalExtension getPortalExtension() {
- return portalExtension;
- }
+ private String id;
+ private String title;
+ private ImageDescriptor imageDescriptor;
+ private StackComposite pageComposite;
+ private boolean initialized;
+ private List<Layer> layers;
+ private Layer currentLayer;
+ private IAction[] actions;
+ private List<TaskBar> navigationTaskBars;
- public String getPageId() {
- return pageId;
+ public PortalPage(String title, ImageDescriptor imageDescriptor, String id, List<IPortalPageLayer> layerExtensions) {
+ this.title = title;
+ this.imageDescriptor = imageDescriptor;
+ this.id = id;
+ layers = new ArrayList<Layer>(layerExtensions.size());
+ for (IPortalPageLayer layerExtension : layerExtensions) {
+ layers.add(new Layer(layerExtension));
+ }
+ navigationTaskBars = new ArrayList<TaskBar>(layerExtensions.size());
}
- public void setControl(Control control) {
- this.control = control;
+ public String getId() {
+ return id;
+ }
+
+ public String getTitle() {
+ return title;
}
- public Control getControl() {
- return control;
+ public ImageDescriptor getImageDescriptor() {
+ return imageDescriptor;
+ }
+
+ public Control getPageControl() {
+ return pageComposite;
}
- public void setInitialized(boolean initialized) {
- this.initialized = initialized;
+ public void initialize() {
+ setCurrentLayer(layers.get(0));
+ initialized = true;
}
public boolean isInitialized() {
return initialized;
}
+
+ public void createPageComposite(Composite parent, PortalEditor portalEditor) {
+ Composite backgroundParent = portalEditor.getBackgroundParent();
+ pageComposite = new StackComposite(parent, backgroundParent);
+ for (Layer layer : layers) {
+ Composite layerComposite = new SharedBackgroundComposite(pageComposite, backgroundParent);
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(layerComposite);
+ GridLayoutFactory.fillDefaults().numColumns(2).spacing(20, 0).extendedMargins(20, 20, 20, 0).applyTo(layerComposite);
+ createTaskBarControls(portalEditor, layerComposite, layer.getLayer());
+ createMainControl(portalEditor, layerComposite, layer.getLayer());
+ layer.setControl(layerComposite);
+ }
+ }
+ protected void createTaskBarControls(PortalEditor portalEditor, Composite pageComposite, IPortalPageLayer layerExtension) {
+ Composite backgroundParent = portalEditor.getBackgroundParent();
+ Composite taskComposite = new SharedBackgroundComposite(pageComposite, backgroundParent);
+ GridLayoutFactory.fillDefaults().applyTo(taskComposite);
+ GridDataFactory.fillDefaults().grab(false, true).applyTo(taskComposite);
+ TaskBar taskBar = new TaskBar(taskComposite, backgroundParent, this);
+ GridDataFactory.fillDefaults().minSize(150, SWT.DEFAULT).grab(true, false).indent(0, 0).applyTo(taskBar);
+ navigationTaskBars.add(taskBar);
+ ActionUIUpdater updater = new ActionUIUpdater();
+ IActionBar[] commandBars = layerExtension.createCommandBars(portalEditor, updater);
+ for (IActionBar actionBar : commandBars) {
+ taskBar = new TaskBar(taskComposite, backgroundParent, actionBar);
+ updater.addTaskBar(taskBar);
+ GridDataFactory.fillDefaults().minSize(150, SWT.DEFAULT).grab(true, false).indent(0, 0).applyTo(taskBar);
+ }
+ }
+
+ protected void createMainControl(PortalEditor portalEditor, Composite pageComposite, IPortalPageLayer layerExtension) {
+ Color background = pageComposite.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
+ Composite mainControl =
+ new RoundedCornerComposite(pageComposite, portalEditor.getBackgroundParent(), null, background);
+ GridLayoutFactory.fillDefaults().margins(2, 2).applyTo(mainControl);
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(mainControl);
+ Control control = layerExtension.createControl(mainControl, portalEditor);
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(control);
+ }
+
+ @Override
+ public IAction[] getActions() {
+ if (actions == null) {
+ actions = new Action[layers.size()];
+ int i = 0;
+ for (Layer layer : layers) {
+ actions[i++] = new ChangeLayerAction(layer);
+ }
+ }
+ return actions;
+ }
+
+ @Override
+ public String[] getHighlightedActionIds() {
+ return null;
+ }
+
+ protected void setCurrentLayer(Layer layer) {
+ currentLayer = layer;
+ pageComposite.showControl(currentLayer.getControl());
+ if (!currentLayer.isInitialized())
+ currentLayer.initialize();
+ for (TaskBar taskBar : navigationTaskBars) {
+ taskBar.updateAllActionsUI();
+ }
+ }
}
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/editor/StackComposite.java Tue Jul 27 15:28:19 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/editor/StackComposite.java Tue Jul 27 15:29:41 2010 -0500
@@ -7,7 +7,6 @@
public class StackComposite extends SharedBackgroundComposite {
private StackLayout stackLayout;
- private Control currentControl;
public StackComposite(Composite parent, Composite backgroundParent) {
super(parent, backgroundParent);
@@ -16,7 +15,7 @@
}
public void showControl(Control control) {
- if (control == currentControl)
+ if (stackLayout.topControl == control)
return;
stackLayout.topControl = control;
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/editor/TaskBar.java Tue Jul 27 15:28:19 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/editor/TaskBar.java Tue Jul 27 15:29:41 2010 -0500
@@ -31,7 +31,7 @@
import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.Hyperlink;
-import com.nokia.carbide.internal.discovery.ui.extension.IPortalExtension.IActionBar;
+import com.nokia.carbide.internal.discovery.ui.extension.IPortalPageLayer.IActionBar;
class TaskBar extends RoundedCornerComposite {
@@ -58,8 +58,8 @@
private Map<Hyperlink, IAction> linkToActionMap;
private ActionListener listener;
- public TaskBar(Composite parent, PortalEditor portalEditor, IActionBar actionBar) {
- super(parent, portalEditor.getBackgroundParent(),
+ public TaskBar(Composite parent, Composite backgroundParent, IActionBar actionBar) {
+ super(parent, backgroundParent,
parent.getDisplay().getSystemColor(SWT.COLOR_BLACK),
parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
createTitle(actionBar);
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/AbstractBrowserPortalPage.java Tue Jul 27 15:28:19 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/AbstractBrowserPortalPage.java Tue Jul 27 15:29:41 2010 -0500
@@ -35,11 +35,11 @@
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IEditorPart;
-import com.nokia.carbide.internal.discovery.ui.extension.IPortalExtension;
+import com.nokia.carbide.internal.discovery.ui.extension.IPortalPageLayer;
import com.nokia.carbide.discovery.ui.Activator;
import com.nokia.carbide.discovery.ui.Messages;
-public abstract class AbstractBrowserPortalPage implements IPortalExtension {
+public abstract class AbstractBrowserPortalPage implements IPortalPageLayer {
private final class NavigationActionBar implements IActionBar {
private List<IAction> actions;
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/AbstractMultiLayerPortalPage.java Tue Jul 27 15:28:19 2010 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package com.nokia.carbide.internal.discovery.ui.extension;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IEditorPart;
-
-import com.nokia.carbide.internal.discovery.ui.editor.PortalEditor;
-import com.nokia.carbide.internal.discovery.ui.editor.StackComposite;
-import com.nokia.carbide.internal.discovery.ui.extension.IPortalExtension;
-
-/**
- * An abstract class implementing IPortalPage allowing a single portal page
- * to contain multiple layers controlled by a command bar
- */
-public abstract class AbstractMultiLayerPortalPage implements IPortalExtension {
-
- private StackComposite stackComposite;
-
- @Override
- public Control createControl(Composite parent, IEditorPart part) {
- PortalEditor portalEditor = (PortalEditor) part.getAdapter(PortalEditor.class);
- stackComposite = new StackComposite(parent, portalEditor.getBackgroundParent());
- return stackComposite;
- }
-
-
-
- @Override
- public void init() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public IActionBar[] createCommandBars(IEditorPart part, IActionUIUpdater updater) {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/IPortalExtension.java Tue Jul 27 15:28:19 2010 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package com.nokia.carbide.internal.discovery.ui.extension;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IEditorPart;
-
-/**
- * Interface to a portal extension
- */
-public interface IPortalExtension {
-
- /**
- * Interface to an action/navigation bar for the portal extension
- */
- public interface IActionBar {
-
- /**
- * Required title for the action bar
- * @return String
- */
- String getTitle();
-
- /**
- * Actions shown in the action bar:
- * Required: text and run() methods
- * Optional: tool tip text
- * Unused: image/check
- * @return IAction
- */
- IAction[] getActions();
-
- /**
- * Action ids for actions that should be emphasized in the action bar (e.g., bold font)
- * @return String[] or null
- */
- String[] getHighlightedActionIds();
-
- }
-
- /**
- * Interface allowing the UI for provided actions of an IActionBar to be updated (e.g., enabled state)
- */
- public interface IActionUIUpdater {
-
- /**
- * Update the UI for a specific action by id
- * @param actionId
- */
- void update(String actionId);
-
- /**
- * Update the UI for all actions in the IActionBar
- */
- void updateAll();
-
- }
-
- /**
- * Required title text used by main navigation bar
- * @return String
- */
- String getText();
-
- /**
- * Required image descriptor used by main navigation bar
- * @return ImageDescriptor
- */
- ImageDescriptor getImageDescriptor();
-
- /**
- * Called to create the control for the extension
- * @param parent Composite
- * @param part IEditorPart
- * @return Control
- */
- Control createControl(Composite parent, IEditorPart part);
-
- /**
- * Called to initialize the extension when shown for the first time
- */
- void init();
-
- /**
- * Return action bars for the extension
- * @param part IEditorPart
- * @param updater IActionUIUpdater
- * @return IActionBar[]
- */
- IActionBar[] createCommandBars(IEditorPart part, IActionUIUpdater updater);
-
- /**
- * Called to dispose internal resources of the extension
- */
- void dispose();
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/extension/IPortalPageLayer.java Tue Jul 27 15:29:41 2010 -0500
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.carbide.internal.discovery.ui.extension;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ * Interface to a portal page layer extension
+ */
+public interface IPortalPageLayer {
+
+ /**
+ * The title of this portal page layer
+ * @return String
+ */
+ String getTitle();
+
+ /**
+ * Interface to an action/navigation bar for the portal portal page layer
+ */
+ public interface IActionBar {
+
+ /**
+ * Required title for the action bar
+ * @return String
+ */
+ String getTitle();
+
+ /**
+ * Actions shown in the action bar:
+ * Required: text and run() methods
+ * Optional: tool tip text
+ * Unused: image/check
+ * @return IAction
+ */
+ IAction[] getActions();
+
+ /**
+ * Action ids for actions that should be emphasized in the action bar (e.g., bold font)
+ * @return String[] or null
+ */
+ String[] getHighlightedActionIds();
+
+ }
+
+ /**
+ * Interface allowing the UI for provided actions of an IActionBar to be updated (e.g., enabled state)
+ */
+ public interface IActionUIUpdater {
+
+ /**
+ * Update the UI for a specific action by id
+ * @param actionId
+ */
+ void update(String actionId);
+
+ /**
+ * Update the UI for all actions in the IActionBar
+ */
+ void updateAll();
+
+ }
+
+ /**
+ * Called to create the control for the portal page layer
+ * @param parent Composite
+ * @param part IEditorPart
+ * @return Control
+ */
+ Control createControl(Composite parent, IEditorPart part);
+
+ /**
+ * Called to initialize the portal page layer when shown for the first time
+ */
+ void init();
+
+ /**
+ * Return action bars for the portal page layer
+ * @param part IEditorPart
+ * @param updater IActionUIUpdater
+ * @return IActionBar[]
+ */
+ IActionBar[] createCommandBars(IEditorPart part, IActionUIUpdater updater);
+
+ /**
+ * Called to dispose internal resources of the portal page layer
+ */
+ void dispose();
+}
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/view/HomePage.java Tue Jul 27 15:28:19 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/view/HomePage.java Tue Jul 27 15:29:41 2010 -0500
@@ -1,21 +1,13 @@
package com.nokia.carbide.internal.discovery.ui.view;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import com.nokia.carbide.discovery.ui.Activator;
import com.nokia.carbide.discovery.ui.Messages;
import com.nokia.carbide.internal.discovery.ui.extension.AbstractBrowserPortalPage;
public class HomePage extends AbstractBrowserPortalPage {
@Override
- public String getText() {
+ public String getTitle() {
return Messages.HomePage_Title;
}
- @Override
- public ImageDescriptor getImageDescriptor() {
- return Activator.getImageDescriptor("icons/Carbide_c_icon_16x16.png"); //$NON-NLS-1$
- }
-
}
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/view/InstallExtensionsPortalExtension.java Tue Jul 27 15:28:19 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/view/InstallExtensionsPortalExtension.java Tue Jul 27 15:29:41 2010 -0500
@@ -29,7 +29,6 @@
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
-import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
@@ -48,11 +47,11 @@
import com.nokia.carbide.discovery.ui.Activator;
import com.nokia.carbide.discovery.ui.Messages;
-import com.nokia.carbide.internal.discovery.ui.extension.IPortalExtension;
+import com.nokia.carbide.internal.discovery.ui.extension.IPortalPageLayer;
import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
@SuppressWarnings("restriction")
-public class InstallExtensionsPortalExtension implements IPortalExtension {
+public class InstallExtensionsPortalExtension implements IPortalPageLayer {
private static final String INSTALL_ACTION_ID = InstallExtensionsPortalExtension.class.getName() + ".install"; //$NON-NLS-1$
@@ -134,16 +133,11 @@
}
@Override
- public String getText() {
+ public String getTitle() {
return Messages.InstallExtensionsPage_Title;
}
@Override
- public ImageDescriptor getImageDescriptor() {
- return Activator.getImageDescriptor("icons/icon-discovery.png"); //$NON-NLS-1$
- }
-
- @Override
public Control createControl(Composite parent, IEditorPart part) {
Composite c = new Composite(parent, SWT.NONE);
GridLayoutFactory.swtDefaults().applyTo(c);
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/view/SupportPage.java Tue Jul 27 15:28:19 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/view/SupportPage.java Tue Jul 27 15:29:41 2010 -0500
@@ -1,8 +1,5 @@
package com.nokia.carbide.internal.discovery.ui.view;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import com.nokia.carbide.discovery.ui.Activator;
import com.nokia.carbide.discovery.ui.Messages;
import com.nokia.carbide.internal.discovery.ui.extension.AbstractBrowserPortalPage;
@@ -12,13 +9,8 @@
}
@Override
- public String getText() {
+ public String getTitle() {
return Messages.SupportPage_Title;
}
- @Override
- public ImageDescriptor getImageDescriptor() {
- return Activator.getImageDescriptor("icons/Carbide_c_icon_16x16.png"); //$NON-NLS-1$
- }
-
}