Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2014-11-12 10:41:09 +0000
committerTobias Schwarz2014-11-12 10:41:09 +0000
commit0f2b147550f9be59472e7eb6eb12de075f2c65be (patch)
tree0f996ff725db239a3bb54b6f7dd80fd934e2587d /target_explorer
parent646b5df21ae03ffa94c836da532f65a3ceeb86d0 (diff)
downloadorg.eclipse.tcf-0f2b147550f9be59472e7eb6eb12de075f2c65be.tar.gz
org.eclipse.tcf-0f2b147550f9be59472e7eb6eb12de075f2c65be.tar.xz
org.eclipse.tcf-0f2b147550f9be59472e7eb6eb12de075f2c65be.zip
SM: add command line to properties view, fix problem after disconnect of
general connection
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/TreeContentProvider.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEventListener.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/ProcessMonitorEventListener.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/BasicInformationSection.java23
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.properties1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tabbed/MapLabelProvider.java16
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractTreeViewerExplorerEditorPage.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeViewerLabelProvider.java4
9 files changed, 79 insertions, 15 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/TreeContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/TreeContentProvider.java
index f6de7bfd6..7a8dfd508 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/TreeContentProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/controls/TreeContentProvider.java
@@ -164,8 +164,10 @@ public abstract class TreeContentProvider implements ITreeContentProvider, Prope
* @param provider The element node.
*/
private void installPropertyChangeListener(IPropertyChangeProvider provider) {
- if (provider != null && !providers.contains(provider) && commonViewerListener != null) {
- provider.addPropertyChangeListener(commonViewerListener);
+ if (provider != null && !providers.contains(provider)) {
+ if (commonViewerListener != null) {
+ provider.addPropertyChangeListener(commonViewerListener);
+ }
provider.addPropertyChangeListener(this);
providers.add(provider);
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEventListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEventListener.java
index aa2757c65..909eb167e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEventListener.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEventListener.java
@@ -16,6 +16,7 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.tcf.te.core.interfaces.IConnectable;
import org.eclipse.tcf.te.runtime.events.ChangeEvent;
+import org.eclipse.tcf.te.runtime.events.EventManager;
import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IRuntimeModel;
import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
import org.eclipse.tcf.te.tcf.filesystem.core.model.ModelManager;
@@ -51,6 +52,10 @@ public class FSExplorerEventListener extends AbstractEventListener {
final Object source = changeEvent.getSource();
if (treeControl.getViewer() != null) {
+ if (treeControl.getViewer().getControl() == null || treeControl.getViewer().getControl().isDisposed()) {
+ EventManager.getInstance().removeEventListener(this);
+ return;
+ }
// Property changes for the runtime model refreshes the whole tree.
if (source instanceof IRuntimeModel) {
treeControl.getViewer().refresh();
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/ProcessMonitorEventListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/ProcessMonitorEventListener.java
index 24821d561..0aee63f0a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/ProcessMonitorEventListener.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/ProcessMonitorEventListener.java
@@ -19,6 +19,7 @@ import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.te.core.interfaces.IConnectable;
import org.eclipse.tcf.te.runtime.callback.Callback;
import org.eclipse.tcf.te.runtime.events.ChangeEvent;
+import org.eclipse.tcf.te.runtime.events.EventManager;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProperties;
import org.eclipse.tcf.te.tcf.processes.core.model.ModelManager;
@@ -56,6 +57,10 @@ public class ProcessMonitorEventListener extends AbstractEventListener {
final Object source = changeEvent.getSource();
if (treeControl.getViewer() != null) {
+ if (treeControl.getViewer().getControl() == null || treeControl.getViewer().getControl().isDisposed()) {
+ EventManager.getInstance().removeEventListener(this);
+ return;
+ }
// Property changes for the runtime model refreshes the whole tree.
if (source instanceof IRuntimeModel) {
treeControl.getViewer().refresh();
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/BasicInformationSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/BasicInformationSection.java
index c3ac90461..eaa4d305e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/BasicInformationSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/BasicInformationSection.java
@@ -16,6 +16,7 @@ import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.services.ISysMonitor;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProvider;
import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNodeProperties;
import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
import org.eclipse.tcf.te.tcf.ui.tabbed.BaseTitledSection;
import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
@@ -29,10 +30,14 @@ public class BasicInformationSection extends BaseTitledSection {
/* default */ ISysMonitor.SysMonitorContext context;
// The process name
/* default */ String nodeName;
+ // The node command line
+ /* default */ String[] nodeCmdLine;
// The node type
/* default */ String nodeType;
// The text field for the name of the process.
private Text nameText;
+ // The text field for the command line of the process.
+ private Text cmdLineText;
// The text field for the type of the process.
private Text typeText;
// The text field for the state of the process.
@@ -48,7 +53,8 @@ public class BasicInformationSection extends BaseTitledSection {
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
super.createControls(parent, aTabbedPropertySheetPage);
nameText = createWrapTextField(null, Messages.BasicInformationSection_Name);
- typeText = createTextField(nameText, Messages.BasicInformationSection_Type);
+ cmdLineText = createTextField(nameText, Messages.BasicInformationSection_CmdLine);
+ typeText = createTextField(cmdLineText, Messages.BasicInformationSection_Type);
stateText = createTextField(typeText, Messages.BasicInformationSection_State);
userText = createTextField(stateText, Messages.BasicInformationSection_User);
}
@@ -68,6 +74,7 @@ public class BasicInformationSection extends BaseTitledSection {
context = node.getSysMonitorContext();
nodeName = node.getName();
nodeType = node.getType().toString();
+ nodeCmdLine = (String[])node.getProperty(IProcessContextNodeProperties.PROPERTY_CMD_LINE);
}
};
@@ -83,6 +90,8 @@ public class BasicInformationSection extends BaseTitledSection {
public void refresh() {
SWTControlUtil.setText(nameText, nodeName != null ? nodeName: ""); //$NON-NLS-1$
SWTControlUtil.setText(typeText, nodeType != null ? nodeType : ""); //$NON-NLS-1$
+ SWTControlUtil.setText(cmdLineText, nodeCmdLine != null ? makeString(nodeCmdLine) : ""); //$NON-NLS-1$
+
SWTControlUtil.setText(stateText, context != null && context.getState() != null ? context.getState() : ""); //$NON-NLS-1$
SWTControlUtil.setText(userText, context != null && context.getUserName() != null ? context.getUserName() : ""); //$NON-NLS-1$
super.refresh();
@@ -96,4 +105,16 @@ public class BasicInformationSection extends BaseTitledSection {
protected String getText() {
return Messages.BasicInformationSection_Title;
}
+
+ public final static String makeString(String[] cmdline) {
+ Assert.isNotNull(cmdline);
+
+ StringBuilder buffer = new StringBuilder();
+ for (String arg : cmdline) {
+ buffer.append(arg.contains(" ") ? "\"" + arg + "\"" : arg); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ buffer.append(" "); //$NON-NLS-1$
+ }
+
+ return buffer.toString();
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.java
index 4fc818e2c..bd0d75671 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.java
@@ -88,6 +88,7 @@ public class Messages extends NLS {
public static String BasicInformationSection_State;
public static String BasicInformationSection_Title;
public static String BasicInformationSection_Type;
+ public static String BasicInformationSection_CmdLine;
public static String BasicInformationSection_User;
public static String ConfigIntervalDynamicContribution_Custom;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.properties
index be29df90a..5108aaaec 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.properties
@@ -42,6 +42,7 @@ BasicInformationSection_Name=Name:
BasicInformationSection_State=State:
BasicInformationSection_Title=Basic Information
BasicInformationSection_Type=Type:
+BasicInformationSection_CmdLine=Cmd Line:
BasicInformationSection_User=User:
ConfigIntervalDynamicContribution_Custom=Custom ...
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
index 914b37514..0af0ad3cc 100644
--- 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
@@ -36,8 +36,8 @@ public class MapLabelProvider extends LabelProvider implements ITableLabelProvid
public String getColumnText(Object element, int columnIndex) {
if (element instanceof Entry) {
Entry<?, ?> entry = (Entry<?, ?>) element;
+ Object key = entry.getKey();
if (columnIndex == 0) {
- Object key = entry.getKey();
return key == null ? "" : key.toString(); //$NON-NLS-1$
}
Object object = entry.getValue();
@@ -50,6 +50,20 @@ public class MapLabelProvider extends LabelProvider implements ITableLabelProvid
object = null;
}
}
+ if (object instanceof Object[]) {
+ Object[] array = (Object[])object;
+ String value = ""; //$NON-NLS-1$
+ for (Object obj : array) {
+ if (value.length() > 0) {
+ if ("cmdline".equals(key)) //$NON-NLS-1$
+ value += " "; //$NON-NLS-1$
+ else
+ value += ", "; //$NON-NLS-1$
+ }
+ value += obj.toString();
+ }
+ return value;
+ }
return object == null ? "" : object.toString(); //$NON-NLS-1$
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractTreeViewerExplorerEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractTreeViewerExplorerEditorPage.java
index 370ea63da..e983811de 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractTreeViewerExplorerEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractTreeViewerExplorerEditorPage.java
@@ -41,6 +41,7 @@ import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -54,6 +55,7 @@ import org.eclipse.tcf.te.ui.interfaces.ITreeControlInputChangedListener;
import org.eclipse.tcf.te.ui.trees.AbstractTreeControl;
import org.eclipse.tcf.te.ui.trees.TreeControl;
import org.eclipse.tcf.te.ui.utils.TreeViewerUtil;
+import org.eclipse.tcf.te.ui.views.activator.UIPlugin;
import org.eclipse.ui.ISources;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
@@ -71,6 +73,8 @@ public abstract class AbstractTreeViewerExplorerEditorPage extends AbstractCusto
private TreeControl treeControl;
private IToolBarManager toolbarMgr;
private PropertyChangeListener pcListener;
+ private ISelectionChangedListener scListener;
+ private FocusListener fListener;
private Image formImage;
/* (non-Javadoc)
@@ -82,8 +86,12 @@ public abstract class AbstractTreeViewerExplorerEditorPage extends AbstractCusto
if(provider != null && pcListener != null) {
provider.removePropertyChangeListener(pcListener);
}
- if(formImage != null) {
- formImage.dispose();
+ if (treeControl != null && treeControl.getViewer() != null) {
+ treeControl.getViewer().removeSelectionChangedListener(scListener);
+ if (treeControl.getViewer() instanceof TreeViewer) {
+ ((TreeViewer)treeControl.getViewer()).removeDoubleClickListener(this);
+ ((TreeViewer)treeControl.getViewer()).getTree().removeFocusListener(fListener);
+ }
}
if (treeControl != null) { treeControl.dispose(); treeControl = null; }
super.dispose();
@@ -117,9 +125,13 @@ public abstract class AbstractTreeViewerExplorerEditorPage extends AbstractCusto
if(bundle != null) {
URL iconURL = bundle.getEntry(iconPath);
if(iconURL != null) {
- ImageDescriptor iconDesc = ImageDescriptor.createFromURL(iconURL);
- if(iconDesc != null) {
- formImage = iconDesc.createImage();
+ formImage = UIPlugin.getImage(iconURL.toString());
+ if (formImage == null) {
+ ImageDescriptor iconDesc = ImageDescriptor.createFromURL(iconURL);
+ if(iconDesc != null) {
+ formImage = iconDesc.createImage();
+ UIPlugin.getDefault().getImageRegistry().put(iconURL.toString(), formImage);
+ }
}
}
}
@@ -261,17 +273,20 @@ public abstract class AbstractTreeViewerExplorerEditorPage extends AbstractCusto
*/
private void addViewerListeners() {
TreeViewer viewer = (TreeViewer) treeControl.getViewer();
- viewer.addSelectionChangedListener(new ISelectionChangedListener(){
+ scListener = new ISelectionChangedListener(){
@Override
public void selectionChanged(SelectionChangedEvent event) {
propagateSelection();
- }});
- viewer.getTree().addFocusListener(new FocusAdapter(){
+ }
+ };
+ viewer.addSelectionChangedListener(scListener);
+ fListener = new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
propagateSelection();
}
- });
+ };
+ viewer.getTree().addFocusListener(fListener);
viewer.addDoubleClickListener(this);
IPropertyChangeProvider provider = getPropertyChangeProvider();
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeViewerLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeViewerLabelProvider.java
index 4db08f511..4ff907ea0 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeViewerLabelProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeViewerLabelProvider.java
@@ -56,8 +56,8 @@ public class TreeViewerLabelProvider extends PendingAwareLabelProvider implement
*/
private ColumnDescriptor getColumn(int columnIndex) {
Tree tree = viewer.getTree();
- TreeColumn column = tree.getColumn(columnIndex);
- ColumnDescriptor descriptor = (ColumnDescriptor) column.getData();
+ TreeColumn column = tree.getColumnCount() > columnIndex ? tree.getColumn(columnIndex) : null;
+ ColumnDescriptor descriptor = column != null ? (ColumnDescriptor) column.getData() : null;
return descriptor;
}

Back to the top