Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrbrooks2010-07-24 04:02:08 -0400
committerrbrooks2010-07-24 04:02:08 -0400
commit4ed8bddc791fda93940f238c5135556a07041dc0 (patch)
tree64a118285c5006c3a38320dbb2d374e8ea72a061 /plugins/org.eclipse.osee.ote.ui.host.cmd
parent542cc7344d3f129d64e47f547384297c8e1b1f43 (diff)
downloadorg.eclipse.osee-4ed8bddc791fda93940f238c5135556a07041dc0.tar.gz
org.eclipse.osee-4ed8bddc791fda93940f238c5135556a07041dc0.tar.xz
org.eclipse.osee-4ed8bddc791fda93940f238c5135556a07041dc0.zip
converted all line terminators to unix style
Diffstat (limited to 'plugins/org.eclipse.osee.ote.ui.host.cmd')
-rw-r--r--plugins/org.eclipse.osee.ote.ui.host.cmd/.classpath14
-rw-r--r--plugins/org.eclipse.osee.ote.ui.host.cmd/META-INF/MANIFEST.MF44
-rw-r--r--plugins/org.eclipse.osee.ote.ui.host.cmd/build.properties12
-rw-r--r--plugins/org.eclipse.osee.ote.ui.host.cmd/plugin.xml24
-rw-r--r--plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/CategoryNode.java34
-rw-r--r--plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/ConsoleNode.java76
-rw-r--r--plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/EnvironmentViewer.java572
-rw-r--r--plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/OteUiHostCmdImage.java56
-rw-r--r--plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/TreeBuilder.java56
-rw-r--r--plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/UiPlugin.java58
-rw-r--r--plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/UserNode.java34
11 files changed, 490 insertions, 490 deletions
diff --git a/plugins/org.eclipse.osee.ote.ui.host.cmd/.classpath b/plugins/org.eclipse.osee.ote.ui.host.cmd/.classpath
index 64ed6b3795d..1fa3e6803d3 100644
--- a/plugins/org.eclipse.osee.ote.ui.host.cmd/.classpath
+++ b/plugins/org.eclipse.osee.ote.ui.host.cmd/.classpath
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.osee.ote.ui.host.cmd/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ote.ui.host.cmd/META-INF/MANIFEST.MF
index 2e1c9923784..bad3a741f5d 100644
--- a/plugins/org.eclipse.osee.ote.ui.host.cmd/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ote.ui.host.cmd/META-INF/MANIFEST.MF
@@ -1,22 +1,22 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: OTE UI Host Cmd Plugin (Incubation)
-Bundle-SymbolicName: org.eclipse.osee.ote.ui.host.cmd;singleton:=true
-Bundle-Version: 0.9.5.qualifier
-Bundle-Activator: org.eclipse.osee.ote.ui.host.cmd.UiPlugin
-Require-Bundle: org.eclipse.ui,
- org.eclipse.osee.framework.jdk.core,
- org.eclipse.osee.ote.core,
- org.eclipse.osee.framework.jini,
- net.jini,
- org.eclipse.osee.framework.ui.service.control,
- org.eclipse.osee.framework.plugin.core,
- org.eclipse.osee.framework.ui.plugin,
- org.eclipse.osee.framework.ui.swt,
- org.eclipse.osgi,
- org.eclipse.core.runtime
-Bundle-ActivationPolicy: lazy
-Bundle-Vendor: Eclipse Open System Engineering Environment
-Export-Package: org.eclipse.osee.ote.ui.host.cmd
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Import-Package: org.eclipse.osee.framework.logging
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OTE UI Host Cmd Plugin (Incubation)
+Bundle-SymbolicName: org.eclipse.osee.ote.ui.host.cmd;singleton:=true
+Bundle-Version: 0.9.5.qualifier
+Bundle-Activator: org.eclipse.osee.ote.ui.host.cmd.UiPlugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.osee.framework.jdk.core,
+ org.eclipse.osee.ote.core,
+ org.eclipse.osee.framework.jini,
+ net.jini,
+ org.eclipse.osee.framework.ui.service.control,
+ org.eclipse.osee.framework.plugin.core,
+ org.eclipse.osee.framework.ui.plugin,
+ org.eclipse.osee.framework.ui.swt,
+ org.eclipse.osgi,
+ org.eclipse.core.runtime
+Bundle-ActivationPolicy: lazy
+Bundle-Vendor: Eclipse Open System Engineering Environment
+Export-Package: org.eclipse.osee.ote.ui.host.cmd
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.eclipse.osee.framework.logging
diff --git a/plugins/org.eclipse.osee.ote.ui.host.cmd/build.properties b/plugins/org.eclipse.osee.ote.ui.host.cmd/build.properties
index 8a33b335c37..9cc7b3895cc 100644
--- a/plugins/org.eclipse.osee.ote.ui.host.cmd/build.properties
+++ b/plugins/org.eclipse.osee.ote.ui.host.cmd/build.properties
@@ -1,6 +1,6 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- images/
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ images/
diff --git a/plugins/org.eclipse.osee.ote.ui.host.cmd/plugin.xml b/plugins/org.eclipse.osee.ote.ui.host.cmd/plugin.xml
index bcbfbda3040..beaebc9d37c 100644
--- a/plugins/org.eclipse.osee.ote.ui.host.cmd/plugin.xml
+++ b/plugins/org.eclipse.osee.ote.ui.host.cmd/plugin.xml
@@ -1,12 +1,12 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
- <extension
- point="org.eclipse.osee.framework.ui.service.control.ServiceView">
- <ServiceHandler
- ServiceIcon="images/test_server.gif"
- ServiceInterface="org.eclipse.osee.ote.core.environment.interfaces.IHostTestEnvironment"
- ServiceRenderer="org.eclipse.osee.ote.ui.host.cmd.TestServerConsoleServiceRenderer"/>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+ <extension
+ point="org.eclipse.osee.framework.ui.service.control.ServiceView">
+ <ServiceHandler
+ ServiceIcon="images/test_server.gif"
+ ServiceInterface="org.eclipse.osee.ote.core.environment.interfaces.IHostTestEnvironment"
+ ServiceRenderer="org.eclipse.osee.ote.ui.host.cmd.TestServerConsoleServiceRenderer"/>
+ </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/CategoryNode.java b/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/CategoryNode.java
index 7ab4275065d..a4237d0b606 100644
--- a/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/CategoryNode.java
+++ b/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/CategoryNode.java
@@ -8,20 +8,20 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.host.cmd;
-
-import org.eclipse.osee.framework.jdk.core.type.TreeParent;
-
-/**
- * @author Roberto E. Escobar
- */
-public class CategoryNode extends TreeParent {
-
- /**
- * @param name
- */
- public CategoryNode(String name) {
- super(name);
- }
-
-}
+package org.eclipse.osee.ote.ui.host.cmd;
+
+import org.eclipse.osee.framework.jdk.core.type.TreeParent;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class CategoryNode extends TreeParent {
+
+ /**
+ * @param name
+ */
+ public CategoryNode(String name) {
+ super(name);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/ConsoleNode.java b/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/ConsoleNode.java
index f03b4cf389b..359d18fdd41 100644
--- a/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/ConsoleNode.java
+++ b/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/ConsoleNode.java
@@ -8,44 +8,44 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.host.cmd;
-
+package org.eclipse.osee.ote.ui.host.cmd;
+
import org.eclipse.osee.framework.jdk.core.type.TreeObject;
import org.eclipse.osee.ote.core.OSEEPerson1_4;
import org.eclipse.osee.ote.core.environment.interfaces.IRemoteCommandConsole;
-
-
-/**
- * @author Ken J. Aguilar
- */
-public class ConsoleNode extends TreeObject {
-
- private final IRemoteCommandConsole console;
- private String users;
-
- public ConsoleNode(IRemoteCommandConsole console, OSEEPerson1_4[] users) {
- super("Console");
- this.console = console;
- if (users.length > 1) {
- StringBuilder sb = new StringBuilder(128);
- sb.append(users[0].getName());
- sb.append(", ");
- for (int i = 1; i < users.length - 1; i++) {
- sb.append(users[i].getName());
- sb.append(", ");
- }
- sb.append(users[users.length -1]);
- this.users = sb.toString();
- } else {
- this.users = users.length == 0 ? "<none>" : users[0].getName();
- }
- }
-
- public IRemoteCommandConsole getConsole() {
- return console;
- }
-
- public String getUsers() {
- return users;
- }
-}
+
+
+/**
+ * @author Ken J. Aguilar
+ */
+public class ConsoleNode extends TreeObject {
+
+ private final IRemoteCommandConsole console;
+ private String users;
+
+ public ConsoleNode(IRemoteCommandConsole console, OSEEPerson1_4[] users) {
+ super("Console");
+ this.console = console;
+ if (users.length > 1) {
+ StringBuilder sb = new StringBuilder(128);
+ sb.append(users[0].getName());
+ sb.append(", ");
+ for (int i = 1; i < users.length - 1; i++) {
+ sb.append(users[i].getName());
+ sb.append(", ");
+ }
+ sb.append(users[users.length -1]);
+ this.users = sb.toString();
+ } else {
+ this.users = users.length == 0 ? "<none>" : users[0].getName();
+ }
+ }
+
+ public IRemoteCommandConsole getConsole() {
+ return console;
+ }
+
+ public String getUsers() {
+ return users;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/EnvironmentViewer.java b/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/EnvironmentViewer.java
index 50fbe32d2c0..ac09778a051 100644
--- a/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/EnvironmentViewer.java
+++ b/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/EnvironmentViewer.java
@@ -1,286 +1,286 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * 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:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ote.ui.host.cmd;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.ITreeViewerListener;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TreeExpansionEvent;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.osee.framework.jdk.core.type.TreeObject;
-import org.eclipse.osee.framework.jdk.core.type.TreeParent;
-import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Roberto E. Escobar
- */
-public class EnvironmentViewer extends Composite {
-
- private static final Image ENVIRONMENT_IMAGE = PlatformUI.getWorkbench().getSharedImages().getImage(
- ISharedImages.IMG_OBJ_FOLDER);
-
- private static final Image USER_IMAGE = ImageManager.getImage(OteUiHostCmdImage.USER);
-
- private static final Image CONSOLE_IMAGE = ImageManager.getImage(OteUiHostCmdImage.CONSOLE);
-
- protected enum ColumnEnum {
- Service(SWT.LEFT),
- Users;
-
- private int alignment;
-
- private ColumnEnum() {
- this.alignment = SWT.CENTER;
- }
-
- private ColumnEnum(int alignment) {
- this.alignment = alignment;
- }
-
- public int getAlignment() {
- return alignment;
- }
-
- public static String[] toArray() {
- ColumnEnum[] enumArray = ColumnEnum.values();
- String[] toReturn = new String[enumArray.length];
- for (int index = 0; index < enumArray.length; index++) {
- toReturn[index] = enumArray[index].toString();
- }
- return toReturn;
- }
- }
-
- private TreeViewer viewer;
-
- public EnvironmentViewer(Composite parent, int style) {
- super(parent, style);
- createControl();
- }
-
- public void createControl() {
- this.setLayout(new GridLayout());
- this.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- createTreeArea(this);
- createColumns();
- attachListeners();
- packColumnData();
- }
-
- private void createTreeArea(Composite parent) {
- viewer = new TreeViewer(parent, SWT.SINGLE | SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- (viewer).getTree().setHeaderVisible(true);
- (viewer).getTree().setLinesVisible(true);
- viewer.setUseHashlookup(true);
- viewer.setColumnProperties(ColumnEnum.toArray());
- viewer.setContentProvider(new TreeContentProvider());
- viewer.setLabelProvider(new TreeLabelProvider());
- viewer.setSorter(new ViewerSorter());
- viewer.setInput(new ArrayList<String>());
- viewer.getControl().setBackground(Displays.getSystemColor(SWT.COLOR_WHITE));
- }
-
- private void createColumns() {
- for (ColumnEnum columnEnum : ColumnEnum.values()) {
- TreeColumn column = new TreeColumn(viewer.getTree(), SWT.CENTER, columnEnum.ordinal());
- column.setText(columnEnum.toString());
- column.setWidth(columnEnum.toString().length());
- column.setAlignment(columnEnum.getAlignment());
- }
- }
-
- public void packColumnData() {
- TreeColumn[] columns = viewer.getTree().getColumns();
- for (TreeColumn column : columns) {
- column.pack();
- }
- }
-
- private void attachListeners() {
- viewer.addTreeListener(new ITreeViewerListener() {
-
- public void treeCollapsed(TreeExpansionEvent event) {
- packColumnData();
- }
-
- public void treeExpanded(TreeExpansionEvent event) {
- packColumnData();
- }
-
- });
- }
-
- private class TreeLabelProvider implements ITableLabelProvider, ILabelProvider {
-
- public Image getImage(Object obj) {
- Image toReturn = null;
- if (obj instanceof UserNode) {
- toReturn = USER_IMAGE;
- } else if (obj instanceof ConsoleNode) {
- toReturn = CONSOLE_IMAGE;
- } else if (obj instanceof TreeParent) {
- toReturn = ENVIRONMENT_IMAGE;
- }
- return toReturn;
- }
-
- public String getText(Object obj) {
- if (obj instanceof ConsoleNode) {
- ((ConsoleNode) obj).getName();
- }
- return obj.toString();
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- Image toReturn = null;
- ColumnEnum column = ColumnEnum.values()[columnIndex];
- switch (column) {
- case Service:
- if (element instanceof UserNode) {
- toReturn = USER_IMAGE;
- } else if (element instanceof ConsoleNode) {
- toReturn = CONSOLE_IMAGE;
- } else if (element instanceof TreeParent) {
- toReturn = ENVIRONMENT_IMAGE;
- }
- break;
- default:
- break;
- }
- return toReturn;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- String toReturn = null;
- ColumnEnum column = ColumnEnum.values()[columnIndex];
- switch (column) {
- case Service:
- if (element instanceof ConsoleNode) {
- toReturn = ((ConsoleNode) element).getName();
- } else if (element instanceof TreeParent) {
- toReturn = element.toString();
- }
- break;
- case Users:
- if (element instanceof ConsoleNode) {
- toReturn = ((ConsoleNode) element).getUsers();
- }
- break;
- default:
- break;
- }
- return toReturn;
- }
-
- public void addListener(ILabelProviderListener listener) {
- }
-
- public void dispose() {
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- }
- }
-
- private class TreeContentProvider implements ITreeContentProvider {
-
- public void dispose() {
- }
-
- public Object[] getChildren(Object parentElement) {
- if (parentElement != null && parentElement instanceof TreeParent) {
- TreeParent parent = (TreeParent) parentElement;
- if (parent.hasChildren()) {
- return parent.getChildren();
- }
- }
- return new Object[0];
- }
-
- public Object[] getElements(Object inputElement) {
- if (inputElement != null && inputElement instanceof Collection) {
- Collection<?> elementArray = (Collection<?>) inputElement;
- return elementArray.toArray();
- }
- return new Object[0];
- }
-
- public Object getParent(Object element) {
- if (element != null && element instanceof TreeObject) {
- TreeObject child = (TreeObject) element;
- return child.getParent();
- }
- return new Object();
- }
-
- public boolean hasChildren(Object element) {
- if (element instanceof TreeParent) {
- TreeParent parent = (TreeParent) element;
- return parent.hasChildren();
- }
- return false;
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- }
-
- @Override
- public boolean setFocus() {
- return this.viewer.getControl().setFocus();
- }
-
- public StructuredViewer getViewer() {
- return viewer;
- }
-
- public void setInput(List<TreeParent> input) {
- viewer.setInput(input);
- }
-
- public void refresh() {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- packColumnData();
- viewer.refresh();
- }
- });
- }
-
- @Override
- public void dispose() {
- viewer.getControl().dispose();
- super.dispose();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * 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:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ote.ui.host.cmd;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.ITreeViewerListener;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TreeExpansionEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.osee.framework.jdk.core.type.TreeObject;
+import org.eclipse.osee.framework.jdk.core.type.TreeParent;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class EnvironmentViewer extends Composite {
+
+ private static final Image ENVIRONMENT_IMAGE = PlatformUI.getWorkbench().getSharedImages().getImage(
+ ISharedImages.IMG_OBJ_FOLDER);
+
+ private static final Image USER_IMAGE = ImageManager.getImage(OteUiHostCmdImage.USER);
+
+ private static final Image CONSOLE_IMAGE = ImageManager.getImage(OteUiHostCmdImage.CONSOLE);
+
+ protected enum ColumnEnum {
+ Service(SWT.LEFT),
+ Users;
+
+ private int alignment;
+
+ private ColumnEnum() {
+ this.alignment = SWT.CENTER;
+ }
+
+ private ColumnEnum(int alignment) {
+ this.alignment = alignment;
+ }
+
+ public int getAlignment() {
+ return alignment;
+ }
+
+ public static String[] toArray() {
+ ColumnEnum[] enumArray = ColumnEnum.values();
+ String[] toReturn = new String[enumArray.length];
+ for (int index = 0; index < enumArray.length; index++) {
+ toReturn[index] = enumArray[index].toString();
+ }
+ return toReturn;
+ }
+ }
+
+ private TreeViewer viewer;
+
+ public EnvironmentViewer(Composite parent, int style) {
+ super(parent, style);
+ createControl();
+ }
+
+ public void createControl() {
+ this.setLayout(new GridLayout());
+ this.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ createTreeArea(this);
+ createColumns();
+ attachListeners();
+ packColumnData();
+ }
+
+ private void createTreeArea(Composite parent) {
+ viewer = new TreeViewer(parent, SWT.SINGLE | SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ (viewer).getTree().setHeaderVisible(true);
+ (viewer).getTree().setLinesVisible(true);
+ viewer.setUseHashlookup(true);
+ viewer.setColumnProperties(ColumnEnum.toArray());
+ viewer.setContentProvider(new TreeContentProvider());
+ viewer.setLabelProvider(new TreeLabelProvider());
+ viewer.setSorter(new ViewerSorter());
+ viewer.setInput(new ArrayList<String>());
+ viewer.getControl().setBackground(Displays.getSystemColor(SWT.COLOR_WHITE));
+ }
+
+ private void createColumns() {
+ for (ColumnEnum columnEnum : ColumnEnum.values()) {
+ TreeColumn column = new TreeColumn(viewer.getTree(), SWT.CENTER, columnEnum.ordinal());
+ column.setText(columnEnum.toString());
+ column.setWidth(columnEnum.toString().length());
+ column.setAlignment(columnEnum.getAlignment());
+ }
+ }
+
+ public void packColumnData() {
+ TreeColumn[] columns = viewer.getTree().getColumns();
+ for (TreeColumn column : columns) {
+ column.pack();
+ }
+ }
+
+ private void attachListeners() {
+ viewer.addTreeListener(new ITreeViewerListener() {
+
+ public void treeCollapsed(TreeExpansionEvent event) {
+ packColumnData();
+ }
+
+ public void treeExpanded(TreeExpansionEvent event) {
+ packColumnData();
+ }
+
+ });
+ }
+
+ private class TreeLabelProvider implements ITableLabelProvider, ILabelProvider {
+
+ public Image getImage(Object obj) {
+ Image toReturn = null;
+ if (obj instanceof UserNode) {
+ toReturn = USER_IMAGE;
+ } else if (obj instanceof ConsoleNode) {
+ toReturn = CONSOLE_IMAGE;
+ } else if (obj instanceof TreeParent) {
+ toReturn = ENVIRONMENT_IMAGE;
+ }
+ return toReturn;
+ }
+
+ public String getText(Object obj) {
+ if (obj instanceof ConsoleNode) {
+ ((ConsoleNode) obj).getName();
+ }
+ return obj.toString();
+ }
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ Image toReturn = null;
+ ColumnEnum column = ColumnEnum.values()[columnIndex];
+ switch (column) {
+ case Service:
+ if (element instanceof UserNode) {
+ toReturn = USER_IMAGE;
+ } else if (element instanceof ConsoleNode) {
+ toReturn = CONSOLE_IMAGE;
+ } else if (element instanceof TreeParent) {
+ toReturn = ENVIRONMENT_IMAGE;
+ }
+ break;
+ default:
+ break;
+ }
+ return toReturn;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ String toReturn = null;
+ ColumnEnum column = ColumnEnum.values()[columnIndex];
+ switch (column) {
+ case Service:
+ if (element instanceof ConsoleNode) {
+ toReturn = ((ConsoleNode) element).getName();
+ } else if (element instanceof TreeParent) {
+ toReturn = element.toString();
+ }
+ break;
+ case Users:
+ if (element instanceof ConsoleNode) {
+ toReturn = ((ConsoleNode) element).getUsers();
+ }
+ break;
+ default:
+ break;
+ }
+ return toReturn;
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+ }
+
+ private class TreeContentProvider implements ITreeContentProvider {
+
+ public void dispose() {
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement != null && parentElement instanceof TreeParent) {
+ TreeParent parent = (TreeParent) parentElement;
+ if (parent.hasChildren()) {
+ return parent.getChildren();
+ }
+ }
+ return new Object[0];
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if (inputElement != null && inputElement instanceof Collection) {
+ Collection<?> elementArray = (Collection<?>) inputElement;
+ return elementArray.toArray();
+ }
+ return new Object[0];
+ }
+
+ public Object getParent(Object element) {
+ if (element != null && element instanceof TreeObject) {
+ TreeObject child = (TreeObject) element;
+ return child.getParent();
+ }
+ return new Object();
+ }
+
+ public boolean hasChildren(Object element) {
+ if (element instanceof TreeParent) {
+ TreeParent parent = (TreeParent) element;
+ return parent.hasChildren();
+ }
+ return false;
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ }
+
+ @Override
+ public boolean setFocus() {
+ return this.viewer.getControl().setFocus();
+ }
+
+ public StructuredViewer getViewer() {
+ return viewer;
+ }
+
+ public void setInput(List<TreeParent> input) {
+ viewer.setInput(input);
+ }
+
+ public void refresh() {
+ Displays.ensureInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ packColumnData();
+ viewer.refresh();
+ }
+ });
+ }
+
+ @Override
+ public void dispose() {
+ viewer.getControl().dispose();
+ super.dispose();
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/OteUiHostCmdImage.java b/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/OteUiHostCmdImage.java
index d0a3e2c17db..18550ce02bb 100644
--- a/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/OteUiHostCmdImage.java
+++ b/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/OteUiHostCmdImage.java
@@ -8,31 +8,31 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.host.cmd;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.osee.framework.ui.swt.KeyedImage;
-
-public enum OteUiHostCmdImage implements KeyedImage {
- CONSOLE("console.gif"),
- TEST_SERVER("test_server.gif"),
- USER("user.gif");
-
- private final String fileName;
-
- private OteUiHostCmdImage(String fileName) {
- this.fileName = fileName;
- }
-
- @Override
- public ImageDescriptor createImageDescriptor() {
- return ImageManager.createImageDescriptor(UiPlugin.PLUGIN_ID, "images", fileName);
- }
-
- @Override
- public String getImageKey() {
- return UiPlugin.PLUGIN_ID + ".images." + fileName;
- }
-
-}
+package org.eclipse.osee.ote.ui.host.cmd;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.osee.framework.ui.swt.KeyedImage;
+
+public enum OteUiHostCmdImage implements KeyedImage {
+ CONSOLE("console.gif"),
+ TEST_SERVER("test_server.gif"),
+ USER("user.gif");
+
+ private final String fileName;
+
+ private OteUiHostCmdImage(String fileName) {
+ this.fileName = fileName;
+ }
+
+ @Override
+ public ImageDescriptor createImageDescriptor() {
+ return ImageManager.createImageDescriptor(UiPlugin.PLUGIN_ID, "images", fileName);
+ }
+
+ @Override
+ public String getImageKey() {
+ return UiPlugin.PLUGIN_ID + ".images." + fileName;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/TreeBuilder.java b/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/TreeBuilder.java
index 77bb76c0785..9dbb3dff63c 100644
--- a/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/TreeBuilder.java
+++ b/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/TreeBuilder.java
@@ -8,31 +8,31 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.host.cmd;
-
-import java.util.Collection;
-import java.util.Map;
-import org.eclipse.osee.framework.jdk.core.type.InputManager;
-import org.eclipse.osee.framework.jdk.core.type.TreeParent;
-import org.eclipse.osee.ote.core.OSEEPerson1_4;
-import org.eclipse.osee.ote.core.environment.interfaces.IHostTestEnvironment;
-import org.eclipse.osee.ote.core.environment.interfaces.IRemoteCommandConsole;
-import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironment;
-
-/**
- * @author Roberto E. Escobar
- */
-public class TreeBuilder {
-
- public static void buildTree(InputManager<TreeParent> inputManager, IHostTestEnvironment host, Map<ITestEnvironment, IRemoteCommandConsole> consoles) throws Exception {
-
- TreeParent treeParent = new TreeParent("Test Service");
- CategoryNode categoryNode = new CategoryNode("Consoles");
- treeParent.addChild(categoryNode);
- for (ITestEnvironment env : host.getRemoteEnvironments()) {
- Collection<OSEEPerson1_4> users = env.getUserList();
- categoryNode.addChild(new ConsoleNode(consoles.get(env), users.toArray(new OSEEPerson1_4[users.size()])));
- }
- inputManager.addNode(treeParent);
- }
-}
+package org.eclipse.osee.ote.ui.host.cmd;
+
+import java.util.Collection;
+import java.util.Map;
+import org.eclipse.osee.framework.jdk.core.type.InputManager;
+import org.eclipse.osee.framework.jdk.core.type.TreeParent;
+import org.eclipse.osee.ote.core.OSEEPerson1_4;
+import org.eclipse.osee.ote.core.environment.interfaces.IHostTestEnvironment;
+import org.eclipse.osee.ote.core.environment.interfaces.IRemoteCommandConsole;
+import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironment;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class TreeBuilder {
+
+ public static void buildTree(InputManager<TreeParent> inputManager, IHostTestEnvironment host, Map<ITestEnvironment, IRemoteCommandConsole> consoles) throws Exception {
+
+ TreeParent treeParent = new TreeParent("Test Service");
+ CategoryNode categoryNode = new CategoryNode("Consoles");
+ treeParent.addChild(categoryNode);
+ for (ITestEnvironment env : host.getRemoteEnvironments()) {
+ Collection<OSEEPerson1_4> users = env.getUserList();
+ categoryNode.addChild(new ConsoleNode(consoles.get(env), users.toArray(new OSEEPerson1_4[users.size()])));
+ }
+ inputManager.addNode(treeParent);
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/UiPlugin.java b/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/UiPlugin.java
index cf6fa53d79d..31e63566a8b 100644
--- a/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/UiPlugin.java
+++ b/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/UiPlugin.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * 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:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.ote.ui.host.cmd;
-
-import org.eclipse.osee.framework.ui.plugin.OseeUiActivator;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class UiPlugin extends OseeUiActivator {
- public static final String PLUGIN_ID = "org.eclipse.osee.ote.ui.host.cmd";
- private static UiPlugin plugin;
-
- public UiPlugin() {
- plugin = this;
- }
-
- public static UiPlugin getInstance() {
- return plugin;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * 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:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ote.ui.host.cmd;
+
+import org.eclipse.osee.framework.ui.plugin.OseeUiActivator;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class UiPlugin extends OseeUiActivator {
+ public static final String PLUGIN_ID = "org.eclipse.osee.ote.ui.host.cmd";
+ private static UiPlugin plugin;
+
+ public UiPlugin() {
+ plugin = this;
+ }
+
+ public static UiPlugin getInstance() {
+ return plugin;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/UserNode.java b/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/UserNode.java
index 4583010b6e0..d839280dabf 100644
--- a/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/UserNode.java
+++ b/plugins/org.eclipse.osee.ote.ui.host.cmd/src/org/eclipse/osee/ote/ui/host/cmd/UserNode.java
@@ -8,20 +8,20 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ote.ui.host.cmd;
-
-import org.eclipse.osee.framework.jdk.core.type.TreeObject;
-
-/**
- * @author Roberto E. Escobar
- */
-public class UserNode extends TreeObject {
-
- /**
- * @param name
- */
- public UserNode(String name) {
- super(name);
- }
-
-}
+package org.eclipse.osee.ote.ui.host.cmd;
+
+import org.eclipse.osee.framework.jdk.core.type.TreeObject;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class UserNode extends TreeObject {
+
+ /**
+ * @param name
+ */
+ public UserNode(String name) {
+ super(name);
+ }
+
+}

Back to the top