Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2011-11-05 06:06:54 -0400
committerUwe Stieber2011-11-05 06:06:54 -0400
commit6c70dfdf7a2ab79e7f04124c78de3d598c395a9d (patch)
treeb2329a761a848cd576807db6048b325bd7c18db8
parent9d07bd88c8213dbcb24a31a930a2f19d0a395250 (diff)
downloadorg.eclipse.tcf-6c70dfdf7a2ab79e7f04124c78de3d598c395a9d.tar.gz
org.eclipse.tcf-6c70dfdf7a2ab79e7f04124c78de3d598c395a9d.tar.xz
org.eclipse.tcf-6c70dfdf7a2ab79e7f04124c78de3d598c395a9d.zip
Target Explorer: Add filter to show only elements implementing IWorkingSetElement within the TargetWorkingSetPage
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.runtime/META-INF/MANIFEST.MF1
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.runtime/src/org/eclipse/tm/te/runtime/interfaces/workingsets/IWorkingSetElement.java21
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.tcf.locator/src/org/eclipse/tm/te/tcf/locator/nodes/PeerModel.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/workingsets/pages/TargetWorkingSetPage.java22
4 files changed, 45 insertions, 2 deletions
diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tm.te.runtime/META-INF/MANIFEST.MF
index b6583641c..c777d7cef 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.runtime/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tm.te.runtime/META-INF/MANIFEST.MF
@@ -20,6 +20,7 @@ Export-Package: org.eclipse.tm.te.runtime.activator,
org.eclipse.tm.te.runtime.interfaces.extensions,
org.eclipse.tm.te.runtime.interfaces.properties,
org.eclipse.tm.te.runtime.interfaces.tracing,
+ org.eclipse.tm.te.runtime.interfaces.workingsets,
org.eclipse.tm.te.runtime.internal;x-internal:=true,
org.eclipse.tm.te.runtime.nls,
org.eclipse.tm.te.runtime.preferences,
diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime/src/org/eclipse/tm/te/runtime/interfaces/workingsets/IWorkingSetElement.java b/target_explorer/plugins/org.eclipse.tm.te.runtime/src/org/eclipse/tm/te/runtime/interfaces/workingsets/IWorkingSetElement.java
new file mode 100644
index 000000000..d5bfaf539
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tm.te.runtime/src/org/eclipse/tm/te/runtime/interfaces/workingsets/IWorkingSetElement.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.tm.te.runtime.interfaces.workingsets;
+
+import org.eclipse.core.runtime.IAdaptable;
+
+/**
+ * Interface to be implemented by root elements contributed to the
+ * Target Explorer tree view which can be added to a working set as
+ * root element.
+ */
+public interface IWorkingSetElement extends IAdaptable {
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.locator/src/org/eclipse/tm/te/tcf/locator/nodes/PeerModel.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.locator/src/org/eclipse/tm/te/tcf/locator/nodes/PeerModel.java
index 4f7539b6c..c655253aa 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.tcf.locator/src/org/eclipse/tm/te/tcf/locator/nodes/PeerModel.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.locator/src/org/eclipse/tm/te/tcf/locator/nodes/PeerModel.java
@@ -16,6 +16,7 @@ import java.util.Map;
import org.eclipse.core.runtime.Assert;
import org.eclipse.tm.tcf.protocol.IPeer;
import org.eclipse.tm.tcf.protocol.Protocol;
+import org.eclipse.tm.te.runtime.interfaces.workingsets.IWorkingSetElement;
import org.eclipse.tm.te.runtime.properties.PropertiesContainer;
import org.eclipse.tm.te.tcf.locator.interfaces.IModelListener;
import org.eclipse.tm.te.tcf.locator.interfaces.nodes.ILocatorModel;
@@ -26,7 +27,7 @@ import org.eclipse.tm.te.tcf.locator.interfaces.nodes.IPeerModelProperties;
/**
* Default peer model implementation.
*/
-public class PeerModel extends PropertiesContainer implements IPeerModel {
+public class PeerModel extends PropertiesContainer implements IPeerModel, IWorkingSetElement {
// Reference to the parent locator model
private final ILocatorModel parentModel;
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/workingsets/pages/TargetWorkingSetPage.java b/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/workingsets/pages/TargetWorkingSetPage.java
index b159fe62f..d8b3fec7a 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/workingsets/pages/TargetWorkingSetPage.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/workingsets/pages/TargetWorkingSetPage.java
@@ -13,6 +13,9 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.tm.te.runtime.interfaces.workingsets.IWorkingSetElement;
import org.eclipse.tm.te.ui.views.activator.UIPlugin;
import org.eclipse.tm.te.ui.views.interfaces.IRoot;
import org.eclipse.tm.te.ui.views.interfaces.IUIConstants;
@@ -21,6 +24,7 @@ import org.eclipse.tm.te.ui.views.internal.View;
import org.eclipse.tm.te.ui.views.nls.Messages;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.internal.navigator.NavigatorContentService;
+import org.eclipse.ui.internal.navigator.NavigatorContentServiceContentProvider;
import org.eclipse.ui.navigator.INavigatorContentService;
/**
@@ -81,9 +85,25 @@ public class TargetWorkingSetPage extends AbstractWorkingSetWizardPage {
// We have to simulate the common viewer here to get the content right.
contentService = new NavigatorContentService(IUIConstants.ID_EXPLORER, tree);
- tree.setContentProvider(contentService.createCommonContentProvider());
+ tree.setContentProvider(new NavigatorContentServiceContentProvider((NavigatorContentService)contentService) {
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.internal.navigator.NavigatorContentServiceContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(Object anElementOrPath) {
+ return false;
+ }
+ });
tree.setLabelProvider(contentService.createCommonLabelProvider());
+ // Filter out everything not implementing IWorkingSetElement
+ tree.addFilter(new ViewerFilter() {
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ return element instanceof IWorkingSetElement;
+ }
+ });
+
// Create the root node
root = new View.Root();
tree.setInput(root);

Back to the top