Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2013-12-19 05:54:06 -0500
committerTobias Schwarz2013-12-19 05:54:06 -0500
commitf0f4baeea56babed12127580c80092fd993a963b (patch)
tree2770d8b775ecd7f5df20c03e7b54232ffac646bd /target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf
parent7fb8b83faf758f57321cbb70b52b813abe69aa69 (diff)
downloadorg.eclipse.tcf-f0f4baeea56babed12127580c80092fd993a963b.tar.gz
org.eclipse.tcf-f0f4baeea56babed12127580c80092fd993a963b.tar.xz
org.eclipse.tcf-f0f4baeea56babed12127580c80092fd993a963b.zip
Target Explorer: property view
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/AdapterFactory.java7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSection.java108
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerNodePropertiesSection.java54
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerNodePropertiesSectionContentProvider.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSectionContentProvider.java)4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerNodePropertiesSectionLabelProvider.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSectionLabelProvider.java)4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerNodeSectionFilter.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSectionFilter.java)6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerPropertiesSection.java74
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerSectionFilter.java29
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/AbstractMapPropertiesSection.java93
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/BaseTitledSection.java19
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/MapContentProvider.java51
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/MapLabelProvider.java59
14 files changed, 399 insertions, 120 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/AdapterFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/AdapterFactory.java
index 4aaea8277..f14d3e1f2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/AdapterFactory.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/adapters/AdapterFactory.java
@@ -11,6 +11,7 @@ package org.eclipse.tcf.te.tcf.ui.internal.adapters;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.tcf.protocol.IPeer;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.ui.views.editor.EditorInput;
import org.eclipse.tcf.te.ui.views.interfaces.IEditorSaveAsAdapter;
@@ -41,6 +42,12 @@ public class AdapterFactory implements IAdapterFactory {
*/
@Override
public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof IPeer) {
+ if (ILabelProvider.class.equals(adapterType)) {
+ return labelProvider;
+ }
+ }
+
if (adaptableObject instanceof IPeerNode) {
if (ILabelProvider.class.equals(adapterType)) {
return labelProvider;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSection.java
deleted file mode 100644
index f7d27346d..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSection.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 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.tcf.ui.internal.tabbed;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.ViewerComparator;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
-import org.eclipse.tcf.te.ui.forms.CustomFormToolkit;
-import org.eclipse.tcf.te.ui.tables.TableViewerComparator;
-import org.eclipse.tcf.te.ui.tables.properties.NodePropertiesTableControl;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-/**
- * The property section to display the general properties of a peer.
- */
-public class PeerGeneralSection extends AbstractPropertySection {
- // The peer to be displayed.
- private IPeerNode peer;
- // The table control to display the properties.
- private NodePropertiesTableControl tableControl;
- // The form toolkit
- private CustomFormToolkit toolkit;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#dispose()
- */
- @Override
- public void dispose() {
- if (toolkit != null) { toolkit.dispose(); toolkit = null; }
- super.dispose();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
- */
- @Override
- public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
- super.createControls(parent, aTabbedPropertySheetPage);
- Composite composite = getWidgetFactory().createFlatFormComposite(parent);
- composite.setLayout(new GridLayout());
- tableControl = new NodePropertiesTableControl(this.getPart()) {
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.vtl.ui.datasource.controls.tables.NodePropertiesTableControl#doCreateTableViewerContentProvider(org.eclipse.jface.viewers.TableViewer)
- */
- @Override
- protected IStructuredContentProvider doCreateTableViewerContentProvider(TableViewer viewer) {
- return new PeerGeneralSectionContentProvider(true);
- }
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.vtl.ui.datasource.controls.tables.properties.NodePropertiesTableControl#doCreateTableViewerLabelProvider(org.eclipse.jface.viewers.TableViewer)
- */
- @Override
- protected ITableLabelProvider doCreateTableViewerLabelProvider(TableViewer viewer) {
- return new PeerGeneralSectionLabelProvider(viewer);
- }
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.vtl.ui.datasource.controls.tables.NodePropertiesTableControl#doCreateTableViewerComparator(org.eclipse.jface.viewers.TableViewer)
- */
- @Override
- protected ViewerComparator doCreateTableViewerComparator(TableViewer viewer) {
- return new TableViewerComparator(viewer, (ITableLabelProvider)viewer.getLabelProvider());
- }
- };
- toolkit = new CustomFormToolkit(new FormToolkit(parent.getDisplay()));
- tableControl.setupFormPanel(composite, toolkit);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#setInput(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- @Override
- public void setInput(IWorkbenchPart part, ISelection selection) {
- super.setInput(part, selection);
- Assert.isTrue(selection instanceof IStructuredSelection);
- Object input = ((IStructuredSelection) selection).getFirstElement();
- this.peer = (IPeerNode)Platform.getAdapterManager().getAdapter(input, IPeerNode.class);
- // Assert.isTrue(input instanceof IPeerNode);
- // this.peer = (IPeerNode) input;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
- */
- @Override
- public void refresh() {
- if (tableControl != null) {
- tableControl.getViewer().setInput(peer);
- }
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerNodePropertiesSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerNodePropertiesSection.java
new file mode 100644
index 000000000..1c6f4f9f7
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerNodePropertiesSection.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.tcf.ui.internal.tabbed;
+
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.tcf.te.tcf.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.ui.tabbed.AbstractMapPropertiesSection;
+/**
+ * The property section to display the general properties of a peerNode.
+ */
+public class PeerNodePropertiesSection extends AbstractMapPropertiesSection {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.ui.tabbed.AbstractMapPropertiesSection#getLabelProvider(org.eclipse.jface.viewers.TableViewer)
+ */
+ @Override
+ protected ILabelProvider getLabelProvider(TableViewer viewer) {
+ return new PeerNodePropertiesSectionLabelProvider(viewer);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.ui.tabbed.AbstractMapPropertiesSection#getContentProvider(org.eclipse.jface.viewers.TableViewer)
+ */
+ @Override
+ protected IContentProvider getContentProvider(TableViewer viewer) {
+ return new PeerNodePropertiesSectionContentProvider(false);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.ui.tabbed.AbstractMapPropertiesSection#getViewerInput()
+ */
+ @Override
+ protected Object getViewerInput() {
+ return getPeerNode(provider);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.ui.tabbed.BaseTitledSection#getText()
+ */
+ @Override
+ protected String getText() {
+ return Messages.PeerNodePropertiesSection_title;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSectionContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerNodePropertiesSectionContentProvider.java
index 3f26b714b..74b8084ea 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSectionContentProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerNodePropertiesSectionContentProvider.java
@@ -36,7 +36,7 @@ import org.eclipse.ui.forms.widgets.Section;
/**
* Peer properties general section table content provider implementation.
*/
-public class PeerGeneralSectionContentProvider implements IStructuredContentProvider {
+public class PeerNodePropertiesSectionContentProvider implements IStructuredContentProvider {
// Flag to control if the content provide may update the parent section title
private final boolean updateParentSectionTitle;
@@ -47,7 +47,7 @@ public class PeerGeneralSectionContentProvider implements IStructuredContentProv
* @param updateParentSectionTitle Specify <code>true</code> to allow the content provider to update
* the parent section title, <code>false</code> if no title update is desired.
*/
- public PeerGeneralSectionContentProvider(boolean updateParentSectionTitle) {
+ public PeerNodePropertiesSectionContentProvider(boolean updateParentSectionTitle) {
this.updateParentSectionTitle = updateParentSectionTitle;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSectionLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerNodePropertiesSectionLabelProvider.java
index 129a70491..f673a62ed 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSectionLabelProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerNodePropertiesSectionLabelProvider.java
@@ -20,7 +20,7 @@ import org.eclipse.tcf.te.ui.tables.properties.NodePropertiesTableTableNode;
/**
* Peer properties general section table label provider implementation.
*/
-public class PeerGeneralSectionLabelProvider extends LabelProvider implements ITableLabelProvider {
+public class PeerNodePropertiesSectionLabelProvider extends LabelProvider implements ITableLabelProvider {
// Reference to the parent table viewer
private final TableViewer parentViewer;
@@ -29,7 +29,7 @@ public class PeerGeneralSectionLabelProvider extends LabelProvider implements IT
*
* @param viewer The table viewer or <code>null</code>.
*/
- public PeerGeneralSectionLabelProvider(TableViewer viewer) {
+ public PeerNodePropertiesSectionLabelProvider(TableViewer viewer) {
super();
parentViewer = viewer;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSectionFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerNodeSectionFilter.java
index 2d0209f2d..36840f164 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerGeneralSectionFilter.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerNodeSectionFilter.java
@@ -1,5 +1,5 @@
/**
- * PeerGeneralSectionFilter.java
+ * PeerNodeSectionFilter.java
* Created on Sep 6, 2012
*
* Copyright (c) 2012 Wind River Systems, Inc.
@@ -14,9 +14,9 @@ import org.eclipse.jface.viewers.IFilter;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
/**
- * Peer model node general section filter implementation.
+ * Peer node general section filter implementation.
*/
-public class PeerGeneralSectionFilter implements IFilter {
+public class PeerNodeSectionFilter implements IFilter {
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IFilter#select(java.lang.Object)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerPropertiesSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerPropertiesSection.java
new file mode 100644
index 000000000..f561ec551
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerPropertiesSection.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.tcf.ui.internal.tabbed;
+
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.ui.tabbed.AbstractMapPropertiesSection;
+import org.eclipse.ui.IWorkbenchPart;
+/**
+ * The property section to display the general properties of a peer.
+ */
+public class PeerPropertiesSection extends AbstractMapPropertiesSection {
+
+ IPeer peer = null;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.ui.tabbed.BaseTitledSection#setInput(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
+ public void setInput(IWorkbenchPart part, ISelection selection) {
+ super.setInput(part, selection);
+ Assert.isTrue(selection instanceof IStructuredSelection);
+ Object input = ((IStructuredSelection) selection).getFirstElement();
+ if (input instanceof IPeer) {
+ peer = (IPeer)input;
+ }
+ else {
+ peer = null;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.ui.tabbed.AbstractMapPropertiesSection#getViewerInput()
+ */
+ @Override
+ protected Object getViewerInput() {
+ final AtomicReference<Map<String,String>> props = new AtomicReference<Map<String,String>>();
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ if (peer != null) {
+ props.set(peer.getAttributes());
+ }
+ }
+ };
+ Assert.isTrue(!Protocol.isDispatchThread());
+ Protocol.invokeAndWait(runnable);
+
+ return props.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.ui.tabbed.BaseTitledSection#getText()
+ */
+ @Override
+ protected String getText() {
+ return Messages.PeerPropertiesSection_title;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerSectionFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerSectionFilter.java
new file mode 100644
index 000000000..f9629bfa4
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerSectionFilter.java
@@ -0,0 +1,29 @@
+/**
+ * PeerNodeSectionFilter.java
+ * Created on Sep 6, 2012
+ *
+ * Copyright (c) 2012 Wind River Systems, Inc.
+ *
+ * The right to copy, distribute, modify, or otherwise make use
+ * of this software may be licensed only pursuant to the terms
+ * of an applicable Wind River license agreement.
+ */
+package org.eclipse.tcf.te.tcf.ui.internal.tabbed;
+
+import org.eclipse.jface.viewers.IFilter;
+import org.eclipse.tcf.protocol.IPeer;
+
+/**
+ * Peer general section filter implementation.
+ */
+public class PeerSectionFilter implements IFilter {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IFilter#select(java.lang.Object)
+ */
+ @Override
+ public boolean select(Object element) {
+ return element instanceof IPeer;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java
index bde661eba..d8e9fe81d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java
@@ -249,4 +249,10 @@ public class Messages extends NLS {
public static String DefaultContextStatusTrimControl_label;
public static String DefaultContextStatusTrimControl_tooltip;
+
+ public static String AbstractMapPropertiesSection_name_label;
+ public static String AbstractMapPropertiesSection_value_label;
+
+ public static String PeerNodePropertiesSection_title;
+ public static String PeerPropertiesSection_title;
}
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 7040ca8d6..3570aa448 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
@@ -209,3 +209,8 @@ PeerImportWizardPage_overwriteDialogToggle_message=Remember my decision
DefaultContextStatusTrimControl_label={0}
DefaultContextStatusTrimControl_tooltip=Most recently used context
+AbstractMapPropertiesSection_name_label=Name
+AbstractMapPropertiesSection_value_label=Value
+
+PeerNodePropertiesSection_title=Configuration Properties
+PeerPropertiesSection_title=Peer Properties
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/AbstractMapPropertiesSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/AbstractMapPropertiesSection.java
new file mode 100644
index 000000000..d7a6a8c36
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/AbstractMapPropertiesSection.java
@@ -0,0 +1,93 @@
+/**
+ * AbstractMapPropertiesSection.java
+ * Created on Sep 14, 2013
+ *
+ * Copyright (c) 2013 Wind River Systems, Inc.
+ *
+ * The right to copy, distribute, modify, or otherwise make use
+ * of this software may be licensed only pursuant to the terms
+ * of an applicable Wind River license agreement.
+ */
+package org.eclipse.tcf.te.tcf.ui.tabbed;
+
+import java.util.Map;
+
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.tcf.te.tcf.ui.nls.Messages;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+/**
+ * The property section to display properties in a table.
+ */
+public abstract class AbstractMapPropertiesSection extends BaseTitledSection {
+ /* default */ Map<String,Object> properties;
+
+ // The table control to display the properties.
+ protected TableViewer viewer;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ */
+ @Override
+ public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+ Table table = getWidgetFactory().createTable(composite, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ data.bottom = new FormAttachment(100, -ITabbedPropertyConstants.VSPACE);
+ table.setLayoutData(data);
+ TableColumn column = new TableColumn(table, SWT.LEFT);
+ column.setText(Messages.AbstractMapPropertiesSection_name_label);
+ column = new TableColumn(table, SWT.LEFT);
+ column.setText(Messages.AbstractMapPropertiesSection_value_label);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ TableLayout tableLayout = new TableLayout();
+ tableLayout.addColumnData(new ColumnWeightData(40, 100, true));
+ tableLayout.addColumnData(new ColumnWeightData(60, 150, true));
+ table.setLayout(tableLayout);
+
+ viewer = new TableViewer(table);
+ viewer.setContentProvider(getContentProvider(viewer));
+ viewer.setLabelProvider(getLabelProvider(viewer));
+ }
+
+ protected IContentProvider getContentProvider(TableViewer viewer) {
+ return new MapContentProvider();
+ }
+
+ protected ILabelProvider getLabelProvider(TableViewer viewer) {
+ return new MapLabelProvider();
+ }
+
+ protected abstract Object getViewerInput();
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
+ */
+ @Override
+ public void refresh() {
+ if (viewer != null && !viewer.getTable().isDisposed()) {
+ viewer.setInput(getViewerInput());
+ viewer.refresh();
+ }
+
+ super.refresh();
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/BaseTitledSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/BaseTitledSection.java
index bf0ba822d..79d088fda 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/BaseTitledSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/BaseTitledSection.java
@@ -11,6 +11,7 @@ package org.eclipse.tcf.te.tcf.ui.tabbed;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
@@ -27,6 +28,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.te.core.interfaces.IPropertyChangeProvider;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProvider;
@@ -72,7 +74,7 @@ public abstract class BaseTitledSection extends AbstractPropertySection implemen
if (provider != null) {
this.provider = provider;
- IPeerNode peerNode = getPeerModel(provider);
+ IPeerNode peerNode = getPeerNode(provider);
this.viewerInput = (IPropertyChangeProvider) peerNode.getAdapter(IPropertyChangeProvider.class);
if (this.viewerInput != null) {
this.viewerInput.addPropertyChangeListener(this);
@@ -85,14 +87,21 @@ public abstract class BaseTitledSection extends AbstractPropertySection implemen
}
/**
- * Get the peer model from the provider.
- * Needs to be overwritten in case of save thread access.
+ * Get the peer node from the provider.
* @param provider
* @return
*/
- protected IPeerNode getPeerModel(IPeerNodeProvider provider) {
+ protected IPeerNode getPeerNode(final IPeerNodeProvider provider) {
Assert.isNotNull(provider);
- return provider.getPeerModel();
+ final AtomicReference<IPeerNode> peerNode = new AtomicReference<IPeerNode>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ peerNode.set(provider.getPeerNode());
+ }
+ });
+
+ return peerNode.get();
}
/**
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/MapContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/MapContentProvider.java
new file mode 100644
index 000000000..15f4eab23
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/MapContentProvider.java
@@ -0,0 +1,51 @@
+/**
+ * MapContentProvider.java
+ * Created on Sep 14, 2013
+ *
+ * Copyright (c) 2013 Wind River Systems, Inc.
+ *
+ * The right to copy, distribute, modify, or otherwise make use
+ * of this software may be licensed only pursuant to the terms
+ * of an applicable Wind River license agreement.
+ */
+package org.eclipse.tcf.te.tcf.ui.tabbed;
+
+import java.util.Map;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+/**
+ * A content provider used to get the properties from a map.
+ */
+public class MapContentProvider implements IStructuredContentProvider {
+
+ /*
+ * (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.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
+ @Override
+ public Object[] getElements(Object inputElement) {
+ if(inputElement instanceof Map) {
+ Map<?, ?> map = (Map<?, ?>) inputElement;
+ return map.entrySet().toArray();
+ }
+ return new Object[0];
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/MapLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/MapLabelProvider.java
new file mode 100644
index 000000000..81964fe46
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/MapLabelProvider.java
@@ -0,0 +1,59 @@
+/**
+ * MapLabelProvider.java
+ * Created on Sep 14, 2013
+ *
+ * Copyright (c) 2013 Wind River Systems, Inc.
+ *
+ * The right to copy, distribute, modify, or otherwise make use
+ * of this software may be licensed only pursuant to the terms
+ * of an applicable Wind River license agreement.
+ */
+package org.eclipse.tcf.te.tcf.ui.tabbed;
+
+import java.util.List;
+import java.util.Map.Entry;
+
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * The label provider to provide texts and images of map entries.
+ */
+public class MapLabelProvider extends LabelProvider implements ITableLabelProvider {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+ */
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+ */
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof Entry) {
+ Entry<?, ?> entry = (Entry<?, ?>) element;
+ if (columnIndex == 0) {
+ Object key = entry.getKey();
+ return key == null ? "" : key.toString(); //$NON-NLS-1$
+ }
+ Object object = entry.getValue();
+ if (object instanceof List<?>) {
+ @SuppressWarnings("unchecked")
+ List<Object> list = (List<Object>)object;
+ if (columnIndex < list.size()) {
+ object = list.get(columnIndex);
+ } else {
+ object = null;
+ }
+ }
+
+ return object == null ? "" : object.toString(); //$NON-NLS-1$
+ }
+ return null;
+ }
+} \ No newline at end of file

Back to the top