Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2016-08-08 23:26:12 +0000
committerJeff Johnston2016-08-10 16:45:54 +0000
commit3fbacfe8b9b5d3fa562464f5ec63a93cd14b4c1c (patch)
treecb8eb2c0450209c6d5b5bba4296a733284b41edf
parente0062a8b31b136a4020d6dff079a52d4060bc452 (diff)
downloadorg.eclipse.linuxtools-3fbacfe8b9b5d3fa562464f5ec63a93cd14b4c1c.tar.gz
org.eclipse.linuxtools-3fbacfe8b9b5d3fa562464f5ec63a93cd14b4c1c.tar.xz
org.eclipse.linuxtools-3fbacfe8b9b5d3fa562464f5ec63a93cd14b4c1c.zip
Bug 487035 - Docker host ip cannot be copied to clipboard from anywhere
- add Connection Settings tab to Connection properties - enhance IDockerConnectionSettings with getProperties() method - update TCPConnectionSettings and UnixSocketConnectionSettings classes to provide their properties - add ConnectionSettingsPropertySection - add ConnectionSettingsContentProvider class which queries a connections settings for its property values - add a CopyValueAction class to copy a property value from Docker property views (BasePropertySection) - add to existing tests to verify that properties are returned from IDockerConnectionSettings and that Copy is available in the Properties view context menu Change-Id: Ia3bd1198bb178c531e759d020240db2d05dc9e17 Reviewed-on: https://git.eclipse.org/r/78653 Tested-by: Hudson CI Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerConnectionSettings.java6
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/TCPConnectionSettings.java9
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/UnixSocketConnectionSettings.java8
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/core/DefaultDockerConnectionSettingsFinderSWTBotTest.java11
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/views/DockerExplorerViewSWTBotTest.java3
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/plugin.properties1
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/plugin.xml14
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/BasePropertySection.java99
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/ConnectionInfoContentProvider.java34
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/ConnectionSettingsContentProvider.java62
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/ConnectionSettingsPropertySection.java48
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/CopyValueAction.java50
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/DVMessages.properties3
13 files changed, 334 insertions, 14 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerConnectionSettings.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerConnectionSettings.java
index afe94cba0b..8d91118ee6 100644
--- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerConnectionSettings.java
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerConnectionSettings.java
@@ -31,6 +31,12 @@ public interface IDockerConnectionSettings {
String getName();
/**
+ * @return properties array of 2-string arrays (Property/Value) to show in
+ * Properties view
+ */
+ Object[] getProperties();
+
+ /**
* @return <code>true</code> if the connection could be established and
* Docker daemon responded to a 'ping' request, <code>false</code>
* otherwise.
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/TCPConnectionSettings.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/TCPConnectionSettings.java
index ead605ba79..f5657a364e 100644
--- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/TCPConnectionSettings.java
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/TCPConnectionSettings.java
@@ -48,6 +48,15 @@ public class TCPConnectionSettings extends BaseConnectionSettings {
return BindingType.TCP_CONNECTION;
}
+ @Override
+ public Object[] getProperties() {
+ return new Object[] {
+ new Object[] { "Type", this.getType().toString() }, //$NON-NLS-1$
+ new Object[] { "Host", this.getHost() }, //$NON-NLS-1$
+ new Object[] { "Certificates", //$NON-NLS-1$
+ this.getPathToCertificates() }, };
+ }
+
/**
* @return the host
*/
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/UnixSocketConnectionSettings.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/UnixSocketConnectionSettings.java
index 0bfe779d89..f28e0e13b5 100644
--- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/UnixSocketConnectionSettings.java
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/UnixSocketConnectionSettings.java
@@ -39,6 +39,14 @@ public class UnixSocketConnectionSettings extends BaseConnectionSettings {
return BindingType.UNIX_SOCKET_CONNECTION;
}
+ @Override
+ public Object[] getProperties() {
+ return new Object[] {
+ new Object[] { "Type", this.getType().toString() }, //$NON-NLS-1$
+ new Object[] { "Socket", this.getPath() }, //$NON-NLS-1$
+ };
+ }
+
/**
* @return the path to the Unix Socket
*/
diff --git a/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/core/DefaultDockerConnectionSettingsFinderSWTBotTest.java b/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/core/DefaultDockerConnectionSettingsFinderSWTBotTest.java
index 1c3c1d81a3..b3a2c8d5a8 100644
--- a/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/core/DefaultDockerConnectionSettingsFinderSWTBotTest.java
+++ b/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/core/DefaultDockerConnectionSettingsFinderSWTBotTest.java
@@ -39,6 +39,17 @@ public class DefaultDockerConnectionSettingsFinderSWTBotTest {
assertThat(connectionSettings.getType()).isEqualTo(BindingType.TCP_CONNECTION);
assertThat(((TCPConnectionSettings)connectionSettings).getHost()).isEqualTo("https://foo");
assertThat(((TCPConnectionSettings)connectionSettings).getPathToCertificates()).isEqualTo("/path/to/certs");
+ Object[] connectionProperties = ((TCPConnectionSettings)connectionSettings).getProperties();
+ assertThat(connectionProperties.length == 3);
+ Object[] firstProperty = (Object[])connectionProperties[0];
+ assertThat(((String)firstProperty[0]).equals("Type"));
+ assertThat(((String)firstProperty[1]).equals("TCP_CONNECTION"));
+ Object[] secondProperty = (Object[]) connectionProperties[1];
+ assertThat(((String) secondProperty[0]).equals("Host"));
+ assertThat(((String) secondProperty[1]).equals("https://foo"));
+ Object[] thirdProperty = (Object[]) connectionProperties[2];
+ assertThat(((String) thirdProperty[0]).equals("Certificates"));
+ assertThat(((String) thirdProperty[1]).equals("/path/to/certs"));
assertThat(((TCPConnectionSettings)connectionSettings).isTlsVerify()).isTrue();
}
diff --git a/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/views/DockerExplorerViewSWTBotTest.java b/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/views/DockerExplorerViewSWTBotTest.java
index f41590b7b3..36c6de139e 100644
--- a/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/views/DockerExplorerViewSWTBotTest.java
+++ b/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/views/DockerExplorerViewSWTBotTest.java
@@ -512,6 +512,9 @@ public class DockerExplorerViewSWTBotTest {
SWTUtils.getContextMenu(dockerExplorerViewBot.bot().tree(), "Show In", "Properties").click();
// the properties view should be visible
assertThat(this.bot.viewById("org.eclipse.ui.views.PropertySheet").isActive()).isEqualTo(true);
+ SWTBotView propertiesViewBot = bot.viewById("org.eclipse.ui.views.PropertySheet");
+ SWTUtils.getContextMenu(propertiesViewBot.bot().tree(), "Copy").click();
+ this.dockerExplorerView = (DockerExplorerView) (dockerExplorerViewBot.getViewReference().getView(true));
}
@Test
diff --git a/containers/org.eclipse.linuxtools.docker.ui/plugin.properties b/containers/org.eclipse.linuxtools.docker.ui/plugin.properties
index 3fbde356e7..aea10c1c8a 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/plugin.properties
+++ b/containers/org.eclipse.linuxtools.docker.ui/plugin.properties
@@ -24,6 +24,7 @@ DockerRegistryAccountPreferencePage.name=Registry Accounts
Info.label=Info
Inspect.label=Inspect
+Settings.label=Settings
BuildDockerImageLaunchConfigType.name=Build Docker Image
RunDockerImageLaunchConfigType.name=Run Docker Image
diff --git a/containers/org.eclipse.linuxtools.docker.ui/plugin.xml b/containers/org.eclipse.linuxtools.docker.ui/plugin.xml
index feb23c84c9..c859a2b114 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/plugin.xml
+++ b/containers/org.eclipse.linuxtools.docker.ui/plugin.xml
@@ -1597,7 +1597,14 @@
tab="org.eclipse.linuxtools.docker.ui.properties.connection.info">
<input type="org.eclipse.linuxtools.docker.core.IDockerConnection"/>
</propertySection>
- <propertySection
+ <propertySection
+ class="org.eclipse.linuxtools.internal.docker.ui.views.ConnectionSettingsPropertySection"
+ enablesFor="1"
+ id="org.eclipse.linuxtools.docker.ui.properties.connection.settings.section"
+ tab="org.eclipse.linuxtools.docker.ui.properties.connection.settings">
+ <input type="org.eclipse.linuxtools.docker.core.IDockerConnection"/>
+ </propertySection>
+ <propertySection
class="org.eclipse.linuxtools.internal.docker.ui.views.ContainerInspectPropertySection"
enablesFor="1"
id="org.eclipse.linuxtools.docker.ui.properties.container.inspect.section"
@@ -1637,6 +1644,11 @@
label="%Info.label">
</propertyTab>
<propertyTab
+ category="org.eclipse.linuxtools.docker.ui.properties.connection"
+ id="org.eclipse.linuxtools.docker.ui.properties.connection.settings"
+ label="%Settings.label">
+ </propertyTab>
+ <propertyTab
category="org.eclipse.linuxtools.docker.ui.properties.container"
id="org.eclipse.linuxtools.docker.ui.properties.container.info"
label="%Info.label">
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/BasePropertySection.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/BasePropertySection.java
index 3b85adf3a1..acc96cb117 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/BasePropertySection.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/BasePropertySection.java
@@ -2,21 +2,36 @@ package org.eclipse.linuxtools.internal.docker.ui.views;
import java.util.Collection;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.TreeViewerColumn;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.part.IPageSite;
import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
public abstract class BasePropertySection extends AbstractPropertySection {
private TreeViewer treeViewer;
+ private CopyValueAction copyAction;
+ private Clipboard clipboard;
+ private IPageSite pageSite;
@Override
public void createControls(final Composite parent, final TabbedPropertySheetPage propertySheetPage) {
@@ -27,6 +42,11 @@ public abstract class BasePropertySection extends AbstractPropertySection {
GridLayoutFactory.fillDefaults().numColumns(1).margins(5, 5).applyTo(container);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).hint(400, 180).applyTo(container);
this.treeViewer = createTableTreeViewer(container);
+ if (this.clipboard != null)
+ this.clipboard.dispose();
+ this.clipboard = new Clipboard(Display.getCurrent());
+ this.pageSite = propertySheetPage.getSite();
+ initContextMenu(pageSite, clipboard);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(treeViewer.getControl());
}
@@ -74,4 +94,83 @@ public abstract class BasePropertySection extends AbstractPropertySection {
return treeViewer;
}
+ /**
+ * Initializes the viewer context menu.
+ *
+ * @param pageSite
+ * page
+ * @param clipboard
+ * clipboard
+ */
+ private void initContextMenu(IPageSite pageSite, Clipboard clipboard) {
+ TreeViewer treeViewer = getTreeViewer();
+ copyAction = new CopyValueAction(getTreeViewer(), clipboard);
+
+ MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
+ menuMgr.addMenuListener(new IMenuListener() {
+ @Override
+ public void menuAboutToShow(IMenuManager manager) {
+ handleMenuAboutToShow(manager);
+ }
+ });
+ pageSite.registerContextMenu(
+ "org.eclipse.linuxtools.docker.ui.BaseProperySection.menuid", //$NON-NLS-1$
+ menuMgr, treeViewer);
+ Menu menu = menuMgr.createContextMenu(treeViewer.getTree());
+ treeViewer.getTree().setMenu(menu);
+
+ menuMgr.add(copyAction);
+ configureCopy();
+ }
+
+ /**
+ * Configures the view copy action which should be run on CTRL+C. We have to
+ * track widget focus to select the actual action because we have a few
+ * widgets that should provide copy action (at least tests hierarchy viewer
+ * and messages viewer).
+ */
+ private void configureCopy() {
+ getTreeViewer().getTree().addFocusListener(new FocusListener() {
+ IAction viewCopyHandler;
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ if (viewCopyHandler != null) {
+ switchTo(viewCopyHandler);
+ }
+ }
+
+ @Override
+ public void focusGained(FocusEvent e) {
+ switchTo(copyAction);
+ }
+
+ private void switchTo(IAction copyAction) {
+ IActionBars actionBars = pageSite.getActionBars();
+ viewCopyHandler = actionBars
+ .getGlobalActionHandler(ActionFactory.COPY.getId());
+ actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(),
+ copyAction);
+ actionBars.updateActionBars();
+ }
+ });
+ }
+
+ /**
+ * Handles the context menu showing.
+ *
+ * @param manager
+ * context menu manager
+ */
+ private void handleMenuAboutToShow(
+ @SuppressWarnings("unused") IMenuManager manager) {
+ ISelection selection = treeViewer.getSelection();
+ copyAction.setEnabled(!selection.isEmpty());
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ this.clipboard.dispose();
+ }
} \ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/ConnectionInfoContentProvider.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/ConnectionInfoContentProvider.java
index 8d73b1b30c..4fafd667a9 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/ConnectionInfoContentProvider.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/ConnectionInfoContentProvider.java
@@ -35,26 +35,34 @@ public class ConnectionInfoContentProvider implements ITreeContentProvider {
@Override
public Object[] getElements(final Object inputElement) {
- if(inputElement instanceof IDockerConnectionInfo) {
+ if (inputElement instanceof IDockerConnectionInfo) {
final IDockerConnectionInfo connectionInfo = (IDockerConnectionInfo) inputElement;
return new Object[] {
- new Object[]{"Containers", connectionInfo.getContainers()}, //$NON-NLS-1$
- new Object[]{"Images", connectionInfo.getImages()}, //$NON-NLS-1$
- new Object[]{"Storage driver", connectionInfo.getStorageDriver()}, //$NON-NLS-1$
- new Object[]{"Execution driver", connectionInfo.getExecutionDriver()}, //$NON-NLS-1$
- new Object[]{"Kernel version", connectionInfo.getKernelVersion()}, //$NON-NLS-1$
- new Object[]{"Operating system", connectionInfo.getOs()}, //$NON-NLS-1$
+ new Object[] { "Containers", //$NON-NLS-1$
+ connectionInfo.getContainers() },
+ new Object[] { "Images", connectionInfo.getImages() }, //$NON-NLS-1$
+ new Object[] { "Storage driver", //$NON-NLS-1$
+ connectionInfo.getStorageDriver() },
+ new Object[] { "Execution driver", //$NON-NLS-1$
+ connectionInfo.getExecutionDriver() },
+ new Object[] { "Kernel version", //$NON-NLS-1$
+ connectionInfo.getKernelVersion() },
+ new Object[] { "Operating system", connectionInfo.getOs() }, //$NON-NLS-1$
new Object[] { "CPU number", //$NON-NLS-1$
connectionInfo.getCPUNumber() },
new Object[] { "Total memory", //$NON-NLS-1$
Long.toString(connectionInfo.getTotalMemory() / MB)
+ " MB" },
- new Object[]{"File descriptors", connectionInfo.getFileDescriptors()}, //$NON-NLS-1$
- new Object[]{"Go routines", connectionInfo.getGoroutines()}, //$NON-NLS-1$
- new Object[]{"Init path", connectionInfo.getInitPath()}, //$NON-NLS-1$
- new Object[]{"API version", connectionInfo.getApiVersion()}, //$NON-NLS-1$
- new Object[]{"Version", connectionInfo.getVersion()}, //$NON-NLS-1$
- new Object[]{"Git commit", connectionInfo.getGitCommit()}, //$NON-NLS-1$
+ new Object[] { "File descriptors", //$NON-NLS-1$
+ connectionInfo.getFileDescriptors() },
+ new Object[] { "Go routines", //$NON-NLS-1$
+ connectionInfo.getGoroutines() },
+ new Object[] { "Init path", connectionInfo.getInitPath() }, //$NON-NLS-1$
+ new Object[] { "API version", //$NON-NLS-1$
+ connectionInfo.getApiVersion() },
+ new Object[] { "Version", connectionInfo.getVersion() }, //$NON-NLS-1$
+ new Object[] { "Git commit", //$NON-NLS-1$
+ connectionInfo.getGitCommit() },
};
}
return EMPTY;
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/ConnectionSettingsContentProvider.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/ConnectionSettingsContentProvider.java
new file mode 100644
index 0000000000..61b2f84413
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/ConnectionSettingsContentProvider.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Red Hat.
+ * 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:
+ * Red Hat - Initial Contribution
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.docker.ui.views;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.linuxtools.docker.core.IDockerConnection;
+import org.eclipse.linuxtools.docker.core.IDockerConnectionSettings;
+
+/**
+ * @author jjohnstn
+ *
+ */
+public class ConnectionSettingsContentProvider implements ITreeContentProvider {
+
+ private static final Object[] EMPTY = new Object[0];
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) {
+ }
+
+ @Override
+ public Object[] getElements(final Object inputElement) {
+ if (inputElement instanceof IDockerConnection) {
+ final IDockerConnection connection = (IDockerConnection) inputElement;
+ IDockerConnectionSettings data = connection.getSettings();
+ if (data != null) {
+ return data.getProperties();
+ }
+ }
+ return EMPTY;
+ }
+
+ @Override
+ public Object[] getChildren(final Object parentElement) {
+ return EMPTY;
+ }
+
+ @Override
+ public Object getParent(final Object element) {
+ return null;
+ }
+
+ @Override
+ public boolean hasChildren(final Object element) {
+ return false;
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/ConnectionSettingsPropertySection.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/ConnectionSettingsPropertySection.java
new file mode 100644
index 0000000000..d7bff88382
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/ConnectionSettingsPropertySection.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Red Hat.
+ * 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:
+ * Red Hat - Initial Contribution
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.docker.ui.views;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.linuxtools.docker.core.IDockerConnection;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+/**
+ * @author jjohnstn
+ *
+ */
+public class ConnectionSettingsPropertySection extends BasePropertySection {
+
+ @Override
+ public void createControls(Composite parent, TabbedPropertySheetPage propertySheetPage) {
+ super.createControls(parent, propertySheetPage);
+ getTreeViewer()
+ .setContentProvider(new ConnectionSettingsContentProvider());
+ }
+
+ @Override
+ public void setInput(final IWorkbenchPart part, final ISelection selection) {
+ super.setInput(part, selection);
+ Assert.isTrue(selection instanceof ITreeSelection);
+ Object input = ((ITreeSelection) selection).getFirstElement();
+ Assert.isTrue(input instanceof IDockerConnection);
+ IDockerConnection connection = (IDockerConnection) input;
+ if (getTreeViewer() != null) {
+ getTreeViewer().setInput(connection);
+ getTreeViewer().expandAll();
+ }
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/CopyValueAction.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/CopyValueAction.java
new file mode 100644
index 0000000000..adfe50bea3
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/CopyValueAction.java
@@ -0,0 +1,50 @@
+package org.eclipse.linuxtools.internal.docker.ui.views;
+
+import java.util.Iterator;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.ui.IWorkbenchCommandConstants;
+
+public class CopyValueAction extends Action {
+
+ private Clipboard clipboard;
+ private TreeViewer treeViewer;
+
+ public CopyValueAction(TreeViewer tableViewer, Clipboard clipboard) {
+ super(DVMessages.getString("CopyAction.text")); //$NON-NLS-1$
+ setToolTipText(DVMessages.getString("CopyAction.tooltip")); //$NON-NLS-1$
+ setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY);
+ this.treeViewer = tableViewer;
+ this.clipboard = clipboard;
+ }
+
+ @Override
+ public void run() {
+ IStructuredSelection selection = (IStructuredSelection)treeViewer.getSelection();
+ if (!selection.isEmpty()) {
+ StringBuilder sb = new StringBuilder();
+ boolean needEOL = false;
+ for (Iterator<?> it = selection.iterator(); it.hasNext();) {
+ Object item = it.next();
+ if (needEOL) {
+ sb.append(System.getProperty("line.separator")); //$NON-NLS-1$
+ } else {
+ needEOL = true;
+ }
+ // Copy just the value of the property - TreeSelection item is
+ // array of 2 strings
+ Object[] text = (Object[])item;
+ sb.append((String) text[1]);
+
+ }
+ clipboard.setContents(new String[] { sb.toString() },
+ new Transfer[] { TextTransfer.getInstance() });
+ }
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/DVMessages.properties b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/DVMessages.properties
index 2ca9285f72..ebc98650c9 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/DVMessages.properties
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/DVMessages.properties
@@ -211,3 +211,6 @@ DockerContainerLinksCategory.label=Links
DockerImagesCategory.label=Images
DockerHierarchyViewNoImageSelected.msg=No Docker image was selected.
+
+CopyAction.text=Copy
+CopyAction.tooltip=Copy property value

Back to the top