diff options
author | Uwe Stieber | 2012-02-27 07:36:07 +0000 |
---|---|---|
committer | Uwe Stieber | 2012-02-27 08:52:13 +0000 |
commit | b08c794cef994d65f9234cda7a473444c2e7f8ff (patch) | |
tree | 0df6f27ac75b3ff699f153136b27e75b87b16658 /target_explorer | |
parent | 3b6ec8bc5e108e746f2c96ecb475634897ce838b (diff) | |
download | org.eclipse.tcf-b08c794cef994d65f9234cda7a473444c2e7f8ff.tar.gz org.eclipse.tcf-b08c794cef994d65f9234cda7a473444c2e7f8ff.tar.xz org.eclipse.tcf-b08c794cef994d65f9234cda7a473444c2e7f8ff.zip |
Target Explorer: Introduce view category nodes
Diffstat (limited to 'target_explorer')
21 files changed, 431 insertions, 45 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerModelProperties.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerModelProperties.java index 93a2075b4..0b1b6ac1d 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerModelProperties.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerModelProperties.java @@ -68,11 +68,6 @@ public interface IPeerModelProperties { public static int STATE_ERROR = 3; /** - * Property: The peer connect timeout (for socket based transports) - */ - public static String PROP_CONNECT_TIMEOUT = "connectTimeout"; //$NON-NLS-1$ - - /** * Property: Reference counter tracking the active channels for this peer. */ public static String PROP_CHANNEL_REF_COUNTER = "channelRefCounter.silent"; //$NON-NLS-1$ @@ -81,4 +76,9 @@ public interface IPeerModelProperties { * Property: The last error the scanner encounter trying to open a channel to this peer. */ public static String PROP_LAST_SCANNER_ERROR = "lastScannerError"; //$NON-NLS-1$ + + /** + * Property: The parent category id. + */ + public static String PROP_PARENT_CATEGORY_ID = "parentCategoryId.silent"; //$NON-NLS-1$ } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml index 4847b9491..9602b7c89 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml @@ -29,7 +29,7 @@ <viewerContentBinding viewerId="org.eclipse.tcf.te.ui.views.View"> <includes> <contentExtension - isRoot="true" + isRoot="false" pattern="org.eclipse.tcf.te.tcf.ui.navigator.*"/> </includes> </viewerContentBinding> @@ -46,6 +46,7 @@ priority="normal"> <enablement> <or> + <instanceof value="org.eclipse.tcf.te.ui.views.interfaces.ICategory"/> <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/> <instanceof value="org.eclipse.tcf.te.tcf.ui.navigator.nodes.PeerRedirectorGroupNode"/> </or> @@ -60,11 +61,6 @@ <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/> </enablement> </commonWizard> - <possibleChildren> - <instanceof - value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"> - </instanceof> - </possibleChildren> </navigatorContent> <commonFilter activeByDefault="false" diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/ContentProviderDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/ContentProviderDelegate.java index 5f064724a..e70da1798 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/ContentProviderDelegate.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/ContentProviderDelegate.java @@ -9,6 +9,7 @@ *******************************************************************************/ package org.eclipse.tcf.te.tcf.ui.navigator; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -21,12 +22,17 @@ import org.eclipse.tcf.protocol.Protocol; import org.eclipse.tcf.te.tcf.locator.interfaces.IModelListener; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.ILocatorModel; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; +import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerRedirector; import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelLookupService; import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService; import org.eclipse.tcf.te.tcf.locator.model.Model; import org.eclipse.tcf.te.tcf.ui.navigator.nodes.PeerRedirectorGroupNode; +import org.eclipse.tcf.te.ui.swt.DisplayUtil; +import org.eclipse.tcf.te.ui.views.extensions.CategoriesExtensionPointManager; +import org.eclipse.tcf.te.ui.views.interfaces.ICategory; import org.eclipse.tcf.te.ui.views.interfaces.IRoot; +import org.eclipse.tcf.te.ui.views.interfaces.IUIConstants; import org.eclipse.ui.IMemento; import org.eclipse.ui.internal.navigator.NavigatorFilterService; import org.eclipse.ui.navigator.CommonViewer; @@ -59,14 +65,67 @@ public class ContentProviderDelegate implements ICommonContentProvider { public Object[] getChildren(Object parentElement) { Object[] children = NO_ELEMENTS; - // If the parent element is null or IRoot, than we assume + // The category id if the parent element is a category node + final String catID = parentElement instanceof ICategory ? ((ICategory)parentElement).getId() : null; + + // If the parent element is a category, than we assume // the locator model as parent element. - if (parentElement == null || parentElement instanceof IRoot) { + if (parentElement instanceof ICategory) { parentElement = Model.getModel(); } // If it is the locator model, get the peers if (parentElement instanceof ILocatorModel) { - children = ((ILocatorModel)parentElement).getPeers(); + final IPeerModel[] peers = ((ILocatorModel)parentElement).getPeers(); + final List<IPeerModel> candidates = new ArrayList<IPeerModel>(); + + Runnable runnable = new Runnable() { + @Override + public void run() { + if (IUIConstants.ID_CAT_FAVORITES.equals(catID)) { + for (IPeerModel peer : peers) { + String value = peer.getPeer().getAttributes().get("favorite"); //$NON-NLS-1$ + boolean isFavorite = value != null && Boolean.parseBoolean(value.trim()); + if (isFavorite && !candidates.contains(peer)) { + peer.setProperty(IPeerModelProperties.PROP_PARENT_CATEGORY_ID, catID); + candidates.add(peer); + } + } + } + else if (IUIConstants.ID_CAT_HOME.equals(catID)) { + for (IPeerModel peer : peers) { + String value = peer.getPeer().getAttributes().get("static.transient"); //$NON-NLS-1$ + boolean isStatic = value != null && Boolean.parseBoolean(value.trim()); + + value = peer.getPeer().getAttributes().get("favorite"); //$NON-NLS-1$ + boolean isFavorite = value != null && Boolean.parseBoolean(value.trim()); + + if (isStatic && !isFavorite && !candidates.contains(peer)) { + peer.setProperty(IPeerModelProperties.PROP_PARENT_CATEGORY_ID, catID); + candidates.add(peer); + } + } + } + else if (IUIConstants.ID_CAT_NEIGHBORHOOD.equals(catID)) { + for (IPeerModel peer : peers) { + String value = peer.getPeer().getAttributes().get("static.transient"); //$NON-NLS-1$ + boolean isStatic = value != null && Boolean.parseBoolean(value.trim()); + + value = peer.getPeer().getAttributes().get("favorite"); //$NON-NLS-1$ + boolean isFavorite = value != null && Boolean.parseBoolean(value.trim()); + + if (!isStatic && !isFavorite && !candidates.contains(peer)) { + peer.setProperty(IPeerModelProperties.PROP_PARENT_CATEGORY_ID, catID); + candidates.add(peer); + } + } + } + } + }; + + if (Protocol.isDispatchThread()) runnable.run(); + else Protocol.invokeAndWait(runnable); + + children = candidates.toArray(new IPeerModel[candidates.size()]); } // If it is a peer model itself, get the child peers else if (parentElement instanceof IPeerModel) { @@ -109,7 +168,20 @@ public class ContentProviderDelegate implements ICommonContentProvider { if (!roots.containsKey(parentPeerId)) roots.put(parentPeer.getID(), new PeerRedirectorGroupNode(parentPeerId)); return roots.get(parentPeerId); } - return ((IPeerModel)element).getModel(); + + // Determine the parent category node + final AtomicReference<String> parentCatID = new AtomicReference<String>(); + Runnable runnable = new Runnable() { + @Override + public void run() { + parentCatID.set(((IPeerModel)element).getStringProperty(IPeerModelProperties.PROP_PARENT_CATEGORY_ID)); + } + }; + if (Protocol.isDispatchThread()) runnable.run(); + else Protocol.invokeAndWait(runnable); + + ICategory category = parentCatID.get() != null ? CategoriesExtensionPointManager.getInstance().getCategory(parentCatID.get(), false) : null; + return category != null ? category : ((IPeerModel)element).getModel(); } else if (element instanceof PeerRedirectorGroupNode) { // Return the parent peer model node final AtomicReference<IPeerModel> parent = new AtomicReference<IPeerModel>(); @@ -145,6 +217,10 @@ public class ContentProviderDelegate implements ICommonContentProvider { List<IPeerModel> children = Model.getModel().getChildren(((PeerRedirectorGroupNode)element).peerId); hasChildren = children != null && children.size() > 0; } + else if (element instanceof ICategory) { + Object[] children = getChildren(element); + hasChildren = children != null && children.length > 0; + } return hasChildren; } @@ -206,9 +282,15 @@ public class ContentProviderDelegate implements ICommonContentProvider { INavigatorFilterService fs = cs != null ? cs.getFilterService() : null; if (fs != null && !fs.isActive(REDIRECT_PEERS_FILTER_ID)) { if (fs instanceof NavigatorFilterService) { - NavigatorFilterService navFilterService = (NavigatorFilterService)fs; + final NavigatorFilterService navFilterService = (NavigatorFilterService)fs; navFilterService.addActiveFilterIds(new String[] { REDIRECT_PEERS_FILTER_ID }); - navFilterService.updateViewer(); + // Do the update view asynchronous to avoid reentrant viewer calls + DisplayUtil.safeAsyncExec(new Runnable() { + @Override + public void run() { + navFilterService.updateViewer(); + } + }); } } } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties index 632771d12..be44139ae 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties @@ -35,7 +35,7 @@ NewTargetWizardPage_description=Define the properties of the new peer. NewTargetWizardPage_section_transportType=Specify the transport type and properties: NewTargetWizardPage_section_attributes=Specify additional peer attributes: -RemotePeerDiscoveryRootNode_label=Peers Discovered +RemotePeerDiscoveryRootNode_label=Peers PeerIdControl_label=Peer ID: PeerNameControl_label=Peer Name: diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/icons/obj16/favorites.gif b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/icons/obj16/favorites.gif Binary files differnew file mode 100644 index 000000000..840a4bbcf --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/icons/obj16/favorites.gif diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/icons/obj16/home_nav.gif b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/icons/obj16/home_nav.gif Binary files differnew file mode 100644 index 000000000..4472e8ce5 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/icons/obj16/home_nav.gif diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/icons/obj16/neighborhood.gif b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/icons/obj16/neighborhood.gif Binary files differnew file mode 100644 index 000000000..99a6091c2 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/icons/obj16/neighborhood.gif diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.properties index cd6d5128b..b667bb6ee 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.properties +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.properties @@ -32,16 +32,13 @@ Editor.name=Target Explorer Details Editor # ***** Common Navigator ***** -filters.workingSet.name=Working sets [not visible in UI] -filters.workingSet.description=Hides unselected working sets [not visible in UI] +navigatorContent.name = Categories -workingsets.extension.name=Working Sets +# ***** Categories ***** -workingset.name=Target Explorer -workingset.description=Target Explorer working sets. - -workingset.others.name=Other -workingset.others.description=Working set containing all elements not in any group. +category.favorites.name=Favorites +category.home.name=Home +category.neighborhood.name=Neighborhood # ***** Command and menu contributions ***** command.open.name=Open diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.xml index f8ce268d8..d9253b635 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.xml @@ -84,6 +84,25 @@ <extension point="org.eclipse.ui.navigator.navigatorContent"> <!-- Default navigator content contibutions --> + <navigatorContent + activeByDefault="true" + appearsBefore="org.eclipse.tcf.te.tcf.ui.navigator.content" + contentProvider="org.eclipse.tcf.te.ui.views.navigator.ContentProviderDelegate" + icon="icons/eview16/targets_view.gif" + id="org.eclipse.tcf.te.ui.views.navigator.content" + labelProvider="org.eclipse.tcf.te.ui.views.navigator.LabelProviderDelegate" + name="%navigatorContent.name" + priority="higher"> + <triggerPoints> + <instanceof value="org.eclipse.tcf.te.ui.views.interfaces.IRoot"/> + </triggerPoints> + <possibleChildren> + <instanceof value="org.eclipse.tcf.te.ui.views.interfaces.ICategory"/> + </possibleChildren> + <commonSorter + class="org.eclipse.tcf.te.ui.trees.TreeViewerSorter" + id="org.eclipse.tcf.te.ui.views.navigator.sorter"/> + </navigatorContent> <!-- Default navigator action contributions --> <actionProvider @@ -117,7 +136,31 @@ </view> </extension> -<!-- Target Explorer Perspective --> +<!-- View categories contributions --> + <extension point="org.eclipse.tcf.te.ui.views.categories"> + <category + class="org.eclipse.tcf.te.ui.views.categories.Favorites" + icon="icons/obj16/favorites.gif" + id="org.eclipse.tcf.te.ui.views.category.favorites" + label="%category.favorites.name"> + </category> + + <category + class="org.eclipse.tcf.te.ui.views.categories.Home" + icon="icons/obj16/home_nav.gif" + id="org.eclipse.tcf.te.ui.views.category.home" + label="%category.home.name"> + </category> + + <category + class="org.eclipse.tcf.te.ui.views.categories.Neighborhood" + icon="icons/obj16/neighborhood.gif" + id="org.eclipse.tcf.te.ui.views.category.neighborhood" + label="%category.neighborhood.name"> + </category> + </extension> + +<!-- Perspective --> <extension point="org.eclipse.ui.perspectives"> <perspective class="org.eclipse.tcf.te.ui.views.perspective.PerspectiveFactory" @@ -147,8 +190,17 @@ name="%Editor.name"> </editor> </extension> - -<!-- Target Explorer menu contributions --> + +<!-- Tabbed properties view contributions --> + <extension point="org.eclipse.ui.views.properties.tabbed.propertyContributor"> + <propertyContributor + contributorId="org.eclipse.tcf.te.ui" + labelProvider="org.eclipse.tcf.te.ui.views.internal.PropertyContributorLabelProvider"> + <propertyCategory category="org.eclipse.tcf.te"/> + </propertyContributor> + </extension> + +<!-- Menu contributions --> <extension point="org.eclipse.ui.menus"> <menuContribution locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.refresh"> <command @@ -371,15 +423,14 @@ properties="hasApplicableEditorBindings,isRefreshableElement,canRefresh,isDeletableElement,canDelete" type="java.lang.Object"> </propertyTester> - </extension> - -<!-- Tabbed properties view contributions --> - <extension point="org.eclipse.ui.views.properties.tabbed.propertyContributor"> - <propertyContributor - contributorId="org.eclipse.tcf.te.ui" - labelProvider="org.eclipse.tcf.te.ui.views.internal.PropertyContributorLabelProvider"> - <propertyCategory category="org.eclipse.tcf.te"/> - </propertyContributor> + + <propertyTester + class="org.eclipse.tcf.te.ui.views.expressions.PropertyTester" + id="org.eclipse.tcf.te.ui.views.CategortyPropertyTester" + namespace="org.eclipse.tcf.te.ui.views" + properties="isCategoryID,isFavorites,isHome,isNeighborhood" + type="org.eclipse.tcf.te.ui.views.interfaces.ICategory"> + </propertyTester> </extension> </plugin> diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/activator/UIPlugin.java index a20cc5a5d..67ceda4b2 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/activator/UIPlugin.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/activator/UIPlugin.java @@ -110,8 +110,12 @@ public class UIPlugin extends AbstractUIPlugin { registry.put(ImageConsts.EDITOR, ImageDescriptor.createFromURL(url)); url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_EVIEW + "targets_view.gif"); //$NON-NLS-1$ registry.put(ImageConsts.VIEW, ImageDescriptor.createFromURL(url)); + url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_ETOOL + "help.gif"); //$NON-NLS-1$ registry.put(ImageConsts.HELP, ImageDescriptor.createFromURL(url)); + + url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ + "favorites.gif"); //$NON-NLS-1$ + registry.put(ImageConsts.FAVORITES, ImageDescriptor.createFromURL(url)); } /** diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/categories/AbstractCategory.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/categories/AbstractCategory.java index 837f50d36..0cf0e3935 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/categories/AbstractCategory.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/categories/AbstractCategory.java @@ -15,14 +15,16 @@ import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.graphics.Image;
import org.eclipse.tcf.te.runtime.extensions.ExecutableExtension;
+import org.eclipse.tcf.te.runtime.interfaces.IDisposable;
import org.eclipse.tcf.te.ui.views.interfaces.ICategory;
import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
* Abstract main view category node implementation.
*/
-public abstract class AbstractCategory extends ExecutableExtension implements ICategory {
- // The category image
+public abstract class AbstractCategory extends ExecutableExtension implements ICategory, IDisposable {
+ // The category image / image descriptor
+ private ImageDescriptor descriptor = null;
private Image image = null;
/* (non-Javadoc)
@@ -35,7 +37,7 @@ public abstract class AbstractCategory extends ExecutableExtension implements IC // Read the icon attribute and create the image
String attrIcon = config.getAttribute("icon");//$NON-NLS-1$
if (attrIcon != null) {
- ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(config.getNamespaceIdentifier(), attrIcon);
+ descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(config.getNamespaceIdentifier(), attrIcon);
if (descriptor != null) {
image = JFaceResources.getResources().createImageWithDefault(descriptor);
}
@@ -43,6 +45,18 @@ public abstract class AbstractCategory extends ExecutableExtension implements IC }
/* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.interfaces.IDisposable#dispose()
+ */
+ @Override
+ public void dispose() {
+ if (descriptor != null) {
+ JFaceResources.getResources().destroyImage(descriptor);
+ descriptor = null;
+ }
+ image = null;
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.tcf.te.ui.views.interfaces.ICategory#getImage()
*/
@Override
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/categories/Favorites.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/categories/Favorites.java new file mode 100644 index 000000000..d3ab39127 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/categories/Favorites.java @@ -0,0 +1,17 @@ +/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.views.categories;
+
+/**
+ * Favorites category implementation.
+ */
+public class Favorites extends AbstractCategory {
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/categories/Home.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/categories/Home.java new file mode 100644 index 000000000..65bd24e21 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/categories/Home.java @@ -0,0 +1,17 @@ +/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.views.categories;
+
+/**
+ * Favorites category implementation.
+ */
+public class Home extends AbstractCategory {
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/categories/Neighborhood.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/categories/Neighborhood.java new file mode 100644 index 000000000..3ca4503af --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/categories/Neighborhood.java @@ -0,0 +1,17 @@ +/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.views.categories;
+
+/**
+ * Favorites category implementation.
+ */
+public class Neighborhood extends AbstractCategory {
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/expressions/PropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/expressions/PropertyTester.java index 413590279..46e81ddb5 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/expressions/PropertyTester.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/expressions/PropertyTester.java @@ -12,6 +12,8 @@ package org.eclipse.tcf.te.ui.views.expressions; import org.eclipse.core.runtime.Platform; import org.eclipse.tcf.te.ui.views.editor.EditorInput; import org.eclipse.tcf.te.ui.views.extensions.EditorPageBindingExtensionPointManager; +import org.eclipse.tcf.te.ui.views.interfaces.ICategory; +import org.eclipse.tcf.te.ui.views.interfaces.IUIConstants; import org.eclipse.tcf.te.ui.views.interfaces.handler.IDeleteHandlerDelegate; import org.eclipse.tcf.te.ui.views.interfaces.handler.IRefreshHandlerDelegate; import org.eclipse.ui.IEditorInput; @@ -85,6 +87,28 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester return expectedValue.equals(Boolean.valueOf(canDelete)); } + // ***** Categories related properties ***** + + if ("isCategoryID".equals(property) && receiver instanceof ICategory) { //$NON-NLS-1$ + String id = ((ICategory)receiver).getId(); + return id.equals(expectedValue); + } + + if ("isHome".equals(property) && receiver instanceof ICategory) { //$NON-NLS-1$ + String id = ((ICategory)receiver).getId(); + return expectedValue.equals(Boolean.valueOf(id.equals(IUIConstants.ID_CAT_HOME))); + } + + if ("isFavorites".equals(property) && receiver instanceof ICategory) { //$NON-NLS-1$ + String id = ((ICategory)receiver).getId(); + return expectedValue.equals(Boolean.valueOf(id.equals(IUIConstants.ID_CAT_FAVORITES))); + } + + if ("isNeighborhood".equals(property) && receiver instanceof ICategory) { //$NON-NLS-1$ + String id = ((ICategory)receiver).getId(); + return expectedValue.equals(Boolean.valueOf(id.equals(IUIConstants.ID_CAT_NEIGHBORHOOD))); + } + return false; } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/extensions/CategoriesExtensionPointManager.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/extensions/CategoriesExtensionPointManager.java index e69be3422..f661532b2 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/extensions/CategoriesExtensionPointManager.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/extensions/CategoriesExtensionPointManager.java @@ -47,7 +47,7 @@ public class CategoriesExtensionPointManager extends AbstractExtensionPointManag */
@Override
protected String getExtensionPointId() {
- return "org.eclipse.tcf.te.views.categories"; //$NON-NLS-1$
+ return "org.eclipse.tcf.te.ui.views.categories"; //$NON-NLS-1$
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/interfaces/IUIConstants.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/interfaces/IUIConstants.java index cee2ba22a..9916c4de8 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/interfaces/IUIConstants.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/interfaces/IUIConstants.java @@ -24,6 +24,11 @@ public interface IUIConstants { */ public static final String ID_EDITOR = "org.eclipse.tcf.te.ui.views.Editor"; //$NON-NLS-1$ + /** + * The tabbed properties contributor id. + */ + public static final String TABBED_PROPERTIES_CONTRIBUTOR_ID = "org.eclipse.tcf.te.ui"; //$NON-NLS-1$ + // ***** Define the constants for the main view root mode ***** /** @@ -36,8 +41,20 @@ public interface IUIConstants { */ public static final int MODE_NORMAL = 1; + // ***** Define the constants for the default main view categories ***** + /** - * The tabbed properties contributor id for Target Explorer + * Category: Favorites */ - public static final String TABBED_PROPERTIES_CONTRIBUTOR_ID = "org.eclipse.tcf.te.ui"; //$NON-NLS-1$ + public static final String ID_CAT_FAVORITES = "org.eclipse.tcf.te.ui.views.category.favorites"; //$NON-NLS-1$ + + /** + * Category: Home + */ + public static final String ID_CAT_HOME = "org.eclipse.tcf.te.ui.views.category.home"; //$NON-NLS-1$ + + /** + * Category: Neighborhood + */ + public static final String ID_CAT_NEIGHBORHOOD = "org.eclipse.tcf.te.ui.views.category.neighborhood"; //$NON-NLS-1$ } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/interfaces/ImageConsts.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/interfaces/ImageConsts.java index 24f5d6746..f698f5ca6 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/interfaces/ImageConsts.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/interfaces/ImageConsts.java @@ -56,4 +56,9 @@ public interface ImageConsts { * The key to access the help action image. */ public static final String HELP = "HelpAction"; //$NON-NLS-1$ + + /** + * The key to access the favorites category image. + */ + public static final String FAVORITES = "Favorites"; //$NON-NLS-1$ } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/ViewViewerSorter.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/ViewViewerSorter.java index f505c9e62..91f748902 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/ViewViewerSorter.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/ViewViewerSorter.java @@ -89,4 +89,4 @@ public final class ViewViewerSorter extends TreePathViewerSorter { sorter.setContentService(contentService);
}
-}
+}
\ No newline at end of file diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/navigator/ContentProviderDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/navigator/ContentProviderDelegate.java new file mode 100644 index 000000000..56f5a000b --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/navigator/ContentProviderDelegate.java @@ -0,0 +1,103 @@ +/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.views.navigator;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.tcf.te.ui.views.extensions.CategoriesExtensionPointManager;
+import org.eclipse.tcf.te.ui.views.interfaces.ICategory;
+import org.eclipse.tcf.te.ui.views.interfaces.IRoot;
+import org.eclipse.tcf.te.ui.views.internal.ViewRoot;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonContentProvider;
+
+/**
+ * Category content provider delegate implementation.
+ */
+public class ContentProviderDelegate implements ICommonContentProvider {
+ private final static Object[] NO_ELEMENTS = new Object[0];
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+ */
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ Object[] children = NO_ELEMENTS;
+
+ if (parentElement == null || parentElement instanceof IRoot) {
+ // Return all contributed categories if there are any
+ return CategoriesExtensionPointManager.getInstance().getCategories(false);
+ }
+
+ return children;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+ */
+ @Override
+ public Object getParent(Object element) {
+ if (element instanceof ICategory) {
+ return ViewRoot.getInstance();
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getElements(java.lang.Object)
+ */
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ @Override
+ public void dispose() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.navigator.ICommonContentProvider#init(org.eclipse.ui.navigator.ICommonContentExtensionSite)
+ */
+ @Override
+ public void init(ICommonContentExtensionSite aConfig) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.navigator.IMementoAware#restoreState(org.eclipse.ui.IMemento)
+ */
+ @Override
+ public void restoreState(IMemento aMemento) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.navigator.IMementoAware#saveState(org.eclipse.ui.IMemento)
+ */
+ @Override
+ public void saveState(IMemento aMemento) {
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/navigator/LabelProviderDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/navigator/LabelProviderDelegate.java new file mode 100644 index 000000000..6782ff947 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/navigator/LabelProviderDelegate.java @@ -0,0 +1,42 @@ +/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.views.navigator;
+
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.tcf.te.ui.views.interfaces.ICategory;
+
+/**
+ * Category label provider delegate implementation.
+ */
+public class LabelProviderDelegate extends LabelProvider {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+ */
+ @Override
+ public String getText(Object element) {
+ if (element instanceof ICategory) {
+ return ((ICategory)element).getLabel();
+ }
+ return super.getText(element);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+ */
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof ICategory) {
+ return ((ICategory)element).getImage();
+ }
+ return super.getImage(element);
+ }
+}
|