Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2012-08-30 06:30:21 +0000
committerUwe Stieber2012-08-30 07:53:57 +0000
commitc20d113ec54c9ec737a2972ff63bbdd015103a56 (patch)
tree4a49e6a38e027989b3eb2895de64bb955ae6959c /target_explorer
parent4ea5a7690c1cdc07b5b1ffaa8bdd7b3db65299e5 (diff)
downloadorg.eclipse.tcf-c20d113ec54c9ec737a2972ff63bbdd015103a56.tar.gz
org.eclipse.tcf-c20d113ec54c9ec737a2972ff63bbdd015103a56.tar.xz
org.eclipse.tcf-c20d113ec54c9ec737a2972ff63bbdd015103a56.zip
Target Explorer: Reworked Process Monitor to use new process model
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/META-INF/MANIFEST.MF1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/QueryDoneGetChildren.java75
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/QueryDoneGetContext.java127
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/QueryDoneOpenChannel.java85
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/RefreshChildrenDoneOpenChannel.java122
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/RefreshDoneGetChildren.java93
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/RefreshDoneGetContext.java167
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/RefreshDoneMonitorCallback.java113
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/RefreshDoneOpenChannel.java65
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/ProcessModel.java220
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/ProcessTreeNode.java271
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/interfaces/IProcessContextNode.java9
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/nodes/ProcessContextNode.java53
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/RuntimeModel.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelRefreshService.java146
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/steps/AttachStep.java420
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/steps/DetachStep.java376
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/steps/TerminateStep.java339
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/nls/Messages.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/nls/Messages.properties5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/META-INF/MANIFEST.MF10
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/icons/obj16/pending.gifbin0 -> 664 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.properties24
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.xml1450
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/activator/UIPlugin.java264
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/controls/ProcessNavigatorContentProvider.java81
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/controls/ProcessTreeContentProvider.java60
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/controls/ProcessViewerSorter.java35
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/ProcessMonitorEditorPage.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/pages/ProcessMonitorEditorPage.java)169
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/ProcessMonitorEventListener.java67
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/ProcessMonitorTitleDecorator.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/pages/ProcessMonitorTitleDecorator.java)128
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/RefreshingImageDescriptor.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/pages/RefreshingImageDescriptor.java)2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/tree/ContentProvider.java58
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/AttachHandler.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/handler/AttachHandler.java)260
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/ConfigIntervalDynamicContribution.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/handler/ConfigIntervalDynamicContribution.java)537
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/ConfigRefreshIntervalHandler.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/handler/ConfigRefreshIntervalHandler.java)108
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/DetachHandler.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/handler/DetachHandler.java)112
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/RefreshHandler.java114
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/RefreshProcessListHandler.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/handler/RefreshProcessListHandler.java)83
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/TerminateHandler.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/handler/TerminateHandler.java)170
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/AdapterFactory.java130
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessTreeNodeLoader.java77
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/PIDComparator.java78
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/PIDLabelProvider.java90
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/PPIDComparator.java77
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/PPIDLabelProvider.java88
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/ProcessComparator.java224
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/ProcessLabelProvider.java65
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/StateComparator.java87
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/StateLabelProvider.java90
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/UserComparator.java87
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/UserLabelProvider.java90
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/filters/SingleThreadFilter.java114
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/handler/RefreshHandler.java41
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/AdvancedPropertiesPage.java150
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/ContextPage.java226
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/GeneralInformationPage.java213
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessNodeGeneralMatcher.java136
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessSearchable.java166
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessStateSearchable.java539
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessUserSearchable.java370
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/AdvancedPropertiesSection.java199
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/BasicContextSection.java192
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/BasicInformationSection.java180
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/ContextIDSection.java212
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/IDSection.java171
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/MemorySection.java164
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/ProcessFilter.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/testers/ProcessPropertyTester.java100
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/navigator/events/EventListener.java56
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/navigator/runtime/ContentProviderDelegate.java273
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/navigator/runtime/LabelProviderDelegate.java129
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/suites/AllProcessTests.java57
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/suites/AllTests.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/processes/ProcessesTestCase.java30
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/processes/callbacks/QueryChildrenCallbackTest.java72
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/internal/utils/QuickFilter.java523
77 files changed, 5511 insertions, 6446 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/META-INF/MANIFEST.MF
index d86f50dae..e93d60aa2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/META-INF/MANIFEST.MF
@@ -20,7 +20,6 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Export-Package: org.eclipse.tcf.te.tcf.processes.core.activator;x-internal:=true,
- org.eclipse.tcf.te.tcf.processes.core.callbacks,
org.eclipse.tcf.te.tcf.processes.core.interfaces,
org.eclipse.tcf.te.tcf.processes.core.interfaces.launcher,
org.eclipse.tcf.te.tcf.processes.core.interfaces.tracing;x-internal:=true,
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/QueryDoneGetChildren.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/QueryDoneGetChildren.java
deleted file mode 100644
index e0721592f..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/QueryDoneGetChildren.java
+++ /dev/null
@@ -1,75 +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.processes.core.callbacks;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.tcf.protocol.IChannel;
-import org.eclipse.tcf.protocol.IToken;
-import org.eclipse.tcf.services.IProcesses;
-import org.eclipse.tcf.services.ISysMonitor;
-import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.tcf.core.concurrent.CallbackMonitor;
-import org.eclipse.tcf.te.tcf.processes.core.activator.CoreBundleActivator;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-
-/**
- * The callback handler that handles the result of service.getChildren when querying.
- */
-public class QueryDoneGetChildren implements ISysMonitor.DoneGetChildren {
- // The channel used for query.
- IChannel channel;
- // The service used for query.
- ISysMonitor service;
- // The parent node to be queried.
- ProcessTreeNode parentNode;
- // The callback object
- ICallback callback;
- /**
- * Create an instance with the field parameters.
- */
- public QueryDoneGetChildren(ICallback callback, IChannel channel, ISysMonitor service, ProcessTreeNode parentNode) {
- this.callback = callback;
- this.channel = channel;
- this.service = service;
- this.parentNode = parentNode;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.services.ISysMonitor.DoneGetChildren#doneGetChildren(org.eclipse.tcf.protocol.IToken, java.lang.Exception, java.lang.String[])
- */
- @Override
- public void doneGetChildren(IToken token, Exception error, String[] contextIds) {
- if (error == null) {
- if (contextIds != null && contextIds.length > 0) {
- IProcesses pService = channel.getRemoteService(IProcesses.class);
- if (pService != null) {
- CallbackMonitor monitor = new CallbackMonitor(callback, (Object[]) contextIds);
- for (String contextId : contextIds) {
- QueryDoneGetContext done = new QueryDoneGetContext(contextId, channel, monitor, parentNode);
- service.getContext(contextId, done);
- pService.getContext(contextId, done);
- }
- }
- }
- else {
- parentNode.clearChildren();
- if(callback != null) {
- callback.done(this, Status.OK_STATUS);
- }
- }
- }
- else if (callback != null) {
- IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), error.getMessage(), error);
- callback.done(this, status);
- }
- }
-} \ No newline at end of file
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/QueryDoneGetContext.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/QueryDoneGetContext.java
deleted file mode 100644
index 625eb80b2..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/QueryDoneGetContext.java
+++ /dev/null
@@ -1,127 +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.processes.core.callbacks;
-
-import java.util.Queue;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.tcf.protocol.IChannel;
-import org.eclipse.tcf.protocol.IToken;
-import org.eclipse.tcf.services.IProcesses;
-import org.eclipse.tcf.services.IProcesses.ProcessContext;
-import org.eclipse.tcf.services.ISysMonitor;
-import org.eclipse.tcf.te.runtime.callback.Callback;
-import org.eclipse.tcf.te.tcf.core.concurrent.CallbackMonitor;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-
-/**
- * The callback handler that handles the result of service.getContext when querying.
- */
-public class QueryDoneGetContext implements ISysMonitor.DoneGetContext, IProcesses.DoneGetContext {
- // The current context id.
- String contextId;
- // The channel used for query.
- IChannel channel;
- // The parent node to be queried.
- ProcessTreeNode parentNode;
- // The callback monitor to check if the query has finished.
- CallbackMonitor monitor;
- // The current child node
- ProcessTreeNode childNode;
- // The process context of this child node.
- IProcesses.ProcessContext pContext;
- // The system monitor context of this child node.
- ISysMonitor.SysMonitorContext sContext;
- // The flag to indicate if the system monitor service has returned.
- volatile boolean sysMonitorDone;
- // The flag to indicate if the process service has returned.
- volatile boolean processesDone;
-
- /**
- * Create an instance with the field parameters.
- */
- public QueryDoneGetContext(String contextId, IChannel channel, CallbackMonitor monitor, ProcessTreeNode parentNode) {
- this.contextId = contextId;
- this.channel = channel;
- this.parentNode = parentNode;
- this.monitor = monitor;
- this.sysMonitorDone = false;
- this.processesDone = false;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.services.ISysMonitor.DoneGetContext#doneGetContext(org.eclipse.tcf.protocol.IToken, java.lang.Exception, org.eclipse.tcf.services.ISysMonitor.SysMonitorContext)
- */
- @Override
- public void doneGetContext(IToken token, Exception error, ISysMonitor.SysMonitorContext context) {
- if (error == null && context != null) {
- sContext = context;
- }
- sysMonitorDone = true;
- refreshChildren();
- }
-
- /**
- * Refresh the children under this child node.
- */
- private void refreshChildren() {
- if (sysMonitorDone && processesDone) {
- if(sContext != null) {
- childNode = new ProcessTreeNode(parentNode, sContext);
- childNode.setProcessContext(pContext);
- } else if(pContext != null) {
- childNode = new ProcessTreeNode(parentNode, pContext);
- childNode.setSysMonitorContext(sContext);
- }
- if (childNode != null) {
- parentNode.addChild(childNode);
- childNode.queryStarted();
- ISysMonitor service = channel.getRemoteService(ISysMonitor.class);
- if (service != null) {
- Queue<ProcessTreeNode> queue = new ConcurrentLinkedQueue<ProcessTreeNode>();
- service.getChildren(childNode.id, new RefreshDoneGetChildren(new Callback() {
- @Override
- protected void internalDone(Object caller, IStatus status) {
- doCallback(caller, status);
- }
- }, queue, channel, service, childNode));
- }
- } else {
- doCallback(this, Status.OK_STATUS);
- }
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.services.IProcesses.DoneGetContext#doneGetContext(org.eclipse.tcf.protocol.IToken, java.lang.Exception, org.eclipse.tcf.services.IProcesses.ProcessContext)
- */
- @Override
- public void doneGetContext(IToken token, Exception error, ProcessContext context) {
- if (error == null && context != null) {
- pContext = context;
- }
- processesDone = true;
- refreshChildren();
- }
-
- /**
- * Call after everything is done.
- *
- * @param caller The caller.
- * @param status The returned status.
- */
- protected void doCallback(Object caller, IStatus status) {
- monitor.unlock(contextId, status);
- }
-} \ No newline at end of file
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/QueryDoneOpenChannel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/QueryDoneOpenChannel.java
deleted file mode 100644
index 5d41d9999..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/QueryDoneOpenChannel.java
+++ /dev/null
@@ -1,85 +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.processes.core.callbacks;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.tcf.protocol.IChannel;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.services.ISysMonitor;
-import org.eclipse.tcf.te.runtime.callback.Callback;
-import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.tcf.core.Tcf;
-import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
-import org.eclipse.tcf.te.tcf.processes.core.activator.CoreBundleActivator;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-
-/**
- * The callback handler that handles the event when the channel opens when querying.
- */
-public class QueryDoneOpenChannel implements IChannelManager.DoneOpenChannel {
- // The parent node to be queried.
- ProcessTreeNode parentNode;
- // The callback object.
- ICallback callback;
-
- /**
- * Create an instance with a process model and a parent node.
- *
- * @param parentNode The parent node to be queried.
- */
- public QueryDoneOpenChannel(ProcessTreeNode parentNode) {
- this(parentNode, null);
- }
-
- /**
- * Create an instance with a process model and a parent node.
- *
- * @param parentNode The parent node to be queried.
- * @param callback The callback object.
- */
- public QueryDoneOpenChannel(ProcessTreeNode parentNode, ICallback callback) {
- this.parentNode = parentNode;
- this.callback = callback;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager.DoneOpenChannel#doneOpenChannel(java.lang.Throwable, org.eclipse.tcf.protocol.IChannel)
- */
- @Override
- public void doneOpenChannel(Throwable error, final IChannel channel) {
- Assert.isTrue(Protocol.isDispatchThread());
- if (error == null) {
- ISysMonitor service = channel.getRemoteService(ISysMonitor.class);
- if (service != null) {
- service.getChildren(parentNode.id, new QueryDoneGetChildren(new Callback(){
- @Override
- protected void internalDone(Object caller, IStatus status) {
- parentNode.queryDone();
- Tcf.getChannelManager().closeChannel(channel);
- if(callback != null) {
- callback.done(caller, status);
- }
- }
- }, channel, service, parentNode));
- }
- else if (callback != null) {
- callback.done(this, Status.OK_STATUS);
- }
- }
- else if (!(error instanceof OperationCanceledException) && callback != null) {
- IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), error.getMessage(), error);
- callback.done(this, status);
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/RefreshChildrenDoneOpenChannel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/RefreshChildrenDoneOpenChannel.java
deleted file mode 100644
index 77f795ab3..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/RefreshChildrenDoneOpenChannel.java
+++ /dev/null
@@ -1,122 +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.processes.core.callbacks;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Queue;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.tcf.protocol.IChannel;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.services.ISysMonitor;
-import org.eclipse.tcf.te.runtime.callback.Callback;
-import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.tcf.core.Tcf;
-import org.eclipse.tcf.te.tcf.core.concurrent.CallbackMonitor;
-import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
-import org.eclipse.tcf.te.tcf.processes.core.activator.CoreBundleActivator;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-
-/**
- * The callback handler that handles the event when the channel opens when refreshing.
- */
-public class RefreshChildrenDoneOpenChannel implements IChannelManager.DoneOpenChannel {
- // The parent node to be refreshed.
- ProcessTreeNode parentNode;
- // The callback object.
- ICallback callback;
-
- /**
- * Create an instance with the specified field parameters.
- */
- public RefreshChildrenDoneOpenChannel(ProcessTreeNode parentNode) {
- this(parentNode, null);
- }
-
- /**
- * Create an instance with a process model and a parent node.
- *
- * @param parentNode The parent node to be queried.
- * @param callback The callback object.
- */
- public RefreshChildrenDoneOpenChannel(ProcessTreeNode parentNode, ICallback callback) {
- this.parentNode = parentNode;
- this.callback = callback;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager.DoneOpenChannel#doneOpenChannel(java.lang.Throwable, org.eclipse.tcf.protocol.IChannel)
- */
- @Override
- public void doneOpenChannel(Throwable error, final IChannel channel) {
- Assert.isTrue(Protocol.isDispatchThread());
- if (error == null) {
- ICallback wrapperCallback = new Callback(){
- @Override
- protected void internalDone(Object caller, IStatus status) {
- Tcf.getChannelManager().closeChannel(channel);
- if(callback != null) {
- callback.done(caller, status);
- }
- }};
- ISysMonitor service = channel.getRemoteService(ISysMonitor.class);
- if (service != null) {
- Object[] childrenIds = getChildrenIds();
- if(childrenIds.length == 0) {
- wrapperCallback.done(this, Status.OK_STATUS);
- }
- else {
- final CallbackMonitor monitor = new CallbackMonitor(wrapperCallback, childrenIds);
- for (ProcessTreeNode child : parentNode.getChildren()) {
- if (!child.childrenQueried && !child.childrenQueryRunning) {
- final String contextId = child.id;
- ICallback callback = new Callback() {
- @Override
- protected void internalDone(Object caller, IStatus status) {
- monitor.unlock(contextId, status);
- }
- };
- Queue<ProcessTreeNode> queue = new ConcurrentLinkedQueue<ProcessTreeNode>();
- ISysMonitor.DoneGetChildren done = new RefreshDoneGetChildren(callback, queue, channel, service, child);
- service.getChildren(child.id, done);
- }
- }
- }
- }
- else {
- wrapperCallback.done(this, Status.OK_STATUS);
- }
- }
- else if (!(error instanceof OperationCanceledException) && callback != null) {
- IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), error.getMessage(), error);
- callback.done(this, status);
- }
- }
-
- /**
- * Create and initialize a status map with all the context ids and completion status
- * set to false.
- */
- private Object[] getChildrenIds() {
- List<Object> ids = new ArrayList<Object>();
- for (ProcessTreeNode child : parentNode.getChildren()) {
- if (!child.childrenQueried && !child.childrenQueryRunning) {
- ids.add(child.id);
- }
- }
- return ids.toArray(new Object[ids.size()]);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/RefreshDoneGetChildren.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/RefreshDoneGetChildren.java
deleted file mode 100644
index 0b62f02dd..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/RefreshDoneGetChildren.java
+++ /dev/null
@@ -1,93 +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.processes.core.callbacks;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Queue;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.tcf.protocol.IChannel;
-import org.eclipse.tcf.protocol.IToken;
-import org.eclipse.tcf.services.IProcesses;
-import org.eclipse.tcf.services.ISysMonitor;
-import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.tcf.core.concurrent.CallbackMonitor;
-import org.eclipse.tcf.te.tcf.processes.core.activator.CoreBundleActivator;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-
-/**
- * The callback handler that handles the result of service.getChildren when refreshing.
- */
-public class RefreshDoneGetChildren implements ISysMonitor.DoneGetChildren {
- // The channel used for refreshing.
- IChannel channel;
- // The service used for refreshing.
- ISysMonitor service;
- // The parent node to be refreshed.
- ProcessTreeNode parentNode;
- // The queue to iterate the legitimate node in the whole tree.
- Queue<ProcessTreeNode> queue;
- // The service used for refreshing.
- ICallback callback;
-
- /**
- * Create an instance with the field parameters.
- */
- public RefreshDoneGetChildren(ICallback callback, Queue<ProcessTreeNode> queue, IChannel channel, ISysMonitor service, ProcessTreeNode parentNode) {
- this.callback = callback;
- this.queue = queue;
- this.channel = channel;
- this.service = service;
- this.parentNode = parentNode;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.services.ISysMonitor.DoneGetChildren#doneGetChildren(org.eclipse.tcf.protocol.IToken, java.lang.Exception, java.lang.String[])
- */
- @Override
- public void doneGetChildren(IToken token, Exception error, String[] contextIds) {
- if (error == null) {
- if (contextIds != null && contextIds.length > 0) {
- IProcesses pService = channel.getRemoteService(IProcesses.class);
- if (pService != null) {
- List<ProcessTreeNode> newNodes = Collections.synchronizedList(new ArrayList<ProcessTreeNode>());
- ICallback monitorCallback = new RefreshDoneMonitorCallback(newNodes, parentNode, queue, callback, service, channel);
- CallbackMonitor monitor = new CallbackMonitor(monitorCallback, (Object[]) contextIds);
- for (String contextId : contextIds) {
- RefreshDoneGetContext done = new RefreshDoneGetContext(channel, newNodes, contextId, monitor, parentNode);
- service.getContext(contextId, done);
- pService.getContext(contextId, done);
- }
- }
- } else {
- parentNode.queryDone();
- parentNode.clearChildren();
- if (queue.isEmpty()) {
- if(callback != null) {
- callback.done(this, Status.OK_STATUS);
- }
- } else {
- ProcessTreeNode node = queue.poll();
- service.getChildren(node.id, new RefreshDoneGetChildren(callback, queue, channel, service, node));
- }
- }
- } else {
- parentNode.queryDone();
- if(callback != null) {
- IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), error.getMessage(), error);
- callback.done(this, status);
- }
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/RefreshDoneGetContext.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/RefreshDoneGetContext.java
deleted file mode 100644
index 9a114bc21..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/RefreshDoneGetContext.java
+++ /dev/null
@@ -1,167 +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.processes.core.callbacks;
-
-import java.util.List;
-import java.util.Queue;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.tcf.protocol.IChannel;
-import org.eclipse.tcf.protocol.IToken;
-import org.eclipse.tcf.services.IProcesses;
-import org.eclipse.tcf.services.IProcesses.ProcessContext;
-import org.eclipse.tcf.services.ISysMonitor;
-import org.eclipse.tcf.te.runtime.callback.Callback;
-import org.eclipse.tcf.te.tcf.core.concurrent.CallbackMonitor;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-
-/**
- * The callback handler that handles the result of service.getContext when refreshing.
- */
-public class RefreshDoneGetContext implements ISysMonitor.DoneGetContext, IProcesses.DoneGetContext {
- // The current context id.
- String contextId;
- // The parent node to be refreshed.
- ProcessTreeNode parentNode;
- // The list to record all new nodes for merging.
- List<ProcessTreeNode> newNodes;
- // The current child node
- ProcessTreeNode childNode;
- // The process context of this child node.
- ProcessContext pContext;
- // The system monitor context of this child node.
- ISysMonitor.SysMonitorContext sContext;
- // The flag to indicate if the system monitor service has returned.
- volatile boolean sysMonitorDone;
- // The flag to indicate if the process service has returned.
- volatile boolean processesDone;
- // The callback monitor
- CallbackMonitor monitor;
- // The TCF channel
- IChannel channel;
-
- /**
- * Create an instance with the field parameters.
- */
- public RefreshDoneGetContext(IChannel channel, List<ProcessTreeNode> newNodes, String contextId, CallbackMonitor monitor, ProcessTreeNode parentNode) {
- this.channel = channel;
- this.contextId = contextId;
- this.parentNode = parentNode;
- this.monitor = monitor;
- this.newNodes = newNodes;
- this.sysMonitorDone = false;
- this.processesDone = false;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.services.ISysMonitor.DoneGetContext#doneGetContext(org.eclipse.tcf.protocol.IToken, java.lang.Exception, org.eclipse.tcf.services.ISysMonitor.SysMonitorContext)
- */
- @Override
- public void doneGetContext(IToken token, Exception error, ISysMonitor.SysMonitorContext context) {
- if (error == null && context != null) {
- sContext = context;
- }
- sysMonitorDone = true;
- packNode();
- }
-
- /**
- * Search the specified child node in the children of the parent node.
- *
- * @param childNode The child node.
- * @return The index of the child node or -1 if no such node.
- */
- private int searchChild(ProcessTreeNode childNode) {
- return searchInList(childNode, parentNode.getChildren());
- }
-
- /**
- * Search the specified child node in the specified list.
- *
- * @param childNode The child node.
- * @param list The process node list.
- * @return The index of the child node or -1 if no such node.
- */
- private int searchInList(ProcessTreeNode childNode, List<ProcessTreeNode> list) {
- synchronized (list) {
- for (int i = 0; i < list.size(); i++) {
- ProcessTreeNode node = list.get(i);
- if (childNode.id.equals(node.id)) {
- return i;
- }
- }
- return -1;
- }
- }
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.services.IProcesses.DoneGetContext#doneGetContext(org.eclipse.tcf.protocol.IToken, java.lang.Exception, org.eclipse.tcf.services.IProcesses.ProcessContext)
- */
- @Override
- public void doneGetContext(IToken token, Exception error, ProcessContext context) {
- if (error == null && context != null) {
- pContext = context;
- }
- processesDone = true;
- packNode();
- }
-
- /**
- * Pack the child node with parent node and refresh the node if it is a newly
- * created node.
- */
- private void packNode() {
- if (sysMonitorDone && processesDone) {
- if (sContext != null) {
- childNode = new ProcessTreeNode(parentNode, sContext);
- childNode.setProcessContext(pContext);
- }
- else if (pContext != null) {
- childNode = new ProcessTreeNode(parentNode, pContext);
- childNode.setSysMonitorContext(sContext);
- }
- if (childNode != null) {
- final int index = searchChild(childNode);
- if (index != -1) {
- ProcessTreeNode node = parentNode.getChildren().get(index);
- if (sContext != null) {
- node.updateSysMonitorContext(sContext);
- }
- if (pContext != null) {
- node.setProcessContext(pContext);
- }
- childNode = node;
- newNodes.add(childNode);
- monitor.unlock(contextId, Status.OK_STATUS);
- }
- else {
- ISysMonitor service = channel.getRemoteService(ISysMonitor.class);
- Assert.isNotNull(service);
- Queue<ProcessTreeNode> queue = new ConcurrentLinkedQueue<ProcessTreeNode>();
- service.getChildren(childNode.id, new RefreshDoneGetChildren(new Callback() {
- @Override
- protected void internalDone(Object caller, IStatus status) {
- parentNode.addChild(childNode);
- newNodes.add(childNode);
- monitor.unlock(contextId, status);
- }
- }, queue, channel, service, childNode));
- }
- }
- else {
- monitor.unlock(contextId, Status.OK_STATUS);
- }
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/RefreshDoneMonitorCallback.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/RefreshDoneMonitorCallback.java
deleted file mode 100644
index 37d7b2ba8..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/RefreshDoneMonitorCallback.java
+++ /dev/null
@@ -1,113 +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.processes.core.callbacks;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Queue;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.tcf.protocol.IChannel;
-import org.eclipse.tcf.services.ISysMonitor;
-import org.eclipse.tcf.te.runtime.callback.Callback;
-import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-
-/**
- * The monitor's callback invoked after all the contexts of the processes have been
- * fetched and updated.
- */
-public class RefreshDoneMonitorCallback extends Callback {
- // The new nodes during this querying.
- List<ProcessTreeNode> newNodes;
- // The parent node whose children are refreshing.
- ProcessTreeNode parentNode;
- // The queue to cache the legitimate nodes for refreshing.
- Queue<ProcessTreeNode> queue;
- // The callback after the querying is done.
- ICallback callback;
- // The service used to fetch process context.
- ISysMonitor service;
- // The TCF channel.
- IChannel channel;
-
- /**
- * Create an instance with parameters to initialize the fields.
- */
- public RefreshDoneMonitorCallback(List<ProcessTreeNode> newNodes, ProcessTreeNode parentNode,
- Queue<ProcessTreeNode> queue, ICallback callback, ISysMonitor service, IChannel channel) {
- this.newNodes = newNodes;
- this.parentNode = parentNode;
- this.queue = queue;
- this.callback = callback;
- this.service = service;
- this.channel = channel;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.callback.Callback#internalDone(java.lang.Object, org.eclipse.core.runtime.IStatus)
- */
- @Override
- protected void internalDone(Object caller, IStatus status) {
- parentNode.queryDone();
- removeDead();
- for (ProcessTreeNode node : parentNode.getChildren()) {
- if (node.childrenQueried && !node.childrenQueryRunning) {
- Assert.isTrue(queue.offer(node));
- }
- }
- if (queue.isEmpty()) {
- if (callback != null) {
- callback.done(caller, status);
- }
- }
- else {
- ProcessTreeNode node = queue.poll();
- service.getChildren(node.id, new RefreshDoneGetChildren(callback, queue, channel, service, node));
- }
- }
-
- /**
- * Remove the dead process nodes.
- */
- private void removeDead() {
- List<ProcessTreeNode> dead = new ArrayList<ProcessTreeNode>();
- for (ProcessTreeNode node : parentNode.getChildren()) {
- int index = searchInList(node, newNodes);
- if (index == -1) {
- dead.add(node);
- }
- }
- for (ProcessTreeNode node : dead) {
- parentNode.removeChild(node);
- }
- }
-
- /**
- * Search the specified child node in the specified list.
- *
- * @param childNode The child node.
- * @param list The process node list.
- * @return The index of the child node or -1 if no such node.
- */
- private int searchInList(ProcessTreeNode childNode, List<ProcessTreeNode> list) {
- synchronized (list) {
- for (int i = 0; i < list.size(); i++) {
- ProcessTreeNode node = list.get(i);
- if (childNode.id.equals(node.id)) {
- return i;
- }
- }
- return -1;
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/RefreshDoneOpenChannel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/RefreshDoneOpenChannel.java
deleted file mode 100644
index d775df7b4..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/callbacks/RefreshDoneOpenChannel.java
+++ /dev/null
@@ -1,65 +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.processes.core.callbacks;
-
-import java.util.Queue;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.tcf.protocol.IChannel;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.services.ISysMonitor;
-import org.eclipse.tcf.te.runtime.callback.Callback;
-import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.tcf.core.Tcf;
-import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-
-/**
- * The callback handler that handles the event when the channel opens when refreshing.
- */
-public class RefreshDoneOpenChannel implements IChannelManager.DoneOpenChannel {
- // The parent node to be refreshed.
- ProcessTreeNode parentNode;
- // The callback to be called when refresh is done.
- ICallback callback;
-
- /**
- * Create an instance with the specified field parameters.
- */
- public RefreshDoneOpenChannel(ProcessTreeNode parentNode, ICallback callback) {
- this.callback = callback;
- this.parentNode = parentNode;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager.DoneOpenChannel#doneOpenChannel(java.lang.Throwable, org.eclipse.tcf.protocol.IChannel)
- */
- @Override
- public void doneOpenChannel(Throwable error, final IChannel channel) {
- Assert.isTrue(Protocol.isDispatchThread());
- if (error == null) {
- ISysMonitor service = channel.getRemoteService(ISysMonitor.class);
- if (service != null) {
- Queue<ProcessTreeNode> queue = new ConcurrentLinkedQueue<ProcessTreeNode>();
- service.getChildren(parentNode.id, new RefreshDoneGetChildren(new Callback(){
- @Override
- protected void internalDone(Object caller, IStatus status) {
- Tcf.getChannelManager().closeChannel(channel);
- if(callback!=null) {
- callback.done(caller, status);
- }
- }}, queue, channel, service, parentNode));
- }
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/ProcessModel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/ProcessModel.java
deleted file mode 100644
index e8e09fd7d..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/ProcessModel.java
+++ /dev/null
@@ -1,220 +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.processes.core.model;
-
-import java.beans.PropertyChangeEvent;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.core.interfaces.IPropertyChangeProvider;
-import org.eclipse.tcf.te.runtime.callback.Callback;
-import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.ITreeNodeModel;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.processes.core.activator.CoreBundleActivator;
-import org.eclipse.tcf.te.tcf.processes.core.nls.Messages;
-
-/**
- * The process tree model implementation.
- */
-public class ProcessModel implements ITreeNodeModel{
- /* default */static final String PROCESS_ROOT_KEY = CoreBundleActivator.getUniqueIdentifier() + ".process.root"; //$NON-NLS-1$
-
- /**
- * Get the process model stored in the peer model.
- * If there's no process model yet, create a new process model.
- *
- * @param peerModel The target's peer model.
- * @return The process model representing the process.
- */
- public static ProcessModel getProcessModel(final IPeerModel peerModel) {
- final AtomicReference<ProcessModel> model = new AtomicReference<ProcessModel>();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- if (peerModel != null) {
- model.set((ProcessModel) peerModel.getProperty(PROCESS_ROOT_KEY));
- if (model.get() == null) {
- model.set(new ProcessModel(peerModel));
- peerModel.setProperty(PROCESS_ROOT_KEY, model.get());
- }
- }
- }
- };
-
- if (Protocol.isDispatchThread()) runnable.run();
- else Protocol.invokeAndWait(runnable);
-
- return model.get();
- }
-
- /**
- * Create a root process node.
- *
- * @param peerModel The peer model which this process belongs to.
- * @return The root process node.
- */
- /* default */ static ProcessTreeNode createRootNode(IPeerModel peerModel) {
- ProcessTreeNode node = new ProcessTreeNode();
- node.type = "ProcRootNode"; //$NON-NLS-1$
- node.peerNode = peerModel;
- node.name = Messages.ProcessLabelProvider_RootNodeLabel;
- return node;
- }
-
- // The root node of the peer model
- ProcessTreeNode root;
- // The polling interval in seconds. If it is zero, then stop polling periodically.
- /* default */int interval;
- // The timer to schedule polling task.
- /* default */Timer pollingTimer;
- // The flag to indicate if the polling has been stopped.
- /* default */boolean stopped;
- IPeerModel peerModel;
- // The periodic refreshing callback.
- /**
- * Create a File System Model.
- */
- /* default */ ProcessModel(IPeerModel peerModel) {
- this.peerModel = peerModel;
- this.stopped = true;
- }
-
- /**
- * Get the root node of the peer model.
- *
- * @return The root node.
- */
- @Override
- public ProcessTreeNode getRoot() {
- if(root == null) {
- root = createRoot();
- }
- return root;
- }
-
- /**
- * Set the root node of the peer model.
- *
- * @param root The root node
- */
- ProcessTreeNode createRoot() {
- return createRootNode(peerModel);
- }
-
- /**
- * Start the periodical polling.
- */
- void startPolling() {
- setStopped(false);
- pollingTimer = new Timer();
- scheduleRefreshing();
- }
-
- /**
- * Set the status of the polling and
- * fire a property change event.
- *
- * @param stopped if the polling should be stopped.
- */
- void setStopped(boolean stopped) {
- if(this.stopped != stopped) {
- boolean old = this.stopped;
- this.stopped = stopped;
- Boolean oldValue = Boolean.valueOf(old);
- Boolean newValue = Boolean.valueOf(stopped);
- PropertyChangeEvent event = new PropertyChangeEvent(getRoot(), "stopped", oldValue, newValue); //$NON-NLS-1$
- IPropertyChangeProvider provider = (IPropertyChangeProvider) peerModel.getAdapter(IPropertyChangeProvider.class);
- provider.firePropertyChange(event);
- }
- }
-
- /**
- * Stop the periodical polling.
- */
- void stopPolling() {
- setStopped(true);
- }
-
- /**
- * Schedule the periodical refreshing.
- */
- void scheduleRefreshing() {
- final ICallback refreshCallback = new Callback() {
- @Override
- protected void internalDone(Object caller, IStatus status) {
- if (!stopped) {
- scheduleRefreshing();
- }
- else {
- if (pollingTimer != null) {
- pollingTimer.cancel();
- pollingTimer = null;
- }
- }
- }
- };
- TimerTask pollingTask = new TimerTask(){
- @Override
- public void run() {
- if (root != null && root.childrenQueried && !root.childrenQueryRunning) {
- root.refresh(refreshCallback);
- }
- else {
- refreshCallback.done(this, Status.OK_STATUS);
- }
- }};
- pollingTimer.schedule(pollingTask, interval * 1000L);
- }
-
- /**
- * Set new interval.
- *
- * @param interval The new interval.
- */
- public void setInterval(int interval) {
- Assert.isTrue(interval >= 0);
- if (this.interval != interval) {
- if(this.interval == 0) {
- this.interval = interval;
- startPolling();
- } else {
- this.interval = interval;
- if(interval == 0) {
- stopPolling();
- }
- }
- }
- }
-
- /**
- * Get the current interval.
- *
- * @return the current interval.
- */
- public int getInterval() {
- return interval;
- }
-
- /**
- * If the polling has been stopped.
- *
- * @return true if it is stopped.
- */
- public boolean isRefreshStopped() {
- return stopped;
- }
-}
-
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/ProcessTreeNode.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/ProcessTreeNode.java
deleted file mode 100644
index 62c652918..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/ProcessTreeNode.java
+++ /dev/null
@@ -1,271 +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.processes.core.model;
-
-import java.beans.PropertyChangeEvent;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.services.IProcesses;
-import org.eclipse.tcf.services.IProcesses.ProcessContext;
-import org.eclipse.tcf.services.ISysMonitor;
-import org.eclipse.tcf.services.ISysMonitor.SysMonitorContext;
-import org.eclipse.tcf.te.core.interfaces.IFilterable;
-import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.tcf.core.Tcf;
-import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager.DoneOpenChannel;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.AbstractTreeNode;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.UserAccount;
-import org.eclipse.tcf.te.tcf.processes.core.callbacks.QueryDoneOpenChannel;
-import org.eclipse.tcf.te.tcf.processes.core.callbacks.RefreshChildrenDoneOpenChannel;
-import org.eclipse.tcf.te.tcf.processes.core.callbacks.RefreshDoneOpenChannel;
-
-/**
- * Representation of a process tree node.
- */
-public final class ProcessTreeNode extends AbstractTreeNode implements IFilterable {
- /**
- * The system monitor context object
- */
- public ISysMonitor.SysMonitorContext context;
-
- /**
- * The process context object
- */
- public IProcesses.ProcessContext pContext;
-
- /**
- * The internal process id
- */
- public String id = null;
-
- /**
- * The internal parent process id.
- */
- public String parentId = null;
-
- /**
- * The native process id.
- */
- public long pid = 0L;
-
- /**
- * The native parent process id.
- */
- public long ppid = 0L;
-
- /**
- * The process state
- */
- public String state = null;
-
- /**
- * The process owner/creator
- */
- public String username = null;
-
- /**
- * Create a pending node.
- */
- public ProcessTreeNode() {
- }
-
- /**
- * Create process node with its parent node and a context.
- *
- * @param parentNode The parent node.
- * @param aContext The system monitor context.
- */
- public ProcessTreeNode(ProcessTreeNode parentNode, ISysMonitor.SysMonitorContext aContext) {
- Assert.isTrue(Protocol.isDispatchThread());
- Assert.isNotNull(aContext);
- context = aContext;
- pContext = null;
- name = aContext.getFile();
- type = "ProcNode"; //$NON-NLS-1$
- id = aContext.getID();
- pid = aContext.getPID();
- ppid = aContext.getPPID();
- parentId = aContext.getParentID();
- state = aContext.getState();
- username = aContext.getUserName();
- parent = parentNode;
- peerNode = parentNode.peerNode;
- }
-
- /**
- * Create process node with its parent node and a process context.
- *
- * @param parentNode The parent node.
- * @param aContext The process context.
- */
- public ProcessTreeNode(ProcessTreeNode parentNode, ProcessContext aContext) {
- Assert.isTrue(Protocol.isDispatchThread());
- Assert.isNotNull(aContext);
- context = null;
- pContext = aContext;
- name = aContext.getName();
- type = "ProcNode"; //$NON-NLS-1$
- id = aContext.getID();
- if(id != null) {
- pid = parsePID(id);
- } else {
- pid = -1;
- }
- parentId = aContext.getParentID();
- if(parentId != null) {
- ppid = parsePID(parentId);
- } else {
- ppid = -1;
- }
- parent = parentNode;
- peerNode = parentNode.peerNode;
- }
-
- /**
- * Parse a process id from string to long.
- *
- * @param string The string expression of the process id.
- * @return a long process id or -1 if it is not able to be parsed.
- */
- private long parsePID(String string) {
- if(string.startsWith("P")) { //$NON-NLS-1$
- string = string.substring(1);
- }
- try {
- return Long.parseLong(string);
- } catch(NumberFormatException nfe) {
- return -1;
- }
- }
-
- /**
- * Get the children process list.
- *
- * @return The children process list.
- */
- @Override
- public List<ProcessTreeNode> getChildren() {
- return (List<ProcessTreeNode>) super.getChildren();
- }
-
- /**
- * Return if this node is a root node.
- *
- * @return true if it is a root node.
- */
- @Override
- public boolean isSystemRoot() {
- return type != null && type.equals("ProcRootNode"); //$NON-NLS-1$
- }
-
- /**
- * Update this process' data with a new system monitor context.
- *
- * @param aContext the new context.
- */
- public void updateSysMonitorContext(SysMonitorContext aContext) {
- Assert.isNotNull(aContext);
- SysMonitorContext oldContext = this.context;
- this.context = aContext;
- name = aContext.getFile();
- id = aContext.getID();
- pid = aContext.getPID();
- ppid = aContext.getPPID();
- parentId = aContext.getParentID();
- state = aContext.getState();
- username = aContext.getUserName();
- if (oldContext != aContext) {
- firePropertyChange(new PropertyChangeEvent(this, "context", oldContext, aContext)); //$NON-NLS-1$
- }
- }
-
- public boolean isAgentOwner() {
- UserAccount account = getUserAccount(peerNode);
- if (account != null && context != null) {
- return context.getUID() == account.getEUID();
- }
- return false;
- }
-
- /**
- * Update this process' data with a new system monitor context.
- *
- * @param aContext the new context.
- */
- public void updateProcessContext(ProcessContext aContext) {
- Assert.isNotNull(aContext);
- ProcessContext oldContext = this.pContext;
- this.pContext = aContext;
- name = aContext.getName();
- id = aContext.getID();
- parentId = aContext.getParentID();
- if (oldContext != aContext) {
- firePropertyChange(new PropertyChangeEvent(this, "pContext", oldContext, aContext)); //$NON-NLS-1$
- }
- }
-
- /**
- * Set the process context.
- *
- * @param pContext The process context.
- */
- public void setProcessContext(IProcesses.ProcessContext pContext) {
- IProcesses.ProcessContext oldContext = this.pContext;
- this.pContext = pContext;
- if (oldContext != pContext) {
- firePropertyChange(new PropertyChangeEvent(this, "pContext", oldContext, pContext)); //$NON-NLS-1$
- }
- }
-
- /**
- * Set the system monitor context and fire a property change event.
- */
- public void setSysMonitorContext(SysMonitorContext sContext) {
- SysMonitorContext oldContext = this.context;
- this.context = sContext;
- if (oldContext != sContext) {
- firePropertyChange(new PropertyChangeEvent(this, "sContext", oldContext, context)); //$NON-NLS-1$
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.filesystem.core.model.AbstractTreeNode#doCreateRefreshDoneOpenChannel(org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
- */
- @Override
- protected DoneOpenChannel doCreateRefreshDoneOpenChannel(ICallback callback) {
- return new RefreshDoneOpenChannel(this, callback);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.filesystem.core.model.AbstractTreeNode#doCreateQueryDoneOpenChannel()
- */
- @Override
- protected DoneOpenChannel doCreateQueryDoneOpenChannel(ICallback callback) {
- return new QueryDoneOpenChannel(this, callback);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.filesystem.core.model.AbstractTreeNode#getParent()
- */
- @Override
- public ProcessTreeNode getParent() {
- return (ProcessTreeNode) parent;
- }
-
- @Override
- public void refreshChildren() {
- Tcf.getChannelManager().openChannel(peerNode.getPeer(), null, new RefreshChildrenDoneOpenChannel(this));
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/interfaces/IProcessContextNode.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/interfaces/IProcessContextNode.java
index f504022f4..13cd5d500 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/interfaces/IProcessContextNode.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/interfaces/IProcessContextNode.java
@@ -20,7 +20,14 @@ public interface IProcessContextNode extends IContainerModelNode {
/**
* Process context node types
*/
- public enum TYPE { Root, Folder, File }
+ public enum TYPE { Process, Thread }
+
+ /**
+ * Set the type of the context node.
+ *
+ * @param type The context node type. Must not be <code>null</code>.
+ */
+ public void setType(TYPE type);
/**
* Returns the type of the context node.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/nodes/ProcessContextNode.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/nodes/ProcessContextNode.java
index 43c676337..a30e35aef 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/nodes/ProcessContextNode.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/nodes/ProcessContextNode.java
@@ -12,10 +12,13 @@ package org.eclipse.tcf.te.tcf.processes.core.model.nodes;
import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.services.IProcesses;
import org.eclipse.tcf.services.ISysMonitor;
import org.eclipse.tcf.services.ISysMonitor.SysMonitorContext;
+import org.eclipse.tcf.te.core.interfaces.IFilterable;
import org.eclipse.tcf.te.runtime.model.ContainerModelNode;
import org.eclipse.tcf.te.runtime.model.contexts.AsyncRefreshableCtxAdapter;
import org.eclipse.tcf.te.runtime.model.interfaces.contexts.IAsyncRefreshableCtx;
@@ -30,12 +33,15 @@ import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNod
/**
* A process context node implementation.
*/
-public class ProcessContextNode extends ContainerModelNode implements IProcessContextNode {
+public class ProcessContextNode extends ContainerModelNode implements IProcessContextNode, IPeerModelProvider, IFilterable {
// Reference to the agent side process context object
private IProcesses.ProcessContext pContext = null;
// Reference to the agent side system monitor context object
private ISysMonitor.SysMonitorContext sContext = null;
+ // The node type
+ private TYPE type = TYPE.Process;
+
// Context nodes needs asynchronous refreshes
private final IAsyncRefreshableCtx refreshableCtxAdapter = new AsyncRefreshableCtxAdapter();
@@ -65,8 +71,28 @@ public class ProcessContextNode extends ContainerModelNode implements IProcessCo
public String getName() {
Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$
// If the node is associated with an agent side context, take the name
- // from the agent side context
+ // from the agent side context first
String name = pContext != null ? pContext.getName() : null;
+
+ // If the name is empty or the same as the context ID -> reset
+ if (name != null && ("".equals(name.trim()) || name.equals(pContext.getID()))) { //$NON-NLS-1$
+ name = null;
+ }
+
+ // Take the last part of the image name if available
+ String file = sContext != null ? sContext.getFile() : null;
+ if (file != null && !"".equals(file)) { //$NON-NLS-1$
+ IPath path = new Path(file);
+ // If it is a typical Windows path with a drive letter, take only the
+ // last segment. In all other cases, take "file" as it is
+ if (path.getDevice() != null && path.getDevice().endsWith(":") && path.getDevice().length() == 2) { //$NON-NLS-1$
+ name = path.lastSegment();
+ } else {
+ name = file;
+ }
+ }
+
+ // Fallback to the context ID
if (name == null || "".equals(name.trim())) name = pContext != null ? pContext.getID() : null; //$NON-NLS-1$
// Fallback to the local node properties
@@ -77,11 +103,20 @@ public class ProcessContextNode extends ContainerModelNode implements IProcessCo
}
/* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode#setType(org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode.TYPE)
+ */
+ @Override
+ public void setType(TYPE type) {
+ Assert.isNotNull(type);
+ this.type = type;
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode#getType()
*/
@Override
public TYPE getType() {
- return null;
+ return type;
}
/* (non-Javadoc)
@@ -120,6 +155,14 @@ public class ProcessContextNode extends ContainerModelNode implements IProcessCo
return sContext;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider#getPeerModel()
+ */
+ @Override
+ public IPeerModel getPeerModel() {
+ return (IPeerModel)getAdapter(IPeerModel.class);
+ }
+
/* (non-Javadoc)
* @see org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode#isComplete()
*/
@@ -208,7 +251,9 @@ public class ProcessContextNode extends ContainerModelNode implements IProcessCo
public void run() {
StringBuilder buffer = new StringBuilder(toString.get());
buffer.deleteCharAt(buffer.length() - 1);
- buffer.append(", context properties="); //$NON-NLS-1$
+ buffer.append(", system monitor properties="); //$NON-NLS-1$
+ buffer.append(getSysMonitorContext() != null ? getSysMonitorContext().toString() : "{}"); //$NON-NLS-1$
+ buffer.append(", process properties="); //$NON-NLS-1$
buffer.append(getProcessContext() != null ? getProcessContext().toString() : "{}"); //$NON-NLS-1$
buffer.append("}"); //$NON-NLS-1$
toString.set(buffer.toString());
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/RuntimeModel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/RuntimeModel.java
index 32334ae66..01148671b 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/RuntimeModel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/RuntimeModel.java
@@ -15,6 +15,7 @@ import java.util.TimerTask;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.core.interfaces.IFilterable;
import org.eclipse.tcf.te.runtime.callback.Callback;
import org.eclipse.tcf.te.runtime.model.ContainerModelNode;
import org.eclipse.tcf.te.runtime.model.contexts.AsyncRefreshableCtxAdapter;
@@ -39,7 +40,7 @@ import org.eclipse.tcf.te.tcf.processes.core.model.runtime.services.RuntimeModel
/**
* Model implementation dealing with Processes at runtime.
*/
-public final class RuntimeModel extends ContainerModelNode implements IRuntimeModel {
+public final class RuntimeModel extends ContainerModelNode implements IRuntimeModel, IFilterable {
// Flag to mark the model disposed
private boolean disposed;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelRefreshService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelRefreshService.java
index b8010727e..af47e2f23 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelRefreshService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/runtime/services/RuntimeModelRefreshService.java
@@ -38,6 +38,7 @@ import org.eclipse.tcf.te.tcf.core.model.interfaces.services.IModelUpdateService
import org.eclipse.tcf.te.tcf.core.model.services.AbstractModelService;
import org.eclipse.tcf.te.tcf.processes.core.activator.CoreBundleActivator;
import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode.TYPE;
import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNodeProperties;
import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeModel;
@@ -206,7 +207,7 @@ public class RuntimeModelRefreshService extends AbstractModelService<IRuntimeMod
// Get the context instance for the current id
IProcessContextNode candidate = entry.getValue();
// Try to find an existing context node first
- IModelNode[] nodes = model.getService(IModelLookupService.class).lkupModelNodesById(candidate.getProcessContext().getID());
+ IModelNode[] nodes = model.getService(IModelLookupService.class).lkupModelNodesById(candidate.getStringProperty(IModelNode.PROPERTY_ID));
// If found, update the context node properties from the new one
if (nodes.length > 0) {
for (IModelNode node : nodes) {
@@ -245,29 +246,20 @@ public class RuntimeModelRefreshService extends AbstractModelService<IRuntimeMod
Assert.isNotNull(service);
final ISysMonitor sysMonService = channel.getRemoteService(ISysMonitor.class);
Assert.isNotNull(sysMonService);
- final String contextId = ((IProcessContextNode)node).getProcessContext().getID();
- service.getContext(contextId, new IProcesses.DoneGetContext() {
+ final String contextId = ((IProcessContextNode)node).getStringProperty(IModelNode.PROPERTY_ID);
+ sysMonService.getContext(contextId, new ISysMonitor.DoneGetContext() {
@Override
- public void doneGetContext(IToken token, Exception error, IProcesses.ProcessContext context) {
- if (error == null) {
- ((IProcessContextNode)node).setProcessContext(context);
-
- sysMonService.getContext(contextId, new ISysMonitor.DoneGetContext() {
- @Override
- public void doneGetContext(IToken token, Exception error, SysMonitorContext context) {
- if (error == null) {
- ((IProcessContextNode)node).setSysMonitorContext(context);
- callback.done(this, Status.OK_STATUS);
- }
- else {
- callback.done(RuntimeModelRefreshService.this, new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), error.getLocalizedMessage(), error));
- }
- }
- });
- }
- else {
- callback.done(RuntimeModelRefreshService.this, new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), error.getLocalizedMessage(), error));
- }
+ public void doneGetContext(IToken token, Exception error, SysMonitorContext context) {
+ ((IProcessContextNode)node).setSysMonitorContext(context);
+
+ // Get the process context
+ service.getContext(contextId, new IProcesses.DoneGetContext() {
+ @Override
+ public void doneGetContext(IToken token, Exception error, IProcesses.ProcessContext context) {
+ ((IProcessContextNode)node).setProcessContext(context);
+ callback.done(RuntimeModelRefreshService.this, Status.OK_STATUS);
+ }
+ });
}
});
} else {
@@ -303,67 +295,72 @@ public class RuntimeModelRefreshService extends AbstractModelService<IRuntimeMod
if (error == null) {
// Determine the parent context id
String parentContextId = null;
- if (parent != null && parent.getProcessContext() != null) parentContextId = parent.getProcessContext().getID();
+ if (parent != null && parent.getProcessContext() != null) parentContextId = parent.getStringProperty(IModelNode.PROPERTY_ID);
// Get the Systems service and query the configuration id's
final IProcesses service = channel.getRemoteService(IProcesses.class);
Assert.isNotNull(service);
final ISysMonitor sysMonService = channel.getRemoteService(ISysMonitor.class);
Assert.isNotNull(sysMonService);
- service.getChildren(parentContextId, false, new IProcesses.DoneGetChildren() {
+ sysMonService.getChildren(parentContextId, new ISysMonitor.DoneGetChildren() {
@Override
public void doneGetChildren(IToken token, Exception error, String[] context_ids) {
if (error == null) {
- final AsyncCallbackCollector collector = new AsyncCallbackCollector(new Callback() {
- @Override
- protected void internalDone(Object caller, IStatus status) {
- Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
- if (status.getSeverity() == IStatus.OK) {
- // Process the read system contexts
- if (!contexts.isEmpty()) processContexts(contexts, oldChildren, model, parent);
- callback.done(RuntimeModelRefreshService.this, Status.OK_STATUS);
- } else {
- callback.done(RuntimeModelRefreshService.this, new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), status.getMessage(), status.getException()));
- }
- }
- }, new CallbackInvocationDelegate());
-
- // Loop the returned context id's and query the context data
- for (String id : context_ids) {
- final String contextId = id;
- final ICallback innerCallback = new AsyncCallbackCollector.SimpleCollectorCallback(collector);
- service.getContext(contextId, new IProcesses.DoneGetContext() {
+ if (context_ids != null && context_ids.length > 0) {
+ final AsyncCallbackCollector collector = new AsyncCallbackCollector(new Callback() {
@Override
- public void doneGetContext(IToken token, Exception error, IProcesses.ProcessContext context) {
- if (error == null) {
- final IProcessContextNode node = createContextNodeFrom(context);
- Assert.isNotNull(node);
- contexts.put(node.getUUID(), node);
-
- final ICallback innerCallback2 = new AsyncCallbackCollector.SimpleCollectorCallback(collector);
- sysMonService.getContext(contextId, new ISysMonitor.DoneGetContext() {
- @Override
- public void doneGetContext(IToken token, Exception error, SysMonitorContext context) {
- if (error == null) {
- node.setSysMonitorContext(context);
- innerCallback2.done(RuntimeModelRefreshService.this, Status.OK_STATUS);
- }
- else {
- innerCallback2.done(RuntimeModelRefreshService.this, new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), error.getLocalizedMessage(), error));
- }
- }
- });
-
- innerCallback.done(RuntimeModelRefreshService.this, Status.OK_STATUS);
- }
- else {
- innerCallback.done(RuntimeModelRefreshService.this, new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), error.getLocalizedMessage(), error));
+ protected void internalDone(Object caller, IStatus status) {
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
+ if (status.getSeverity() == IStatus.OK) {
+ // Process the read process contexts
+ if (!contexts.isEmpty()) processContexts(contexts, oldChildren, model, parent);
+ callback.done(RuntimeModelRefreshService.this, Status.OK_STATUS);
+ } else {
+ callback.done(RuntimeModelRefreshService.this, new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), status.getMessage(), status.getException()));
}
}
- });
- }
+ }, new CallbackInvocationDelegate());
+
+ // Loop the returned context id's and query the context data
+ for (String id : context_ids) {
+ final String contextId = id;
+ final ICallback innerCallback = new AsyncCallbackCollector.SimpleCollectorCallback(collector);
+ sysMonService.getContext(contextId, new ISysMonitor.DoneGetContext() {
+ @Override
+ public void doneGetContext(IToken token, Exception error, SysMonitorContext context) {
+ // Ignore errors. Some of the context might be OS context we do not have
+ // permissions to read the properties from.
+ if (context != null) {
+ final IProcessContextNode node = createContextNodeFrom(context);
+ Assert.isNotNull(node);
+ node.setType(parent == null ? TYPE.Process : TYPE.Thread);
+ contexts.put(node.getUUID(), node);
+
+ // Query the corresponding process context
+ service.getContext(contextId, new IProcesses.DoneGetContext() {
+ @Override
+ public void doneGetContext(IToken token, Exception error, IProcesses.ProcessContext context) {
+ // Errors are ignored
+ node.setProcessContext(context);
+ if (context != null) node.setProperty(IProcessContextNodeProperties.PROPERTY_NAME, context.getName());
+
+ // Refresh the children of the node
+// List<IProcessContextNode> oldChildren = node.getChildren(IProcessContextNode.class);
+// refreshContextChildren(oldChildren, model, node, innerCallback);
+ innerCallback.done(RuntimeModelRefreshService.this, Status.OK_STATUS);
+ }
+ });
+ } else {
+ innerCallback.done(RuntimeModelRefreshService.this, Status.OK_STATUS);
+ }
+ }
+ });
+ }
- collector.initDone();
+ collector.initDone();
+ } else {
+ callback.done(RuntimeModelRefreshService.this, Status.OK_STATUS);
+ }
} else {
callback.done(RuntimeModelRefreshService.this, new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), error.getLocalizedMessage(), error));
}
@@ -383,19 +380,18 @@ public class RuntimeModelRefreshService extends AbstractModelService<IRuntimeMod
/**
* Create a context node instance from the given process context.
*
- * @param context The process context. Must not be <code>null</code>.
+ * @param context The system monitor context. Must not be <code>null</code>.
* @return The context node instance.
*/
- public IProcessContextNode createContextNodeFrom(IProcesses.ProcessContext context) {
+ public IProcessContextNode createContextNodeFrom(SysMonitorContext context) {
Assert.isNotNull(context);
// Create a context node and associate the given context
IProcessContextNode node = getModel().getFactory().newInstance(IProcessContextNode.class);
- node.setProcessContext(context);
+ node.setSysMonitorContext(context);
// Re-create the context properties from the context
node.setProperty(IProcessContextNodeProperties.PROPERTY_ID, context.getID());
- node.setProperty(IProcessContextNodeProperties.PROPERTY_NAME, context.getName());
return node;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/steps/AttachStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/steps/AttachStep.java
index 861c999f6..5edb56ebe 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/steps/AttachStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/steps/AttachStep.java
@@ -1,213 +1,207 @@
-/*******************************************************************************
- * Copyright (c) 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.processes.core.model.steps;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.tcf.protocol.IChannel;
-import org.eclipse.tcf.protocol.IToken;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.services.IProcesses;
-import org.eclipse.tcf.services.IProcesses.ProcessContext;
-import org.eclipse.tcf.services.ISysMonitor;
-import org.eclipse.tcf.services.ISysMonitor.SysMonitorContext;
-import org.eclipse.tcf.te.runtime.callback.Callback;
-import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IDebugService;
-import org.eclipse.tcf.te.runtime.statushandler.StatusHandlerManager;
-import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandler;
-import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandlerConstants;
-import org.eclipse.tcf.te.tcf.core.Tcf;
-import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
-import org.eclipse.tcf.te.tcf.processes.core.activator.CoreBundleActivator;
-import org.eclipse.tcf.te.tcf.processes.core.interfaces.IContextHelpIds;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.core.nls.Messages;
-
-/**
- * Process attach step implementation.
- */
-public class AttachStep {
-
- /**
- * Attach to the given process context.
- * <p>
- * <b>Note:</b> This method must be called from within the TCF dispatch thread.
- *
- * @param node The context. Must not be <code>null</code>.
- * @param callback The callback to invoke once the operation completed, or<code>null</code>.
- */
- public void executeAttach(final ProcessTreeNode node, final ICallback callback) {
- Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
- Assert.isNotNull(node);
-
- // If the context is already attached, there is nothing to do
- if (node.pContext != null && !node.pContext.isAttached()) {
- if (node.peerNode != null) {
- // Determine the debug service to attach to the peer node
- IDebugService dbgService = ServiceManager.getInstance().getService(node.peerNode, IDebugService.class, false);
- if (dbgService != null) {
- // Attach to the peer node first
- dbgService.attach(node.peerNode, new PropertiesContainer(), new Callback() {
- @Override
- protected void internalDone(Object caller, IStatus status) {
- callback.setProperty("launch", getProperty("launch")); //$NON-NLS-1$ //$NON-NLS-2$
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- doAttach(node, callback);
- }
- };
- if (Protocol.isDispatchThread()) runnable.run();
- else Protocol.invokeLater(runnable);
- }
- });
- } else {
- doAttach(node, callback);
- }
- } else {
- onError(node, Messages.AttachStep_error_connect, null, callback);
- }
- } else {
- if (node.pContext == null) {
- onError(node, Messages.AttachStep_error_connect, null, callback);
- } else {
- onDone(callback);
- }
- }
- }
-
- /**
- * Opens a channel and perform the attach to the given context node.
- * <p>
- * <b>Note:</b> This method must be called from within the TCF dispatch thread.
- *
- * @param model The runtime model instance. Must not be <code>null</code>.
- * @param node The context node. Must not be <code>null</code>.
- * @param callback The callback to invoke once the operation completed, or<code>null</code>.
- */
- protected void doAttach(final ProcessTreeNode node, final ICallback callback) {
- Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
- Assert.isNotNull(node);
-
- // Open a channel
- Tcf.getChannelManager().openChannel(node.peerNode.getPeer(), null, new IChannelManager.DoneOpenChannel() {
- @Override
- public void doneOpenChannel(final Throwable error, final IChannel channel) {
- if (error == null) {
- final IProcesses service = channel.getRemoteService(IProcesses.class);
- if (service != null) {
- service.getContext(node.pContext.getID(), new IProcesses.DoneGetContext() {
- @Override
- public void doneGetContext(IToken token, Exception error, ProcessContext context) {
- if (error == null && context != null) {
- context.attach(new IProcesses.DoneCommand() {
- @Override
- public void doneCommand(IToken token, Exception error) {
- if (error == null) {
- // We are attached now, trigger a refresh of the node
- ISysMonitor monService = channel.getRemoteService(ISysMonitor.class);
- if (monService != null) {
- monService.getContext(node.id, new ISysMonitor.DoneGetContext() {
- @Override
- public void doneGetContext(IToken token, Exception error, SysMonitorContext context) {
- node.updateSysMonitorContext(context);
-
- service.getContext(node.pContext.getID(), new IProcesses.DoneGetContext() {
- @Override
- public void doneGetContext(IToken token, Exception error, ProcessContext context) {
- node.setProcessContext(context);
- onDone(callback);
- }
- });
- }
- });
- } else {
- onDone(callback);
- }
- } else {
- onError(node, Messages.AttachStep_error_attach, error, callback);
- }
- }
- });
- } else {
- onError(node, Messages.AttachStep_error_getContext, error, callback);
- }
- }
- });
- } else {
- onError(node, Messages.AttachStep_error_connect, null, callback);
- }
- } else {
- onError(node, Messages.AttachStep_error_openChannel, error, callback);
- }
- }
- });
- }
-
- /**
- * Error handler. Called if a step failed.
- *
- * @param channel The channel or <code>null</code>.
- * @param context The status handler context. Must not be <code>null</code>:
- * @param message The message or <code>null</code>.
- * @param error The error or <code>null</code>.
- * @param callback The callback or <code>null</code>.
- */
- protected void onError(Object context, String message, Throwable error, ICallback callback) {
- Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
-
- String detailMessage = error != null ? error.getMessage() : null;
- if (detailMessage != null && detailMessage.contains("\n")) { //$NON-NLS-1$
- detailMessage = detailMessage.replaceAll("\n", ", "); //$NON-NLS-1$ //$NON-NLS-2$
- detailMessage = detailMessage.replaceAll(":, ", ": "); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- String fullMessage = message;
- if (fullMessage != null) fullMessage = NLS.bind(fullMessage, detailMessage != null ? detailMessage : ""); //$NON-NLS-1$
- else fullMessage = detailMessage;
-
- if (fullMessage != null) {
- IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), fullMessage, error);
-
- if (callback == null) {
- IStatusHandler[] handlers = StatusHandlerManager.getInstance().getHandler(context);
- if (handlers.length > 0) {
- IPropertiesContainer data = new PropertiesContainer();
- data.setProperty(IStatusHandlerConstants.PROPERTY_TITLE, Messages.AttachStep_error_title);
- data.setProperty(IStatusHandlerConstants.PROPERTY_CONTEXT_HELP_ID, IContextHelpIds.MESSAGE_ATTACH_FAILED);
- data.setProperty(IStatusHandlerConstants.PROPERTY_CALLER, this);
-
- handlers[0].handleStatus(status, data, null);
- } else {
- CoreBundleActivator.getDefault().getLog().log(status);
- }
- }
- else {
- callback.done(this, status);
- }
- }
- }
-
- /**
- * Done handler. Called if all necessary steps are completed.
- *
- * @param callback The callback to invoke or <code>null</code>
- */
- protected void onDone(ICallback callback) {
- Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
- if (callback != null) callback.done(this, Status.OK_STATUS);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 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.processes.core.model.steps;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.IProcesses;
+import org.eclipse.tcf.services.IProcesses.ProcessContext;
+import org.eclipse.tcf.te.runtime.callback.Callback;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
+import org.eclipse.tcf.te.runtime.services.ServiceManager;
+import org.eclipse.tcf.te.runtime.services.interfaces.IDebugService;
+import org.eclipse.tcf.te.runtime.statushandler.StatusHandlerManager;
+import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandler;
+import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandlerConstants;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
+import org.eclipse.tcf.te.tcf.core.model.interfaces.IModel;
+import org.eclipse.tcf.te.tcf.core.model.interfaces.services.IModelRefreshService;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.processes.core.activator.CoreBundleActivator;
+import org.eclipse.tcf.te.tcf.processes.core.interfaces.IContextHelpIds;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.core.nls.Messages;
+
+/**
+ * Process attach step implementation.
+ */
+public class AttachStep {
+
+ /**
+ * Attach to the given process context.
+ * <p>
+ * <b>Note:</b> This method must be called from within the TCF dispatch thread.
+ *
+ * @param node The context. Must not be <code>null</code>.
+ * @param callback The callback to invoke once the operation completed, or<code>null</code>.
+ */
+ public void executeAttach(final IProcessContextNode node, final ICallback callback) {
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
+ Assert.isNotNull(node);
+
+ // If the context is already attached, there is nothing to do
+ if (node.getProcessContext() != null && !node.getProcessContext().isAttached()) {
+ IPeerModel peerNode = (IPeerModel)node.getAdapter(IPeerModel.class);
+ if (peerNode != null) {
+ // Determine the debug service to attach to the peer node
+ IDebugService dbgService = ServiceManager.getInstance().getService(peerNode, IDebugService.class, false);
+ if (dbgService != null) {
+ // Attach to the peer node first
+ dbgService.attach(peerNode, new PropertiesContainer(), new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ callback.setProperty("launch", getProperty("launch")); //$NON-NLS-1$ //$NON-NLS-2$
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ doAttach(node, callback);
+ }
+ };
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeLater(runnable);
+ }
+ });
+ } else {
+ doAttach(node, callback);
+ }
+ } else {
+ onError(node, Messages.AttachStep_error_connect, null, callback);
+ }
+ } else {
+ if (node.getProcessContext() == null) {
+ onError(node, Messages.AttachStep_error_connect, null, callback);
+ } else {
+ onDone(callback);
+ }
+ }
+ }
+
+ /**
+ * Opens a channel and perform the attach to the given context node.
+ * <p>
+ * <b>Note:</b> This method must be called from within the TCF dispatch thread.
+ *
+ * @param node The context node. Must not be <code>null</code>.
+ * @param callback The callback to invoke once the operation completed, or<code>null</code>.
+ */
+ protected void doAttach(final IProcessContextNode node, final ICallback callback) {
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
+ Assert.isNotNull(node);
+
+ // Determine the peer model node
+ final IPeerModel peerNode = (IPeerModel)node.getAdapter(IPeerModel.class);
+
+ // Open a channel
+ Tcf.getChannelManager().openChannel(peerNode.getPeer(), null, new IChannelManager.DoneOpenChannel() {
+ @Override
+ public void doneOpenChannel(final Throwable error, final IChannel channel) {
+ if (error == null) {
+ final IProcesses service = channel.getRemoteService(IProcesses.class);
+ if (service != null) {
+ service.getContext(node.getStringProperty(IModelNode.PROPERTY_ID), new IProcesses.DoneGetContext() {
+ @Override
+ public void doneGetContext(IToken token, Exception error, ProcessContext context) {
+ if (error == null && context != null) {
+ context.attach(new IProcesses.DoneCommand() {
+ @Override
+ public void doneCommand(IToken token, Exception error) {
+ if (error == null) {
+ // We are attached now, trigger a refresh of the node
+ IModel model = node.getParent(IModel.class);
+ Assert.isNotNull(model);
+ model.getService(IModelRefreshService.class).refresh(node, new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ onDone(callback);
+ }
+ });
+ } else {
+ onError(node, Messages.AttachStep_error_attach, error, callback);
+ }
+ }
+ });
+ } else {
+ onError(node, Messages.AttachStep_error_getContext, error, callback);
+ }
+ }
+ });
+ } else {
+ onError(node, Messages.AttachStep_error_connect, null, callback);
+ }
+ } else {
+ onError(node, Messages.AttachStep_error_openChannel, error, callback);
+ }
+ }
+ });
+ }
+
+ /**
+ * Error handler. Called if a step failed.
+ *
+ * @param channel The channel or <code>null</code>.
+ * @param context The status handler context. Must not be <code>null</code>:
+ * @param message The message or <code>null</code>.
+ * @param error The error or <code>null</code>.
+ * @param callback The callback or <code>null</code>.
+ */
+ protected void onError(Object context, String message, Throwable error, ICallback callback) {
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
+
+ String detailMessage = error != null ? error.getMessage() : null;
+ if (detailMessage != null && detailMessage.contains("\n")) { //$NON-NLS-1$
+ detailMessage = detailMessage.replaceAll("\n", ", "); //$NON-NLS-1$ //$NON-NLS-2$
+ detailMessage = detailMessage.replaceAll(":, ", ": "); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ String fullMessage = message;
+ if (fullMessage != null) fullMessage = NLS.bind(fullMessage, detailMessage != null ? detailMessage : ""); //$NON-NLS-1$
+ else fullMessage = detailMessage;
+
+ if (fullMessage != null) {
+ IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), fullMessage, error);
+
+ if (callback == null) {
+ IStatusHandler[] handlers = StatusHandlerManager.getInstance().getHandler(context);
+ if (handlers.length > 0) {
+ IPropertiesContainer data = new PropertiesContainer();
+ data.setProperty(IStatusHandlerConstants.PROPERTY_TITLE, Messages.AttachStep_error_title);
+ data.setProperty(IStatusHandlerConstants.PROPERTY_CONTEXT_HELP_ID, IContextHelpIds.MESSAGE_ATTACH_FAILED);
+ data.setProperty(IStatusHandlerConstants.PROPERTY_CALLER, this);
+
+ handlers[0].handleStatus(status, data, null);
+ } else {
+ CoreBundleActivator.getDefault().getLog().log(status);
+ }
+ }
+ else {
+ callback.done(this, status);
+ }
+ }
+ }
+
+ /**
+ * Done handler. Called if all necessary steps are completed.
+ *
+ * @param callback The callback to invoke or <code>null</code>
+ */
+ protected void onDone(ICallback callback) {
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
+ if (callback != null) callback.done(this, Status.OK_STATUS);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/steps/DetachStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/steps/DetachStep.java
index c0ff38999..3d43b7a1a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/steps/DetachStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/steps/DetachStep.java
@@ -1,190 +1,186 @@
-/*******************************************************************************
- * Copyright (c) 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.processes.core.model.steps;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.tcf.protocol.IChannel;
-import org.eclipse.tcf.protocol.IToken;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.services.IProcesses;
-import org.eclipse.tcf.services.IProcesses.ProcessContext;
-import org.eclipse.tcf.services.ISysMonitor;
-import org.eclipse.tcf.services.ISysMonitor.SysMonitorContext;
-import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
-import org.eclipse.tcf.te.runtime.statushandler.StatusHandlerManager;
-import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandler;
-import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandlerConstants;
-import org.eclipse.tcf.te.tcf.core.Tcf;
-import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
-import org.eclipse.tcf.te.tcf.processes.core.activator.CoreBundleActivator;
-import org.eclipse.tcf.te.tcf.processes.core.interfaces.IContextHelpIds;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.core.nls.Messages;
-
-/**
- * Process context detach step implementation.
- */
-public class DetachStep {
-
- /**
- * Detach from the given process context.
- * <p>
- * <b>Note:</b> This method must be called from within the TCF dispatch thread.
- *
- * @param node The context node. Must not be <code>null</code>.
- * @param callback The callback to invoke once the operation completed, or <code>null</code>.
- */
- public void executeDetach(final ProcessTreeNode node, final ICallback callback) {
- Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
- Assert.isNotNull(node);
-
- // If the context is not attached, there is nothing to do
- if (node.pContext != null && node.pContext.isAttached()) {
- if (node.peerNode != null) {
- doDetach(node, callback);
- } else {
- onError(node, Messages.DetachStep_error_disconnect, null, callback);
- }
- } else {
- if (node.pContext == null) {
- onError(node, Messages.DetachStep_error_disconnect, null, callback);
- } else {
- onDone(callback);
- }
- }
- }
-
- /**
- * Opens a channel and perform the detach to the given context node.
- * <p>
- * <b>Note:</b> This method must be called from within the TCF dispatch thread.
- *
- * @param model The runtime model instance. Must not be <code>null</code>.
- * @param node The context node. Must not be <code>null</code>.
- * @param callback The callback to invoke once the operation completed, or<code>null</code>.
- */
- protected void doDetach(final ProcessTreeNode node, final ICallback callback) {
- Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
- Assert.isNotNull(node);
-
- // Open a channel
- Tcf.getChannelManager().openChannel(node.peerNode.getPeer(), null, new IChannelManager.DoneOpenChannel() {
- @Override
- public void doneOpenChannel(final Throwable error, final IChannel channel) {
- if (error == null) {
- final IProcesses service = channel.getRemoteService(IProcesses.class);
- if (service != null) {
- service.getContext(node.pContext.getID(), new IProcesses.DoneGetContext() {
- @Override
- public void doneGetContext(IToken token, Exception error, ProcessContext context) {
- if (error == null && context != null) {
- context.detach(new IProcesses.DoneCommand() {
- @Override
- public void doneCommand(IToken token, Exception error) {
- if (error == null) {
- // We are detached now, trigger a refresh of the node
- ISysMonitor monService = channel.getRemoteService(ISysMonitor.class);
- if (monService != null) {
- monService.getContext(node.id, new ISysMonitor.DoneGetContext() {
- @Override
- public void doneGetContext(IToken token, Exception error, SysMonitorContext context) {
- node.updateSysMonitorContext(context);
-
- service.getContext(node.pContext.getID(), new IProcesses.DoneGetContext() {
- @Override
- public void doneGetContext(IToken token, Exception error, ProcessContext context) {
- node.setProcessContext(context);
- onDone(callback);
- }
- });
- }
- });
- } else {
- onDone(callback);
- }
- } else {
- onError(node, Messages.DetachStep_error_detach, error, callback);
- }
- }
- });
- } else {
- onError(node, Messages.DetachStep_error_getContext, error, callback);
- }
- }
- });
- } else {
- onError(node, Messages.DetachStep_error_disconnect, null, callback);
- }
- } else {
- onError(node, Messages.DetachStep_error_openChannel, error, callback);
- }
- }
- });
- }
-
- /**
- * Error handler. Called if a step failed.
- *
- * @param channel The channel or <code>null</code>.
- * @param context The status handler context. Must not be <code>null</code>:
- * @param message The message or <code>null</code>.
- * @param error The error or <code>null</code>.
- * @param callback The callback or <code>null</code>.
- */
- protected void onError(Object context, String message, Throwable error, ICallback callback) {
- Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
-
- String detailMessage = error != null ? error.getMessage() : null;
- if (detailMessage != null && detailMessage.contains("\n")) { //$NON-NLS-1$
- detailMessage = detailMessage.replaceAll("\n", ", "); //$NON-NLS-1$ //$NON-NLS-2$
- detailMessage = detailMessage.replaceAll(":, ", ": "); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- String fullMessage = message;
- if (fullMessage != null) fullMessage = NLS.bind(fullMessage, detailMessage != null ? detailMessage : ""); //$NON-NLS-1$
- else fullMessage = detailMessage;
-
- if (fullMessage != null) {
- IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), fullMessage, error);
-
- if (callback == null) {
- IStatusHandler[] handlers = StatusHandlerManager.getInstance().getHandler(context);
- if (handlers.length > 0) {
- IPropertiesContainer data = new PropertiesContainer();
- data.setProperty(IStatusHandlerConstants.PROPERTY_TITLE, Messages.DetachStep_error_title);
- data.setProperty(IStatusHandlerConstants.PROPERTY_CONTEXT_HELP_ID, IContextHelpIds.MESSAGE_DETACH_FAILED);
- data.setProperty(IStatusHandlerConstants.PROPERTY_CALLER, this);
-
- handlers[0].handleStatus(status, data, null);
- } else {
- CoreBundleActivator.getDefault().getLog().log(status);
- }
- }
- else {
- callback.done(this, status);
- }
- }
- }
-
- /**
- * Done handler. Called if all necessary steps are completed.
- *
- * @param callback The callback to invoke or <code>null</code>
- */
- protected void onDone(ICallback callback) {
- Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
- if (callback != null) callback.done(this, Status.OK_STATUS);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 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.processes.core.model.steps;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.IProcesses;
+import org.eclipse.tcf.services.IProcesses.ProcessContext;
+import org.eclipse.tcf.te.runtime.callback.Callback;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
+import org.eclipse.tcf.te.runtime.statushandler.StatusHandlerManager;
+import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandler;
+import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandlerConstants;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
+import org.eclipse.tcf.te.tcf.core.model.interfaces.IModel;
+import org.eclipse.tcf.te.tcf.core.model.interfaces.services.IModelRefreshService;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.processes.core.activator.CoreBundleActivator;
+import org.eclipse.tcf.te.tcf.processes.core.interfaces.IContextHelpIds;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.core.nls.Messages;
+
+/**
+ * Process context detach step implementation.
+ */
+public class DetachStep {
+
+ /**
+ * Detach from the given process context.
+ * <p>
+ * <b>Note:</b> This method must be called from within the TCF dispatch thread.
+ *
+ * @param node The context node. Must not be <code>null</code>.
+ * @param callback The callback to invoke once the operation completed, or <code>null</code>.
+ */
+ public void executeDetach(final IProcessContextNode node, final ICallback callback) {
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
+ Assert.isNotNull(node);
+
+ // If the context is not attached, there is nothing to do
+ if (node.getProcessContext() != null && node.getProcessContext().isAttached()) {
+ IPeerModel peerNode = (IPeerModel)node.getAdapter(IPeerModel.class);
+ if (peerNode != null) {
+ doDetach(node, callback);
+ } else {
+ onError(node, Messages.DetachStep_error_disconnect, null, callback);
+ }
+ } else {
+ if (node.getProcessContext() == null) {
+ onError(node, Messages.DetachStep_error_disconnect, null, callback);
+ } else {
+ onDone(callback);
+ }
+ }
+ }
+
+ /**
+ * Opens a channel and perform the detach to the given context node.
+ * <p>
+ * <b>Note:</b> This method must be called from within the TCF dispatch thread.
+ *
+ * @param model The runtime model instance. Must not be <code>null</code>.
+ * @param node The context node. Must not be <code>null</code>.
+ * @param callback The callback to invoke once the operation completed, or<code>null</code>.
+ */
+ protected void doDetach(final IProcessContextNode node, final ICallback callback) {
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
+ Assert.isNotNull(node);
+
+ // Determine the peer model node
+ final IPeerModel peerNode = (IPeerModel)node.getAdapter(IPeerModel.class);
+
+ // Open a channel
+ Tcf.getChannelManager().openChannel(peerNode.getPeer(), null, new IChannelManager.DoneOpenChannel() {
+ @Override
+ public void doneOpenChannel(final Throwable error, final IChannel channel) {
+ if (error == null) {
+ final IProcesses service = channel.getRemoteService(IProcesses.class);
+ if (service != null) {
+ service.getContext(node.getStringProperty(IModelNode.PROPERTY_ID), new IProcesses.DoneGetContext() {
+ @Override
+ public void doneGetContext(IToken token, Exception error, ProcessContext context) {
+ if (error == null && context != null) {
+ context.detach(new IProcesses.DoneCommand() {
+ @Override
+ public void doneCommand(IToken token, Exception error) {
+ if (error == null) {
+ // We are detached now, trigger a refresh of the node
+ IModel model = node.getParent(IModel.class);
+ Assert.isNotNull(model);
+ model.getService(IModelRefreshService.class).refresh(node, new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ onDone(callback);
+ }
+ });
+ } else {
+ onError(node, Messages.DetachStep_error_detach, error, callback);
+ }
+ }
+ });
+ } else {
+ onError(node, Messages.DetachStep_error_getContext, error, callback);
+ }
+ }
+ });
+ } else {
+ onError(node, Messages.DetachStep_error_disconnect, null, callback);
+ }
+ } else {
+ onError(node, Messages.DetachStep_error_openChannel, error, callback);
+ }
+ }
+ });
+ }
+
+ /**
+ * Error handler. Called if a step failed.
+ *
+ * @param channel The channel or <code>null</code>.
+ * @param context The status handler context. Must not be <code>null</code>:
+ * @param message The message or <code>null</code>.
+ * @param error The error or <code>null</code>.
+ * @param callback The callback or <code>null</code>.
+ */
+ protected void onError(Object context, String message, Throwable error, ICallback callback) {
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
+
+ String detailMessage = error != null ? error.getMessage() : null;
+ if (detailMessage != null && detailMessage.contains("\n")) { //$NON-NLS-1$
+ detailMessage = detailMessage.replaceAll("\n", ", "); //$NON-NLS-1$ //$NON-NLS-2$
+ detailMessage = detailMessage.replaceAll(":, ", ": "); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ String fullMessage = message;
+ if (fullMessage != null) fullMessage = NLS.bind(fullMessage, detailMessage != null ? detailMessage : ""); //$NON-NLS-1$
+ else fullMessage = detailMessage;
+
+ if (fullMessage != null) {
+ IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), fullMessage, error);
+
+ if (callback == null) {
+ IStatusHandler[] handlers = StatusHandlerManager.getInstance().getHandler(context);
+ if (handlers.length > 0) {
+ IPropertiesContainer data = new PropertiesContainer();
+ data.setProperty(IStatusHandlerConstants.PROPERTY_TITLE, Messages.DetachStep_error_title);
+ data.setProperty(IStatusHandlerConstants.PROPERTY_CONTEXT_HELP_ID, IContextHelpIds.MESSAGE_DETACH_FAILED);
+ data.setProperty(IStatusHandlerConstants.PROPERTY_CALLER, this);
+
+ handlers[0].handleStatus(status, data, null);
+ } else {
+ CoreBundleActivator.getDefault().getLog().log(status);
+ }
+ }
+ else {
+ callback.done(this, status);
+ }
+ }
+ }
+
+ /**
+ * Done handler. Called if all necessary steps are completed.
+ *
+ * @param callback The callback to invoke or <code>null</code>
+ */
+ protected void onDone(ICallback callback) {
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
+ if (callback != null) callback.done(this, Status.OK_STATUS);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/steps/TerminateStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/steps/TerminateStep.java
index dad06d2e7..c3534d7ff 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/steps/TerminateStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/steps/TerminateStep.java
@@ -1,167 +1,172 @@
-/*******************************************************************************
- * Copyright (c) 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.processes.core.model.steps;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.tcf.protocol.IChannel;
-import org.eclipse.tcf.protocol.IToken;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.services.IProcesses;
-import org.eclipse.tcf.services.IProcesses.ProcessContext;
-import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
-import org.eclipse.tcf.te.runtime.statushandler.StatusHandlerManager;
-import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandler;
-import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandlerConstants;
-import org.eclipse.tcf.te.tcf.core.Tcf;
-import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
-import org.eclipse.tcf.te.tcf.processes.core.activator.CoreBundleActivator;
-import org.eclipse.tcf.te.tcf.processes.core.interfaces.IContextHelpIds;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.core.nls.Messages;
-
-/**
- * Process context terminate step implementation.
- */
-public class TerminateStep {
-
- /**
- * Terminate from the given process context.
- * <p>
- * <b>Note:</b> This method must be called from within the TCF dispatch thread.
- *
- * @param node The context node. Must not be <code>null</code>.
- * @param callback The callback to invoke once the operation completed, or <code>null</code>.
- */
- public void executeTerminate(final ProcessTreeNode node, final ICallback callback) {
- Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
- Assert.isNotNull(node);
-
- // If the context is not attached, there is nothing to do
- if (node.pContext != null) {
- if (node.peerNode != null) {
- doTerminate(node, callback);
- } else {
- onError(node, Messages.DetachStep_error_disconnect, null, callback);
- }
- }
- else {
- onError(node, Messages.DetachStep_error_disconnect, null, callback);
- }
- }
-
- /**
- * Opens a channel and perform the terminate to the given context node.
- * <p>
- * <b>Note:</b> This method must be called from within the TCF dispatch thread.
- *
- * @param model The runtime model instance. Must not be <code>null</code>.
- * @param node The context node. Must not be <code>null</code>.
- * @param callback The callback to invoke once the operation completed, or<code>null</code>.
- */
- protected void doTerminate(final ProcessTreeNode node, final ICallback callback) {
- Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
- Assert.isNotNull(node);
-
- // Open a channel
- Tcf.getChannelManager().openChannel(node.peerNode.getPeer(), null, new IChannelManager.DoneOpenChannel() {
- @Override
- public void doneOpenChannel(final Throwable error, final IChannel channel) {
- if (error == null) {
- final IProcesses service = channel.getRemoteService(IProcesses.class);
- if (service != null) {
- service.getContext(node.pContext.getID(), new IProcesses.DoneGetContext() {
- @Override
- public void doneGetContext(IToken token, Exception error, ProcessContext context) {
- if (error == null && context != null) {
- context.terminate(new IProcesses.DoneCommand() {
- @Override
- public void doneCommand(IToken token, Exception error) {
- if (error == null) {
- // We are terminated now, trigger a refresh of the node
- onDone(callback);
- } else {
- onError(node, Messages.DetachStep_error_detach, error, callback);
- }
- }
- });
- } else {
- onError(node, Messages.DetachStep_error_getContext, error, callback);
- }
- }
- });
- } else {
- onError(node, Messages.DetachStep_error_disconnect, null, callback);
- }
- } else {
- onError(node, Messages.DetachStep_error_openChannel, error, callback);
- }
- }
- });
- }
-
- /**
- * Error handler. Called if a step failed.
- *
- * @param channel The channel or <code>null</code>.
- * @param context The status handler context. Must not be <code>null</code>:
- * @param message The message or <code>null</code>.
- * @param error The error or <code>null</code>.
- * @param callback The callback or <code>null</code>.
- */
- protected void onError(Object context, String message, Throwable error, ICallback callback) {
- Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
-
- String detailMessage = error != null ? error.getMessage() : null;
- if (detailMessage != null && detailMessage.contains("\n")) { //$NON-NLS-1$
- detailMessage = detailMessage.replaceAll("\n", ", "); //$NON-NLS-1$ //$NON-NLS-2$
- detailMessage = detailMessage.replaceAll(":, ", ": "); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- String fullMessage = message;
- if (fullMessage != null) fullMessage = NLS.bind(fullMessage, detailMessage != null ? detailMessage : ""); //$NON-NLS-1$
- else fullMessage = detailMessage;
-
- if (fullMessage != null) {
- IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), fullMessage, error);
-
- if (callback == null) {
- IStatusHandler[] handlers = StatusHandlerManager.getInstance().getHandler(context);
- if (handlers.length > 0) {
- IPropertiesContainer data = new PropertiesContainer();
- data.setProperty(IStatusHandlerConstants.PROPERTY_TITLE, Messages.DetachStep_error_title);
- data.setProperty(IStatusHandlerConstants.PROPERTY_CONTEXT_HELP_ID, IContextHelpIds.MESSAGE_DETACH_FAILED);
- data.setProperty(IStatusHandlerConstants.PROPERTY_CALLER, this);
-
- handlers[0].handleStatus(status, data, null);
- } else {
- CoreBundleActivator.getDefault().getLog().log(status);
- }
- }
- else {
- callback.done(this, status);
- }
- }
- }
-
- /**
- * Done handler. Called if all necessary steps are completed.
- *
- * @param callback The callback to invoke or <code>null</code>
- */
- protected void onDone(ICallback callback) {
- Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
- if (callback != null) callback.done(this, Status.OK_STATUS);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 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.processes.core.model.steps;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.IProcesses;
+import org.eclipse.tcf.services.IProcesses.ProcessContext;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
+import org.eclipse.tcf.te.runtime.statushandler.StatusHandlerManager;
+import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandler;
+import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandlerConstants;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.processes.core.activator.CoreBundleActivator;
+import org.eclipse.tcf.te.tcf.processes.core.interfaces.IContextHelpIds;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.core.nls.Messages;
+
+/**
+ * Process context terminate step implementation.
+ */
+public class TerminateStep {
+
+ /**
+ * Terminate from the given process context.
+ * <p>
+ * <b>Note:</b> This method must be called from within the TCF dispatch thread.
+ *
+ * @param node The context node. Must not be <code>null</code>.
+ * @param callback The callback to invoke once the operation completed, or <code>null</code>.
+ */
+ public void executeTerminate(final IProcessContextNode node, final ICallback callback) {
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
+ Assert.isNotNull(node);
+
+ // If the context is not attached, there is nothing to do
+ if (node.getProcessContext() != null) {
+ IPeerModel peerNode = (IPeerModel)node.getAdapter(IPeerModel.class);
+ if (peerNode != null) {
+ doTerminate(node, callback);
+ } else {
+ onError(node, Messages.DetachStep_error_disconnect, null, callback);
+ }
+ }
+ else {
+ onError(node, Messages.DetachStep_error_disconnect, null, callback);
+ }
+ }
+
+ /**
+ * Opens a channel and perform the terminate to the given context node.
+ * <p>
+ * <b>Note:</b> This method must be called from within the TCF dispatch thread.
+ *
+ * @param model The runtime model instance. Must not be <code>null</code>.
+ * @param node The context node. Must not be <code>null</code>.
+ * @param callback The callback to invoke once the operation completed, or<code>null</code>.
+ */
+ protected void doTerminate(final IProcessContextNode node, final ICallback callback) {
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
+ Assert.isNotNull(node);
+
+ // Determine the peer model node
+ final IPeerModel peerNode = (IPeerModel)node.getAdapter(IPeerModel.class);
+
+ // Open a channel
+ Tcf.getChannelManager().openChannel(peerNode.getPeer(), null, new IChannelManager.DoneOpenChannel() {
+ @Override
+ public void doneOpenChannel(final Throwable error, final IChannel channel) {
+ if (error == null) {
+ final IProcesses service = channel.getRemoteService(IProcesses.class);
+ if (service != null) {
+ service.getContext(node.getStringProperty(IModelNode.PROPERTY_ID), new IProcesses.DoneGetContext() {
+ @Override
+ public void doneGetContext(IToken token, Exception error, ProcessContext context) {
+ if (error == null && context != null) {
+ context.terminate(new IProcesses.DoneCommand() {
+ @Override
+ public void doneCommand(IToken token, Exception error) {
+ if (error == null) {
+ onDone(callback);
+ } else {
+ onError(node, Messages.TerminateStep_error_terminate, error, callback);
+ }
+ }
+ });
+ } else {
+ onError(node, Messages.TerminateStep_error_getContext, error, callback);
+ }
+ }
+ });
+ } else {
+ onError(node, Messages.TerminateStep_error_terminate, null, callback);
+ }
+ } else {
+ onError(node, Messages.TerminateStep_error_openChannel, error, callback);
+ }
+ }
+ });
+ }
+
+ /**
+ * Error handler. Called if a step failed.
+ *
+ * @param channel The channel or <code>null</code>.
+ * @param context The status handler context. Must not be <code>null</code>:
+ * @param message The message or <code>null</code>.
+ * @param error The error or <code>null</code>.
+ * @param callback The callback or <code>null</code>.
+ */
+ protected void onError(Object context, String message, Throwable error, ICallback callback) {
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
+
+ String detailMessage = error != null ? error.getMessage() : null;
+ if (detailMessage != null && detailMessage.contains("\n")) { //$NON-NLS-1$
+ detailMessage = detailMessage.replaceAll("\n", ", "); //$NON-NLS-1$ //$NON-NLS-2$
+ detailMessage = detailMessage.replaceAll(":, ", ": "); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ String fullMessage = message;
+ if (fullMessage != null) fullMessage = NLS.bind(fullMessage, detailMessage != null ? detailMessage : ""); //$NON-NLS-1$
+ else fullMessage = detailMessage;
+
+ if (fullMessage != null) {
+ IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), fullMessage, error);
+
+ if (callback == null) {
+ IStatusHandler[] handlers = StatusHandlerManager.getInstance().getHandler(context);
+ if (handlers.length > 0) {
+ IPropertiesContainer data = new PropertiesContainer();
+ data.setProperty(IStatusHandlerConstants.PROPERTY_TITLE, Messages.TerminateStep_error_title);
+ data.setProperty(IStatusHandlerConstants.PROPERTY_CONTEXT_HELP_ID, IContextHelpIds.MESSAGE_DETACH_FAILED);
+ data.setProperty(IStatusHandlerConstants.PROPERTY_CALLER, this);
+
+ handlers[0].handleStatus(status, data, null);
+ } else {
+ CoreBundleActivator.getDefault().getLog().log(status);
+ }
+ }
+ else {
+ callback.done(this, status);
+ }
+ }
+ }
+
+ /**
+ * Done handler. Called if all necessary steps are completed.
+ *
+ * @param callback The callback to invoke or <code>null</code>
+ */
+ protected void onDone(ICallback callback) {
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
+ if (callback != null) callback.done(this, Status.OK_STATUS);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/nls/Messages.java
index 902cc6ce1..5a8e52000 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/nls/Messages.java
@@ -65,4 +65,9 @@ public class Messages extends NLS {
public static String DetachStep_error_getContext;
public static String DetachStep_error_detach;
public static String DetachStep_error_openChannel;
+
+ public static String TerminateStep_error_title;
+ public static String TerminateStep_error_terminate;
+ public static String TerminateStep_error_getContext;
+ public static String TerminateStep_error_openChannel;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/nls/Messages.properties
index c07dfe921..f8792f382 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/nls/Messages.properties
@@ -44,3 +44,8 @@ DetachStep_error_disconnect=Failed to detach from context: {0}
DetachStep_error_getContext=Failed to get context: {0}
DetachStep_error_detach=Failed to detach context: {0}
DetachStep_error_openChannel=Failed to open channel: {0}
+
+TerminateStep_error_title=Error
+TerminateStep_error_terminate=Failed to terminate context: {0}
+TerminateStep_error_getContext=Failed to get context: {0}
+TerminateStep_error_openChannel=Failed to open channel: {0}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/META-INF/MANIFEST.MF
index 9cc9928b8..0d0c0a1ab 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/META-INF/MANIFEST.MF
@@ -11,11 +11,13 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.300",
org.eclipse.tcf.core;bundle-version="1.1.0",
org.eclipse.tcf.te.runtime;bundle-version="1.1.0",
+ org.eclipse.tcf.te.runtime.concurrent;bundle-version="1.1.0",
org.eclipse.tcf.te.runtime.model;bundle-version="1.1.0",
org.eclipse.tcf.te.runtime.services;bundle-version="1.1.0",
org.eclipse.tcf.te.runtime.statushandler;bundle-version="1.1.0",
org.eclipse.tcf.te.core;bundle-version="1.1.0",
org.eclipse.tcf.te.tcf.core;bundle-version="1.1.0",
+ org.eclipse.tcf.te.tcf.core.model;bundle-version="1.1.0",
org.eclipse.tcf.te.tcf.locator;bundle-version="1.1.0",
org.eclipse.tcf.te.tcf.filesystem.core;bundle-version="1.1.0",
org.eclipse.tcf.te.tcf.filesystem.ui;bundle-version="1.1.0",
@@ -30,18 +32,20 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Export-Package: org.eclipse.tcf.te.tcf.processes.ui.activator;x-internal:=true,
- org.eclipse.tcf.te.tcf.processes.ui.controls,
+ org.eclipse.tcf.te.tcf.processes.ui.editor,
+ org.eclipse.tcf.te.tcf.processes.ui.editor.tree,
+ org.eclipse.tcf.te.tcf.processes.ui.handler,
org.eclipse.tcf.te.tcf.processes.ui.help,
org.eclipse.tcf.te.tcf.processes.ui.interfaces,
org.eclipse.tcf.te.tcf.processes.ui.internal.adapters;x-internal:=true,
org.eclipse.tcf.te.tcf.processes.ui.internal.columns;x-internal:=true,
org.eclipse.tcf.te.tcf.processes.ui.internal.dialogs;x-internal:=true,
org.eclipse.tcf.te.tcf.processes.ui.internal.filters;x-internal:=true,
- org.eclipse.tcf.te.tcf.processes.ui.internal.handler;x-internal:=true,
- org.eclipse.tcf.te.tcf.processes.ui.internal.pages;x-internal:=true,
org.eclipse.tcf.te.tcf.processes.ui.internal.preferences;x-internal:=true,
org.eclipse.tcf.te.tcf.processes.ui.internal.properties;x-internal:=true,
org.eclipse.tcf.te.tcf.processes.ui.internal.search;x-internal:=true,
org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed;x-internal:=true,
org.eclipse.tcf.te.tcf.processes.ui.internal.testers;x-internal:=true,
+ org.eclipse.tcf.te.tcf.processes.ui.navigator.events,
+ org.eclipse.tcf.te.tcf.processes.ui.navigator.runtime,
org.eclipse.tcf.te.tcf.processes.ui.nls;x-internal:=true
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/icons/obj16/pending.gif b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/icons/obj16/pending.gif
new file mode 100644
index 000000000..0930dac23
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/icons/obj16/pending.gif
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.properties
index 0556da55a..81ea72016 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.properties
@@ -29,9 +29,9 @@ column.name.user = User
navigatorContent.name = Processes
-command.refresh.label = Refresh Process List
-command.refresh.tooltip = Refresh Process List
-command.refresh.name = Refresh Process List
+command.refreshviewer.label = Refresh Process List
+command.refreshviewer.tooltip = Refresh Process List
+command.refreshviewer.name = Refresh Process List
command.startPolling.label = Start Polling
command.startPolling.tooltip = Start Polling
@@ -59,19 +59,23 @@ commonFilter.singlethread.name = Single Thread Filter
propertyTab.general.label = Basic
propertyTab.context.label = Context
propertyTab.advanced.label = Properties
-command.refreshNode.label = Refresh
-command.refreshNode.label.0 = Refresh
-command.refreshNode.name = Refresh Process Node
-command.refresh.label.1 = Refresh
-command.refresh.tooltip.1 = Refresh the selected node
+
+command.refresh.label=Refresh
+command.refresh.tooltip=Refresh the selected node
+
command.properties.label.0 = Properties
command.properties.label.1 = Properties
+
page.properties.name = Properties
page.context.name = Context
page.basic.name = Basic
+
command.terminate.label = Terminate
command.terminate.tooltip = Terminate the selected process
command.terminate.name = Terminate
-command.filter.label = Filter...
+
+command.filter.label=Filter...
+
command.reset.label = Reset
-command.search.label = Find... \ No newline at end of file
+
+command.search.label = Find...
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.xml
index 6e8d8fa3b..e30d80c21 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.xml
@@ -1,781 +1,669 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-
-<!-- Adapter factory contributions -->
- <extension point="org.eclipse.core.runtime.adapters">
- <factory
- adaptableType="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode"
- class="org.eclipse.tcf.te.tcf.processes.ui.internal.adapters.AdapterFactory">
- <adapter type="org.eclipse.jface.viewers.ILabelProvider"/>
- <adapter type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
- <adapter
- type="org.eclipse.tcf.te.ui.interfaces.ILazyLoader">
- </adapter>
- <adapter
- type="org.eclipse.tcf.te.ui.interfaces.ISearchable">
- </adapter>
- </factory>
- </extension>
-
-<!-- Editor page contributions -->
- <extension point="org.eclipse.tcf.te.ui.views.editorPages">
- <editorPage
- class="org.eclipse.tcf.te.tcf.processes.ui.internal.pages.ProcessMonitorEditorPage"
- icon="icons/obj16/process_root.gif"
- id="org.eclipse.tcf.te.tcf.processes.ui.ProcessExplorerEditorPage"
- name="%ProcessExplorerEditorPage.name">
- </editorPage>
- </extension>
-
-<!-- Editor page binding contributions -->
- <extension point="org.eclipse.tcf.te.ui.views.editorPageBindings">
- <editorPageBinding
- id="org.eclipse.tcf.te.tcf.processes.ui.binding.ProcessExplorerEditorPage"
- pageId="org.eclipse.tcf.te.tcf.processes.ui.ProcessExplorerEditorPage">
- <enablement>
- <with variable="activeEditorInput">
- <and>
- <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
- <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="Processes"/>
- </and>
- </with>
- </enablement>
- </editorPageBinding>
- </extension>
-
-<!-- Processes menu contributions -->
- <extension point="org.eclipse.ui.menus">
-
- <menuContribution locationURI="toolbar:org.eclipse.tcf.te.tcf.processes.ui.ProcessExplorerEditorPage?before=additions">
- <command
- commandId="org.eclipse.tcf.te.tcf.processes.ui.command.refreshViewer"
- icon="icons/obj16/refresh.gif"
- label="%command.refresh.label"
- style="push"
- tooltip="%command.refresh.tooltip">
- </command>
- <command
- commandId="org.eclipse.tcf.te.tcf.processes.ui.command.refreshInterval"
- icon="icons/obj16/refresh_interval.png"
- id="org.eclipse.tcf.te.tcf.processes.ui.ProcessExplorerEditorPage.refreshInterval"
- label="%command.configure.label"
- style="pulldown"
- tooltip="%command.configure.tooltip">
- </command>
- </menuContribution>
-
- <menuContribution locationURI="menu:org.eclipse.tcf.te.tcf.processes.ui.ProcessExplorerEditorPage.refreshInterval">
- <dynamic
- class="org.eclipse.tcf.te.tcf.processes.ui.internal.handler.ConfigIntervalDynamicContribution"
- id="org.eclipse.tcf.te.tcf.processes.ui.menu.refreshIntervalDynamic">
- </dynamic>
- </menuContribution>
-
- <menuContribution locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.launch.rundebug">
- <command
- commandId="org.eclipse.tcf.te.launch.command.attach"
- disabledIcon="platform:/plugin/org.eclipse.tcf.te.launch.ui/icons/dlcl16/attach.gif"
- icon="platform:/plugin/org.eclipse.tcf.te.launch.ui/icons/elcl16/attach.gif"
- id="org.eclipse.tcf.te.tcf.processes.ui.commands.attach"
- label="%command.attach.label"
- style="push"
- tooltip="%command.attach.tooltip">
- <visibleWhen checkEnabled="false">
- <reference definitionId="te.expressions.processes.isProcessTreeNode"/>
- </visibleWhen>
- </command>
-
- <command
- commandId="org.eclipse.tcf.te.launch.command.detach"
- disabledIcon="platform:/plugin/org.eclipse.tcf.te.launch.ui/icons/dlcl16/detach.gif"
- icon="platform:/plugin/org.eclipse.tcf.te.launch.ui/icons/elcl16/detach.gif"
- id="org.eclipse.tcf.te.tcf.processes.ui.commands.detach"
- label="%command.detach.label"
- style="push"
- tooltip="%command.detach.tooltip">
- <visibleWhen checkEnabled="false">
- <reference definitionId="te.expressions.processes.isProcessTreeNode"/>
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.tcf.te.launch.command.terminate"
- icon="platform:/plugin/org.eclipse.debug.ui/icons/full/elcl16/terminate_co.gif"
- id="org.eclipse.tcf.te.launch.menu.terminate"
- label="%command.terminate.label"
- style="push"
- tooltip="%command.terminate.tooltip">
- <visibleWhen
- checkEnabled="false">
- <reference
- definitionId="te.expressions.processes.isProcessTreeNode">
- </reference>
- </visibleWhen>
- </command>
- </menuContribution>
-
- <menuContribution
- locationURI="popup:org.eclipse.tcf.te.tcf.processes.ui.ProcessExplorerEditorPage?after=additions">
- <separator
- name="group.launch.rundebug"
- visible="true">
- </separator>
- <command
- commandId="org.eclipse.tcf.te.launch.command.attach"
- disabledIcon="platform:/plugin/org.eclipse.tcf.te.launch.ui/icons/dlcl16/attach.gif"
- icon="platform:/plugin/org.eclipse.tcf.te.launch.ui/icons/elcl16/attach.gif"
- id="org.eclipse.tcf.te.tcf.processes.ui.commands.attach"
- label="%command.attach.label"
- style="push"
- tooltip="%command.attach.tooltip">
- <visibleWhen
- checkEnabled="false">
- <reference
- definitionId="te.expressions.processes.isProcessTreeNode">
- </reference>
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.tcf.te.launch.command.detach"
- disabledIcon="platform:/plugin/org.eclipse.tcf.te.launch.ui/icons/dlcl16/detach.gif"
- icon="platform:/plugin/org.eclipse.tcf.te.launch.ui/icons/elcl16/detach.gif"
- id="org.eclipse.tcf.te.tcf.processes.ui.commands.detach"
- label="%command.detach.label"
- style="push"
- tooltip="%command.detach.tooltip">
- <visibleWhen
- checkEnabled="false">
- <reference
- definitionId="te.expressions.processes.isProcessTreeNode">
- </reference>
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.tcf.te.launch.command.terminate"
- icon="platform:/plugin/org.eclipse.debug.ui/icons/full/elcl16/terminate_co.gif"
- id="org.eclipse.tcf.te.launch.menu.terminate"
- label="%command.terminate.label"
- style="push"
- tooltip="%command.terminate.tooltip">
- <visibleWhen
- checkEnabled="false">
- <reference
- definitionId="te.expressions.processes.isProcessTreeNode">
- </reference>
- </visibleWhen>
- </command>
- <separator
- name="group.refresh"
- visible="true">
- </separator>
- <command
- commandId="org.eclipse.tcf.te.ui.command.refresh"
- label="%command.refresh.label.1"
- style="push"
- tooltip="%command.refresh.tooltip.1">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="selection">
- <count
- value="+">
- </count>
- <iterate
- ifEmpty="false"
- operator="and">
- <instanceof
- value="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode">
- </instanceof>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- <separator
- name="group.search"
- visible="true">
- </separator>
- <command
- commandId="org.eclipse.tcf.te.ui.views.command.find"
- label="%command.search.label"
- style="push">
- </command>
- <separator
- name="group.filter"
- visible="true">
- </separator>
- <command
- commandId="org.eclipse.tcf.te.ui.views.command.quickfilter"
- label="%command.filter.label"
- style="push">
- </command>
- <command
- commandId="org.eclipse.tcf.te.ui.views.command.resetfilter"
- label="%command.reset.label"
- style="push">
- </command>
- <separator
- name="group.properties"
- visible="true">
- </separator>
- <command
- commandId="org.eclipse.ui.file.properties"
- id="properties"
- label="%command.properties.label.0">
- <visibleWhen>
- <with
- variable="selection">
- <count
- value="1">
- </count>
- <iterate
- ifEmpty="false"
- operator="and">
- <and>
- <instanceof
- value="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode">
- </instanceof>
- <not>
- <test
- property="org.eclipse.tcf.te.tcf.processes.ui.model.isSystemRoot">
- </test>
- </not>
- </and>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- </menuContribution>
- <menuContribution
- locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.properties">
- <command
- commandId="org.eclipse.ui.file.properties"
- id="properties"
- label="%command.properties.label.1">
- <visibleWhen>
- <with
- variable="selection">
- <count
- value="1">
- </count>
- <iterate
- ifEmpty="false"
- operator="and">
- <and>
- <instanceof
- value="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode">
- </instanceof>
- <not>
- <test
- property="org.eclipse.tcf.te.tcf.processes.ui.model.isSystemRoot">
- </test>
- </not>
- </and>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- </menuContribution>
- <menuContribution
- locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.refresh">
- <command
- commandId="org.eclipse.tcf.te.ui.command.refresh"
- label="%command.refresh.label.1"
- style="push"
- tooltip="%command.refresh.tooltip.1">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="selection">
- <count
- value="+">
- </count>
- <iterate
- ifEmpty="false"
- operator="and">
- <instanceof
- value="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode">
- </instanceof>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- </menuContribution>
- </extension>
-
-<!-- Command contributions -->
- <extension point="org.eclipse.ui.commands">
- <command
- categoryId="org.eclipse.tcf.te.ui.commands.category"
- helpContextId="org.eclipse.tcf.te.tcf.processes.ui.command_Refresh"
- id="org.eclipse.tcf.te.tcf.processes.ui.command.refreshViewer"
- name="%command.refresh.name">
- </command>
- <command
- categoryId="org.eclipse.tcf.te.ui.commands.category"
- helpContextId="org.eclipse.tcf.te.tcf.processes.ui.command_RefreshInterval"
- id="org.eclipse.tcf.te.tcf.processes.ui.command.refreshInterval"
- name="%command.configure.name">
- </command>
- <command
- categoryId="org.eclipse.tcf.te.ui.commands.category"
- helpContextId="org.eclipse.tcf.te.launch.command_erminate"
- id="org.eclipse.tcf.te.launch.command.terminate"
- name="%command.terminate.name">
- </command>
- </extension>
-
-<!-- Handler contributions -->
- <extension point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.tcf.te.tcf.processes.ui.internal.handler.RefreshProcessListHandler"
- commandId="org.eclipse.tcf.te.tcf.processes.ui.command.refreshViewer">
- </handler>
-
- <handler
- class="org.eclipse.tcf.te.tcf.processes.ui.internal.handler.ConfigRefreshIntervalHandler"
- commandId="org.eclipse.tcf.te.tcf.processes.ui.command.refreshInterval">
- </handler>
-
- <handler
- class="org.eclipse.tcf.te.tcf.processes.ui.internal.handler.AttachHandler"
- commandId="org.eclipse.tcf.te.launch.command.attach">
- <activeWhen>
- <and>
- <with variable="activePartId">
- <or>
- <equals
- value="org.eclipse.tcf.te.ui.views.View">
- </equals>
- <equals
- value="org.eclipse.tcf.te.ui.views.Editor">
- </equals>
- </or>
- </with>
- <reference definitionId="te.expressions.processes.isProcessTreeNode"/>
- </and>
- </activeWhen>
- <enabledWhen>
- <with variable="selection">
- <count value="+"/>
- <iterate operator="and" ifEmpty="false">
- <adapt type="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode">
- <test property="org.eclipse.tcf.te.tcf.processes.ui.model.isAttached" value="false"/>
- </adapt>
- </iterate>
- </with>
- </enabledWhen>
- </handler>
-
- <handler
- class="org.eclipse.tcf.te.tcf.processes.ui.internal.handler.DetachHandler"
- commandId="org.eclipse.tcf.te.launch.command.detach">
- <activeWhen>
- <and>
- <with variable="activePartId">
- <or>
- <equals
- value="org.eclipse.tcf.te.ui.views.View">
- </equals>
- <equals
- value="org.eclipse.tcf.te.ui.views.Editor">
- </equals>
- </or>
- </with>
- <reference definitionId="te.expressions.processes.isProcessTreeNode"/>
- </and>
- </activeWhen>
- <enabledWhen>
- <with variable="selection">
- <count value="+"/>
- <iterate operator="and" ifEmpty="false">
- <adapt type="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode">
- <test property="org.eclipse.tcf.te.tcf.processes.ui.model.isAttached" value="true"/>
- </adapt>
- </iterate>
- </with>
- </enabledWhen>
- </handler>
- <handler
- class="org.eclipse.tcf.te.tcf.processes.ui.internal.handler.TerminateHandler"
- commandId="org.eclipse.tcf.te.launch.command.terminate">
- <activeWhen>
- <and>
- <with
- variable="activePartId">
- <or>
- <equals
- value="org.eclipse.tcf.te.ui.views.View">
- </equals>
- <equals
- value="org.eclipse.tcf.te.ui.views.Editor">
- </equals>
- </or>
- </with>
- <reference
- definitionId="te.expressions.processes.isProcessTreeNode">
- </reference>
- </and>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <count
- value="+">
- </count>
- <iterate
- ifEmpty="false"
- operator="and">
- <adapt
- type="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode">
- </adapt>
- </iterate>
- </with>
- </enabledWhen>
- </handler>
- <handler
- class="org.eclipse.tcf.te.tcf.processes.ui.internal.handler.RefreshHandler"
- commandId="org.eclipse.tcf.te.ui.command.refresh">
- <activeWhen>
- <and>
- <with
- variable="activePartId">
- <or>
- <equals
- value="org.eclipse.tcf.te.ui.views.View">
- </equals>
- <equals
- value="org.eclipse.tcf.te.ui.views.Editor">
- </equals>
- </or>
- </with>
- <with
- variable="selection">
- <iterate
- ifEmpty="false"
- operator="and">
- <instanceof
- value="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode">
- </instanceof>
- </iterate>
- </with>
- </and>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <count
- value="+">
- </count>
- <iterate
- ifEmpty="false"
- operator="and">
- <instanceof
- value="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode">
- </instanceof>
- </iterate>
- </with>
- </enabledWhen>
- </handler>
- </extension>
-
-<!-- Reusable core expression fragments -->
- <extension point="org.eclipse.core.expressions.definitions">
-
- <!--
- Expression to test if the selection contains single process tree nodes only.
- -->
- <definition id="te.expressions.processes.isProcessTreeNode">
- <with variable="selection">
- <count value="+"/>
- <iterate operator="and" ifEmpty="false">
- <and>
- <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode"/>
- <adapt type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel">
- <test
- property="org.eclipse.tcf.te.tcf.locator.hasRemoteService"
- value="Processes">
- </test>
- </adapt>
- </and>
- </iterate>
- </with>
- </definition>
-
- </extension>
-
-<!-- Eclipse core expressions property tester -->
-
- <extension point="org.eclipse.tcf.te.ui.viewers">
- <viewer
- autoExpandLevel="0"
- contentProvider="org.eclipse.tcf.te.tcf.processes.ui.controls.ProcessTreeContentProvider"
- id="org.eclipse.tcf.te.ui.controls.viewer.processes"
- persistent="true">
- <creation>
- <style
- name="SWT.FULL_SELECTION">
- </style>
- <style
- name="SWT.MULTI">
- </style>
- </creation>
- </viewer>
- <columnContribution
- viewerId="org.eclipse.tcf.te.ui.controls.viewer.processes">
- <column
- comparator="org.eclipse.tcf.te.tcf.processes.ui.internal.columns.ProcessComparator"
- id="name"
- labelProvider="org.eclipse.tcf.te.tcf.processes.ui.internal.columns.ProcessLabelProvider"
- moveable="true"
- name="%column.name.name"
- resizable="true"
- visible="true"
- width="250">
- </column>
- <column
- comparator="org.eclipse.tcf.te.tcf.processes.ui.internal.columns.PIDComparator"
- id="pid"
- labelProvider="org.eclipse.tcf.te.tcf.processes.ui.internal.columns.PIDLabelProvider"
- moveable="true"
- name="%column.name.pid"
- resizable="true"
- style="SWT.RIGHT"
- visible="true"
- width="50">
- </column>
- <column
- comparator="org.eclipse.tcf.te.tcf.processes.ui.internal.columns.PPIDComparator"
- id="ppid"
- labelProvider="org.eclipse.tcf.te.tcf.processes.ui.internal.columns.PPIDLabelProvider"
- moveable="true"
- name="%column.name.ppid"
- resizable="true"
- style="SWT.RIGHT"
- visible="true"
- width="50">
- </column>
- <column
- comparator="org.eclipse.tcf.te.tcf.processes.ui.internal.columns.StateComparator"
- id="state"
- labelProvider="org.eclipse.tcf.te.tcf.processes.ui.internal.columns.StateLabelProvider"
- moveable="true"
- name="%column.name.state"
- resizable="true"
- style="SWT.RIGHT"
- visible="true"
- width="50">
- </column>
- <column
- comparator="org.eclipse.tcf.te.tcf.processes.ui.internal.columns.UserComparator"
- id="user"
- labelProvider="org.eclipse.tcf.te.tcf.processes.ui.internal.columns.UserLabelProvider"
- moveable="true"
- name="%column.name.user"
- resizable="true"
- style="SWT.RIGHT"
- visible="true"
- width="100">
- </column>
- </columnContribution>
- <filterContribution
- viewerId="org.eclipse.tcf.te.ui.controls.viewer.processes">
- <filter
- class="org.eclipse.tcf.te.tcf.processes.ui.internal.filters.SingleThreadFilter"
- description="%singlethreadfilter.description"
- enabled="true"
- id="org.eclipse.tcf.te.tcf.processes.ui.navigator.filter.singleThread"
- name="%singlethreadfilter.name">
- </filter>
- </filterContribution>
- </extension>
-
- <extension point="org.eclipse.ui.navigator.navigatorContent">
- <navigatorContent
- activeByDefault="false"
- contentProvider="org.eclipse.tcf.te.tcf.processes.ui.controls.ProcessNavigatorContentProvider"
- icon="icons/obj16/process_root.gif"
- id="org.eclipse.tcf.te.tcf.processes.ui.navigator.content"
- labelProvider="org.eclipse.tcf.te.tcf.processes.ui.internal.columns.ProcessLabelProvider"
- name="%navigatorContent.name"
- priority="normal">
- <triggerPoints>
- <instanceof
- value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel">
- </instanceof>
- <test
- property="org.eclipse.tcf.te.tcf.locator.hasRemoteService"
- value="SysMonitor">
- </test>
- </triggerPoints>
- <possibleChildren>
- <instanceof
- value="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode">
- </instanceof>
- </possibleChildren>
- <commonSorter
- class="org.eclipse.tcf.te.tcf.processes.ui.controls.ProcessViewerSorter">
- </commonSorter>
- </navigatorContent>
- <commonFilter
- activeByDefault="true"
- class="org.eclipse.tcf.te.tcf.processes.ui.internal.filters.SingleThreadFilter"
- id="org.eclipse.tcf.te.tcf.processes.ui.navigator.filter.singleThread"
- name="%commonFilter.singlethread.name"
- visibleInUI="false">
- </commonFilter>
- </extension>
-
- <extension point="org.eclipse.ui.navigator.viewer">
- <viewerContentBinding
- viewerId="org.eclipse.tcf.te.ui.views.View">
- <includes>
- <contentExtension
- pattern="org.eclipse.tcf.te.tcf.processes.ui.navigator.*">
- </contentExtension>
- </includes>
- </viewerContentBinding>
- </extension>
-
- <extension point="org.eclipse.core.runtime.preferences">
- <initializer class="org.eclipse.tcf.te.tcf.processes.ui.internal.preferences.PreferencesInitializer"/>
- </extension>
-
- <extension point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
- <propertyTabs
- contributorId="org.eclipse.tcf.te.ui">
- <propertyTab
- category="org.eclipse.tcf.te"
- id="org.eclipse.tcf.te.tcf.processes.ui.propertytab.general"
- label="%propertyTab.general.label">
- </propertyTab>
- <propertyTab
- afterTab="org.eclipse.tcf.te.tcf.processes.ui.propertytab.general"
- category="org.eclipse.tcf.te"
- id="org.eclipse.tcf.te.tcf.processes.ui.propertytab.context"
- label="%propertyTab.context.label">
- </propertyTab>
- <propertyTab
- afterTab="org.eclipse.tcf.te.tcf.processes.ui.propertytab.context"
- category="org.eclipse.tcf.te"
- id="org.eclipse.tcf.te.tcf.processes.ui.propertytab.advanced"
- label="%propertyTab.advanced.label">
- </propertyTab>
- </propertyTabs>
- </extension>
-
- <extension point="org.eclipse.ui.views.properties.tabbed.propertySections">
- <propertySections
- contributorId="org.eclipse.tcf.te.ui">
- <propertySection
- class="org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed.BasicInformationSection"
- enablesFor="1"
- filter="org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed.ProcessFilter"
- id="org.eclipse.tcf.te.tcf.processes.ui.propertysection.general.basic"
- tab="org.eclipse.tcf.te.tcf.processes.ui.propertytab.general">
- </propertySection>
- <propertySection
- afterSection="org.eclipse.tcf.te.tcf.processes.ui.propertysection.general.basic"
- class="org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed.IDSection"
- enablesFor="1"
- filter="org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed.ProcessFilter"
- id="org.eclipse.tcf.te.tcf.processes.ui.propertysection.general.id"
- tab="org.eclipse.tcf.te.tcf.processes.ui.propertytab.general">
- </propertySection>
- <propertySection
- class="org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed.BasicContextSection"
- enablesFor="1"
- filter="org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed.ProcessFilter"
- id="org.eclipse.tcf.te.tcf.processes.ui.propertysection.context.basicContext"
- tab="org.eclipse.tcf.te.tcf.processes.ui.propertytab.context">
- </propertySection>
- <propertySection
- afterSection="org.eclipse.tcf.te.tcf.processes.ui.propertysection.context.basicContext"
- class="org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed.ContextIDSection"
- enablesFor="1"
- filter="org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed.ProcessFilter"
- id="org.eclipse.tcf.te.tcf.processes.ui.propertysection.context.contextId"
- tab="org.eclipse.tcf.te.tcf.processes.ui.propertytab.context">
- </propertySection>
- <propertySection
- afterSection="org.eclipse.tcf.te.tcf.processes.ui.propertysection.context.contextId"
- class="org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed.MemorySection"
- enablesFor="1"
- filter="org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed.ProcessFilter"
- id="org.eclipse.tcf.te.tcf.processes.ui.propertysection.context.memory"
- tab="org.eclipse.tcf.te.tcf.processes.ui.propertytab.context">
- </propertySection>
- <propertySection
- class="org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed.AdvancedPropertiesSection"
- enablesFor="1"
- filter="org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed.ProcessFilter"
- id="org.eclipse.tcf.te.tcf.processes.ui.propertysection.advanced"
- tab="org.eclipse.tcf.te.tcf.processes.ui.propertytab.advanced">
- </propertySection>
- </propertySections>
- </extension>
- <extension
- point="org.eclipse.ui.propertyPages">
- <page
- class="org.eclipse.tcf.te.tcf.processes.ui.internal.properties.AdvancedPropertiesPage"
- id="org.eclipse.tcf.te.tcf.processes.ui.pages.advanced"
- name="%page.properties.name">
- <enabledWhen>
- <and>
- <instanceof
- value="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode">
- </instanceof>
- <not>
- <test
- property="org.eclipse.tcf.te.tcf.processes.ui.model.isSystemRoot">
- </test>
- </not>
- </and>
- </enabledWhen>
- </page>
- <page
- class="org.eclipse.tcf.te.tcf.processes.ui.internal.properties.ContextPage"
- id="org.eclipse.tcf.te.tcf.processes.ui.pages.context"
- name="%page.context.name">
- <enabledWhen>
- <and>
- <instanceof
- value="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode">
- </instanceof>
- <not>
- <test
- property="org.eclipse.tcf.te.tcf.processes.ui.model.isSystemRoot">
- </test>
- </not>
- </and>
- </enabledWhen>
- </page>
- <page
- class="org.eclipse.tcf.te.tcf.processes.ui.internal.properties.GeneralInformationPage"
- id="org.eclipse.tcf.te.tcf.processes.ui.pages.basic"
- name="%page.basic.name">
- <enabledWhen>
- <and>
- <instanceof
- value="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode">
- </instanceof>
- <not>
- <test
- property="org.eclipse.tcf.te.tcf.processes.ui.model.isSystemRoot">
- </test>
- </not>
- </and>
- </enabledWhen>
- </page>
- </extension>
- <extension
- point="org.eclipse.core.expressions.propertyTesters">
- <propertyTester
- class="org.eclipse.tcf.te.tcf.processes.ui.internal.testers.ProcessPropertyTester"
- id="org.eclipse.tcf.te.tcf.processes.ui.propertytester.process"
- namespace="org.eclipse.tcf.te.tcf.processes.ui.model"
- properties="isSystemRoot, isAttached"
- type="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode">
- </propertyTester>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+<!-- Adapter factory contributions -->
+ <extension point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"
+ class="org.eclipse.tcf.te.tcf.processes.ui.internal.adapters.AdapterFactory">
+ <adapter type="org.eclipse.jface.viewers.ILabelProvider"/>
+ <adapter type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
+ <adapter type="org.eclipse.tcf.te.ui.interfaces.ISearchable"/>
+ </factory>
+
+ <factory
+ adaptableType="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeModel"
+ class="org.eclipse.tcf.te.tcf.processes.ui.internal.adapters.AdapterFactory">
+ <adapter type="org.eclipse.tcf.te.ui.interfaces.ISearchable"/>
+ </factory>
+ </extension>
+
+<!-- Event listener contributions -->
+ <extension point="org.eclipse.tcf.te.runtime.eventListeners">
+ <eventListener
+ class="org.eclipse.tcf.te.tcf.processes.ui.navigator.events.EventListener">
+ <eventSourceType
+ bundleId="org.eclipse.tcf.te.tcf.processes.core"
+ class="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeModel">
+ </eventSourceType>
+ <eventSourceType
+ bundleId="org.eclipse.tcf.te.tcf.processes.core"
+ class="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode">
+ </eventSourceType>
+ </eventListener>
+ </extension>
+
+<!-- Eclipse core expressions property tester -->
+ <extension point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ class="org.eclipse.tcf.te.tcf.processes.ui.internal.testers.ProcessPropertyTester"
+ id="org.eclipse.tcf.te.tcf.processes.ui.propertytester.process"
+ namespace="org.eclipse.tcf.te.tcf.processes.ui.model"
+ properties="isAttached"
+ type="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode">
+ </propertyTester>
+ </extension>
+
+<!-- Common navigator contributions -->
+ <extension point="org.eclipse.ui.navigator.viewer">
+ <viewerContentBinding
+ viewerId="org.eclipse.tcf.te.ui.views.View">
+ <includes>
+ <contentExtension
+ pattern="org.eclipse.tcf.te.tcf.processes.ui.navigator.*">
+ </contentExtension>
+ </includes>
+ </viewerContentBinding>
+ </extension>
+
+ <extension point="org.eclipse.ui.navigator.navigatorContent">
+ <navigatorContent
+ activeByDefault="false"
+ contentProvider="org.eclipse.tcf.te.tcf.processes.ui.navigator.runtime.ContentProviderDelegate"
+ icon="icons/obj16/process_root.gif"
+ id="org.eclipse.tcf.te.tcf.processes.ui.navigator.content"
+ labelProvider="org.eclipse.tcf.te.tcf.processes.ui.navigator.runtime.LabelProviderDelegate"
+ name="%navigatorContent.name"
+ priority="normal">
+
+ <triggerPoints>
+ <or>
+ <and>
+ <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
+ <and>
+ <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="Processes"/>
+ <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="SysMonitor"/>
+ </and>
+ </and>
+ <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"/>
+ <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeModel"/>
+ <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IPendingOperationNode"/>
+ </or>
+ </triggerPoints>
+ <possibleChildren>
+ <or>
+ <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"/>
+ <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeModel"/>
+ <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IPendingOperationNode"/>
+ </or>
+ </possibleChildren>
+ <commonSorter
+ class="org.eclipse.tcf.te.ui.trees.TreeViewerSorter">
+ </commonSorter>
+ </navigatorContent>
+ <commonFilter
+ activeByDefault="true"
+ class="org.eclipse.tcf.te.tcf.processes.ui.internal.filters.SingleThreadFilter"
+ id="org.eclipse.tcf.te.tcf.processes.ui.navigator.filter.singleThread"
+ name="%commonFilter.singlethread.name"
+ visibleInUI="false">
+ </commonFilter>
+ </extension>
+
+<!-- Editor page contributions -->
+ <extension point="org.eclipse.tcf.te.ui.views.editorPages">
+ <editorPage
+ class="org.eclipse.tcf.te.tcf.processes.ui.editor.ProcessMonitorEditorPage"
+ icon="icons/obj16/process_root.gif"
+ id="org.eclipse.tcf.te.tcf.processes.ui.ProcessExplorerEditorPage"
+ name="%ProcessExplorerEditorPage.name">
+ </editorPage>
+ </extension>
+
+<!-- Editor page binding contributions -->
+ <extension point="org.eclipse.tcf.te.ui.views.editorPageBindings">
+ <editorPageBinding
+ id="org.eclipse.tcf.te.tcf.processes.ui.binding.ProcessExplorerEditorPage"
+ pageId="org.eclipse.tcf.te.tcf.processes.ui.ProcessExplorerEditorPage">
+ <enablement>
+ <with variable="activeEditorInput">
+ <and>
+ <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
+ <and>
+ <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="Processes"/>
+ <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="SysMonitor"/>
+ </and>
+ </and>
+ </with>
+ </enablement>
+ </editorPageBinding>
+ </extension>
+
+<!-- Processes menu contributions -->
+ <extension point="org.eclipse.ui.menus">
+ <menuContribution locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.launch.rundebug">
+ <command
+ commandId="org.eclipse.tcf.te.launch.command.attach"
+ disabledIcon="platform:/plugin/org.eclipse.tcf.te.launch.ui/icons/dlcl16/attach.gif"
+ icon="platform:/plugin/org.eclipse.tcf.te.launch.ui/icons/elcl16/attach.gif"
+ id="org.eclipse.tcf.te.tcf.processes.ui.commands.attach"
+ label="%command.attach.label"
+ style="push"
+ tooltip="%command.attach.tooltip">
+ <visibleWhen checkEnabled="false">
+ <reference definitionId="te.expressions.processes.isProcessTreeNode"/>
+ </visibleWhen>
+ </command>
+
+ <command
+ commandId="org.eclipse.tcf.te.launch.command.detach"
+ disabledIcon="platform:/plugin/org.eclipse.tcf.te.launch.ui/icons/dlcl16/detach.gif"
+ icon="platform:/plugin/org.eclipse.tcf.te.launch.ui/icons/elcl16/detach.gif"
+ id="org.eclipse.tcf.te.tcf.processes.ui.commands.detach"
+ label="%command.detach.label"
+ style="push"
+ tooltip="%command.detach.tooltip">
+ <visibleWhen checkEnabled="false">
+ <reference definitionId="te.expressions.processes.isProcessTreeNode"/>
+ </visibleWhen>
+ </command>
+
+ <command
+ commandId="org.eclipse.tcf.te.launch.command.terminate"
+ icon="platform:/plugin/org.eclipse.debug.ui/icons/full/elcl16/terminate_co.gif"
+ id="org.eclipse.tcf.te.launch.menu.terminate"
+ label="%command.terminate.label"
+ style="push"
+ tooltip="%command.terminate.tooltip">
+ <visibleWhen checkEnabled="false">
+ <reference definitionId="te.expressions.processes.isProcessTreeNode"/>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+
+ <menuContribution locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.refresh">
+ <command
+ commandId="org.eclipse.tcf.te.ui.command.refresh"
+ id="org.eclipse.tcf.te.ui.commands.refresh"
+ label="%command.refresh.label"
+ mnemonic="f"
+ style="push"
+ tooltip="%command.refresh.tooltip">
+ <visibleWhen checkEnabled="false">
+ <with variable="selection">
+ <count value="+"/>
+ <iterate operator="and" ifEmpty="false">
+ <or>
+ <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeModel"/>
+ <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"/>
+ </or>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+
+ <menuContribution locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.properties">
+ <command
+ commandId="org.eclipse.ui.file.properties"
+ id="properties"
+ label="%command.properties.label.1">
+ <visibleWhen>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate ifEmpty="false" operator="and">
+ <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"/>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+
+ <menuContribution locationURI="toolbar:org.eclipse.tcf.te.tcf.processes.ui.ProcessExplorerEditorPage?before=additions">
+ <command
+ commandId="org.eclipse.tcf.te.tcf.processes.ui.command.refreshViewer"
+ icon="icons/obj16/refresh.gif"
+ label="%command.refreshviewer.label"
+ style="push"
+ tooltip="%command.refreshviewer.tooltip">
+ </command>
+ <command
+ commandId="org.eclipse.tcf.te.tcf.processes.ui.command.refreshInterval"
+ icon="icons/obj16/refresh_interval.png"
+ id="org.eclipse.tcf.te.tcf.processes.ui.ProcessExplorerEditorPage.refreshInterval"
+ label="%command.configure.label"
+ style="pulldown"
+ tooltip="%command.configure.tooltip">
+ </command>
+ </menuContribution>
+
+ <menuContribution locationURI="menu:org.eclipse.tcf.te.tcf.processes.ui.ProcessExplorerEditorPage.refreshInterval">
+ <dynamic
+ class="org.eclipse.tcf.te.tcf.processes.ui.handler.ConfigIntervalDynamicContribution"
+ id="org.eclipse.tcf.te.tcf.processes.ui.menu.refreshIntervalDynamic">
+ </dynamic>
+ </menuContribution>
+
+ <menuContribution locationURI="popup:org.eclipse.tcf.te.tcf.processes.ui.ProcessExplorerEditorPage?after=additions">
+ <separator
+ name="group.launch.rundebug"
+ visible="true">
+ </separator>
+ <command
+ commandId="org.eclipse.tcf.te.launch.command.attach"
+ disabledIcon="platform:/plugin/org.eclipse.tcf.te.launch.ui/icons/dlcl16/attach.gif"
+ icon="platform:/plugin/org.eclipse.tcf.te.launch.ui/icons/elcl16/attach.gif"
+ id="org.eclipse.tcf.te.tcf.processes.ui.commands.attach"
+ label="%command.attach.label"
+ style="push"
+ tooltip="%command.attach.tooltip">
+ <visibleWhen checkEnabled="false">
+ <reference definitionId="te.expressions.processes.isProcessTreeNode"/>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.tcf.te.launch.command.detach"
+ disabledIcon="platform:/plugin/org.eclipse.tcf.te.launch.ui/icons/dlcl16/detach.gif"
+ icon="platform:/plugin/org.eclipse.tcf.te.launch.ui/icons/elcl16/detach.gif"
+ id="org.eclipse.tcf.te.tcf.processes.ui.commands.detach"
+ label="%command.detach.label"
+ style="push"
+ tooltip="%command.detach.tooltip">
+ <visibleWhen checkEnabled="false">
+ <reference definitionId="te.expressions.processes.isProcessTreeNode"/>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.tcf.te.launch.command.terminate"
+ icon="platform:/plugin/org.eclipse.debug.ui/icons/full/elcl16/terminate_co.gif"
+ id="org.eclipse.tcf.te.launch.menu.terminate"
+ label="%command.terminate.label"
+ style="push"
+ tooltip="%command.terminate.tooltip">
+ <visibleWhen checkEnabled="false">
+ <reference definitionId="te.expressions.processes.isProcessTreeNode"/>
+ </visibleWhen>
+ </command>
+ <separator
+ name="group.refresh"
+ visible="true">
+ </separator>
+ <command
+ commandId="org.eclipse.tcf.te.ui.command.refresh"
+ label="%command.refresh.label"
+ style="push"
+ tooltip="%command.refresh.tooltip">
+ <visibleWhen checkEnabled="false">
+ <with variable="selection">
+ <count value="+"/>
+ <iterate ifEmpty="false" operator="and">
+ <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"/>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <separator
+ name="group.search"
+ visible="true">
+ </separator>
+ <command
+ commandId="org.eclipse.tcf.te.ui.views.command.find"
+ label="%command.search.label"
+ style="push">
+ </command>
+ <separator
+ name="group.filter"
+ visible="true">
+ </separator>
+ <command
+ commandId="org.eclipse.tcf.te.ui.views.command.quickfilter"
+ label="%command.filter.label"
+ style="push">
+ </command>
+ <command
+ commandId="org.eclipse.tcf.te.ui.views.command.resetfilter"
+ label="%command.reset.label"
+ style="push">
+ </command>
+ <separator
+ name="group.properties"
+ visible="true">
+ </separator>
+ <command
+ commandId="org.eclipse.ui.file.properties"
+ id="properties"
+ label="%command.properties.label.0">
+ <visibleWhen>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate ifEmpty="false" operator="and">
+ <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"/>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+
+ </extension>
+
+<!-- Command contributions -->
+ <extension point="org.eclipse.ui.commands">
+ <command
+ categoryId="org.eclipse.tcf.te.ui.commands.category"
+ helpContextId="org.eclipse.tcf.te.tcf.processes.ui.command_Refresh"
+ id="org.eclipse.tcf.te.tcf.processes.ui.command.refreshViewer"
+ name="%command.refreshviewer.name">
+ </command>
+ <command
+ categoryId="org.eclipse.tcf.te.ui.commands.category"
+ helpContextId="org.eclipse.tcf.te.tcf.processes.ui.command_RefreshInterval"
+ id="org.eclipse.tcf.te.tcf.processes.ui.command.refreshInterval"
+ name="%command.configure.name">
+ </command>
+ <command
+ categoryId="org.eclipse.tcf.te.ui.commands.category"
+ helpContextId="org.eclipse.tcf.te.launch.command_erminate"
+ id="org.eclipse.tcf.te.launch.command.terminate"
+ name="%command.terminate.name">
+ </command>
+ </extension>
+
+<!-- Handler contributions -->
+ <extension point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.tcf.te.tcf.processes.ui.handler.RefreshProcessListHandler"
+ commandId="org.eclipse.tcf.te.tcf.processes.ui.command.refreshViewer">
+ </handler>
+
+ <handler
+ class="org.eclipse.tcf.te.tcf.processes.ui.handler.ConfigRefreshIntervalHandler"
+ commandId="org.eclipse.tcf.te.tcf.processes.ui.command.refreshInterval">
+ </handler>
+
+ <handler
+ class="org.eclipse.tcf.te.tcf.processes.ui.handler.AttachHandler"
+ commandId="org.eclipse.tcf.te.launch.command.attach">
+ <activeWhen>
+ <with variable="activePartId">
+ <or>
+ <equals value="org.eclipse.tcf.te.ui.views.View"/>
+ <equals value="org.eclipse.tcf.te.ui.views.Editor"/>
+ </or>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <with variable="selection">
+ <count value="+"/>
+ <iterate operator="and" ifEmpty="false">
+ <adapt type="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode">
+ <test property="org.eclipse.tcf.te.tcf.processes.ui.model.isAttached" value="false"/>
+ </adapt>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
+
+ <handler
+ class="org.eclipse.tcf.te.tcf.processes.ui.handler.DetachHandler"
+ commandId="org.eclipse.tcf.te.launch.command.detach">
+ <activeWhen>
+ <with variable="activePartId">
+ <or>
+ <equals value="org.eclipse.tcf.te.ui.views.View"/>
+ <equals value="org.eclipse.tcf.te.ui.views.Editor"/>
+ </or>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <with variable="selection">
+ <count value="+"/>
+ <iterate operator="and" ifEmpty="false">
+ <adapt type="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode">
+ <test property="org.eclipse.tcf.te.tcf.processes.ui.model.isAttached" value="true"/>
+ </adapt>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
+ <handler
+ class="org.eclipse.tcf.te.tcf.processes.ui.handler.TerminateHandler"
+ commandId="org.eclipse.tcf.te.launch.command.terminate">
+ <activeWhen>
+ <with variable="activePartId">
+ <or>
+ <equals value="org.eclipse.tcf.te.ui.views.View"/>
+ <equals value="org.eclipse.tcf.te.ui.views.Editor"/>
+ </or>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <with variable="selection">
+ <count value="+"/>
+ <iterate ifEmpty="false" operator="and">
+ <adapt type="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode">
+ </adapt>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
+
+ <handler
+ class="org.eclipse.tcf.te.tcf.processes.ui.handler.RefreshHandler"
+ commandId="org.eclipse.tcf.te.ui.command.refresh">
+ <activeWhen>
+ <with variable="activePartId">
+ <or>
+ <equals value="org.eclipse.tcf.te.ui.views.View"/>
+ <equals value="org.eclipse.tcf.te.ui.views.Editor"/>
+ </or>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <with variable="selection">
+ <count value="+"/>
+ <iterate ifEmpty="false" operator="and">
+ <or>
+ <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeModel"/>
+ <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"/>
+ </or>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
+ </extension>
+
+<!-- Reusable core expression fragments -->
+ <extension point="org.eclipse.core.expressions.definitions">
+
+ <!--
+ Expression to test if the selection contains single process tree nodes only.
+ -->
+ <definition id="te.expressions.processes.isProcessTreeNode">
+ <with variable="selection">
+ <count value="+"/>
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"/>
+ </iterate>
+ </with>
+ </definition>
+
+ </extension>
+
+<!-- Column viewer contributions -->
+ <extension point="org.eclipse.tcf.te.ui.viewers">
+ <viewer
+ autoExpandLevel="0"
+ contentProvider="org.eclipse.tcf.te.tcf.processes.ui.editor.tree.ContentProvider"
+ id="org.eclipse.tcf.te.ui.controls.viewer.processes"
+ persistent="true">
+ <creation>
+ <style name="SWT.FULL_SELECTION"/>
+ <style name="SWT.MULTI"/>
+ </creation>
+ </viewer>
+ <columnContribution viewerId="org.eclipse.tcf.te.ui.controls.viewer.processes">
+ <column
+ comparator="org.eclipse.tcf.te.tcf.processes.ui.internal.columns.ProcessComparator"
+ id="name"
+ labelProvider="org.eclipse.tcf.te.tcf.processes.ui.navigator.runtime.LabelProviderDelegate"
+ moveable="true"
+ name="%column.name.name"
+ resizable="true"
+ visible="true"
+ width="250">
+ </column>
+ <column
+ comparator="org.eclipse.tcf.te.tcf.processes.ui.internal.columns.PIDComparator"
+ id="pid"
+ labelProvider="org.eclipse.tcf.te.tcf.processes.ui.internal.columns.PIDLabelProvider"
+ moveable="true"
+ name="%column.name.pid"
+ resizable="true"
+ style="SWT.RIGHT"
+ visible="true"
+ width="50">
+ </column>
+ <column
+ comparator="org.eclipse.tcf.te.tcf.processes.ui.internal.columns.PPIDComparator"
+ id="ppid"
+ labelProvider="org.eclipse.tcf.te.tcf.processes.ui.internal.columns.PPIDLabelProvider"
+ moveable="true"
+ name="%column.name.ppid"
+ resizable="true"
+ style="SWT.RIGHT"
+ visible="true"
+ width="50">
+ </column>
+ <column
+ comparator="org.eclipse.tcf.te.tcf.processes.ui.internal.columns.StateComparator"
+ id="state"
+ labelProvider="org.eclipse.tcf.te.tcf.processes.ui.internal.columns.StateLabelProvider"
+ moveable="true"
+ name="%column.name.state"
+ resizable="true"
+ style="SWT.RIGHT"
+ visible="true"
+ width="50">
+ </column>
+ <column
+ comparator="org.eclipse.tcf.te.tcf.processes.ui.internal.columns.UserComparator"
+ id="user"
+ labelProvider="org.eclipse.tcf.te.tcf.processes.ui.internal.columns.UserLabelProvider"
+ moveable="true"
+ name="%column.name.user"
+ resizable="true"
+ style="SWT.RIGHT"
+ visible="true"
+ width="100">
+ </column>
+ </columnContribution>
+ <filterContribution
+ viewerId="org.eclipse.tcf.te.ui.controls.viewer.processes">
+ <filter
+ class="org.eclipse.tcf.te.tcf.processes.ui.internal.filters.SingleThreadFilter"
+ description="%singlethreadfilter.description"
+ enabled="true"
+ id="org.eclipse.tcf.te.tcf.processes.ui.navigator.filter.singleThread"
+ name="%singlethreadfilter.name">
+ </filter>
+ </filterContribution>
+ </extension>
+
+<!-- Preference contributions -->
+ <extension point="org.eclipse.core.runtime.preferences">
+ <initializer class="org.eclipse.tcf.te.tcf.processes.ui.internal.preferences.PreferencesInitializer"/>
+ </extension>
+
+<!-- Tabbed properties view contributions -->
+ <extension point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
+ <propertyTabs contributorId="org.eclipse.tcf.te.ui">
+ <propertyTab
+ category="org.eclipse.tcf.te"
+ id="org.eclipse.tcf.te.tcf.processes.ui.propertytab.general"
+ label="%propertyTab.general.label">
+ </propertyTab>
+ <propertyTab
+ afterTab="org.eclipse.tcf.te.tcf.processes.ui.propertytab.general"
+ category="org.eclipse.tcf.te"
+ id="org.eclipse.tcf.te.tcf.processes.ui.propertytab.context"
+ label="%propertyTab.context.label">
+ </propertyTab>
+ <propertyTab
+ afterTab="org.eclipse.tcf.te.tcf.processes.ui.propertytab.context"
+ category="org.eclipse.tcf.te"
+ id="org.eclipse.tcf.te.tcf.processes.ui.propertytab.advanced"
+ label="%propertyTab.advanced.label">
+ </propertyTab>
+ </propertyTabs>
+ </extension>
+
+ <extension point="org.eclipse.ui.views.properties.tabbed.propertySections">
+ <propertySections contributorId="org.eclipse.tcf.te.ui">
+ <propertySection
+ class="org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed.BasicInformationSection"
+ enablesFor="1"
+ id="org.eclipse.tcf.te.tcf.processes.ui.propertysection.general.basic"
+ tab="org.eclipse.tcf.te.tcf.processes.ui.propertytab.general">
+ <input type="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"/>
+ </propertySection>
+ <propertySection
+ afterSection="org.eclipse.tcf.te.tcf.processes.ui.propertysection.general.basic"
+ class="org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed.IDSection"
+ enablesFor="1"
+ id="org.eclipse.tcf.te.tcf.processes.ui.propertysection.general.id"
+ tab="org.eclipse.tcf.te.tcf.processes.ui.propertytab.general">
+ <input type="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"/>
+ </propertySection>
+ <propertySection
+ class="org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed.BasicContextSection"
+ enablesFor="1"
+ id="org.eclipse.tcf.te.tcf.processes.ui.propertysection.context.basicContext"
+ tab="org.eclipse.tcf.te.tcf.processes.ui.propertytab.context">
+ <input type="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"/>
+ </propertySection>
+ <propertySection
+ afterSection="org.eclipse.tcf.te.tcf.processes.ui.propertysection.context.basicContext"
+ class="org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed.ContextIDSection"
+ enablesFor="1"
+ id="org.eclipse.tcf.te.tcf.processes.ui.propertysection.context.contextId"
+ tab="org.eclipse.tcf.te.tcf.processes.ui.propertytab.context">
+ <input type="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"/>
+ </propertySection>
+ <propertySection
+ afterSection="org.eclipse.tcf.te.tcf.processes.ui.propertysection.context.contextId"
+ class="org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed.MemorySection"
+ enablesFor="1"
+ id="org.eclipse.tcf.te.tcf.processes.ui.propertysection.context.memory"
+ tab="org.eclipse.tcf.te.tcf.processes.ui.propertytab.context">
+ <input type="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"/>
+ </propertySection>
+ <propertySection
+ class="org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed.AdvancedPropertiesSection"
+ enablesFor="1"
+ id="org.eclipse.tcf.te.tcf.processes.ui.propertysection.advanced"
+ tab="org.eclipse.tcf.te.tcf.processes.ui.propertytab.advanced">
+ <input type="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"/>
+ </propertySection>
+ </propertySections>
+ </extension>
+
+<!-- Property page contributions -->
+ <extension point="org.eclipse.ui.propertyPages">
+ <page
+ class="org.eclipse.tcf.te.tcf.processes.ui.internal.properties.AdvancedPropertiesPage"
+ id="org.eclipse.tcf.te.tcf.processes.ui.pages.advanced"
+ name="%page.properties.name">
+ <enabledWhen>
+ <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"/>
+ </enabledWhen>
+ </page>
+ <page
+ class="org.eclipse.tcf.te.tcf.processes.ui.internal.properties.ContextPage"
+ id="org.eclipse.tcf.te.tcf.processes.ui.pages.context"
+ name="%page.context.name">
+ <enabledWhen>
+ <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"/>
+ </enabledWhen>
+ </page>
+ <page
+ class="org.eclipse.tcf.te.tcf.processes.ui.internal.properties.GeneralInformationPage"
+ id="org.eclipse.tcf.te.tcf.processes.ui.pages.basic"
+ name="%page.basic.name">
+ <enabledWhen>
+ <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"/>
+ </enabledWhen>
+ </page>
+ </extension>
+
+</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/activator/UIPlugin.java
index 43e3231d1..06b3153ff 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/activator/UIPlugin.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/activator/UIPlugin.java
@@ -1,130 +1,134 @@
-/*******************************************************************************
- * 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.processes.ui.activator;
-
-import java.net.URL;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.tcf.te.tcf.processes.ui.interfaces.ImageConsts;
-import org.eclipse.tcf.te.ui.jface.images.AbstractImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class UIPlugin extends AbstractUIPlugin {
- // The shared instance
- private static UIPlugin plugin;
-
- /**
- * The constructor
- */
- public UIPlugin() {
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static UIPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Convenience method which returns the unique identifier of this plugin.
- */
- public static String getUniqueIdentifier() {
- if (getDefault() != null && getDefault().getBundle() != null) {
- return getDefault().getBundle().getSymbolicName();
- }
- return "org.eclipse.tcf.te.tcf.processes.ui"; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry)
- */
- @Override
- protected void initializeImageRegistry(ImageRegistry registry) {
- URL url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ + "process.png"); //$NON-NLS-1$
- registry.put(ImageConsts.OBJ_Process, ImageDescriptor.createFromURL(url));
- url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ + "thread.gif"); //$NON-NLS-1$
- registry.put(ImageConsts.OBJ_Thread, ImageDescriptor.createFromURL(url));
- url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ + "process_root.gif"); //$NON-NLS-1$
- registry.put(ImageConsts.OBJ_Process_Root, ImageDescriptor.createFromURL(url));
- url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ + "process_polling.png"); //$NON-NLS-1$
- registry.put(ImageConsts.PM_POLLING, ImageDescriptor.createFromURL(url));
- }
-
- /**
- * Loads the image registered under the specified key from the image
- * registry and returns the <code>Image</code> object instance.
- *
- * @param key The key the image is registered with.
- * @return The <code>Image</code> object instance or <code>null</code>.
- */
- public static Image getImage(String key) {
- return getDefault().getImageRegistry().get(key);
- }
-
- /**
- * Loads the image registered under the specified key from the image
- * registry and returns the <code>ImageDescriptor</code> object instance.
- *
- * @param key The key the image is registered with.
- * @return The <code>ImageDescriptor</code> object instance or <code>null</code>.
- */
- public static ImageDescriptor getImageDescriptor(String key) {
- return getDefault().getImageRegistry().getDescriptor(key);
- }
-
- /**
- * Loads the image given by the specified image descriptor from the image
- * registry. If the image has been loaded ones before already, the cached
- * <code>Image</code> object instance is returned. Otherwise, the <code>
- * Image</code> object instance will be created and cached before returned.
- *
- * @param descriptor The image descriptor.
- * @return The corresponding <code>Image</code> object instance or <code>null</code>.
- */
- public static Image getSharedImage(AbstractImageDescriptor descriptor) {
- ImageRegistry registry = getDefault().getImageRegistry();
-
- String imageKey = descriptor.getDecriptorKey();
- Image image = registry.get(imageKey);
- if (image == null) {
- registry.put(imageKey, descriptor);
- image = registry.get(imageKey);
- }
-
- return image;
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.activator;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.tcf.te.runtime.model.MessageModelNode;
+import org.eclipse.tcf.te.tcf.processes.ui.interfaces.ImageConsts;
+import org.eclipse.tcf.te.ui.jface.images.AbstractImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class UIPlugin extends AbstractUIPlugin {
+ // The shared instance
+ private static UIPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public UIPlugin() {
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static UIPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Convenience method which returns the unique identifier of this plugin.
+ */
+ public static String getUniqueIdentifier() {
+ if (getDefault() != null && getDefault().getBundle() != null) {
+ return getDefault().getBundle().getSymbolicName();
+ }
+ return "org.eclipse.tcf.te.tcf.processes.ui"; //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry)
+ */
+ @Override
+ protected void initializeImageRegistry(ImageRegistry registry) {
+ URL url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ + "process.png"); //$NON-NLS-1$
+ registry.put(ImageConsts.OBJ_Process, ImageDescriptor.createFromURL(url));
+ url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ + "thread.gif"); //$NON-NLS-1$
+ registry.put(ImageConsts.OBJ_Thread, ImageDescriptor.createFromURL(url));
+ url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ + "process_root.gif"); //$NON-NLS-1$
+ registry.put(ImageConsts.OBJ_Process_Root, ImageDescriptor.createFromURL(url));
+ url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ + "process_polling.png"); //$NON-NLS-1$
+ registry.put(ImageConsts.PM_POLLING, ImageDescriptor.createFromURL(url));
+
+ url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ + "pending.gif"); //$NON-NLS-1$
+ registry.put(MessageModelNode.OBJECT_MESSAGE_PENDING_ID, ImageDescriptor.createFromURL(url));
+ }
+
+ /**
+ * Loads the image registered under the specified key from the image
+ * registry and returns the <code>Image</code> object instance.
+ *
+ * @param key The key the image is registered with.
+ * @return The <code>Image</code> object instance or <code>null</code>.
+ */
+ public static Image getImage(String key) {
+ return getDefault().getImageRegistry().get(key);
+ }
+
+ /**
+ * Loads the image registered under the specified key from the image
+ * registry and returns the <code>ImageDescriptor</code> object instance.
+ *
+ * @param key The key the image is registered with.
+ * @return The <code>ImageDescriptor</code> object instance or <code>null</code>.
+ */
+ public static ImageDescriptor getImageDescriptor(String key) {
+ return getDefault().getImageRegistry().getDescriptor(key);
+ }
+
+ /**
+ * Loads the image given by the specified image descriptor from the image
+ * registry. If the image has been loaded ones before already, the cached
+ * <code>Image</code> object instance is returned. Otherwise, the <code>
+ * Image</code> object instance will be created and cached before returned.
+ *
+ * @param descriptor The image descriptor.
+ * @return The corresponding <code>Image</code> object instance or <code>null</code>.
+ */
+ public static Image getSharedImage(AbstractImageDescriptor descriptor) {
+ ImageRegistry registry = getDefault().getImageRegistry();
+
+ String imageKey = descriptor.getDecriptorKey();
+ Image image = registry.get(imageKey);
+ if (image == null) {
+ registry.put(imageKey, descriptor);
+ image = registry.get(imageKey);
+ }
+
+ return image;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/controls/ProcessNavigatorContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/controls/ProcessNavigatorContentProvider.java
deleted file mode 100644
index 80633075c..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/controls/ProcessNavigatorContentProvider.java
+++ /dev/null
@@ -1,81 +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.processes.ui.controls;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.ITreeNodeModel;
-import org.eclipse.tcf.te.tcf.filesystem.ui.controls.NavigatorContentProvider;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessModel;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.navigator.NavigatorFilterService;
-import org.eclipse.ui.navigator.ICommonContentExtensionSite;
-import org.eclipse.ui.navigator.ICommonContentProvider;
-import org.eclipse.ui.navigator.INavigatorContentService;
-import org.eclipse.ui.navigator.INavigatorFilterService;
-
-
-/**
- * Processes content provider for the common navigator of Target Explorer.
- */
-@SuppressWarnings("restriction")
-public class ProcessNavigatorContentProvider extends NavigatorContentProvider implements ICommonContentProvider {
- // The "Single Thread" filter id
- private final static String SINGLE_THREAD_FILTER_ID = "org.eclipse.tcf.te.tcf.processes.ui.navigator.filter.singleThread"; //$NON-NLS-1$
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.filesystem.ui.controls.NavigatorContentProvider#doGetModel(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel)
- */
- @Override
- protected ITreeNodeModel doGetModel(IPeerModel peerNode) {
- return ProcessModel.getProcessModel(peerNode);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.navigator.ICommonContentProvider#init(org.eclipse.ui.navigator.ICommonContentExtensionSite)
- */
- @Override
- public void init(ICommonContentExtensionSite config) {
- Assert.isNotNull(config);
-
- // Make sure that the hidden "Single Thread" filter is active
- INavigatorContentService cs = config.getService();
- INavigatorFilterService fs = cs != null ? cs.getFilterService() : null;
- if (fs != null && !fs.isActive(SINGLE_THREAD_FILTER_ID)) {
- if (fs instanceof NavigatorFilterService) {
- final NavigatorFilterService navFilterService = (NavigatorFilterService)fs;
- navFilterService.addActiveFilterIds(new String[] { SINGLE_THREAD_FILTER_ID });
- Display display = PlatformUI.getWorkbench().getDisplay();
- display.asyncExec(new Runnable(){
- @Override
- public void run() {
- navFilterService.updateViewer();
- }});
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.navigator.IMementoAware#restoreState(org.eclipse.ui.IMemento)
- */
- @Override
- public void restoreState(IMemento aMemento) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.navigator.IMementoAware#saveState(org.eclipse.ui.IMemento)
- */
- @Override
- public void saveState(IMemento aMemento) {
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/controls/ProcessTreeContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/controls/ProcessTreeContentProvider.java
deleted file mode 100644
index 0285dcec1..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/controls/ProcessTreeContentProvider.java
+++ /dev/null
@@ -1,60 +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.processes.ui.controls;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessModel;
-
-
-/**
- * Process tree control content provider implementation.
- */
-public class ProcessTreeContentProvider extends ProcessNavigatorContentProvider {
- // The target's peer model.
- private IPeerModel peerModel;
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.trees.TreeContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- super.inputChanged(viewer, oldInput, newInput);
- if(newInput instanceof IPeerModel) {
- peerModel = (IPeerModel) newInput;
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.trees.TreeContentProvider#dispose()
- */
- @Override
- public void dispose() {
- super.dispose();
- if(peerModel != null) {
- ProcessModel model = ProcessModel.getProcessModel(peerModel);
- if(!model.isRefreshStopped()) {
- // If the model is auto refreshing, then stop it when the editor is disposed.
- model.setInterval(0);
- }
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.processes.ui.controls.ProcessNavigatorContentProvider#isRootNodeVisible()
- */
- @Override
- protected boolean isRootNodeVisible() {
- return false;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/controls/ProcessViewerSorter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/controls/ProcessViewerSorter.java
deleted file mode 100644
index 09a45c667..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/controls/ProcessViewerSorter.java
+++ /dev/null
@@ -1,35 +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.processes.ui.controls;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.ui.internal.columns.ProcessComparator;
-import org.eclipse.tcf.te.ui.trees.TreeViewerSorter;
-
-/**
- * The common sorter for the process contribution to the target explorer.
- */
-public class ProcessViewerSorter extends TreeViewerSorter {
- private ProcessComparator comparator = new ProcessComparator();
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.viewers.Viewer,
- * java.lang.Object, java.lang.Object)
- */
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
- if (e1 instanceof ProcessTreeNode && e2 instanceof ProcessTreeNode) {
- return comparator.compare((ProcessTreeNode) e1, (ProcessTreeNode) e2);
- }
- return super.compare(viewer, e1, e2);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/pages/ProcessMonitorEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/ProcessMonitorEditorPage.java
index d1caf2d1c..3f732cf6c 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/pages/ProcessMonitorEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/ProcessMonitorEditorPage.java
@@ -1,70 +1,99 @@
-/*******************************************************************************
- * 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.processes.ui.internal.pages;
-
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessModel;
-import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
-import org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage;
-
-/**
- * The editor page for Process Monitor.
- */
-public class ProcessMonitorEditorPage extends TreeViewerExplorerEditorPage {
- // The decorator used to decorate the title bar.
- private ILabelDecorator decorator = new ProcessMonitorTitleDecorator();
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage#getViewerId()
- */
- @Override
- protected String getViewerId() {
- return "org.eclipse.tcf.te.ui.controls.viewer.processes"; //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getFormTitle()
- */
- @Override
- protected String getFormTitle() {
- return Messages.ProcessMonitorEditorPage_PageTitle;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getContextHelpId()
- */
- @Override
- protected String getContextHelpId() {
- return "org.eclipse.tcf.te.tcf.processes.ui.ProcessExplorerEditorPage"; //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage#getTitleBarDecorator()
- */
- @Override
- protected ILabelDecorator getTitleBarDecorator() {
- return decorator;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage#getViewerInput()
- */
- @Override
- protected Object getViewerInput() {
- IPeerModel peerModel = (IPeerModel) getEditorInputNode();
- return ProcessModel.getProcessModel(peerModel).getRoot();
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.editor;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.ILabelDecorator;
+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.IPeerModel;
+import org.eclipse.tcf.te.tcf.processes.core.model.ModelManager;
+import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.trees.TreeControl;
+import org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage;
+
+/**
+ * The editor page for Process Monitor.
+ */
+public class ProcessMonitorEditorPage extends TreeViewerExplorerEditorPage {
+ // The decorator used to decorate the title bar.
+ private ILabelDecorator decorator = new ProcessMonitorTitleDecorator();
+ // The event listener instance
+ private ProcessMonitorEventListener listener = null;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage#dispose()
+ */
+ @Override
+ public void dispose() {
+ if (listener != null) {
+ EventManager.getInstance().removeEventListener(listener);
+ listener = null;
+ }
+ super.dispose();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage#getViewerId()
+ */
+ @Override
+ protected String getViewerId() {
+ return "org.eclipse.tcf.te.ui.controls.viewer.processes"; //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getFormTitle()
+ */
+ @Override
+ protected String getFormTitle() {
+ return Messages.ProcessMonitorEditorPage_PageTitle;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getContextHelpId()
+ */
+ @Override
+ protected String getContextHelpId() {
+ return "org.eclipse.tcf.te.tcf.processes.ui.ProcessExplorerEditorPage"; //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage#getTitleBarDecorator()
+ */
+ @Override
+ protected ILabelDecorator getTitleBarDecorator() {
+ return decorator;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage#doCreateTreeControl()
+ */
+ @Override
+ protected TreeControl doCreateTreeControl() {
+ TreeControl treeControl = super.doCreateTreeControl();
+ Assert.isNotNull(treeControl);
+
+ if (listener == null) {
+ listener = new ProcessMonitorEventListener(treeControl);
+ EventManager.getInstance().addEventListener(listener, ChangeEvent.class);
+ }
+
+ return treeControl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage#getViewerInput()
+ */
+ @Override
+ protected Object getViewerInput() {
+ IPeerModel peerModel = (IPeerModel) getEditorInputNode();
+ return ModelManager.getRuntimeModel(peerModel);
+ }
+}
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
new file mode 100644
index 000000000..0e83899ad
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/ProcessMonitorEventListener.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 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.processes.ui.editor;
+
+import java.util.EventObject;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.tcf.te.runtime.events.ChangeEvent;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeModel;
+import org.eclipse.tcf.te.ui.events.AbstractEventListener;
+import org.eclipse.tcf.te.ui.trees.TreeControl;
+
+/**
+ * Process monitor page event listener implementation.
+ */
+public class ProcessMonitorEventListener extends AbstractEventListener {
+ // Reference to the parent tree control
+ private final TreeControl treeControl;
+
+ /**
+ * Constructor.
+ *
+ * @param treeControl The parent tree control. Must not be <code>null</code>.
+ */
+ public ProcessMonitorEventListener(TreeControl treeControl) {
+ Assert.isNotNull(treeControl);
+ this.treeControl = treeControl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.interfaces.events.IEventListener#eventFired(java.util.EventObject)
+ */
+ @Override
+ public void eventFired(EventObject event) {
+ if (event instanceof ChangeEvent) {
+ final ChangeEvent changeEvent = (ChangeEvent)event;
+ final Object source = changeEvent.getSource();
+
+ // Property changes for the runtime model refreshes the whole tree.
+ if (source instanceof IRuntimeModel) {
+ treeControl.getViewer().refresh();
+ }
+
+ // Property changes for individual context nodes refreshes the node only
+ else if (source instanceof IProcessContextNode) {
+ if ("expanded".equals(changeEvent.getEventId())) { //$NON-NLS-1$
+ // Expansion state of the node changed.
+ boolean expanded = ((Boolean)changeEvent.getNewValue()).booleanValue();
+ // Update the nodes expansion state
+ ((TreeViewer)treeControl.getViewer()).setExpandedState(source, expanded);
+ } else {
+ ((TreeViewer)treeControl.getViewer()).refresh(source, true);
+ }
+ }
+ }
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/pages/ProcessMonitorTitleDecorator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/ProcessMonitorTitleDecorator.java
index fa9f7284d..97e6e62b8 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/pages/ProcessMonitorTitleDecorator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/ProcessMonitorTitleDecorator.java
@@ -1,66 +1,62 @@
-/*******************************************************************************
- * 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.processes.ui.internal.pages;
-
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessModel;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.ui.activator.UIPlugin;
-import org.eclipse.tcf.te.ui.jface.images.AbstractImageDescriptor;
-
-/**
- * The title bar decorator for Process Monitor.
- */
-public class ProcessMonitorTitleDecorator extends LabelProvider implements ILabelDecorator {
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.ILabelDecorator#decorateImage(org.eclipse.swt.graphics.Image, java.lang.Object)
- */
- @Override
- public Image decorateImage(Image image, Object element) {
- if(element instanceof ProcessTreeNode) {
- ProcessTreeNode node = (ProcessTreeNode) element;
- IPeerModel peerModel = node.peerNode;
- ProcessModel pModel = ProcessModel.getProcessModel(peerModel);
- if(!pModel.isRefreshStopped()) {
- Image decoratedImage = image;
- if (image != null) {
- AbstractImageDescriptor descriptor = new RefreshingImageDescriptor(UIPlugin.getDefault().getImageRegistry(), image);
- decoratedImage = UIPlugin.getSharedImage(descriptor);
- }
- return decoratedImage;
- }
- return image;
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.ILabelDecorator#decorateText(java.lang.String, java.lang.Object)
- */
- @Override
- public String decorateText(String text, Object element) {
- if(element instanceof ProcessTreeNode) {
- ProcessTreeNode node = (ProcessTreeNode) element;
- IPeerModel peerModel = node.peerNode;
- ProcessModel pModel = ProcessModel.getProcessModel(peerModel);
- if(!pModel.isRefreshStopped()) {
- return text + " [Auto Refreshing]"; //$NON-NLS-1$
- }
- return text;
- }
- return null;
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.editor;
+
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeModel;
+import org.eclipse.tcf.te.tcf.processes.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.ui.jface.images.AbstractImageDescriptor;
+
+/**
+ * The title bar decorator for Process Monitor.
+ */
+public class ProcessMonitorTitleDecorator extends LabelProvider implements ILabelDecorator {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelDecorator#decorateImage(org.eclipse.swt.graphics.Image, java.lang.Object)
+ */
+ @Override
+ public Image decorateImage(Image image, Object element) {
+ if (element instanceof IProcessContextNode) {
+ IProcessContextNode node = (IProcessContextNode) element;
+ IRuntimeModel model = node.getParent(IRuntimeModel.class);
+ if (model.getAutoRefreshInterval() > 0) {
+ Image decoratedImage = image;
+ if (image != null) {
+ AbstractImageDescriptor descriptor = new RefreshingImageDescriptor(UIPlugin
+ .getDefault().getImageRegistry(), image);
+ decoratedImage = UIPlugin.getSharedImage(descriptor);
+ }
+ return decoratedImage;
+ }
+ return image;
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelDecorator#decorateText(java.lang.String, java.lang.Object)
+ */
+ @Override
+ public String decorateText(String text, Object element) {
+ if (element instanceof IProcessContextNode) {
+ IProcessContextNode node = (IProcessContextNode) element;
+ IRuntimeModel model = node.getParent(IRuntimeModel.class);
+ if (model.getAutoRefreshInterval() > 0) {
+ return text + " [Auto Refreshing]"; //$NON-NLS-1$
+ }
+ return text;
+ }
+ return null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/pages/RefreshingImageDescriptor.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/RefreshingImageDescriptor.java
index 7a49799b3..afb0ace4a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/pages/RefreshingImageDescriptor.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/RefreshingImageDescriptor.java
@@ -8,7 +8,7 @@
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.tcf.te.tcf.processes.ui.internal.pages;
+package org.eclipse.tcf.te.tcf.processes.ui.editor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/tree/ContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/tree/ContentProvider.java
new file mode 100644
index 000000000..a557ac2b2
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/editor/tree/ContentProvider.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * 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.processes.ui.editor.tree;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.processes.core.model.ModelManager;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeModel;
+import org.eclipse.tcf.te.tcf.processes.ui.navigator.runtime.ContentProviderDelegate;
+
+/**
+ * Process tree control content provider implementation.
+ */
+public class ContentProvider extends ContentProviderDelegate {
+ // The target's peer model.
+ private IPeerModel peerModel;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.processes.ui.navigator.runtime.ContentProviderDelegate#dispose()
+ */
+ @Override
+ public void dispose() {
+ if (peerModel != null) {
+ IRuntimeModel model = ModelManager.getRuntimeModel(peerModel);
+ if (model != null && model.getAutoRefreshInterval() > 0) {
+ // If the model is auto refreshing, then stop it when the editor is disposed.
+ model.setAutoRefreshInterval(0);
+ }
+ ModelManager.disposeRuntimeModel(peerModel);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.processes.ui.navigator.runtime.ContentProviderDelegate#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ super.inputChanged(viewer, oldInput, newInput);
+ if (newInput instanceof IPeerModel) {
+ peerModel = (IPeerModel) newInput;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.processes.ui.navigator.runtime.ContentProviderDelegate#isRuntimeModelNodeVisible()
+ */
+ @Override
+ protected boolean isRuntimeModelNodeVisible() {
+ return false;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/handler/AttachHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/AttachHandler.java
index 0fdf4e66f..6f2771bb4 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/handler/AttachHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/AttachHandler.java
@@ -1,130 +1,130 @@
-/*******************************************************************************
- * Copyright (c) 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.processes.ui.internal.handler;
-
-import java.util.Iterator;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.Command;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.ParameterizedCommand;
-import org.eclipse.core.expressions.EvaluationContext;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.runtime.callback.Callback;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.core.model.steps.AttachStep;
-import org.eclipse.tcf.te.tcf.processes.ui.activator.UIPlugin;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.ICommandService;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.handlers.IHandlerService;
-
-/**
- * Attach to process command handler implementation.
- */
-public class AttachHandler extends AbstractHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- @Override
- public Object execute(final ExecutionEvent event) throws ExecutionException {
- final ISelection selection = HandlerUtil.getCurrentSelection(event);
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- Iterator<?> iterator = ((IStructuredSelection)selection).iterator();
- while (iterator.hasNext()) {
- final Object candidate = iterator.next();
- if (candidate instanceof ProcessTreeNode) {
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- ProcessTreeNode node = (ProcessTreeNode)candidate;
- doAttach(event, node);
- }
- };
-
- Protocol.invokeLater(runnable);
- }
- }
- }
-
- return null;
- }
-
- /**
- * Executes the attach to the given node.
- * <p>
- * <b>Note:</b> This method must be called from within the TCF dispatch thread.
- *
- * @param event The execution event.
- * @param node The context to attach. Must not be <code>null</code>.
- */
- protected void doAttach(final ExecutionEvent event, final ProcessTreeNode node) {
- Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
- Assert.isNotNull(node);
-
- AttachStep step = new AttachStep();
- step.executeAttach(node, new Callback() {
- @Override
- protected void internalDone(Object caller, IStatus status) {
- if (status.getSeverity() == IStatus.OK) {
- // Get the launch instance from the callback properties
- Object launch = getProperty("launch"); //$NON-NLS-1$
- if (launch != null) {
- ICommandService service = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class);
- Command command = service != null ? service.getCommand("org.eclipse.tcf.te.launch.command.showInDebugView") : null; //$NON-NLS-1$
- if (command != null && command.isDefined() && command.isEnabled()) {
- try {
- ISelection selection = HandlerUtil.getCurrentSelection(event);
- EvaluationContext ctx = new EvaluationContext(null, selection);
- ctx.addVariable("launch", launch); //$NON-NLS-1$
- ctx.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, selection);
- ctx.addVariable(ISources.ACTIVE_MENU_SELECTION_NAME, selection);
- ctx.addVariable(ISources.ACTIVE_WORKBENCH_WINDOW_NAME, HandlerUtil.getActiveWorkbenchWindow(event));
- IWorkbenchPart part = HandlerUtil.getActivePart(event);
- if (part != null) {
- IWorkbenchPartSite site = part.getSite();
- ctx.addVariable(ISources.ACTIVE_PART_ID_NAME, site.getId());
- ctx.addVariable(ISources.ACTIVE_PART_NAME, part);
- ctx.addVariable(ISources.ACTIVE_SITE_NAME, site);
- ctx.addVariable(ISources.ACTIVE_SHELL_NAME, site.getShell());
- }
- ctx.setAllowPluginActivation(true);
-
- ParameterizedCommand pCmd = ParameterizedCommand.generateCommand(command, null);
- Assert.isNotNull(pCmd);
- IHandlerService handlerSvc = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
- Assert.isNotNull(handlerSvc);
- handlerSvc.executeCommandInContext(pCmd, null, ctx);
- } catch (Exception e) {
- // If the platform is in debug mode, we print the exception to the log view
- if (Platform.inDebugMode()) {
- status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), e.getMessage(), e);
- UIPlugin.getDefault().getLog().log(status);
- }
- }
- }
-
- }
- }
- }
- });
- }
-}
+/*******************************************************************************
+ * Copyright (c) 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.processes.ui.handler;
+
+import java.util.Iterator;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.ParameterizedCommand;
+import org.eclipse.core.expressions.EvaluationContext;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.runtime.callback.Callback;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.steps.AttachStep;
+import org.eclipse.tcf.te.tcf.processes.ui.activator.UIPlugin;
+import org.eclipse.ui.ISources;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.handlers.IHandlerService;
+
+/**
+ * Attach to process command handler implementation.
+ */
+public class AttachHandler extends AbstractHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ final ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ Iterator<?> iterator = ((IStructuredSelection)selection).iterator();
+ while (iterator.hasNext()) {
+ final Object candidate = iterator.next();
+ if (candidate instanceof IProcessContextNode) {
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ IProcessContextNode node = (IProcessContextNode)candidate;
+ doAttach(event, node);
+ }
+ };
+
+ Protocol.invokeLater(runnable);
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Executes the attach to the given node.
+ * <p>
+ * <b>Note:</b> This method must be called from within the TCF dispatch thread.
+ *
+ * @param event The execution event.
+ * @param node The context to attach. Must not be <code>null</code>.
+ */
+ protected void doAttach(final ExecutionEvent event, final IProcessContextNode node) {
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
+ Assert.isNotNull(node);
+
+ AttachStep step = new AttachStep();
+ step.executeAttach(node, new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ if (status.getSeverity() == IStatus.OK) {
+ // Get the launch instance from the callback properties
+ Object launch = getProperty("launch"); //$NON-NLS-1$
+ if (launch != null) {
+ ICommandService service = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class);
+ Command command = service != null ? service.getCommand("org.eclipse.tcf.te.launch.command.showInDebugView") : null; //$NON-NLS-1$
+ if (command != null && command.isDefined() && command.isEnabled()) {
+ try {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ EvaluationContext ctx = new EvaluationContext(null, selection);
+ ctx.addVariable("launch", launch); //$NON-NLS-1$
+ ctx.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, selection);
+ ctx.addVariable(ISources.ACTIVE_MENU_SELECTION_NAME, selection);
+ ctx.addVariable(ISources.ACTIVE_WORKBENCH_WINDOW_NAME, HandlerUtil.getActiveWorkbenchWindow(event));
+ IWorkbenchPart part = HandlerUtil.getActivePart(event);
+ if (part != null) {
+ IWorkbenchPartSite site = part.getSite();
+ ctx.addVariable(ISources.ACTIVE_PART_ID_NAME, site.getId());
+ ctx.addVariable(ISources.ACTIVE_PART_NAME, part);
+ ctx.addVariable(ISources.ACTIVE_SITE_NAME, site);
+ ctx.addVariable(ISources.ACTIVE_SHELL_NAME, site.getShell());
+ }
+ ctx.setAllowPluginActivation(true);
+
+ ParameterizedCommand pCmd = ParameterizedCommand.generateCommand(command, null);
+ Assert.isNotNull(pCmd);
+ IHandlerService handlerSvc = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
+ Assert.isNotNull(handlerSvc);
+ handlerSvc.executeCommandInContext(pCmd, null, ctx);
+ } catch (Exception e) {
+ // If the platform is in debug mode, we print the exception to the log view
+ if (Platform.inDebugMode()) {
+ status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), e.getMessage(), e);
+ UIPlugin.getDefault().getLog().log(status);
+ }
+ }
+ }
+
+ }
+ }
+ }
+ });
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/handler/ConfigIntervalDynamicContribution.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/ConfigIntervalDynamicContribution.java
index 0ce9a7327..40f3e91e3 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/handler/ConfigIntervalDynamicContribution.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/ConfigIntervalDynamicContribution.java
@@ -1,268 +1,269 @@
-/*******************************************************************************
- * 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.processes.ui.internal.handler;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.commands.Command;
-import org.eclipse.core.commands.ParameterizedCommand;
-import org.eclipse.core.expressions.EvaluationContext;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.SafeRunner;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessModel;
-import org.eclipse.tcf.te.tcf.processes.ui.activator.UIPlugin;
-import org.eclipse.tcf.te.tcf.processes.ui.internal.preferences.IPreferenceConsts;
-import org.eclipse.tcf.te.tcf.processes.ui.internal.preferences.PreferencesInitializer;
-import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.CompoundContributionItem;
-import org.eclipse.ui.commands.ICommandService;
-import org.eclipse.ui.handlers.IHandlerService;
-
-/**
- * The dynamic contribution class to create a drop down menu of interval configuration.
- */
-public class ConfigIntervalDynamicContribution extends CompoundContributionItem implements IPreferenceConsts {
- private static final String CUSTOM_COMMAND_ID = "org.eclipse.tcf.te.tcf.processes.ui.command.refreshInterval"; //$NON-NLS-1$
- /**
- * The action to allow a most recently used interval to be selected.
- */
- static class MRUAction extends Action {
- // The process model.
- private ProcessModel model;
- // The interval of this most recently used item.
- private int seconds;
- /**
- * Constructor
- *
- * @param model The process model.
- * @param seconds The interval time.
- */
- public MRUAction(ProcessModel model, int seconds) {
- super("" + seconds + " s", AS_RADIO_BUTTON); //$NON-NLS-1$//$NON-NLS-2$
- this.seconds = seconds;
- this.model = model;
- if(model.getInterval() == seconds) {
- setChecked(true);
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
- @Override
- public void run() {
- if (isChecked()) {
- this.model.setInterval(seconds);
- }
- }
- }
-
- /**
- * The action to allow a speed grade to be selected.
- */
- static class GradeAction extends Action {
- // The process model.
- private ProcessModel model;
- // The interval time represented by this grade.
- private int seconds;
-
- /**
- * Constructor
- *
- * @param model The process model.
- * @param name The grade name.
- * @param seconds The interval time.
- */
- public GradeAction(ProcessModel model, String name, int seconds) {
- super(name + (seconds > 0 ? " (" + seconds + " s)" : ""), AS_RADIO_BUTTON); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- this.model = model;
- this.seconds = seconds;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
- @Override
- public void run() {
- if (isChecked()) {
- this.model.setInterval(seconds);
- PreferencesInitializer.addMRUInterval(seconds);
- }
- }
- }
-
-
- /**
- * The action to allow defining a custom interval.
- */
- static class CustomAction extends Action {
- /**
- * Constructor
- *
- * @param model The process model.
- * @param name The grade name.
- * @param seconds The interval time.
- */
- public CustomAction() {
- super(Messages.ConfigIntervalDynamicContribution_Custom, AS_RADIO_BUTTON);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
- @Override
- public void run() {
- if (isChecked()) {
- final IWorkbench workbench = PlatformUI.getWorkbench();
- ICommandService service = (ICommandService) workbench.getService(ICommandService.class);
- Command cmd = service != null ? service.getCommand(CUSTOM_COMMAND_ID) : null;
- if (cmd != null && cmd.isDefined() && cmd.isEnabled()) {
- final Command command = cmd;
- SafeRunner.run(new SafeRunnable() {
- @Override
- public void handleException(Throwable e) {
- // Ignore exception
- }
- @Override
- public void run() throws Exception {
- EvaluationContext ctx = new EvaluationContext(null, StructuredSelection.EMPTY);
- IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
- Shell shell = window.getShell();
- ctx.addVariable(ISources.ACTIVE_SHELL_NAME, shell);
- IEditorInput editorInput = window.getActivePage().getActiveEditor().getEditorInput();
- ctx.addVariable(ISources.ACTIVE_EDITOR_INPUT_NAME, editorInput);
- ctx.setAllowPluginActivation(true);
-
- ParameterizedCommand pCmd = ParameterizedCommand.generateCommand(command, null);
- Assert.isNotNull(pCmd);
- IHandlerService handlerSvc = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
- Assert.isNotNull(handlerSvc);
- handlerSvc.executeCommandInContext(pCmd, null, ctx);
- }
- });
- }
- }
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
- */
- @Override
- protected IContributionItem[] getContributionItems() {
- IEditorInput editorInput = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorInput();
- IPeerModel peerModel = (IPeerModel) editorInput.getAdapter(IPeerModel.class);
- List<IContributionItem> items = new ArrayList<IContributionItem>();
- if (peerModel != null) {
- ProcessModel model = ProcessModel.getProcessModel(peerModel);
- List<IContributionItem> groupItems = createGradeActions(model);
- if(!groupItems.isEmpty()) {
- items.addAll(groupItems);
- }
- groupItems = createMRUActions(model);
- if(!groupItems.isEmpty()) {
- items.add(new Separator("MRU")); //$NON-NLS-1$
- items.addAll(groupItems);
- }
- }
- return items.toArray(new IContributionItem[items.size()]);
- }
-
- /**
- * Create and return the speed grade actions.
- *
- * @param model The current process model.
- * @return The grade action list.
- */
- private List<IContributionItem> createGradeActions(ProcessModel model) {
- List<IContributionItem> items = new ArrayList<IContributionItem>();
- IPreferenceStore prefStore = UIPlugin.getDefault().getPreferenceStore();
- String grades = prefStore.getString(PREF_INTERVAL_GRADES);
- Assert.isNotNull(grades);
- StringTokenizer st = new StringTokenizer(grades, "|"); //$NON-NLS-1$
- int current = model.getInterval();
- boolean custom = true;
- while(st.hasMoreTokens()) {
- String token = st.nextToken();
- StringTokenizer st2 = new StringTokenizer(token, ":"); //$NON-NLS-1$
- String name = st2.nextToken();
- String value = st2.nextToken();
- try{
- int seconds = Integer.parseInt(value);
- GradeAction action = new GradeAction(model, name, seconds);
- boolean checked = current == seconds;
- action.setChecked(checked);
- custom &= !checked;
- items.add(new ActionContributionItem(action));
- }
- catch (NumberFormatException nfe) {
- }
- }
- CustomAction action = new CustomAction();
- action.setChecked(custom);
- items.add(new ActionContributionItem(action));
- return items;
- }
-
- /**
- * Create and return the most recently used actions.
- *
- * @param model The current process model.
- * @return The MRU action list.
- */
- private List<IContributionItem> createMRUActions(ProcessModel model) {
- List<IContributionItem> items = new ArrayList<IContributionItem>();
- IPreferenceStore prefStore = UIPlugin.getDefault().getPreferenceStore();
- String mruList = prefStore.getString(PREF_INTERVAL_MRU_LIST);
- if (mruList != null) {
- StringTokenizer st = new StringTokenizer(mruList, ":"); //$NON-NLS-1$
- int maxCount = prefStore.getInt(PREF_INTERVAL_MRU_COUNT);
- int count = 0;
- List<Integer> mru = new ArrayList<Integer>();
- while (st.hasMoreTokens()) {
- String token = st.nextToken();
- try {
- int seconds = Integer.parseInt(token);
- mru.add(Integer.valueOf(seconds));
- count++;
- if (count >= maxCount) break;
- }
- catch (NumberFormatException nfe) {
- }
- }
- if(count > 0) {
- for(int seconds : mru) {
- items.add(new ActionContributionItem(new MRUAction(model, seconds)));
- }
- }
- }
- return items;
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.handler;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.ParameterizedCommand;
+import org.eclipse.core.expressions.EvaluationContext;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.util.SafeRunnable;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.processes.core.model.ModelManager;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeModel;
+import org.eclipse.tcf.te.tcf.processes.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.processes.ui.internal.preferences.IPreferenceConsts;
+import org.eclipse.tcf.te.tcf.processes.ui.internal.preferences.PreferencesInitializer;
+import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.ISources;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.CompoundContributionItem;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.handlers.IHandlerService;
+
+/**
+ * The dynamic contribution class to create a drop down menu of interval configuration.
+ */
+public class ConfigIntervalDynamicContribution extends CompoundContributionItem implements IPreferenceConsts {
+ private static final String CUSTOM_COMMAND_ID = "org.eclipse.tcf.te.tcf.processes.ui.command.refreshInterval"; //$NON-NLS-1$
+ /**
+ * The action to allow a most recently used interval to be selected.
+ */
+ static class MRUAction extends Action {
+ // The process model.
+ private IRuntimeModel model;
+ // The interval of this most recently used item.
+ private int seconds;
+ /**
+ * Constructor
+ *
+ * @param model The process model.
+ * @param seconds The interval time.
+ */
+ public MRUAction(IRuntimeModel model, int seconds) {
+ super("" + seconds + " s", AS_RADIO_BUTTON); //$NON-NLS-1$//$NON-NLS-2$
+ this.seconds = seconds;
+ this.model = model;
+ if(model.getAutoRefreshInterval() == seconds) {
+ setChecked(true);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ if (isChecked()) {
+ this.model.setAutoRefreshInterval(seconds);
+ }
+ }
+ }
+
+ /**
+ * The action to allow a speed grade to be selected.
+ */
+ static class GradeAction extends Action {
+ // The process model.
+ private IRuntimeModel model;
+ // The interval time represented by this grade.
+ private int seconds;
+
+ /**
+ * Constructor
+ *
+ * @param model The process model.
+ * @param name The grade name.
+ * @param seconds The interval time.
+ */
+ public GradeAction(IRuntimeModel model, String name, int seconds) {
+ super(name + (seconds > 0 ? " (" + seconds + " s)" : ""), AS_RADIO_BUTTON); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ this.model = model;
+ this.seconds = seconds;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ if (isChecked()) {
+ this.model.setAutoRefreshInterval(seconds);
+ PreferencesInitializer.addMRUInterval(seconds);
+ }
+ }
+ }
+
+
+ /**
+ * The action to allow defining a custom interval.
+ */
+ static class CustomAction extends Action {
+ /**
+ * Constructor
+ *
+ * @param model The process model.
+ * @param name The grade name.
+ * @param seconds The interval time.
+ */
+ public CustomAction() {
+ super(Messages.ConfigIntervalDynamicContribution_Custom, AS_RADIO_BUTTON);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ if (isChecked()) {
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+ ICommandService service = (ICommandService) workbench.getService(ICommandService.class);
+ Command cmd = service != null ? service.getCommand(CUSTOM_COMMAND_ID) : null;
+ if (cmd != null && cmd.isDefined() && cmd.isEnabled()) {
+ final Command command = cmd;
+ SafeRunner.run(new SafeRunnable() {
+ @Override
+ public void handleException(Throwable e) {
+ // Ignore exception
+ }
+ @Override
+ public void run() throws Exception {
+ EvaluationContext ctx = new EvaluationContext(null, StructuredSelection.EMPTY);
+ IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
+ Shell shell = window.getShell();
+ ctx.addVariable(ISources.ACTIVE_SHELL_NAME, shell);
+ IEditorInput editorInput = window.getActivePage().getActiveEditor().getEditorInput();
+ ctx.addVariable(ISources.ACTIVE_EDITOR_INPUT_NAME, editorInput);
+ ctx.setAllowPluginActivation(true);
+
+ ParameterizedCommand pCmd = ParameterizedCommand.generateCommand(command, null);
+ Assert.isNotNull(pCmd);
+ IHandlerService handlerSvc = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
+ Assert.isNotNull(handlerSvc);
+ handlerSvc.executeCommandInContext(pCmd, null, ctx);
+ }
+ });
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
+ */
+ @Override
+ protected IContributionItem[] getContributionItems() {
+ IEditorInput editorInput = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorInput();
+ IPeerModel peerModel = (IPeerModel) editorInput.getAdapter(IPeerModel.class);
+ List<IContributionItem> items = new ArrayList<IContributionItem>();
+ if (peerModel != null) {
+ IRuntimeModel model = ModelManager.getRuntimeModel(peerModel);
+ List<IContributionItem> groupItems = createGradeActions(model);
+ if(!groupItems.isEmpty()) {
+ items.addAll(groupItems);
+ }
+ groupItems = createMRUActions(model);
+ if(!groupItems.isEmpty()) {
+ items.add(new Separator("MRU")); //$NON-NLS-1$
+ items.addAll(groupItems);
+ }
+ }
+ return items.toArray(new IContributionItem[items.size()]);
+ }
+
+ /**
+ * Create and return the speed grade actions.
+ *
+ * @param model The current process model.
+ * @return The grade action list.
+ */
+ private List<IContributionItem> createGradeActions(IRuntimeModel model) {
+ List<IContributionItem> items = new ArrayList<IContributionItem>();
+ IPreferenceStore prefStore = UIPlugin.getDefault().getPreferenceStore();
+ String grades = prefStore.getString(PREF_INTERVAL_GRADES);
+ Assert.isNotNull(grades);
+ StringTokenizer st = new StringTokenizer(grades, "|"); //$NON-NLS-1$
+ int current = model.getAutoRefreshInterval();
+ boolean custom = true;
+ while(st.hasMoreTokens()) {
+ String token = st.nextToken();
+ StringTokenizer st2 = new StringTokenizer(token, ":"); //$NON-NLS-1$
+ String name = st2.nextToken();
+ String value = st2.nextToken();
+ try{
+ int seconds = Integer.parseInt(value);
+ GradeAction action = new GradeAction(model, name, seconds);
+ boolean checked = current == seconds;
+ action.setChecked(checked);
+ custom &= !checked;
+ items.add(new ActionContributionItem(action));
+ }
+ catch (NumberFormatException nfe) {
+ }
+ }
+ CustomAction action = new CustomAction();
+ action.setChecked(custom);
+ items.add(new ActionContributionItem(action));
+ return items;
+ }
+
+ /**
+ * Create and return the most recently used actions.
+ *
+ * @param model The current process model.
+ * @return The MRU action list.
+ */
+ private List<IContributionItem> createMRUActions(IRuntimeModel model) {
+ List<IContributionItem> items = new ArrayList<IContributionItem>();
+ IPreferenceStore prefStore = UIPlugin.getDefault().getPreferenceStore();
+ String mruList = prefStore.getString(PREF_INTERVAL_MRU_LIST);
+ if (mruList != null) {
+ StringTokenizer st = new StringTokenizer(mruList, ":"); //$NON-NLS-1$
+ int maxCount = prefStore.getInt(PREF_INTERVAL_MRU_COUNT);
+ int count = 0;
+ List<Integer> mru = new ArrayList<Integer>();
+ while (st.hasMoreTokens()) {
+ String token = st.nextToken();
+ try {
+ int seconds = Integer.parseInt(token);
+ mru.add(Integer.valueOf(seconds));
+ count++;
+ if (count >= maxCount) break;
+ }
+ catch (NumberFormatException nfe) {
+ }
+ }
+ if(count > 0) {
+ for(int seconds : mru) {
+ items.add(new ActionContributionItem(new MRUAction(model, seconds)));
+ }
+ }
+ }
+ return items;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/handler/ConfigRefreshIntervalHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/ConfigRefreshIntervalHandler.java
index f7dbc8c2b..fa6d5248f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/handler/ConfigRefreshIntervalHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/ConfigRefreshIntervalHandler.java
@@ -1,54 +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.processes.ui.internal.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessModel;
-import org.eclipse.tcf.te.tcf.processes.ui.internal.dialogs.IntervalConfigDialog;
-import org.eclipse.tcf.te.tcf.processes.ui.internal.preferences.PreferencesInitializer;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * The handler to configure the refreshing interval in a dialog.
- */
-public class ConfigRefreshIntervalHandler extends AbstractHandler {
-
- /*
- * (non-Javadoc)
- * @see
- * org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IEditorInput editorInput = HandlerUtil.getActiveEditorInputChecked(event);
- IPeerModel peer = (IPeerModel) editorInput.getAdapter(IPeerModel.class);
- if (peer != null) {
- Shell parent = HandlerUtil.getActiveShellChecked(event);
- IntervalConfigDialog dialog = new IntervalConfigDialog(parent);
- ProcessModel model = ProcessModel.getProcessModel(peer);
- int interval = model.getInterval();
- dialog.setResult(interval);
- if (dialog.open() == Window.OK) {
- interval = dialog.getResult();
- ProcessModel processModel = ProcessModel.getProcessModel(peer);
- processModel.setInterval(interval);
- PreferencesInitializer.addMRUInterval(interval);
- }
- }
- return null;
- }
-
-}
+/*******************************************************************************
+ * 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.processes.ui.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.processes.core.model.ModelManager;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeModel;
+import org.eclipse.tcf.te.tcf.processes.ui.internal.dialogs.IntervalConfigDialog;
+import org.eclipse.tcf.te.tcf.processes.ui.internal.preferences.PreferencesInitializer;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * The handler to configure the refreshing interval in a dialog.
+ */
+public class ConfigRefreshIntervalHandler extends AbstractHandler {
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IEditorInput editorInput = HandlerUtil.getActiveEditorInputChecked(event);
+ IPeerModel peer = (IPeerModel) editorInput.getAdapter(IPeerModel.class);
+ if (peer != null) {
+ Shell parent = HandlerUtil.getActiveShellChecked(event);
+ IntervalConfigDialog dialog = new IntervalConfigDialog(parent);
+ IRuntimeModel model = ModelManager.getRuntimeModel(peer);
+ int interval = model.getAutoRefreshInterval();
+ dialog.setResult(interval);
+ if (dialog.open() == Window.OK) {
+ interval = dialog.getResult();
+ model.setAutoRefreshInterval(interval);
+ PreferencesInitializer.addMRUInterval(interval);
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/handler/DetachHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/DetachHandler.java
index 317079231..fe7174567 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/handler/DetachHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/DetachHandler.java
@@ -1,56 +1,56 @@
-/*******************************************************************************
- * Copyright (c) 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.processes.ui.internal.handler;
-
-import java.util.Iterator;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.core.model.steps.DetachStep;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * Detach from process command handler implementation.
- */
-public class DetachHandler extends AbstractHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ISelection selection = HandlerUtil.getCurrentSelection(event);
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- Iterator<?> iterator = ((IStructuredSelection)selection).iterator();
- while (iterator.hasNext()) {
- final Object candidate = iterator.next();
- if (candidate instanceof ProcessTreeNode) {
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- DetachStep step = new DetachStep();
- step.executeDetach((ProcessTreeNode)candidate, null);
- }
- };
-
- Protocol.invokeLater(runnable);
- }
- }
- }
-
- return null;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 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.processes.ui.handler;
+
+import java.util.Iterator;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.steps.DetachStep;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * Detach from process command handler implementation.
+ */
+public class DetachHandler extends AbstractHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ Iterator<?> iterator = ((IStructuredSelection)selection).iterator();
+ while (iterator.hasNext()) {
+ final Object candidate = iterator.next();
+ if (candidate instanceof IProcessContextNode) {
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ DetachStep step = new DetachStep();
+ step.executeDetach((IProcessContextNode)candidate, null);
+ }
+ };
+
+ Protocol.invokeLater(runnable);
+ }
+ }
+ }
+
+ return null;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/RefreshHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/RefreshHandler.java
new file mode 100644
index 000000000..90699afe5
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/RefreshHandler.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 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.processes.ui.handler;
+
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.tcf.protocol.Protocol;
+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.runtime.model.PendingOperationModelNode;
+import org.eclipse.tcf.te.runtime.model.interfaces.IContainerModelNode;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.runtime.model.interfaces.contexts.IAsyncRefreshableCtx;
+import org.eclipse.tcf.te.runtime.model.interfaces.contexts.IAsyncRefreshableCtx.QueryState;
+import org.eclipse.tcf.te.runtime.model.interfaces.contexts.IAsyncRefreshableCtx.QueryType;
+import org.eclipse.tcf.te.tcf.core.model.interfaces.IModel;
+import org.eclipse.tcf.te.tcf.core.model.interfaces.services.IModelRefreshService;
+import org.eclipse.tcf.te.tcf.processes.core.model.nodes.PendingOperationNode;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * Refresh handler implementation.
+ */
+public class RefreshHandler extends AbstractHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ List<IModelNode> nodes = ((IStructuredSelection) selection).toList();
+ for (IModelNode node : nodes) {
+ if (node instanceof IModel) {
+ final IModel model = (IModel)node;
+ Assert.isNotNull(model);
+
+ // Get the asynchronous refresh context adapter
+ final IAsyncRefreshableCtx refreshable = (IAsyncRefreshableCtx)model.getAdapter(IAsyncRefreshableCtx.class);
+ if (refreshable != null) {
+ // If refresh is already in progress -> drop out
+ if (refreshable.getQueryState(QueryType.CHILD_LIST).equals(QueryState.IN_PROGRESS)) {
+ return null;
+ }
+
+ // Set the query state to IN_PROGRESS
+ refreshable.setQueryState(QueryType.CHILD_LIST, QueryState.IN_PROGRESS);
+ // Create a new pending operation node and associate it with the refreshable
+ PendingOperationModelNode pendingNode = new PendingOperationNode();
+ pendingNode.setParent(model);
+ refreshable.setPendingOperationNode(pendingNode);
+
+ // Trigger a refresh of the view content.
+ ChangeEvent changeEvent = new ChangeEvent(model, IContainerModelNode.NOTIFY_CHANGED, null, null);
+ EventManager.getInstance().fireEvent(changeEvent);
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ // Don't send change events while refreshing
+ final boolean changed = model.setChangeEventsEnabled(false);
+ // Initiate the refresh of the model
+ model.getService(IModelRefreshService.class).refresh(new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ // Mark the refresh as done
+ refreshable.setQueryState(QueryType.CHILD_LIST, QueryState.DONE);
+ // Reset the pending operation node
+ refreshable.setPendingOperationNode(null);
+ // Re-enable the change events if they had been enabled before
+ if (changed) model.setChangeEventsEnabled(true);
+ // Trigger a refresh of the view content.
+ ChangeEvent event = new ChangeEvent(model, IContainerModelNode.NOTIFY_CHANGED, null, null);
+ EventManager.getInstance().fireEvent(event);
+ }
+ });
+ }
+ };
+
+ Protocol.invokeLater(runnable);
+ }
+ } else {
+ final IModelNode finNode = node;
+
+ Protocol.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ final IModel model = finNode.getParent(IModel.class);
+ Assert.isNotNull(model);
+ model.getService(IModelRefreshService.class).refresh(finNode, null);
+ }
+ });
+ }
+ }
+ }
+ return null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/handler/RefreshProcessListHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/RefreshProcessListHandler.java
index 987bfb467..e05a11078 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/handler/RefreshProcessListHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/RefreshProcessListHandler.java
@@ -1,41 +1,42 @@
-/*******************************************************************************
- * 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.processes.ui.internal.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessModel;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * The handler to refresh the process list.
- */
-public class RefreshProcessListHandler extends AbstractHandler {
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IEditorInput editorInput = HandlerUtil.getActiveEditorInputChecked(event);
- IPeerModel peer = (IPeerModel) editorInput.getAdapter(IPeerModel.class);
- if (peer != null) {
- ProcessModel processModel = ProcessModel.getProcessModel(peer);
- ProcessTreeNode root = processModel.getRoot();
- root.refresh();
- }
- return null;
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.tcf.te.tcf.core.model.interfaces.IModel;
+import org.eclipse.tcf.te.tcf.core.model.interfaces.services.IModelRefreshService;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.processes.core.model.ModelManager;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * The handler to refresh the process list.
+ */
+public class RefreshProcessListHandler extends AbstractHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IEditorInput editorInput = HandlerUtil.getActiveEditorInputChecked(event);
+ IPeerModel peer = (IPeerModel) editorInput.getAdapter(IPeerModel.class);
+ if (peer != null) {
+ IModel model = ModelManager.getRuntimeModel(peer);
+ Assert.isNotNull(model);
+ model.getService(IModelRefreshService.class).refresh(null);
+ }
+ return null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/handler/TerminateHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/TerminateHandler.java
index 40e9b93fb..28be32ed2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/handler/TerminateHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/handler/TerminateHandler.java
@@ -1,87 +1,83 @@
-/*******************************************************************************
- * Copyright (c) 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.processes.ui.internal.handler;
-
-import java.util.Iterator;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.runtime.callback.Callback;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.core.model.steps.TerminateStep;
-import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * The handler to terminate the selected process.
- */
-public class TerminateHandler extends AbstractHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ISelection selection = HandlerUtil.getCurrentSelection(event);
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- Iterator<?> iterator = ((IStructuredSelection)selection).iterator();
- while (iterator.hasNext()) {
- Object candidate = iterator.next();
- if (candidate instanceof ProcessTreeNode) {
- final ProcessTreeNode process = (ProcessTreeNode)candidate;
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- TerminateStep step = new TerminateStep();
- step.executeTerminate(process, new TerminateCallback(process));
- }
- };
- Protocol.invokeLater(runnable);
- }
- }
- }
-
- return null;
- }
-
- /**
- * The callback to be invoked after the selected processes are successfully terminated
- * to update the tree viewer or display errors.
- */
- static class TerminateCallback extends Callback {
- private ProcessTreeNode node;
- public TerminateCallback(ProcessTreeNode node) {
- this.node = node;
- }
- @Override
- protected void internalDone(Object caller, final IStatus status) {
- if (status.isOK()) {
- node.getParent().removeChild(node);
- }
- else {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable(){
- @Override
- public void run() {
- String message = status.getMessage();
- Shell parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- MessageDialog.openError(parent, Messages.TerminateHandler_TerminationError, message);
- }});
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 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.processes.ui.handler;
+
+import java.util.Iterator;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.runtime.callback.Callback;
+import org.eclipse.tcf.te.tcf.core.model.interfaces.IModel;
+import org.eclipse.tcf.te.tcf.core.model.interfaces.services.IModelUpdateService;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.steps.TerminateStep;
+import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * The handler to terminate the selected process.
+ */
+public class TerminateHandler extends AbstractHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ Iterator<?> iterator = ((IStructuredSelection)selection).iterator();
+ while (iterator.hasNext()) {
+ Object candidate = iterator.next();
+ if (candidate instanceof IProcessContextNode) {
+ final IProcessContextNode process = (IProcessContextNode)candidate;
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ TerminateStep step = new TerminateStep();
+ step.executeTerminate(process, new Callback() {
+ @Override
+ protected void internalDone(Object caller, final IStatus status) {
+ if (status.isOK()) {
+ IModel model = process.getParent(IModel.class);
+ Assert.isNotNull(model);
+ model.getService(IModelUpdateService.class).remove(process);
+ }
+ else {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable(){
+ @Override
+ public void run() {
+ String message = status.getMessage();
+ Shell parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ MessageDialog.openError(parent, Messages.TerminateHandler_TerminationError, message);
+ }});
+ }
+ }
+ });
+ }
+ };
+ Protocol.invokeLater(runnable);
+ }
+ }
+ }
+
+ return null;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/AdapterFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/AdapterFactory.java
index ab7b1e148..6fcad1f17 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/AdapterFactory.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/AdapterFactory.java
@@ -1,63 +1,67 @@
-/*******************************************************************************
- * 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.processes.ui.internal.adapters;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.ui.internal.columns.ProcessLabelProvider;
-import org.eclipse.tcf.te.tcf.processes.ui.internal.search.ProcessSearchable;
-import org.eclipse.tcf.te.ui.interfaces.ILazyLoader;
-import org.eclipse.tcf.te.ui.interfaces.ISearchable;
-
-/**
- * Adapter factory implementation.
- */
-public class AdapterFactory implements IAdapterFactory {
- // The adapter for ILabelProvider.class
- private ILabelProvider labelProvider = new ProcessLabelProvider();
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
- */
- @Override
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adaptableObject instanceof ProcessTreeNode) {
- if (ILabelProvider.class.equals(adapterType)) {
- return labelProvider;
- }
- if (IPeerModel.class.equals(adapterType)) {
- return ((ProcessTreeNode)adaptableObject).peerNode;
- }
- if(ILazyLoader.class.equals(adapterType)) {
- return new ProcessTreeNodeLoader((ProcessTreeNode)adaptableObject);
- }
- if(ISearchable.class.equals(adapterType)) {
- return new ProcessSearchable();
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
- */
- @Override
- public Class[] getAdapterList() {
- return new Class<?>[] {
- ILabelProvider.class,
- IPeerModel.class,
- ILazyLoader.class,
- ISearchable.class
- };
- }
-
-}
+/*******************************************************************************
+ * 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.processes.ui.internal.adapters;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeModel;
+import org.eclipse.tcf.te.tcf.processes.ui.internal.search.ProcessSearchable;
+import org.eclipse.tcf.te.tcf.processes.ui.navigator.runtime.LabelProviderDelegate;
+import org.eclipse.tcf.te.ui.interfaces.ISearchable;
+
+/**
+ * Adapter factory implementation.
+ */
+public class AdapterFactory implements IAdapterFactory {
+ // The adapter for ILabelProvider.class
+ private ILabelProvider labelProvider = new LabelProviderDelegate();
+
+ private static final Class<?>[] CLASSES = new Class[] {
+ ILabelProvider.class,
+ IPeerModel.class,
+ ISearchable.class
+ };
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ @Override
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof IProcessContextNode) {
+ if (ILabelProvider.class.equals(adapterType)) {
+ return labelProvider;
+ }
+ if (IPeerModel.class.equals(adapterType)) {
+ return ((IProcessContextNode) adaptableObject).getAdapter(adapterType);
+ }
+ if (ISearchable.class.equals(adapterType)) {
+ return new ProcessSearchable();
+ }
+ }
+
+ if (adaptableObject instanceof IRuntimeModel) {
+ if (ISearchable.class.equals(adapterType)) {
+ return new ProcessSearchable();
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ @Override
+ public Class[] getAdapterList() {
+ return CLASSES;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessTreeNodeLoader.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessTreeNodeLoader.java
deleted file mode 100644
index c905a6cfa..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessTreeNodeLoader.java
+++ /dev/null
@@ -1,77 +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.processes.ui.internal.adapters;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.concurrent.TimeoutException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.tcf.te.runtime.callback.Callback;
-import org.eclipse.tcf.te.tcf.core.concurrent.Rendezvous;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.ui.interfaces.ILazyLoader;
-
-/**
- * The implementation of ILazyLoader for ProcessTreeNode check its data availability
- * and load its children if not ready.
- */
-public class ProcessTreeNodeLoader implements ILazyLoader {
- // The node to be checked.
- private ProcessTreeNode node;
-
- /**
- * Constructor
- *
- * @param node the process node.
- */
- public ProcessTreeNodeLoader(ProcessTreeNode node) {
- this.node = node;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ILazyLoader#isDataLoaded()
- */
- @Override
- public boolean isDataLoaded() {
- return node.childrenQueried;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ILazyLoader#loadData(org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public void loadData(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- final Rendezvous rendezvous = new Rendezvous();
- node.queryChildren(new Callback(){
- @Override
- protected void internalDone(Object caller, IStatus status) {
- rendezvous.arrive();
- }
- });
- try {
- rendezvous.waiting(10000L);
- }
- catch (TimeoutException e) {
- throw new InvocationTargetException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ILazyLoader#isLeaf()
- */
- @Override
- public boolean isLeaf() {
- return false;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/PIDComparator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/PIDComparator.java
index 1ac7c9758..239d27a0c 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/PIDComparator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/PIDComparator.java
@@ -1,31 +1,47 @@
-/*******************************************************************************
- * 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.processes.ui.internal.columns;
-
-import java.io.Serializable;
-import java.util.Comparator;
-
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-
-/**
- * The comparator for the tree column "PID".
- */
-public class PIDComparator implements Comparator<ProcessTreeNode>, Serializable {
- private static final long serialVersionUID = 1L;
-
- /*
- * (non-Javadoc)
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- */
- @Override
- public int compare(ProcessTreeNode o1, ProcessTreeNode o2) {
- return o1.pid == o2.pid ? 0 : (o1.pid < o2.pid ? -1 : 1);
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.internal.columns;
+
+import java.io.Serializable;
+import java.util.Comparator;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+
+/**
+ * The comparator for the tree column "PID".
+ */
+public class PIDComparator implements Comparator<IProcessContextNode>, Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /* (non-Javadoc)
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public int compare(final IProcessContextNode o1, final IProcessContextNode o2) {
+ final AtomicLong pid1 = new AtomicLong();
+ final AtomicLong pid2 = new AtomicLong();
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ pid1.set(o1.getSysMonitorContext().getPID());
+ pid2.set(o2.getSysMonitorContext().getPID());
+ }
+ };
+
+ Assert.isTrue(!Protocol.isDispatchThread());
+ Protocol.invokeAndWait(runnable);
+
+ return pid1.get() == pid2.get() ? 0 : (pid1.get() < pid2.get() ? -1 : 1);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/PIDLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/PIDLabelProvider.java
index 71269eb12..7f674f28e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/PIDLabelProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/PIDLabelProvider.java
@@ -1,34 +1,56 @@
-/*******************************************************************************
- * 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.processes.ui.internal.columns;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-
-/**
- * The label provider for the tree column "PID".
- */
-public class PIDLabelProvider extends LabelProvider {
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
- */
- @Override
- public String getText(Object element) {
- Assert.isTrue(element instanceof ProcessTreeNode);
- ProcessTreeNode node = (ProcessTreeNode) element;
- // Pending nodes does not have column texts at all
- if (node.type.endsWith("PendingNode")) return ""; //$NON-NLS-1$ //$NON-NLS-2$
- String id = Long.toString(node.pid);
- return id.startsWith("P") ? id.substring(1) : id; //$NON-NLS-1$
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.internal.columns;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IPendingOperationNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeModel;
+
+/**
+ * The label provider for the tree column "PID".
+ */
+public class PIDLabelProvider extends LabelProvider {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+ */
+ @Override
+ public String getText(Object element) {
+ if (element instanceof IRuntimeModel || element instanceof IPendingOperationNode) {
+ return ""; //$NON-NLS-1$
+ }
+
+ if (element instanceof IProcessContextNode) {
+ final IProcessContextNode node = (IProcessContextNode)element;
+
+ final AtomicLong pid = new AtomicLong();
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ pid.set(node.getSysMonitorContext().getPID());
+ }
+ };
+
+ Assert.isTrue(!Protocol.isDispatchThread());
+ Protocol.invokeAndWait(runnable);
+
+ String id = pid.get() >= 0 ? Long.toString(pid.get()) : ""; //$NON-NLS-1$
+ return id.startsWith("P") ? id.substring(1) : id; //$NON-NLS-1$
+ }
+
+ return super.getText(element);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/PPIDComparator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/PPIDComparator.java
index 138dbf55b..84b029683 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/PPIDComparator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/PPIDComparator.java
@@ -1,30 +1,47 @@
-/*******************************************************************************
- * 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.processes.ui.internal.columns;
-
-import java.io.Serializable;
-import java.util.Comparator;
-
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-
-/**
- * The comparator for the tree column "PPID".
- */
-public class PPIDComparator implements Comparator<ProcessTreeNode>, Serializable {
- private static final long serialVersionUID = 1L;
- /*
- * (non-Javadoc)
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- */
- @Override
- public int compare(ProcessTreeNode o1, ProcessTreeNode o2) {
- return o1.ppid == o2.ppid ? 0 : (o1.ppid < o2.ppid ? -1 : 1);
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.internal.columns;
+
+import java.io.Serializable;
+import java.util.Comparator;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+
+/**
+ * The comparator for the tree column "PPID".
+ */
+public class PPIDComparator implements Comparator<IProcessContextNode>, Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /* (non-Javadoc)
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public int compare(final IProcessContextNode o1, final IProcessContextNode o2) {
+ final AtomicLong ppid1 = new AtomicLong();
+ final AtomicLong ppid2 = new AtomicLong();
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ ppid1.set(o1.getSysMonitorContext().getPPID());
+ ppid2.set(o2.getSysMonitorContext().getPPID());
+ }
+ };
+
+ Assert.isTrue(!Protocol.isDispatchThread());
+ Protocol.invokeAndWait(runnable);
+
+ return ppid1.get() == ppid2.get() ? 0 : (ppid1.get() < ppid2.get() ? -1 : 1);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/PPIDLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/PPIDLabelProvider.java
index c4c97a205..32dc50232 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/PPIDLabelProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/PPIDLabelProvider.java
@@ -1,33 +1,55 @@
-/*******************************************************************************
- * 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.processes.ui.internal.columns;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-
-/**
- * The label provider for the tree column "PPID".
- */
-public class PPIDLabelProvider extends LabelProvider {
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
- */
- @Override
- public String getText(Object element) {
- Assert.isTrue(element instanceof ProcessTreeNode);
- ProcessTreeNode node = (ProcessTreeNode) element;
- // Pending nodes does not have column texts at all
- if (node.type.endsWith("PendingNode")) return ""; //$NON-NLS-1$ //$NON-NLS-2$
- return Long.toString(node.ppid);
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.internal.columns;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IPendingOperationNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeModel;
+
+/**
+ * The label provider for the tree column "PPID".
+ */
+public class PPIDLabelProvider extends LabelProvider {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+ */
+ @Override
+ public String getText(Object element) {
+ if (element instanceof IRuntimeModel || element instanceof IPendingOperationNode) {
+ return ""; //$NON-NLS-1$
+ }
+
+ if (element instanceof IProcessContextNode) {
+ final IProcessContextNode node = (IProcessContextNode)element;
+
+ final AtomicLong ppid = new AtomicLong();
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ ppid.set(node.getSysMonitorContext().getPPID());
+ }
+ };
+
+ Assert.isTrue(!Protocol.isDispatchThread());
+ Protocol.invokeAndWait(runnable);
+
+ return ppid.get() >= 0 ? Long.toString(ppid.get()) : ""; //$NON-NLS-1$
+ }
+
+ return super.getText(element);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/ProcessComparator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/ProcessComparator.java
index 88d3a890f..c8cf7eb2a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/ProcessComparator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/ProcessComparator.java
@@ -1,111 +1,113 @@
-/*******************************************************************************
- * 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.processes.ui.internal.columns;
-
-import java.io.Serializable;
-import java.util.Comparator;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-
-/**
- * The comparator for the tree column "name".
- */
-public class ProcessComparator implements Comparator<ProcessTreeNode> , Serializable {
- private static final long serialVersionUID = 1L;
- private static ProcessLabelProvider labelProvider = new ProcessLabelProvider();
- /*
- * (non-Javadoc)
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- */
- @Override
- public int compare(ProcessTreeNode node1, ProcessTreeNode node2) {
- if (node1 == null && node2 == null) return 0;
- if (node1 != null && node2 == null) return 1;
- if (node1 == null && node2 != null) return -1;
-
- // Get the labels
- String text1 = node1 == null ? null : labelProvider.getText(node1);
- String text2 = node2 == null ? null : labelProvider.getText(node2);
-
- // Normalize labels
- if (text1 == null) text1 = ""; //$NON-NLS-1$
- if (text2 == null) text2 = ""; //$NON-NLS-1$
-
- // The tree sorts not strictly alphabetical. First comes entries starting with numbers,
- // second entries starting with uppercase and than all the rest. Additional, if a label
- // contains
- // uppercase characters, it is sorted in before any labels being lowercase only.
- if (text1.length() > 0 && text2.length() > 0) {
- // Get the first characters of both
- char c1 = text1.charAt(0);
- char c2 = text2.charAt(0);
-
- if (Character.isDigit(c1) || Character.isDigit(c2)) {
- // Check on the differences. If both are digits, the standard compare will do it
- if (Character.isDigit(c1) && !Character.isDigit(c2)) return -1;
- if (!Character.isDigit(c1) && Character.isDigit(c2)) return 1;
- }
-
- if (Character.isUpperCase(c1) || Character.isUpperCase(c2)) {
- // Check on the differences. If both are uppercase characters, the standard compare
- // will do it
- if (Character.isUpperCase(c1) && !Character.isUpperCase(c2)) return -1;
- if (!Character.isUpperCase(c1) && Character.isUpperCase(c2)) return 1;
- }
-
- Matcher m1 = Pattern.compile("(\\D+)(\\d+)").matcher(text1); //$NON-NLS-1$
- Matcher m2 = Pattern.compile("(\\D+)(\\d+)").matcher(text2); //$NON-NLS-1$
- if (m1.matches() && m2.matches()) {
- String p11 = m1.group(1);
- String p12 = m1.group(2);
-
- String p21 = m2.group(1);
- String p22 = m2.group(2);
-
- if (p11 != null && p11.equals(p21)) {
- // Compare the second parts as number
- try {
- int result = 0;
- long l1 = Long.parseLong(p12);
- long l2 = Long.parseLong(p22);
-
- if (l1 > l2) result = 1;
- if (l1 < l2) result = -1;
-
- return result;
- }
- catch (NumberFormatException e) { /* ignored on purpose */
- }
- }
- }
-
- if (text1.matches(".*[A-Z]+.*") || text2.matches(".*[A-Z]+.*")) { //$NON-NLS-1$ //$NON-NLS-2$
- if (text1.matches(".*[A-Z]+.*") && !text2.matches(".*[A-Z]+.*")) return -1; //$NON-NLS-1$ //$NON-NLS-2$
- if (!text1.matches(".*[A-Z]+.*") && text2.matches(".*[A-Z]+.*")) return 1; //$NON-NLS-1$ //$NON-NLS-2$
-
- // Additionally, it even depends on the position of the first uppercase
- // character if both strings contains them :-(
- int minLength = Math.min(text1.length(), text2.length());
- for (int i = 0; i < minLength; i++) {
- char ch1 = text1.charAt(i);
- char ch2 = text2.charAt(i);
-
- if (Character.isUpperCase(ch1) && !Character.isUpperCase(ch2)) return -1;
- if (!Character.isUpperCase(ch1) && Character.isUpperCase(ch2)) return 1;
- // If both are uppercase, we break the loop and compare as usual
- if (Character.isUpperCase(ch1) && Character.isUpperCase(ch2)) break;
- }
- }
- }
- return text1.compareTo(text2);
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.internal.columns;
+
+import java.io.Serializable;
+import java.util.Comparator;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.ui.navigator.runtime.LabelProviderDelegate;
+
+/**
+ * The comparator for the tree column "name".
+ */
+public class ProcessComparator implements Comparator<IProcessContextNode> , Serializable {
+ private static final long serialVersionUID = 1L;
+ private static LabelProvider labelProvider = new LabelProviderDelegate();
+
+ /* (non-Javadoc)
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public int compare(IProcessContextNode node1, IProcessContextNode node2) {
+ if (node1 == null && node2 == null) return 0;
+ if (node1 != null && node2 == null) return 1;
+ if (node1 == null && node2 != null) return -1;
+
+ // Get the labels
+ String text1 = node1 == null ? null : labelProvider.getText(node1);
+ String text2 = node2 == null ? null : labelProvider.getText(node2);
+
+ // Normalize labels
+ if (text1 == null) text1 = ""; //$NON-NLS-1$
+ if (text2 == null) text2 = ""; //$NON-NLS-1$
+
+ // The tree sorts not strictly alphabetical. First comes entries starting with numbers,
+ // second entries starting with uppercase and than all the rest. Additional, if a label
+ // contains
+ // uppercase characters, it is sorted in before any labels being lowercase only.
+ if (text1.length() > 0 && text2.length() > 0) {
+ // Get the first characters of both
+ char c1 = text1.charAt(0);
+ char c2 = text2.charAt(0);
+
+ if (Character.isDigit(c1) || Character.isDigit(c2)) {
+ // Check on the differences. If both are digits, the standard compare will do it
+ if (Character.isDigit(c1) && !Character.isDigit(c2)) return -1;
+ if (!Character.isDigit(c1) && Character.isDigit(c2)) return 1;
+ }
+
+ if (Character.isUpperCase(c1) || Character.isUpperCase(c2)) {
+ // Check on the differences. If both are uppercase characters, the standard compare
+ // will do it
+ if (Character.isUpperCase(c1) && !Character.isUpperCase(c2)) return -1;
+ if (!Character.isUpperCase(c1) && Character.isUpperCase(c2)) return 1;
+ }
+
+ Matcher m1 = Pattern.compile("(\\D+)(\\d+)").matcher(text1); //$NON-NLS-1$
+ Matcher m2 = Pattern.compile("(\\D+)(\\d+)").matcher(text2); //$NON-NLS-1$
+ if (m1.matches() && m2.matches()) {
+ String p11 = m1.group(1);
+ String p12 = m1.group(2);
+
+ String p21 = m2.group(1);
+ String p22 = m2.group(2);
+
+ if (p11 != null && p11.equals(p21)) {
+ // Compare the second parts as number
+ try {
+ int result = 0;
+ long l1 = Long.parseLong(p12);
+ long l2 = Long.parseLong(p22);
+
+ if (l1 > l2) result = 1;
+ if (l1 < l2) result = -1;
+
+ return result;
+ }
+ catch (NumberFormatException e) { /* ignored on purpose */
+ }
+ }
+ }
+
+ if (text1.matches(".*[A-Z]+.*") || text2.matches(".*[A-Z]+.*")) { //$NON-NLS-1$ //$NON-NLS-2$
+ if (text1.matches(".*[A-Z]+.*") && !text2.matches(".*[A-Z]+.*")) return -1; //$NON-NLS-1$ //$NON-NLS-2$
+ if (!text1.matches(".*[A-Z]+.*") && text2.matches(".*[A-Z]+.*")) return 1; //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Additionally, it even depends on the position of the first uppercase
+ // character if both strings contains them :-(
+ int minLength = Math.min(text1.length(), text2.length());
+ for (int i = 0; i < minLength; i++) {
+ char ch1 = text1.charAt(i);
+ char ch2 = text2.charAt(i);
+
+ if (Character.isUpperCase(ch1) && !Character.isUpperCase(ch2)) return -1;
+ if (!Character.isUpperCase(ch1) && Character.isUpperCase(ch2)) return 1;
+ // If both are uppercase, we break the loop and compare as usual
+ if (Character.isUpperCase(ch1) && Character.isUpperCase(ch2)) break;
+ }
+ }
+ }
+ return text1.compareTo(text2);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/ProcessLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/ProcessLabelProvider.java
deleted file mode 100644
index 12a23d7d3..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/ProcessLabelProvider.java
+++ /dev/null
@@ -1,65 +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.processes.ui.internal.columns;
-
-import java.io.File;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.ui.activator.UIPlugin;
-import org.eclipse.tcf.te.tcf.processes.ui.interfaces.ImageConsts;
-import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
-import org.eclipse.tcf.te.ui.trees.PendingAwareLabelProvider;
-
-/**
- * The label provider for the tree column "name".
- */
-public class ProcessLabelProvider extends PendingAwareLabelProvider {
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
- */
- @Override
- public String getText(Object element) {
- if (element instanceof ProcessTreeNode) {
- ProcessTreeNode node = (ProcessTreeNode) element;
- if(node.isSystemRoot()) {
- return Messages.ProcessLabelProvider_RootNodeLabel;
- }
- String name = node.name;
- if (name == null) name = Messages.ProcessLabelProvider_NullNameNodeLabel;
- int slash = name.lastIndexOf(File.separator);
- if (slash != -1) name = name.substring(slash + 1);
- return name;
- }
- return super.getText(element);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
- */
- @Override
- public Image getImage(Object element) {
- if (element instanceof ProcessTreeNode) {
- ProcessTreeNode node = (ProcessTreeNode) element;
- if(node.isSystemRoot()) {
- return UIPlugin.getImage(ImageConsts.OBJ_Process_Root);
- }
- ProcessTreeNode parent = node.getParent();
- if(parent.isSystemRoot()) {
- return UIPlugin.getImage(ImageConsts.OBJ_Process);
- }
- return UIPlugin.getImage(ImageConsts.OBJ_Thread);
- }
- return super.getImage(element);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/StateComparator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/StateComparator.java
index 1c81b6016..aaacc371a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/StateComparator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/StateComparator.java
@@ -1,35 +1,52 @@
-/*******************************************************************************
- * 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.processes.ui.internal.columns;
-
-import java.io.Serializable;
-import java.util.Comparator;
-
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-
-/**
- * The comparator for the tree column "state".
- */
-public class StateComparator implements Comparator<ProcessTreeNode> , Serializable {
- private static final long serialVersionUID = 1L;
- /*
- * (non-Javadoc)
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- */
- @Override
- public int compare(ProcessTreeNode o1, ProcessTreeNode o2) {
- if (o1.state == null) {
- if (o2.state == null) return 0;
- return -1;
- }
- if (o2.state == null) return 1;
- return o1.state.compareTo(o2.state);
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.internal.columns;
+
+import java.io.Serializable;
+import java.util.Comparator;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+
+/**
+ * The comparator for the tree column "state".
+ */
+public class StateComparator implements Comparator<IProcessContextNode> , Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /* (non-Javadoc)
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public int compare(final IProcessContextNode o1, final IProcessContextNode o2) {
+ final AtomicReference<String> state1 = new AtomicReference<String>();
+ final AtomicReference<String> state2 = new AtomicReference<String>();
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ state1.set(o1.getSysMonitorContext().getState());
+ state2.set(o2.getSysMonitorContext().getState());
+ }
+ };
+
+ Assert.isTrue(!Protocol.isDispatchThread());
+ Protocol.invokeAndWait(runnable);
+
+ if (state1.get() == null) {
+ if (state2.get() == null) return 0;
+ return -1;
+ }
+ if (state2.get() == null) return 1;
+ return state1.get().compareTo(state2.get());
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/StateLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/StateLabelProvider.java
index f643e6dc9..384726bfc 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/StateLabelProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/StateLabelProvider.java
@@ -1,35 +1,55 @@
-/*******************************************************************************
- * 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.processes.ui.internal.columns;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-
-/**
- * The label provider for the tree column "state".
- */
-public class StateLabelProvider extends LabelProvider {
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
- */
- @Override
- public String getText(Object element) {
- Assert.isTrue(element instanceof ProcessTreeNode);
- ProcessTreeNode node = (ProcessTreeNode) element;
- // Pending nodes does not have column texts at all
- if (node.type.endsWith("PendingNode")) return ""; //$NON-NLS-1$ //$NON-NLS-2$
- String state = node.state;
- if (state != null) return state;
- return ""; //$NON-NLS-1$
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.internal.columns;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IPendingOperationNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeModel;
+
+/**
+ * The label provider for the tree column "state".
+ */
+public class StateLabelProvider extends LabelProvider {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+ */
+ @Override
+ public String getText(Object element) {
+ if (element instanceof IRuntimeModel || element instanceof IPendingOperationNode) {
+ return ""; //$NON-NLS-1$
+ }
+
+ if (element instanceof IProcessContextNode) {
+ final IProcessContextNode node = (IProcessContextNode)element;
+
+ final AtomicReference<String> state = new AtomicReference<String>();
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ state.set(node.getSysMonitorContext().getState());
+ }
+ };
+
+ Assert.isTrue(!Protocol.isDispatchThread());
+ Protocol.invokeAndWait(runnable);
+
+ if (state.get() != null) return state.get();
+ }
+
+ return ""; //$NON-NLS-1$
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/UserComparator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/UserComparator.java
index 0191772ef..b9e97430b 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/UserComparator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/UserComparator.java
@@ -1,35 +1,52 @@
-/*******************************************************************************
- * 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.processes.ui.internal.columns;
-
-import java.io.Serializable;
-import java.util.Comparator;
-
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-
-/**
- * The comparator for the tree column "user".
- */
-public class UserComparator implements Comparator<ProcessTreeNode> , Serializable {
- private static final long serialVersionUID = 1L;
- /*
- * (non-Javadoc)
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- */
- @Override
- public int compare(ProcessTreeNode o1, ProcessTreeNode o2) {
- if (o1.username == null) {
- if (o2.username == null) return 0;
- return -1;
- }
- if (o2.username == null) return 1;
- return o1.username.compareTo(o2.username);
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.internal.columns;
+
+import java.io.Serializable;
+import java.util.Comparator;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+
+/**
+ * The comparator for the tree column "user".
+ */
+public class UserComparator implements Comparator<IProcessContextNode> , Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /* (non-Javadoc)
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public int compare(final IProcessContextNode o1, final IProcessContextNode o2) {
+ final AtomicReference<String> username1 = new AtomicReference<String>();
+ final AtomicReference<String> username2 = new AtomicReference<String>();
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ username1.set(o1.getSysMonitorContext().getUserName());
+ username2.set(o2.getSysMonitorContext().getUserName());
+ }
+ };
+
+ Assert.isTrue(!Protocol.isDispatchThread());
+ Protocol.invokeAndWait(runnable);
+
+ if (username1.get() == null) {
+ if (username2.get() == null) return 0;
+ return -1;
+ }
+ if (username2.get() == null) return 1;
+ return username1.get().compareTo(username2.get());
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/UserLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/UserLabelProvider.java
index d327dc66f..0eb1992c8 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/UserLabelProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/columns/UserLabelProvider.java
@@ -1,35 +1,55 @@
-/*******************************************************************************
- * 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.processes.ui.internal.columns;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-
-/**
- * The label provider for the tree column "user".
- */
-public class UserLabelProvider extends LabelProvider {
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
- */
- @Override
- public String getText(Object element) {
- Assert.isTrue(element instanceof ProcessTreeNode);
- ProcessTreeNode node = (ProcessTreeNode) element;
- // Pending nodes does not have column texts at all
- if (node.type.endsWith("PendingNode")) return ""; //$NON-NLS-1$ //$NON-NLS-2$
- String username = node.username;
- if (username != null) return username;
- return ""; //$NON-NLS-1$
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.internal.columns;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IPendingOperationNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeModel;
+
+/**
+ * The label provider for the tree column "user".
+ */
+public class UserLabelProvider extends LabelProvider {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+ */
+ @Override
+ public String getText(Object element) {
+ if (element instanceof IRuntimeModel || element instanceof IPendingOperationNode) {
+ return ""; //$NON-NLS-1$
+ }
+
+ if (element instanceof IProcessContextNode) {
+ final IProcessContextNode node = (IProcessContextNode)element;
+
+ final AtomicReference<String> username = new AtomicReference<String>();
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ username.set(node.getSysMonitorContext().getUserName());
+ }
+ };
+
+ Assert.isTrue(!Protocol.isDispatchThread());
+ Protocol.invokeAndWait(runnable);
+
+ if (username.get() != null) return username.get();
+ }
+
+ return ""; //$NON-NLS-1$
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/filters/SingleThreadFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/filters/SingleThreadFilter.java
index aed37fb79..8ce370f82 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/filters/SingleThreadFilter.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/filters/SingleThreadFilter.java
@@ -1,49 +1,65 @@
-/*******************************************************************************
- * 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.processes.ui.internal.filters;
-
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-
-/**
- * The filter to filter out the single thread of a process which has the same name
- * and id with its parent process.
- */
-public class SingleThreadFilter extends ViewerFilter {
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- if(parentElement instanceof TreePath) {
- parentElement = ((TreePath)parentElement).getLastSegment();
- }
- if(parentElement instanceof ProcessTreeNode && element instanceof ProcessTreeNode) {
- ProcessTreeNode parent = (ProcessTreeNode) parentElement;
- ProcessTreeNode child = (ProcessTreeNode) element;
- if(parent.getChildren().size() == 1) {
- if(parent.pid == child.pid) {
- if (parent.name != null) {
- return !parent.name.equals(child.name);
- }
- else if (child.name != null) {
- return !child.name.equals(parent.name);
- }
- return false;
- }
- }
- }
- return true;
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.internal.filters;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+
+/**
+ * The filter to filter out the single thread of a process which has the same name and id with its
+ * parent process.
+ */
+public class SingleThreadFilter extends ViewerFilter {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public boolean select(final Viewer viewer, Object parentElement, Object element) {
+ if (parentElement instanceof TreePath) {
+ parentElement = ((TreePath) parentElement).getLastSegment();
+ }
+ if (parentElement instanceof IProcessContextNode && element instanceof IProcessContextNode) {
+ final AtomicBoolean selected = new AtomicBoolean();
+ final Object pe = parentElement;
+ final Object e = element;
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ IProcessContextNode parent = (IProcessContextNode)pe;
+ IProcessContextNode child = (IProcessContextNode)e;
+ if (parent.getChildren().length == 1) {
+ if (parent.getSysMonitorContext().getPID() == child.getSysMonitorContext().getPID()) {
+ if (parent.getName() != null) {
+ selected.set(!parent.getName().equals(child.getName()));
+ }
+ else if (child.getName() != null) {
+ selected.set(!child.getName().equals(parent.getName()));
+ }
+ }
+ }
+ }
+ };
+
+ Assert.isTrue(!Protocol.isDispatchThread());
+ Protocol.invokeAndWait(runnable);
+
+ return selected.get();
+ }
+ return true;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/handler/RefreshHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/handler/RefreshHandler.java
deleted file mode 100644
index 27c76ae36..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/handler/RefreshHandler.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.processes.ui.internal.handler;
-
-import java.util.List;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * Refresh handler implementation.
- */
-public class RefreshHandler extends AbstractHandler {
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ISelection selection = HandlerUtil.getCurrentSelection(event);
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- List<ProcessTreeNode> processes = ((IStructuredSelection) selection).toList();
- for(ProcessTreeNode process : processes) {
- process.refresh();
- }
- }
- return null;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/AdvancedPropertiesPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/AdvancedPropertiesPage.java
index 090d25505..b065c0126 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/AdvancedPropertiesPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/AdvancedPropertiesPage.java
@@ -1,72 +1,78 @@
-/*******************************************************************************
- * 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.processes.ui.internal.properties;
-
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed.MapContentProvider;
-import org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed.MapEntryLabelProvider;
-import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-/**
- * The property page to display the advanced properties of a process context.
- */
-public class AdvancedPropertiesPage extends PropertyPage {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected Control createContents(Composite parent) {
- IAdaptable element = getElement();
- Assert.isTrue(element instanceof ProcessTreeNode);
-
- ProcessTreeNode node = (ProcessTreeNode) element;
- Map<String, Object> properties = null;
- if(node.context != null) {
- properties = node.context.getProperties();
- }
-
- Composite page = new Composite(parent, SWT.NONE);
- FillLayout layout = new FillLayout();
- layout.marginHeight = 10;
- layout.marginWidth = 10;
- page.setLayout(layout);
-
- TableViewer viewer = new TableViewer(page, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
- Table table = viewer.getTable();
- TableColumn column = new TableColumn(table, SWT.LEFT);
- column.setText(Messages.AdvancedPropertiesSection_Name);
- column.setWidth(100);
- column = new TableColumn(table, SWT.LEFT);
- column.setText(Messages.AdvancedPropertiesSection_Value);
- column.setWidth(150);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- viewer.setContentProvider(new MapContentProvider());
- viewer.setLabelProvider(new MapEntryLabelProvider());
- if(properties != null) {
- viewer.setInput(properties);
- }
-
- return page;
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.internal.properties;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed.MapContentProvider;
+import org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed.MapEntryLabelProvider;
+import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+/**
+ * The property page to display the advanced properties of a process context.
+ */
+public class AdvancedPropertiesPage extends PropertyPage {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createContents(Composite parent) {
+ IAdaptable element = getElement();
+ Assert.isTrue(element instanceof IProcessContextNode);
+
+ final IProcessContextNode node = (IProcessContextNode) element;
+ final Map<String, Object> props = new HashMap<String, Object>();
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ props.putAll(node.getSysMonitorContext().getProperties());
+ }
+ };
+ Assert.isTrue(!Protocol.isDispatchThread());
+ Protocol.invokeAndWait(runnable);
+
+ Composite page = new Composite(parent, SWT.NONE);
+ FillLayout layout = new FillLayout();
+ layout.marginHeight = 10;
+ layout.marginWidth = 10;
+ page.setLayout(layout);
+
+ TableViewer viewer = new TableViewer(page, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
+ Table table = viewer.getTable();
+ TableColumn column = new TableColumn(table, SWT.LEFT);
+ column.setText(Messages.AdvancedPropertiesSection_Name);
+ column.setWidth(100);
+ column = new TableColumn(table, SWT.LEFT);
+ column.setText(Messages.AdvancedPropertiesSection_Value);
+ column.setWidth(150);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ viewer.setContentProvider(new MapContentProvider());
+ viewer.setLabelProvider(new MapEntryLabelProvider());
+ viewer.setInput(props);
+
+ return page;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/ContextPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/ContextPage.java
index cf9a4bf14..dbeee3c86 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/ContextPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/ContextPage.java
@@ -1,106 +1,120 @@
-/*******************************************************************************
- * 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.processes.ui.internal.properties;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.tcf.services.ISysMonitor.SysMonitorContext;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-/**
- * The property page to display the context IDs of a process.
- */
-public class ContextPage extends PropertyPage {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected Control createContents(Composite parent) {
- IAdaptable element = getElement();
- Assert.isTrue(element instanceof ProcessTreeNode);
-
- ProcessTreeNode node = (ProcessTreeNode) element;
- Composite page = new Composite(parent, SWT.NONE);
- GridLayout gridLayout = new GridLayout(2, false);
- page.setLayout(gridLayout);
-
- SysMonitorContext context = node.context;
- createField(Messages.ContextPage_File, context == null ? null : context.getFile(), page);
- createField(Messages.ContextPage_WorkHome, context == null ? null : context.getCurrentWorkingDirectory(), page);
- createField(Messages.ContextPage_Root, context == null ? null : context.getRoot(), page);
- createField(Messages.ContextPage_State, context == null ? null : context.getState(), page);
- createField(Messages.ContextPage_Group, context == null ? null : context.getGroupName(), page);
- createSeparator(page);
- createField(Messages.ContextPage_ID, context == null ? null : context.getID(), page);
- createField(Messages.ContextPage_ParentID, context == null ? null : context.getParentID(), page);
- createField(Messages.ContextPage_GroupID, context == null ? null : Long.valueOf(context.getPGRP()), page);
- createField(Messages.ContextPage_PID, context == null ? null : Long.valueOf(context.getPID()), page);
- createField(Messages.ContextPage_PPID, context == null ? null : Long.valueOf(context.getPPID()), page);
- createField(Messages.ContextPage_TTYGRPID, context == null ? null : Long.valueOf(context.getTGID()), page);
- createField(Messages.ContextPage_TracerPID, context == null ? null : Long.valueOf(context.getTracerPID()), page);
- createField(Messages.ContextPage_UserID, context == null ? null : Long.valueOf(context.getUID()), page);
- createField(Messages.ContextPage_UserGRPID, context == null ? null : Long.valueOf(context.getUGID()), page);
- createSeparator(page);
- createField(Messages.ContextPage_Virtual, context == null ? null : Long.valueOf(context.getVSize()), page);
- createField(Messages.ContextPage_Pages, context == null ? null : Long.valueOf(context.getPSize()), page);
- createField(Messages.ContextPage_Resident, context == null ? null : Long.valueOf(context.getRSS()), page);
-
- return page;
- }
- /**
- * Create a horizontal separator between field sections.
- *
- * @param parent
- * The parent composite of the separator.
- */
- protected void createSeparator(Composite parent) {
- Label label = new Label(parent, SWT.SEPARATOR | SWT.SHADOW_ETCHED_IN | SWT.HORIZONTAL);
- GridData data = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
- data.horizontalSpan = 2;
- label.setLayoutData(data);
- }
- /**
- * Create a field displaying the a specific value with a specific label.
- *
- * @param text
- * The label text for the field.
- * @param value
- * The value to be displayed.
- * @param parent
- * The parent composite of the field.
- */
- protected void createField(String text, Object value, Composite parent) {
- Label label = new Label(parent, SWT.NONE);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalAlignment = SWT.LEFT;
- data.verticalAlignment = SWT.TOP;
- label.setLayoutData(data);
- Text txt = new Text(parent, SWT.WRAP | SWT.READ_ONLY);
- data = new GridData();
- data.verticalAlignment = SWT.TOP;
- data.widthHint = 300;
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- txt.setLayoutData(data);
- txt.setBackground(txt.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- txt.setText(value == null ? "" : value.toString()); //$NON-NLS-1$
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.internal.properties;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.ISysMonitor;
+import org.eclipse.tcf.services.ISysMonitor.SysMonitorContext;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+/**
+ * The property page to display the context IDs of a process.
+ */
+public class ContextPage extends PropertyPage {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createContents(Composite parent) {
+ IAdaptable element = getElement();
+ Assert.isTrue(element instanceof IProcessContextNode);
+
+ final IProcessContextNode node = (IProcessContextNode) element;
+ Composite page = new Composite(parent, SWT.NONE);
+ GridLayout gridLayout = new GridLayout(2, false);
+ page.setLayout(gridLayout);
+
+ final AtomicReference<ISysMonitor.SysMonitorContext> ctx = new AtomicReference<ISysMonitor.SysMonitorContext>();
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ ctx.set(node.getSysMonitorContext());
+ }
+ };
+ Assert.isTrue(!Protocol.isDispatchThread());
+ Protocol.invokeAndWait(runnable);
+
+ SysMonitorContext context = ctx.get();
+ createField(Messages.ContextPage_File, context == null ? null : context.getFile(), page);
+ createField(Messages.ContextPage_WorkHome, context == null ? null : context.getCurrentWorkingDirectory(), page);
+ createField(Messages.ContextPage_Root, context == null ? null : context.getRoot(), page);
+ createField(Messages.ContextPage_State, context == null ? null : context.getState(), page);
+ createField(Messages.ContextPage_Group, context == null ? null : context.getGroupName(), page);
+ createSeparator(page);
+ createField(Messages.ContextPage_ID, context == null ? null : context.getID(), page);
+ createField(Messages.ContextPage_ParentID, context == null ? null : context.getParentID(), page);
+ createField(Messages.ContextPage_GroupID, context == null || context.getPGRP() < 0 ? null : Long.valueOf(context.getPGRP()), page);
+ createField(Messages.ContextPage_PID, context == null || context.getPID() < 0 ? null : Long.valueOf(context.getPID()), page);
+ createField(Messages.ContextPage_PPID, context == null || context.getPPID() < 0 ? null : Long.valueOf(context.getPPID()), page);
+ createField(Messages.ContextPage_TTYGRPID, context == null || context.getTGID() < 0 ? null : Long.valueOf(context.getTGID()), page);
+ createField(Messages.ContextPage_TracerPID, context == null || context.getTracerPID() < 0 ? null : Long.valueOf(context.getTracerPID()), page);
+ createField(Messages.ContextPage_UserID, context == null || context.getUID() < 0 ? null : Long.valueOf(context.getUID()), page);
+ createField(Messages.ContextPage_UserGRPID, context == null || context.getUGID() < 0 ? null : Long.valueOf(context.getUGID()), page);
+ createSeparator(page);
+ createField(Messages.ContextPage_Virtual, context == null || context.getVSize() < 0 ? null : Long.valueOf(context.getVSize()), page);
+ createField(Messages.ContextPage_Pages, context == null || context.getPSize() < 0 ? null : Long.valueOf(context.getPSize()), page);
+ createField(Messages.ContextPage_Resident, context == null || context.getRSS() < 0 ? null : Long.valueOf(context.getRSS()), page);
+
+ return page;
+ }
+ /**
+ * Create a horizontal separator between field sections.
+ *
+ * @param parent
+ * The parent composite of the separator.
+ */
+ protected void createSeparator(Composite parent) {
+ Label label = new Label(parent, SWT.SEPARATOR | SWT.SHADOW_ETCHED_IN | SWT.HORIZONTAL);
+ GridData data = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
+ data.horizontalSpan = 2;
+ label.setLayoutData(data);
+ }
+ /**
+ * Create a field displaying the a specific value with a specific label.
+ *
+ * @param text
+ * The label text for the field.
+ * @param value
+ * The value to be displayed.
+ * @param parent
+ * The parent composite of the field.
+ */
+ protected void createField(String text, Object value, Composite parent) {
+ Label label = new Label(parent, SWT.NONE);
+ label.setText(text);
+ GridData data = new GridData();
+ data.horizontalAlignment = SWT.LEFT;
+ data.verticalAlignment = SWT.TOP;
+ label.setLayoutData(data);
+ Text txt = new Text(parent, SWT.WRAP | SWT.READ_ONLY);
+ data = new GridData();
+ data.verticalAlignment = SWT.TOP;
+ data.widthHint = 300;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ txt.setLayoutData(data);
+ txt.setBackground(txt.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+ txt.setText(value == null ? "" : value.toString()); //$NON-NLS-1$
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/GeneralInformationPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/GeneralInformationPage.java
index d7662f73a..a1ab2d3b1 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/GeneralInformationPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/GeneralInformationPage.java
@@ -1,96 +1,117 @@
-/*******************************************************************************
- * 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.processes.ui.internal.properties;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-/**
- * The general information page of a process' properties dialog.
- */
-public class GeneralInformationPage extends PropertyPage {
-
- private ProcessTreeNode node;
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected Control createContents(Composite parent) {
- IAdaptable element = getElement();
- Assert.isTrue(element instanceof ProcessTreeNode);
-
- node = (ProcessTreeNode) element;
- Composite page = new Composite(parent, SWT.NONE);
- GridLayout gridLayout = new GridLayout(2, false);
- page.setLayout(gridLayout);
-
- createField(Messages.GeneralInformationPage_Name, node.name, page);
- createField(Messages.GeneralInformationPage_Type, node.type, page);
- createField(Messages.GeneralInformationPage_State, node.state, page);
- createField(Messages.GeneralInformationPage_User, node.username, page);
- createSeparator(page);
- createField(Messages.GeneralInformationPage_ProcessID, Long.valueOf(node.pid), page);
- createField(Messages.GeneralInformationPage_ParentPID, Long.valueOf(node.ppid), page);
- createField(Messages.GeneralInformationPage_InternalPID, node.id, page);
- createField(Messages.GeneralInformationPage_InternalPPID, node.parentId, page);
-
- return page;
- }
- /**
- * Create a horizontal separator between field sections.
- *
- * @param parent
- * The parent composite of the separator.
- */
- protected void createSeparator(Composite parent) {
- Label label = new Label(parent, SWT.SEPARATOR | SWT.SHADOW_ETCHED_IN | SWT.HORIZONTAL);
- GridData data = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
- data.horizontalSpan = 2;
- label.setLayoutData(data);
- }
- /**
- * Create a field displaying the a specific value with a specific label.
- *
- * @param text
- * The label text for the field.
- * @param value
- * The value to be displayed.
- * @param parent
- * The parent composite of the field.
- */
- protected void createField(String text, Object value, Composite parent) {
- Label label = new Label(parent, SWT.NONE);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalAlignment = SWT.LEFT;
- data.verticalAlignment = SWT.TOP;
- label.setLayoutData(data);
- Text txt = new Text(parent, SWT.WRAP | SWT.READ_ONLY);
- data = new GridData();
- data.verticalAlignment = SWT.TOP;
- data.widthHint = 300;
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- txt.setLayoutData(data);
- txt.setBackground(txt.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- txt.setText(value == null ? "" : value.toString()); //$NON-NLS-1$
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.internal.properties;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.IProcesses;
+import org.eclipse.tcf.services.ISysMonitor;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+/**
+ * The general information page of a process' properties dialog.
+ */
+public class GeneralInformationPage extends PropertyPage {
+
+ /* default */ IProcessContextNode node;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createContents(Composite parent) {
+ IAdaptable element = getElement();
+ Assert.isTrue(element instanceof IProcessContextNode);
+
+ node = (IProcessContextNode) element;
+
+ final Map<String, Object> props = new HashMap<String, Object>();
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ props.putAll(node.getProcessContext().getProperties());
+ props.putAll(node.getSysMonitorContext().getProperties());
+ props.put(IModelNode.PROPERTY_TYPE, node.getType().toString());
+ }
+ };
+ Assert.isTrue(!Protocol.isDispatchThread());
+ Protocol.invokeAndWait(runnable);
+
+ Composite page = new Composite(parent, SWT.NONE);
+ GridLayout gridLayout = new GridLayout(2, false);
+ page.setLayout(gridLayout);
+
+ createField(Messages.GeneralInformationPage_Name, props.get(IProcesses.PROP_NAME), page);
+ createField(Messages.GeneralInformationPage_Type, props.get(IModelNode.PROPERTY_TYPE), page);
+ createField(Messages.GeneralInformationPage_State, props.get(ISysMonitor.PROP_STATE), page);
+ createField(Messages.GeneralInformationPage_User, props.get(ISysMonitor.PROP_USERNAME), page);
+ createSeparator(page);
+ createField(Messages.GeneralInformationPage_ProcessID, props.get(ISysMonitor.PROP_PID), page);
+ createField(Messages.GeneralInformationPage_ParentPID, props.get(ISysMonitor.PROP_PPID), page);
+ createField(Messages.GeneralInformationPage_InternalPID, props.get(IProcesses.PROP_ID), page);
+ createField(Messages.GeneralInformationPage_InternalPPID, props.get(IProcesses.PROP_PARENTID), page);
+
+ return page;
+ }
+ /**
+ * Create a horizontal separator between field sections.
+ *
+ * @param parent
+ * The parent composite of the separator.
+ */
+ protected void createSeparator(Composite parent) {
+ Label label = new Label(parent, SWT.SEPARATOR | SWT.SHADOW_ETCHED_IN | SWT.HORIZONTAL);
+ GridData data = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
+ data.horizontalSpan = 2;
+ label.setLayoutData(data);
+ }
+ /**
+ * Create a field displaying the a specific value with a specific label.
+ *
+ * @param text
+ * The label text for the field.
+ * @param value
+ * The value to be displayed.
+ * @param parent
+ * The parent composite of the field.
+ */
+ protected void createField(String text, Object value, Composite parent) {
+ Label label = new Label(parent, SWT.NONE);
+ label.setText(text);
+ GridData data = new GridData();
+ data.horizontalAlignment = SWT.LEFT;
+ data.verticalAlignment = SWT.TOP;
+ label.setLayoutData(data);
+ Text txt = new Text(parent, SWT.WRAP | SWT.READ_ONLY);
+ data = new GridData();
+ data.verticalAlignment = SWT.TOP;
+ data.widthHint = 300;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ txt.setLayoutData(data);
+ txt.setBackground(txt.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+ txt.setText(value == null ? "" : value.toString()); //$NON-NLS-1$
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessNodeGeneralMatcher.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessNodeGeneralMatcher.java
index 018e931de..1d768bcba 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessNodeGeneralMatcher.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessNodeGeneralMatcher.java
@@ -1,69 +1,67 @@
-/*******************************************************************************
- * Copyright (c) 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.processes.ui.internal.search;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.ui.internal.columns.ProcessLabelProvider;
-import org.eclipse.tcf.te.ui.interfaces.ISearchMatcher;
-import org.eclipse.tcf.te.ui.utils.StringMatcher;
-/**
- * The ISearchMatcher implementation for a Process Tree Node.
- */
-public class ProcessNodeGeneralMatcher implements ISearchMatcher {
- // Whether it is case sensitive
- private boolean fCaseSensitive;
- // Whether it is precise matching.
- private boolean fMatchPrecise;
- // The string matcher for matching.
- private StringMatcher fStringMatcher;
- // The label provider used to get a text for a process.
- private ILabelProvider labelProvider = new ProcessLabelProvider();
- // The current target names.
- private String fTargetName;
-
- /**
- * Constructor with options.
- *
- * @param caseSensitive
- * @param matchPrecise
- * @param targetName
- */
- public ProcessNodeGeneralMatcher(boolean caseSensitive, boolean matchPrecise, String targetName) {
- fCaseSensitive = caseSensitive;
- fTargetName = targetName;
- fMatchPrecise = matchPrecise;
- if (!fMatchPrecise) {
- fStringMatcher = new StringMatcher(fTargetName, !fCaseSensitive, false);
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ISearchMatcher#match(java.lang.Object)
- */
- @Override
- public boolean match(Object context) {
- if (context == null) return false;
- if (context instanceof ProcessTreeNode) {
- ProcessTreeNode node = (ProcessTreeNode) context;
- if (!node.isSystemRoot()) {
- String text = labelProvider.getText(node);
- if (text != null) {
- if (fMatchPrecise) {
- return fCaseSensitive ? text.equals(fTargetName) : text.equalsIgnoreCase(fTargetName);
- }
- return fStringMatcher.match(text);
- }
- }
- }
- return false;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 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.processes.ui.internal.search;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.ui.navigator.runtime.LabelProviderDelegate;
+import org.eclipse.tcf.te.ui.interfaces.ISearchMatcher;
+import org.eclipse.tcf.te.ui.utils.StringMatcher;
+/**
+ * The ISearchMatcher implementation for a Process Tree Node.
+ */
+public class ProcessNodeGeneralMatcher implements ISearchMatcher {
+ // Whether it is case sensitive
+ private boolean fCaseSensitive;
+ // Whether it is precise matching.
+ private boolean fMatchPrecise;
+ // The string matcher for matching.
+ private StringMatcher fStringMatcher;
+ // The label provider used to get a text for a process.
+ private ILabelProvider labelProvider = new LabelProviderDelegate();
+ // The current target names.
+ private String fTargetName;
+
+ /**
+ * Constructor with options.
+ *
+ * @param caseSensitive
+ * @param matchPrecise
+ * @param targetName
+ */
+ public ProcessNodeGeneralMatcher(boolean caseSensitive, boolean matchPrecise, String targetName) {
+ fCaseSensitive = caseSensitive;
+ fTargetName = targetName;
+ fMatchPrecise = matchPrecise;
+ if (!fMatchPrecise) {
+ fStringMatcher = new StringMatcher(fTargetName, !fCaseSensitive, false);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ISearchMatcher#match(java.lang.Object)
+ */
+ @Override
+ public boolean match(Object context) {
+ if (context == null) return false;
+ if (context instanceof IProcessContextNode) {
+ IProcessContextNode node = (IProcessContextNode) context;
+ String text = labelProvider.getText(node);
+ if (text != null) {
+ if (fMatchPrecise) {
+ return fCaseSensitive ? text.equals(fTargetName) : text.equalsIgnoreCase(fTargetName);
+ }
+ return fStringMatcher.match(text);
+ }
+ }
+ return false;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessSearchable.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessSearchable.java
index 24469cd49..1e536af0e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessSearchable.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessSearchable.java
@@ -1,87 +1,79 @@
-/*******************************************************************************
- * 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.processes.ui.internal.search;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.ui.internal.columns.ProcessLabelProvider;
-import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
-import org.eclipse.tcf.te.ui.utils.CompositeSearchable;
-
-/**
- * The ISearchable adapter for a ProcessTreeNode which creates a UI for the user to
- * input the matching condition and returns a matcher to do the matching.
- */
-public class ProcessSearchable extends CompositeSearchable {
- // The label provider used to get a text for a process.
- ILabelProvider labelProvider = new ProcessLabelProvider();
-
- /**
- * Constructor
- */
- public ProcessSearchable() {
- super(new GeneralSearchable(), new ProcessUserSearchable(), new ProcessStateSearchable());
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#getSearchTitle()
- */
- @Override
- public String getSearchTitle() {
- return Messages.ProcessSearchable_SearchTitle;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#getSearchMessage(java.lang.Object)
- */
- @Override
- public String getSearchMessage(Object rootElement) {
- if(rootElement == null) {
- return Messages.ProcessSearchable_PromptFindInProcessList;
- }
- ProcessTreeNode rootNode = (ProcessTreeNode) rootElement;
- if(rootNode.isSystemRoot()) {
- return Messages.ProcessSearchable_PromptFindInProcessList;
- }
- String message = Messages.ProcessSearchable_PromptFindUnderProcess;
- String rootName = "\"" + getElementName(rootElement) + "\""; //$NON-NLS-1$//$NON-NLS-2$
- message = NLS.bind(message, rootName);
- return message;
- }
-
- /**
- * Get a name representation for each process node.
- *
- * @param rootElement The root element whose name is being retrieved.
- * @return The node's name.
- */
- private String getElementName(Object rootElement) {
- if(rootElement == null) {
- return Messages.ProcessSearchable_ProcessList;
- }
- ProcessTreeNode rootNode = (ProcessTreeNode) rootElement;
- if(rootNode.isSystemRoot()) {
- return Messages.ProcessSearchable_ProcessList;
- }
- return labelProvider.getText(rootElement);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#getElementText(java.lang.Object)
- */
- @Override
- public String getElementText(Object element) {
- return getElementName(element);
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.internal.search;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeModel;
+import org.eclipse.tcf.te.tcf.processes.ui.navigator.runtime.LabelProviderDelegate;
+import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.utils.CompositeSearchable;
+
+/**
+ * The ISearchable adapter for a ProcessTreeNode which creates a UI for the user to
+ * input the matching condition and returns a matcher to do the matching.
+ */
+public class ProcessSearchable extends CompositeSearchable {
+ // The label provider used to get a text for a process.
+ ILabelProvider labelProvider = new LabelProviderDelegate();
+
+ /**
+ * Constructor
+ */
+ public ProcessSearchable() {
+ super(new GeneralSearchable(), new ProcessUserSearchable(), new ProcessStateSearchable());
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#getSearchTitle()
+ */
+ @Override
+ public String getSearchTitle() {
+ return Messages.ProcessSearchable_SearchTitle;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#getSearchMessage(java.lang.Object)
+ */
+ @Override
+ public String getSearchMessage(Object rootElement) {
+ if (rootElement == null || rootElement instanceof IRuntimeModel) {
+ return Messages.ProcessSearchable_PromptFindInProcessList;
+ }
+ String message = Messages.ProcessSearchable_PromptFindUnderProcess;
+ String rootName = "\"" + getElementName(rootElement) + "\""; //$NON-NLS-1$//$NON-NLS-2$
+ message = NLS.bind(message, rootName);
+ return message;
+ }
+
+ /**
+ * Get a name representation for each process node.
+ *
+ * @param rootElement The root element whose name is being retrieved.
+ * @return The node's name.
+ */
+ private String getElementName(Object rootElement) {
+ if(rootElement == null || rootElement instanceof IRuntimeModel) {
+ return Messages.ProcessSearchable_ProcessList;
+ }
+ return labelProvider.getText(rootElement);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#getElementText(java.lang.Object)
+ */
+ @Override
+ public String getElementText(Object element) {
+ return getElementName(element);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessStateSearchable.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessStateSearchable.java
index 8d1da49d6..7d810bf74 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessStateSearchable.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessStateSearchable.java
@@ -1,262 +1,277 @@
-/*******************************************************************************
- * 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.processes.ui.internal.search;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
-
-/**
- * The searchable that provides a UI to collect and test
- * the state of a process during searching.
- * <p>
- * Note the state of a process is expressed using a character from
- * "RSDZTW" where R is running, S is
- * sleeping in an interruptible wait, D is waiting in uninterruptible
- * disk sleep, Z is zombie, T is traced or stopped (on a signal), and W
- * is paging.
- */
-public class ProcessStateSearchable extends ProcessBaseSearchable {
- // Constant values of state options
- private static final int OPTION_NOT_REMEMBER = 0;
- private static final int OPTION_SPECIFIED = 1;
-
- // The choice selected
- private int choice;
-
- // UI elements for input
- private Button fBtnNotRem;
- private Button fBtnSpecified;
-
- private Button fBtnR;
- private Button fBtnS;
- private Button fBtnD;
- private Button fBtnZ;
- private Button fBtnT;
- private Button fBtnW;
-
- // The flags indicating if a certain state is included.
- private boolean fIncludeR;
- private boolean fIncludeS;
- private boolean fIncludeD;
- private boolean fIncludeZ;
- private boolean fIncludeT;
- private boolean fIncludeW;
-
- // The current selected states expressed in the above characters.
- private String fStates;
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#createAdvancedPart(org.eclipse.swt.widgets.Composite)
- */
- @Override
- public void createAdvancedPart(Composite parent) {
- SelectionListener l = new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- optionChecked(e);
- }
- };
- Composite stateComposite = createSection(parent, Messages.ProcessStateSearchable_SectionChooseState);
- stateComposite.setLayout(new GridLayout());
-
- fBtnNotRem = new Button(stateComposite, SWT.RADIO);
- fBtnNotRem.setText(Messages.ProcessStateSearchable_NotSure);
- fBtnNotRem.setSelection(true);
- GridData data = new GridData();
- fBtnNotRem.setLayoutData(data);
- fBtnNotRem.addSelectionListener(l);
-
- fBtnSpecified = new Button(stateComposite, SWT.RADIO);
- fBtnSpecified.setText(Messages.ProcessStateSearchable_SpecifyState);
- data = new GridData();
- fBtnSpecified.setLayoutData(data);
- fBtnSpecified.addSelectionListener(l);
-
- Composite cmpStates = new Composite(stateComposite, SWT.NONE);
- data = new GridData(GridData.FILL_HORIZONTAL);
- cmpStates.setLayoutData(data);
- GridLayout layout = new GridLayout(3, true);
- layout.marginLeft = 20;
- cmpStates.setLayout(layout);
-
- fBtnR = new Button(cmpStates, SWT.CHECK);
- fBtnR.setText(Messages.ProcessStateSearchable_StateRunning);
- fBtnR.setEnabled(false);
- data = new GridData();
- fBtnR.setLayoutData(data);
- fBtnR.addSelectionListener(l);
-
- fBtnS = new Button(cmpStates, SWT.CHECK);
- fBtnS.setText(Messages.ProcessStateSearchable_StateSleeping);
- fBtnS.setEnabled(false);
- data = new GridData();
- fBtnS.setLayoutData(data);
- fBtnS.addSelectionListener(l);
-
- fBtnD = new Button(cmpStates, SWT.CHECK);
- fBtnD.setText(Messages.ProcessStateSearchable_StateWaiting);
- fBtnD.setEnabled(false);
- data = new GridData();
- fBtnD.setLayoutData(data);
- fBtnD.addSelectionListener(l);
-
- fBtnZ = new Button(cmpStates, SWT.CHECK);
- fBtnZ.setText(Messages.ProcessStateSearchable_StateZombie);
- fBtnZ.setEnabled(false);
- data = new GridData();
- fBtnZ.setLayoutData(data);
- fBtnZ.addSelectionListener(l);
-
- fBtnT = new Button(cmpStates, SWT.CHECK);
- fBtnT.setText(Messages.ProcessStateSearchable_StateTraced);
- fBtnT.setEnabled(false);
- data = new GridData();
- fBtnT.setLayoutData(data);
- fBtnT.addSelectionListener(l);
-
- fBtnW = new Button(cmpStates, SWT.CHECK);
- fBtnW.setText(Messages.ProcessStateSearchable_StatePaging);
- fBtnW.setEnabled(false);
- data = new GridData();
- fBtnW.setLayoutData(data);
- fBtnW.addSelectionListener(l);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#isInputValid()
- */
- @Override
- public boolean isInputValid() {
- if(choice == OPTION_SPECIFIED) {
- boolean valid = fIncludeR || fIncludeS || fIncludeD || fIncludeZ || fIncludeT || fIncludeW;
- return valid;
- }
- return true;
- }
-
- /**
- * The method handling the selection event.
- *
- * @param e The selection event.
- */
- protected void optionChecked(SelectionEvent e) {
- Object src = e.getSource();
- if(src == fBtnNotRem) {
- choice = OPTION_NOT_REMEMBER;
- setButtonStates(false);
- }
- else if(src == fBtnSpecified) {
- choice = OPTION_SPECIFIED;
- setButtonStates(true);
- fStates = getSelectedStates();
- }
- else if(src == fBtnR) {
- fIncludeR = fBtnR.getSelection();
- fStates = getSelectedStates();
- }
- else if(src == fBtnS) {
- fIncludeS = fBtnS.getSelection();
- fStates = getSelectedStates();
- }
- else if(src == fBtnD) {
- fIncludeD = fBtnD.getSelection();
- fStates = getSelectedStates();
- }
- else if(src == fBtnZ) {
- fIncludeZ = fBtnZ.getSelection();
- fStates = getSelectedStates();
- }
- else if(src == fBtnT) {
- fIncludeT = fBtnT.getSelection();
- fStates = getSelectedStates();
- }
- else if(src == fBtnW) {
- fIncludeW = fBtnW.getSelection();
- fStates = getSelectedStates();
- }
- fireOptionChanged();
- }
-
- /**
- * Get the current state strings expressed in the character set
- * mentioned above.
- *
- * @return A string that contains all the selected states.
- */
- private String getSelectedStates() {
- StringBuilder builder = new StringBuilder();
- if(fIncludeR) {
- builder.append("R"); //$NON-NLS-1$
- }
- if(fIncludeS) {
- builder.append("S"); //$NON-NLS-1$
- }
- if(fIncludeD) {
- builder.append("D"); //$NON-NLS-1$
- }
- if(fIncludeZ) {
- builder.append("Z"); //$NON-NLS-1$
- }
- if(fIncludeT) {
- builder.append("T"); //$NON-NLS-1$
- }
- if(fIncludeW) {
- builder.append("W"); //$NON-NLS-1$
- }
- return builder.toString();
- }
-
- /**
- * Enable the state buttons using the specified
- * enablement flag.
- *
- * @param enabled the enablement flag.
- */
- private void setButtonStates(boolean enabled) {
- fBtnR.setEnabled(enabled);
- fBtnS.setEnabled(enabled);
- fBtnD.setEnabled(enabled);
- fBtnZ.setEnabled(enabled);
- fBtnT.setEnabled(enabled);
- fBtnW.setEnabled(enabled);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ISearchMatcher#match(java.lang.Object)
- */
- @Override
- public boolean match(Object element) {
- if (element instanceof ProcessTreeNode) {
- switch (choice) {
- case OPTION_NOT_REMEMBER:
- return true;
- case OPTION_SPECIFIED:
- ProcessTreeNode node = (ProcessTreeNode) element;
- String state = node.state;
- if(state != null && state.length() > 0) {
- state = state.toUpperCase();
- return fStates.indexOf(state) != -1;
- }
- }
- }
- return false;
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.internal.search;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
+
+/**
+ * The searchable that provides a UI to collect and test
+ * the state of a process during searching.
+ * <p>
+ * Note the state of a process is expressed using a character from
+ * "RSDZTW" where R is running, S is
+ * sleeping in an interruptible wait, D is waiting in uninterruptible
+ * disk sleep, Z is zombie, T is traced or stopped (on a signal), and W
+ * is paging.
+ */
+public class ProcessStateSearchable extends ProcessBaseSearchable {
+ // Constant values of state options
+ private static final int OPTION_NOT_REMEMBER = 0;
+ private static final int OPTION_SPECIFIED = 1;
+
+ // The choice selected
+ private int choice;
+
+ // UI elements for input
+ private Button fBtnNotRem;
+ private Button fBtnSpecified;
+
+ private Button fBtnR;
+ private Button fBtnS;
+ private Button fBtnD;
+ private Button fBtnZ;
+ private Button fBtnT;
+ private Button fBtnW;
+
+ // The flags indicating if a certain state is included.
+ private boolean fIncludeR;
+ private boolean fIncludeS;
+ private boolean fIncludeD;
+ private boolean fIncludeZ;
+ private boolean fIncludeT;
+ private boolean fIncludeW;
+
+ // The current selected states expressed in the above characters.
+ private String fStates;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#createAdvancedPart(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createAdvancedPart(Composite parent) {
+ SelectionListener l = new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ optionChecked(e);
+ }
+ };
+ Composite stateComposite = createSection(parent, Messages.ProcessStateSearchable_SectionChooseState);
+ stateComposite.setLayout(new GridLayout());
+
+ fBtnNotRem = new Button(stateComposite, SWT.RADIO);
+ fBtnNotRem.setText(Messages.ProcessStateSearchable_NotSure);
+ fBtnNotRem.setSelection(true);
+ GridData data = new GridData();
+ fBtnNotRem.setLayoutData(data);
+ fBtnNotRem.addSelectionListener(l);
+
+ fBtnSpecified = new Button(stateComposite, SWT.RADIO);
+ fBtnSpecified.setText(Messages.ProcessStateSearchable_SpecifyState);
+ data = new GridData();
+ fBtnSpecified.setLayoutData(data);
+ fBtnSpecified.addSelectionListener(l);
+
+ Composite cmpStates = new Composite(stateComposite, SWT.NONE);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ cmpStates.setLayoutData(data);
+ GridLayout layout = new GridLayout(3, true);
+ layout.marginLeft = 20;
+ cmpStates.setLayout(layout);
+
+ fBtnR = new Button(cmpStates, SWT.CHECK);
+ fBtnR.setText(Messages.ProcessStateSearchable_StateRunning);
+ fBtnR.setEnabled(false);
+ data = new GridData();
+ fBtnR.setLayoutData(data);
+ fBtnR.addSelectionListener(l);
+
+ fBtnS = new Button(cmpStates, SWT.CHECK);
+ fBtnS.setText(Messages.ProcessStateSearchable_StateSleeping);
+ fBtnS.setEnabled(false);
+ data = new GridData();
+ fBtnS.setLayoutData(data);
+ fBtnS.addSelectionListener(l);
+
+ fBtnD = new Button(cmpStates, SWT.CHECK);
+ fBtnD.setText(Messages.ProcessStateSearchable_StateWaiting);
+ fBtnD.setEnabled(false);
+ data = new GridData();
+ fBtnD.setLayoutData(data);
+ fBtnD.addSelectionListener(l);
+
+ fBtnZ = new Button(cmpStates, SWT.CHECK);
+ fBtnZ.setText(Messages.ProcessStateSearchable_StateZombie);
+ fBtnZ.setEnabled(false);
+ data = new GridData();
+ fBtnZ.setLayoutData(data);
+ fBtnZ.addSelectionListener(l);
+
+ fBtnT = new Button(cmpStates, SWT.CHECK);
+ fBtnT.setText(Messages.ProcessStateSearchable_StateTraced);
+ fBtnT.setEnabled(false);
+ data = new GridData();
+ fBtnT.setLayoutData(data);
+ fBtnT.addSelectionListener(l);
+
+ fBtnW = new Button(cmpStates, SWT.CHECK);
+ fBtnW.setText(Messages.ProcessStateSearchable_StatePaging);
+ fBtnW.setEnabled(false);
+ data = new GridData();
+ fBtnW.setLayoutData(data);
+ fBtnW.addSelectionListener(l);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#isInputValid()
+ */
+ @Override
+ public boolean isInputValid() {
+ if(choice == OPTION_SPECIFIED) {
+ boolean valid = fIncludeR || fIncludeS || fIncludeD || fIncludeZ || fIncludeT || fIncludeW;
+ return valid;
+ }
+ return true;
+ }
+
+ /**
+ * The method handling the selection event.
+ *
+ * @param e The selection event.
+ */
+ protected void optionChecked(SelectionEvent e) {
+ Object src = e.getSource();
+ if(src == fBtnNotRem) {
+ choice = OPTION_NOT_REMEMBER;
+ setButtonStates(false);
+ }
+ else if(src == fBtnSpecified) {
+ choice = OPTION_SPECIFIED;
+ setButtonStates(true);
+ fStates = getSelectedStates();
+ }
+ else if(src == fBtnR) {
+ fIncludeR = fBtnR.getSelection();
+ fStates = getSelectedStates();
+ }
+ else if(src == fBtnS) {
+ fIncludeS = fBtnS.getSelection();
+ fStates = getSelectedStates();
+ }
+ else if(src == fBtnD) {
+ fIncludeD = fBtnD.getSelection();
+ fStates = getSelectedStates();
+ }
+ else if(src == fBtnZ) {
+ fIncludeZ = fBtnZ.getSelection();
+ fStates = getSelectedStates();
+ }
+ else if(src == fBtnT) {
+ fIncludeT = fBtnT.getSelection();
+ fStates = getSelectedStates();
+ }
+ else if(src == fBtnW) {
+ fIncludeW = fBtnW.getSelection();
+ fStates = getSelectedStates();
+ }
+ fireOptionChanged();
+ }
+
+ /**
+ * Get the current state strings expressed in the character set
+ * mentioned above.
+ *
+ * @return A string that contains all the selected states.
+ */
+ private String getSelectedStates() {
+ StringBuilder builder = new StringBuilder();
+ if(fIncludeR) {
+ builder.append("R"); //$NON-NLS-1$
+ }
+ if(fIncludeS) {
+ builder.append("S"); //$NON-NLS-1$
+ }
+ if(fIncludeD) {
+ builder.append("D"); //$NON-NLS-1$
+ }
+ if(fIncludeZ) {
+ builder.append("Z"); //$NON-NLS-1$
+ }
+ if(fIncludeT) {
+ builder.append("T"); //$NON-NLS-1$
+ }
+ if(fIncludeW) {
+ builder.append("W"); //$NON-NLS-1$
+ }
+ return builder.toString();
+ }
+
+ /**
+ * Enable the state buttons using the specified
+ * enablement flag.
+ *
+ * @param enabled the enablement flag.
+ */
+ private void setButtonStates(boolean enabled) {
+ fBtnR.setEnabled(enabled);
+ fBtnS.setEnabled(enabled);
+ fBtnD.setEnabled(enabled);
+ fBtnZ.setEnabled(enabled);
+ fBtnT.setEnabled(enabled);
+ fBtnW.setEnabled(enabled);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ISearchMatcher#match(java.lang.Object)
+ */
+ @Override
+ public boolean match(Object element) {
+ if (element instanceof IProcessContextNode) {
+ switch (choice) {
+ case OPTION_NOT_REMEMBER:
+ return true;
+ case OPTION_SPECIFIED:
+ final IProcessContextNode node = (IProcessContextNode) element;
+
+ final AtomicReference<String> state = new AtomicReference<String>();
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ state.set(node.getSysMonitorContext().getState());
+ }
+ };
+
+ Assert.isTrue(!Protocol.isDispatchThread());
+ Protocol.invokeAndWait(runnable);
+
+ if(state.get() != null && state.get().length() > 0) {
+ state.set(state.get().toUpperCase());
+ return fStates.indexOf(state.get()) != -1;
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessUserSearchable.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessUserSearchable.java
index a3467d9cd..cd2a93d65 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessUserSearchable.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessUserSearchable.java
@@ -1,177 +1,193 @@
-/*******************************************************************************
- * 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.processes.ui.internal.search;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
-import org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl;
-
-/**
- * The searchable that provides a UI to collect and test
- * the user of a process during searching.
- */
-public class ProcessUserSearchable extends ProcessBaseSearchable {
- // Constant values of user options
- private static final int OPTION_NOT_REMEMBER = 0;
- private static final int OPTION_BY_ME = 1;
- private static final int OPTION_SPECIFIED = 2;
-
- // The choice selected
- private int choice;
- // The specified user when "Specify user" is selected.
- private String user;
-
- // UI elements to input
- private Button fBtnUserNotRem;
- private Button fBtnUserMe;
- private Button fBtnUserSpecified;
- private BaseEditBrowseTextControl txtUser;
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#createAdvancedPart(org.eclipse.swt.widgets.Composite)
- */
- @Override
- public void createAdvancedPart(Composite parent) {
- SelectionListener l = new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- optionChecked(e);
- }
- };
- Composite modifiedComp = createSection(parent, Messages.ProcessUserSearchable_WhoStarted);
- modifiedComp.setLayout(new GridLayout(2, false));
-
- fBtnUserNotRem = new Button(modifiedComp, SWT.RADIO);
- fBtnUserNotRem.setText(Messages.ProcessUserSearchable_DontRemember);
- fBtnUserNotRem.setSelection(true);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- fBtnUserNotRem.setLayoutData(data);
- fBtnUserNotRem.addSelectionListener(l);
-
- fBtnUserMe = new Button(modifiedComp, SWT.RADIO);
- fBtnUserMe.setText(Messages.ProcessUserSearchable_Myself);
- data = new GridData();
- data.horizontalSpan = 2;
- fBtnUserMe.setLayoutData(data);
- fBtnUserMe.addSelectionListener(l);
-
- fBtnUserSpecified = new Button(modifiedComp, SWT.RADIO);
- fBtnUserSpecified.setText(Messages.ProcessUserSearchable_SpecifyUser);
- data = new GridData();
- fBtnUserSpecified.setLayoutData(data);
- fBtnUserSpecified.addSelectionListener(l);
-
- Composite cmpUser = new Composite(modifiedComp, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- cmpUser.setLayout(layout);
- data = new GridData();
- cmpUser.setLayoutData(data);
-
- txtUser = new BaseEditBrowseTextControl(null);
- txtUser.setIsGroup(false);
- txtUser.setHasHistory(false);
- txtUser.setHideBrowseButton(true);
- txtUser.setParentControlIsInnerPanel(true);
- txtUser.setupPanel(cmpUser);
- txtUser.setEnabled(false);
- Text text = (Text) txtUser.getEditFieldControl();
- text.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- userModified();
- }
- });
- }
-
- /**
- * The modified event of the user fields.
- */
- protected void userModified() {
- fireOptionChanged();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#isInputValid()
- */
- @Override
- public boolean isInputValid() {
- if(choice == OPTION_SPECIFIED && txtUser != null) {
- boolean vFrom = txtUser.isValid();
- if(vFrom) {
- String fromText = txtUser.getEditFieldControlText().trim();
- this.user = fromText;
- }
- return vFrom;
- }
- return true;
- }
-
- /**
- * The method handling the selection event.
- *
- * @param e The selection event.
- */
- protected void optionChecked(SelectionEvent e) {
- Object src = e.getSource();
- boolean specified = false;
- if(src == fBtnUserNotRem) {
- choice = OPTION_NOT_REMEMBER;
- }
- else if(src == fBtnUserMe) {
- choice = OPTION_BY_ME;
- }
- else if(src == fBtnUserSpecified) {
- choice = OPTION_SPECIFIED;
- specified = true;
- }
- if (txtUser != null) {
- txtUser.setEnabled(specified);
- }
- fireOptionChanged();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ISearchMatcher#match(java.lang.Object)
- */
- @Override
- public boolean match(Object element) {
- if (element instanceof ProcessTreeNode) {
- ProcessTreeNode process = (ProcessTreeNode) element;
- switch (choice) {
- case OPTION_NOT_REMEMBER:
- return true;
- case OPTION_BY_ME:
- return process.isAgentOwner();
- case OPTION_SPECIFIED:
- return user == null ? process.username == null : user.equals(process.username);
- }
- }
- return false;
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.internal.search;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl;
+
+/**
+ * The searchable that provides a UI to collect and test
+ * the user of a process during searching.
+ */
+public class ProcessUserSearchable extends ProcessBaseSearchable {
+ // Constant values of user options
+ private static final int OPTION_NOT_REMEMBER = 0;
+ private static final int OPTION_BY_ME = 1;
+ private static final int OPTION_SPECIFIED = 2;
+
+ // The choice selected
+ private int choice;
+ // The specified user when "Specify user" is selected.
+ private String user;
+
+ // UI elements to input
+ private Button fBtnUserNotRem;
+ private Button fBtnUserMe;
+ private Button fBtnUserSpecified;
+ private BaseEditBrowseTextControl txtUser;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#createAdvancedPart(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createAdvancedPart(Composite parent) {
+ SelectionListener l = new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ optionChecked(e);
+ }
+ };
+ Composite modifiedComp = createSection(parent, Messages.ProcessUserSearchable_WhoStarted);
+ modifiedComp.setLayout(new GridLayout(2, false));
+
+ fBtnUserNotRem = new Button(modifiedComp, SWT.RADIO);
+ fBtnUserNotRem.setText(Messages.ProcessUserSearchable_DontRemember);
+ fBtnUserNotRem.setSelection(true);
+ GridData data = new GridData();
+ data.horizontalSpan = 2;
+ fBtnUserNotRem.setLayoutData(data);
+ fBtnUserNotRem.addSelectionListener(l);
+
+ fBtnUserMe = new Button(modifiedComp, SWT.RADIO);
+ fBtnUserMe.setText(Messages.ProcessUserSearchable_Myself);
+ data = new GridData();
+ data.horizontalSpan = 2;
+ fBtnUserMe.setLayoutData(data);
+ fBtnUserMe.addSelectionListener(l);
+
+ fBtnUserSpecified = new Button(modifiedComp, SWT.RADIO);
+ fBtnUserSpecified.setText(Messages.ProcessUserSearchable_SpecifyUser);
+ data = new GridData();
+ fBtnUserSpecified.setLayoutData(data);
+ fBtnUserSpecified.addSelectionListener(l);
+
+ Composite cmpUser = new Composite(modifiedComp, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ cmpUser.setLayout(layout);
+ data = new GridData();
+ cmpUser.setLayoutData(data);
+
+ txtUser = new BaseEditBrowseTextControl(null);
+ txtUser.setIsGroup(false);
+ txtUser.setHasHistory(false);
+ txtUser.setHideBrowseButton(true);
+ txtUser.setParentControlIsInnerPanel(true);
+ txtUser.setupPanel(cmpUser);
+ txtUser.setEnabled(false);
+ Text text = (Text) txtUser.getEditFieldControl();
+ text.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ userModified();
+ }
+ });
+ }
+
+ /**
+ * The modified event of the user fields.
+ */
+ protected void userModified() {
+ fireOptionChanged();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#isInputValid()
+ */
+ @Override
+ public boolean isInputValid() {
+ if(choice == OPTION_SPECIFIED && txtUser != null) {
+ boolean vFrom = txtUser.isValid();
+ if(vFrom) {
+ String fromText = txtUser.getEditFieldControlText().trim();
+ this.user = fromText;
+ }
+ return vFrom;
+ }
+ return true;
+ }
+
+ /**
+ * The method handling the selection event.
+ *
+ * @param e The selection event.
+ */
+ protected void optionChecked(SelectionEvent e) {
+ Object src = e.getSource();
+ boolean specified = false;
+ if(src == fBtnUserNotRem) {
+ choice = OPTION_NOT_REMEMBER;
+ }
+ else if(src == fBtnUserMe) {
+ choice = OPTION_BY_ME;
+ }
+ else if(src == fBtnUserSpecified) {
+ choice = OPTION_SPECIFIED;
+ specified = true;
+ }
+ if (txtUser != null) {
+ txtUser.setEnabled(specified);
+ }
+ fireOptionChanged();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ISearchMatcher#match(java.lang.Object)
+ */
+ @Override
+ public boolean match(Object element) {
+ if (element instanceof IProcessContextNode) {
+ final IProcessContextNode node = (IProcessContextNode) element;
+
+ final AtomicReference<String> username = new AtomicReference<String>();
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ username.set(node.getSysMonitorContext().getUserName());
+ }
+ };
+
+ Assert.isTrue(!Protocol.isDispatchThread());
+ Protocol.invokeAndWait(runnable);
+
+ switch (choice) {
+ case OPTION_NOT_REMEMBER:
+ return true;
+ case OPTION_BY_ME:
+ return System.getProperty("user.name").equals(username.get()); //$NON-NLS-1$
+ case OPTION_SPECIFIED:
+ return user == null ? username.get() == null : user.equals(username.get());
+ }
+ }
+ return false;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/AdvancedPropertiesSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/AdvancedPropertiesSection.java
index 1e6d5bec3..33624a6fb 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/AdvancedPropertiesSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/AdvancedPropertiesSection.java
@@ -1,96 +1,103 @@
-/*******************************************************************************
- * 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.processes.ui.internal.tabbed;
-
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-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.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-
-/**
- * The property section to display the advanced properties of a process context.
- */
-public class AdvancedPropertiesSection extends AbstractPropertySection {
- // The properties map.
- protected Map<String, Object> properties;
-
- // The table control to display the properties.
- private 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);
- Composite composite = getWidgetFactory().createFlatFormComposite(parent);
- 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.AdvancedPropertiesSection_Name);
- column.setWidth(100);
- column = new TableColumn(table, SWT.LEFT);
- column.setText(Messages.AdvancedPropertiesSection_Value);
- column.setWidth(150);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- viewer = new TableViewer(table);
- viewer.setContentProvider(new MapContentProvider());
- viewer.setLabelProvider(new MapEntryLabelProvider());
- }
-
- /*
- * (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();
- Assert.isTrue(input instanceof ProcessTreeNode);
- ProcessTreeNode node = (ProcessTreeNode) input;
- if(node.context != null) {
- properties = node.context.getProperties();
- }
- else {
- properties = null;
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
- */
- @Override
- public void refresh() {
- if (viewer != null) viewer.setInput(properties);
- }
-}
+/*******************************************************************************
+ * 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.processes.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.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.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+/**
+ * The property section to display the advanced properties of a process context.
+ */
+public class AdvancedPropertiesSection extends AbstractPropertySection {
+ // The properties map.
+ /* default */ Map<String, Object> properties;
+
+ // The table control to display the properties.
+ private 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);
+ Composite composite = getWidgetFactory().createFlatFormComposite(parent);
+ 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.AdvancedPropertiesSection_Name);
+ column.setWidth(100);
+ column = new TableColumn(table, SWT.LEFT);
+ column.setText(Messages.AdvancedPropertiesSection_Value);
+ column.setWidth(150);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ viewer = new TableViewer(table);
+ viewer.setContentProvider(new MapContentProvider());
+ viewer.setLabelProvider(new MapEntryLabelProvider());
+ }
+
+ /*
+ * (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();
+ Assert.isTrue(input instanceof IProcessContextNode);
+ final IProcessContextNode node = (IProcessContextNode) input;
+ final AtomicReference<Map<String, Object>> props = new AtomicReference<Map<String,Object>>();
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ props.set(node.getSysMonitorContext().getProperties());
+ }
+ };
+ Assert.isTrue(!Protocol.isDispatchThread());
+ Protocol.invokeAndWait(runnable);
+
+ properties = props.get();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
+ */
+ @Override
+ public void refresh() {
+ if (viewer != null) viewer.setInput(properties);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/BasicContextSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/BasicContextSection.java
index 60d1387cf..64a8aaf58 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/BasicContextSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/BasicContextSection.java
@@ -1,91 +1,101 @@
-/*******************************************************************************
- * 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.processes.ui.internal.tabbed;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.tcf.services.ISysMonitor;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-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;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-
-/**
- * The property section to display the basic context information of a process.
- */
-public class BasicContextSection extends BaseTitledSection {
- // The process context to be displayed.
- protected ISysMonitor.SysMonitorContext context;
- // The text field for the executable file.
- protected Text fileText;
- // The text field for the working directory.
- protected Text workDirText;
- // The text field for the root directory.
- protected Text rootText;
- // The state of the process.
- protected Text stateText;
- // The owner of the process.
- protected Text userText;
- // The owner group of the process.
- protected Text groupText;
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#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);
- fileText = createWrapTextField(null, Messages.BasicContextSection_File);
- workDirText = createWrapTextField(fileText, Messages.BasicContextSection_WorkDir);
- rootText = createWrapTextField(workDirText, Messages.BasicContextSection_Root);
- stateText = createTextField(rootText, Messages.BasicContextSection_State);
- userText = createTextField(stateText, Messages.BasicContextSection_User);
- groupText = createTextField(userText, Messages.BasicContextSection_Group);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#updateData(org.eclipse.tcf.te.ui.interfaces.IPropertyChangeProvider)
- */
- @Override
- protected void updateInput(IPeerModelProvider input) {
- Assert.isTrue(input instanceof ProcessTreeNode);
- ProcessTreeNode node = (ProcessTreeNode) input;
- context = node.context;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
- */
- @Override
- public void refresh() {
- SWTControlUtil.setText(fileText, context == null ? "" : (context.getFile() == null ? "" : context.getFile())); //$NON-NLS-1$ //$NON-NLS-2$
- SWTControlUtil.setText(workDirText, context == null ? "" : (context.getCurrentWorkingDirectory() == null ? "" : context.getCurrentWorkingDirectory())); //$NON-NLS-1$ //$NON-NLS-2$
- SWTControlUtil.setText(rootText, context == null ? "" : (context.getRoot() == null ? "" : context.getRoot())); //$NON-NLS-1$ //$NON-NLS-2$
- SWTControlUtil.setText(stateText, context == null ? "" : (context.getState() == null ? "" : context.getState())); //$NON-NLS-1$ //$NON-NLS-2$
- SWTControlUtil.setText(userText, context == null ? "" : (context.getUserName() == null ? "" : context.getUserName())); //$NON-NLS-1$ //$NON-NLS-2$
- SWTControlUtil.setText(groupText, context == null ? "" : (context.getGroupName() == null ? "" : context.getGroupName())); //$NON-NLS-1$ //$NON-NLS-2$
- super.refresh();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#getText()
- */
- @Override
- protected String getText() {
- return Messages.BasicContextSection_Title;
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.internal.tabbed;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.ISysMonitor;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+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;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+/**
+ * The property section to display the basic context information of a process.
+ */
+public class BasicContextSection extends BaseTitledSection {
+ // The process context to be displayed.
+ /* default */ ISysMonitor.SysMonitorContext context;
+ // The text field for the executable file.
+ private Text fileText;
+ // The text field for the working directory.
+ private Text workDirText;
+ // The text field for the root directory.
+ private Text rootText;
+ // The state of the process.
+ private Text stateText;
+ // The owner of the process.
+ private Text userText;
+ // The owner group of the process.
+ private Text groupText;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#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);
+ fileText = createWrapTextField(null, Messages.BasicContextSection_File);
+ workDirText = createWrapTextField(fileText, Messages.BasicContextSection_WorkDir);
+ rootText = createWrapTextField(workDirText, Messages.BasicContextSection_Root);
+ stateText = createTextField(rootText, Messages.BasicContextSection_State);
+ userText = createTextField(stateText, Messages.BasicContextSection_User);
+ groupText = createTextField(userText, Messages.BasicContextSection_Group);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#updateData(org.eclipse.tcf.te.ui.interfaces.IPropertyChangeProvider)
+ */
+ @Override
+ protected void updateInput(IPeerModelProvider input) {
+ Assert.isTrue(input instanceof IProcessContextNode);
+ final IProcessContextNode node = (IProcessContextNode) input;
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ context = node.getSysMonitorContext();
+ }
+ };
+
+ Assert.isTrue(!Protocol.isDispatchThread());
+ Protocol.invokeAndWait(runnable);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
+ */
+ @Override
+ public void refresh() {
+ SWTControlUtil.setText(fileText, context == null ? "" : (context.getFile() == null ? "" : context.getFile())); //$NON-NLS-1$ //$NON-NLS-2$
+ SWTControlUtil.setText(workDirText, context == null ? "" : (context.getCurrentWorkingDirectory() == null ? "" : context.getCurrentWorkingDirectory())); //$NON-NLS-1$ //$NON-NLS-2$
+ SWTControlUtil.setText(rootText, context == null ? "" : (context.getRoot() == null ? "" : context.getRoot())); //$NON-NLS-1$ //$NON-NLS-2$
+ SWTControlUtil.setText(stateText, context == null ? "" : (context.getState() == null ? "" : context.getState())); //$NON-NLS-1$ //$NON-NLS-2$
+ SWTControlUtil.setText(userText, context == null ? "" : (context.getUserName() == null ? "" : context.getUserName())); //$NON-NLS-1$ //$NON-NLS-2$
+ SWTControlUtil.setText(groupText, context == null ? "" : (context.getGroupName() == null ? "" : context.getGroupName())); //$NON-NLS-1$ //$NON-NLS-2$
+ super.refresh();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#getText()
+ */
+ @Override
+ protected String getText() {
+ return Messages.BasicContextSection_Title;
+ }
+}
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 646020d91..4cbd54132 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
@@ -1,81 +1,99 @@
-/*******************************************************************************
- * 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.processes.ui.internal.tabbed;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-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;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-
-/**
- * The property section to display the basic information of a process.
- */
-public class BasicInformationSection extends BaseTitledSection {
- // The process tree node to be displayed.
- protected ProcessTreeNode node;
- // The text field for the name of the process.
- protected Text nameText;
- // The text field for the type of the process.
- protected Text typeText;
- // The text field for the state of the process.
- protected Text stateText;
- // The text field for the ownere of the process.
- protected Text userText;
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#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);
- nameText = createWrapTextField(null, Messages.BasicInformationSection_Name);
- typeText = createTextField(nameText, Messages.BasicInformationSection_Type);
- stateText = createTextField(typeText, Messages.BasicInformationSection_State);
- userText = createTextField(stateText, Messages.BasicInformationSection_User);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#updateData(org.eclipse.tcf.te.ui.interfaces.IPropertyChangeProvider)
- */
- @Override
- protected void updateInput(IPeerModelProvider input) {
- Assert.isTrue(input instanceof ProcessTreeNode);
- this.node = (ProcessTreeNode) input;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
- */
- @Override
- public void refresh() {
- SWTControlUtil.setText(nameText, node != null && node.name != null ? node.name : Messages.ProcessLabelProvider_RootNodeLabel);
- SWTControlUtil.setText(typeText, node != null && node.type != null ? node.type : ""); //$NON-NLS-1$
- SWTControlUtil.setText(stateText, node != null && node.state != null ? node.state : ""); //$NON-NLS-1$
- SWTControlUtil.setText(userText, node != null && node.username != null ? node.username : ""); //$NON-NLS-1$
- super.refresh();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#getText()
- */
- @Override
- protected String getText() {
- return Messages.BasicInformationSection_Title;
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.internal.tabbed;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.ISysMonitor;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+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;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+/**
+ * The property section to display the basic information of a process.
+ */
+public class BasicInformationSection extends BaseTitledSection {
+ // The system monitor context for the selected process node.
+ /* default */ ISysMonitor.SysMonitorContext context;
+ // The process name
+ /* default */ String nodeName;
+ // The node type
+ /* default */ String nodeType;
+ // The text field for the name of the process.
+ private Text nameText;
+ // The text field for the type of the process.
+ private Text typeText;
+ // The text field for the state of the process.
+ private Text stateText;
+ // The text field for the owner of the process.
+ private Text userText;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#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);
+ nameText = createWrapTextField(null, Messages.BasicInformationSection_Name);
+ typeText = createTextField(nameText, Messages.BasicInformationSection_Type);
+ stateText = createTextField(typeText, Messages.BasicInformationSection_State);
+ userText = createTextField(stateText, Messages.BasicInformationSection_User);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#updateData(org.eclipse.tcf.te.ui.interfaces.IPropertyChangeProvider)
+ */
+ @Override
+ protected void updateInput(IPeerModelProvider input) {
+ Assert.isTrue(input instanceof IProcessContextNode);
+ final IProcessContextNode node = (IProcessContextNode) input;
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ context = node.getSysMonitorContext();
+ nodeName = node.getName();
+ nodeType = node.getType().toString();
+ }
+ };
+
+ Assert.isTrue(!Protocol.isDispatchThread());
+ Protocol.invokeAndWait(runnable);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
+ */
+ @Override
+ public void refresh() {
+ SWTControlUtil.setText(nameText, nodeName != null ? nodeName: ""); //$NON-NLS-1$
+ SWTControlUtil.setText(typeText, nodeType != null ? nodeType : ""); //$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();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#getText()
+ */
+ @Override
+ protected String getText() {
+ return Messages.BasicInformationSection_Title;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/ContextIDSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/ContextIDSection.java
index 84e691d14..ce73e97b2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/ContextIDSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/ContextIDSection.java
@@ -1,103 +1,109 @@
-/*******************************************************************************
- * 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.processes.ui.internal.tabbed;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.tcf.services.ISysMonitor;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
-import org.eclipse.tcf.te.tcf.ui.tabbed.BaseTitledSection;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-
-/**
- * The property section to display the context IDs of a process.
- */
-public class ContextIDSection extends BaseTitledSection {
- // The system monitor context for the selected process node.
- protected ISysMonitor.SysMonitorContext context;
- // The text field to display the id of the process context.
- protected Text idText;
- // The text field to display the parent id of the process context.
- protected Text parentIdText;
- // The text field to display the process group id.
- protected Text pgrpText;
- // The text field to display the process id.
- protected Text pidText;
- // The text field to display the parent process id.
- protected Text ppidText;
- // The text field to display the process TTY group ID.
- protected Text tgidText;
- // The text field to display the tracer process's id.
- protected Text tracerPidText;
- // The text field to display the user id of the process.
- protected Text uidText;
- // The text field to display the user group id of the process.
- protected Text ugidText;
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#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);
- idText = createTextField(null, Messages.ContextIDSection_ID);
- parentIdText = createTextField(idText, Messages.ContextIDSection_ParentID);
- pgrpText = createTextField(parentIdText, Messages.ContextIDSection_GroupID);
- pidText = createTextField(pgrpText, Messages.ContextIDSection_PID);
- ppidText = createTextField(pidText, Messages.ContextIDSection_PPID);
- tgidText = createTextField(ppidText, Messages.ContextIDSection_TTY_GRPID);
- tracerPidText = createTextField(tgidText, Messages.ContextIDSection_TracerPID);
- uidText = createTextField(tracerPidText, Messages.ContextIDSection_UserID);
- ugidText = createTextField(uidText, Messages.ContextIDSection_UserGRPID);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#updateData(org.eclipse.tcf.te.ui.interfaces.IPropertyChangeProvider)
- */
- @Override
- protected void updateInput(IPeerModelProvider input) {
- Assert.isTrue(input instanceof ProcessTreeNode);
- ProcessTreeNode node = (ProcessTreeNode) input;
- context = node.context;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
- */
- @Override
- public void refresh() {
- this.idText.setText(context == null ? "" : (context.getID() != null ? "" : context.getID())); //$NON-NLS-1$ //$NON-NLS-2$
- this.parentIdText.setText(context == null ? "" : (context.getParentID()==null?"":context.getParentID())); //$NON-NLS-1$ //$NON-NLS-2$
- this.pgrpText.setText(context == null ? "" : (""+context.getPGRP())); //$NON-NLS-1$ //$NON-NLS-2$
- this.pidText.setText(context == null ? "" : (""+context.getPID())); //$NON-NLS-1$ //$NON-NLS-2$
- this.ppidText.setText(context == null ? "" : (""+context.getPPID())); //$NON-NLS-1$ //$NON-NLS-2$
- this.tgidText.setText(context == null ? "" : (""+context.getTGID())); //$NON-NLS-1$ //$NON-NLS-2$
- this.tracerPidText.setText(context == null ? "" : (""+context.getTracerPID())); //$NON-NLS-1$ //$NON-NLS-2$
- this.uidText.setText(context == null ? "" : (""+context.getUID())); //$NON-NLS-1$ //$NON-NLS-2$
- this.ugidText.setText(context == null ? "" : ("" +context.getUGID())); //$NON-NLS-1$ //$NON-NLS-2$
- super.refresh();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#getText()
- */
- @Override
- protected String getText() {
- return Messages.ContextIDSection_ContextIDs;
- }
-
-}
+/*******************************************************************************
+ * 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.processes.ui.internal.tabbed;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.ISysMonitor;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.ui.tabbed.BaseTitledSection;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+/**
+ * The property section to display the context IDs of a process.
+ */
+public class ContextIDSection extends BaseTitledSection {
+ // The system monitor context for the selected process node.
+ /* default */ ISysMonitor.SysMonitorContext context;
+ // The text field to display the id of the process context.
+ private Text idText;
+ // The text field to display the parent id of the process context.
+ private Text parentIdText;
+ // The text field to display the process group id.
+ private Text pgrpText;
+ // The text field to display the process id.
+ private Text pidText;
+ // The text field to display the parent process id.
+ private Text ppidText;
+ // The text field to display the process TTY group ID.
+ private Text tgidText;
+ // The text field to display the tracer process's id.
+ private Text tracerPidText;
+ // The text field to display the user id of the process.
+ private Text uidText;
+ // The text field to display the user group id of the process.
+ private Text ugidText;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.ui.tabbed.BaseTitledSection#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);
+ idText = createTextField(null, Messages.ContextIDSection_ID);
+ parentIdText = createTextField(idText, Messages.ContextIDSection_ParentID);
+ pgrpText = createTextField(parentIdText, Messages.ContextIDSection_GroupID);
+ pidText = createTextField(pgrpText, Messages.ContextIDSection_PID);
+ ppidText = createTextField(pidText, Messages.ContextIDSection_PPID);
+ tgidText = createTextField(ppidText, Messages.ContextIDSection_TTY_GRPID);
+ tracerPidText = createTextField(tgidText, Messages.ContextIDSection_TracerPID);
+ uidText = createTextField(tracerPidText, Messages.ContextIDSection_UserID);
+ ugidText = createTextField(uidText, Messages.ContextIDSection_UserGRPID);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.ui.tabbed.BaseTitledSection#updateInput(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider)
+ */
+ @Override
+ protected void updateInput(IPeerModelProvider input) {
+ Assert.isTrue(input instanceof IProcessContextNode);
+ final IProcessContextNode node = (IProcessContextNode) input;
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ context = node.getSysMonitorContext();
+ }
+ };
+
+ Assert.isTrue(!Protocol.isDispatchThread());
+ Protocol.invokeAndWait(runnable);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
+ */
+ @Override
+ public void refresh() {
+ this.idText.setText(context == null ? "" : (context.getID() != null ? context.getID() : "")); //$NON-NLS-1$ //$NON-NLS-2$
+ this.parentIdText.setText(context == null ? "" : (context.getParentID() != null ? context.getParentID() : "")); //$NON-NLS-1$ //$NON-NLS-2$
+ this.pgrpText.setText(context == null ? "" : (context.getPGRP() >= 0 ? "" + context.getPGRP() : "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ this.pidText.setText(context == null ? "" : (context.getPID() >= 0 ? "" + context.getPID() : "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ this.ppidText.setText(context == null ? "" : (context.getPPID() >= 0 ? "" + context.getPPID() : "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ this.tgidText.setText(context == null ? "" : (context.getTGID() >= 0 ? "" + context.getTGID() : "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ this.tracerPidText.setText(context == null ? "" : (context.getTracerPID() >= 0 ? "" + context.getTracerPID() : "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ this.uidText.setText(context == null ? "" : (context.getUID() >= 0 ? "" + context.getUID() : "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ this.ugidText.setText(context == null ? "" : (context.getUGID() >= 0 ? "" + context.getUGID() : "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ super.refresh();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#getText()
+ */
+ @Override
+ protected String getText() {
+ return Messages.ContextIDSection_ContextIDs;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/IDSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/IDSection.java
index 7935711f2..f10ee8adb 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/IDSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/IDSection.java
@@ -1,81 +1,90 @@
-/*******************************************************************************
- * 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.processes.ui.internal.tabbed;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-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;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-
-/**
- * The property section to display the IDs of a process.
- */
-public class IDSection extends BaseTitledSection {
- // The process tree node selected.
- protected ProcessTreeNode node;
- // The text field to display the process id.
- protected Text pidText;
- // The text field to display the parent process id.
- protected Text ppidText;
- // The text field to display the internal process id.
- protected Text ipidText;
- // The text field to display the internal parent process id.
- protected Text ippidText;
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#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);
- pidText = createTextField(null, Messages.IDSection_ProcessID);
- ppidText = createTextField(pidText, Messages.IDSection_ParentID);
- ipidText = createTextField(ppidText, Messages.IDSection_InternalID);
- ippidText = createTextField(ipidText, Messages.IDSection_InternalPPID);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#updateData(org.eclipse.tcf.te.ui.interfaces.IPropertyChangeProvider)
- */
- @Override
- protected void updateInput(IPeerModelProvider input) {
- Assert.isTrue(input instanceof ProcessTreeNode);
- this.node = (ProcessTreeNode) input;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
- */
- @Override
- public void refresh() {
- SWTControlUtil.setText(pidText, node != null ? Long.toString(node.pid) : ""); //$NON-NLS-1$
- SWTControlUtil.setText(ppidText, node != null ? Long.toString(node.ppid) : ""); //$NON-NLS-1$
- SWTControlUtil.setText(ipidText, node != null && node.id != null ? node.id : ""); //$NON-NLS-1$
- SWTControlUtil.setText(ippidText, node != null && node.parentId != null ? node.parentId : ""); //$NON-NLS-1$
- super.refresh();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#getText()
- */
- @Override
- protected String getText() {
- return Messages.IDSection_Title;
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.internal.tabbed;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.ISysMonitor;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+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;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+/**
+ * The property section to display the IDs of a process.
+ */
+public class IDSection extends BaseTitledSection {
+ // The system monitor context for the selected process node.
+ /* default */ ISysMonitor.SysMonitorContext context;
+ // The text field to display the process id.
+ private Text pidText;
+ // The text field to display the parent process id.
+ private Text ppidText;
+ // The text field to display the internal process id.
+ private Text ipidText;
+ // The text field to display the internal parent process id.
+ private Text ippidText;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#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);
+ pidText = createTextField(null, Messages.IDSection_ProcessID);
+ ppidText = createTextField(pidText, Messages.IDSection_ParentID);
+ ipidText = createTextField(ppidText, Messages.IDSection_InternalID);
+ ippidText = createTextField(ipidText, Messages.IDSection_InternalPPID);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#updateData(org.eclipse.tcf.te.ui.interfaces.IPropertyChangeProvider)
+ */
+ @Override
+ protected void updateInput(IPeerModelProvider input) {
+ Assert.isTrue(input instanceof IProcessContextNode);
+ final IProcessContextNode node = (IProcessContextNode) input;
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ context = node.getSysMonitorContext();
+ }
+ };
+
+ Assert.isTrue(!Protocol.isDispatchThread());
+ Protocol.invokeAndWait(runnable);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
+ */
+ @Override
+ public void refresh() {
+ SWTControlUtil.setText(pidText, context != null && context.getPID() >= 0 ? Long.toString(context.getPID()) : ""); //$NON-NLS-1$
+ SWTControlUtil.setText(ppidText, context != null && context.getPPID() >= 0 ? Long.toString(context.getPPID()) : ""); //$NON-NLS-1$
+ SWTControlUtil.setText(ipidText, context != null && context.getID() != null ? context.getID() : ""); //$NON-NLS-1$
+ SWTControlUtil.setText(ippidText, context != null && context.getParentID() != null ? context.getParentID() : ""); //$NON-NLS-1$
+ super.refresh();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#getText()
+ */
+ @Override
+ protected String getText() {
+ return Messages.IDSection_Title;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/MemorySection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/MemorySection.java
index f90f78a56..674962f3a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/MemorySection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/MemorySection.java
@@ -1,79 +1,85 @@
-/*******************************************************************************
- * 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.processes.ui.internal.tabbed;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.tcf.services.ISysMonitor;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-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;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-
-/**
- * The property section to display the memory usage of a process.
- */
-public class MemorySection extends BaseTitledSection {
- // The context of the process selected.
- protected ISysMonitor.SysMonitorContext context;
- // The text field for the virtual memory size in bytes.
- protected Text vsizeText;
- // The text field for the virtual memory pages.
- protected Text psizeText;
- // The number of memory pages in process resident set.
- protected Text rssText;
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#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);
- vsizeText = createTextField(null, Messages.MemorySection_VSize);
- psizeText = createTextField(vsizeText, Messages.MemorySection_PSize);
- rssText = createTextField(psizeText, Messages.MemorySection_RSS);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#getText()
- */
- @Override
- protected String getText() {
- return Messages.MemorySection_Title;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#updateData(org.eclipse.tcf.te.ui.interfaces.IPropertyChangeProvider)
- */
- @Override
- protected void updateInput(IPeerModelProvider input) {
- Assert.isTrue(input instanceof ProcessTreeNode);
- ProcessTreeNode node = (ProcessTreeNode) input;
- context = node.context;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
- */
- @Override
- public void refresh() {
- SWTControlUtil.setText(vsizeText, context == null ? "" : "" + context.getVSize()); //$NON-NLS-1$ //$NON-NLS-2$
- SWTControlUtil.setText(psizeText, context == null ? "" : "" + context.getPSize()); //$NON-NLS-1$ //$NON-NLS-2$
- SWTControlUtil.setText(rssText, context == null ? "" : "" + context.getRSS()); //$NON-NLS-1$ //$NON-NLS-2$
- super.refresh();
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.internal.tabbed;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.ISysMonitor;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+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;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+/**
+ * The property section to display the memory usage of a process.
+ */
+public class MemorySection extends BaseTitledSection {
+ // The context of the process selected.
+ /* default */ ISysMonitor.SysMonitorContext context;
+ // The text field for the virtual memory size in bytes.
+ private Text vsizeText;
+ // The text field for the virtual memory pages.
+ private Text psizeText;
+ // The number of memory pages in process resident set.
+ private Text rssText;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#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);
+ vsizeText = createTextField(null, Messages.MemorySection_VSize);
+ psizeText = createTextField(vsizeText, Messages.MemorySection_PSize);
+ rssText = createTextField(psizeText, Messages.MemorySection_RSS);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#getText()
+ */
+ @Override
+ protected String getText() {
+ return Messages.MemorySection_Title;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#updateData(org.eclipse.tcf.te.ui.interfaces.IPropertyChangeProvider)
+ */
+ @Override
+ protected void updateInput(IPeerModelProvider input) {
+ Assert.isTrue(input instanceof IProcessContextNode);
+ final IProcessContextNode node = (IProcessContextNode) input;
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ context = node.getSysMonitorContext();
+ }
+ };
+
+ Assert.isTrue(!Protocol.isDispatchThread());
+ Protocol.invokeAndWait(runnable);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
+ */
+ @Override
+ public void refresh() {
+ SWTControlUtil.setText(vsizeText, context == null ? "" : context.getVSize() >= 0 ? "" + context.getVSize() : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ SWTControlUtil.setText(psizeText, context == null ? "" : context.getPSize() >= 0 ? "" + context.getPSize() : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ SWTControlUtil.setText(rssText, context == null ? "" : context.getRSS() >= 0 ? "" + context.getRSS() : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ super.refresh();
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/ProcessFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/ProcessFilter.java
deleted file mode 100644
index 384f2b75c..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/tabbed/ProcessFilter.java
+++ /dev/null
@@ -1,33 +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.processes.ui.internal.tabbed;
-
-import org.eclipse.jface.viewers.IFilter;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-
-/**
- * The filter to filter out root and pending process node.
- */
-public class ProcessFilter implements IFilter {
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.IFilter#select(java.lang.Object)
- */
- @Override
- public boolean select(Object toTest) {
- if(toTest instanceof ProcessTreeNode) {
- ProcessTreeNode node = (ProcessTreeNode) toTest;
- return !node.isSystemRoot();
- }
- return false;
- }
-
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/testers/ProcessPropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/testers/ProcessPropertyTester.java
index be2e0db79..db705c358 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/testers/ProcessPropertyTester.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/testers/ProcessPropertyTester.java
@@ -1,52 +1,48 @@
-/*******************************************************************************
- * 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.processes.ui.internal.testers;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-
-/**
- * The property tester for a process tree node.
- */
-public class ProcessPropertyTester extends PropertyTester {
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
- */
- @Override
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if(receiver instanceof ProcessTreeNode) {
- final ProcessTreeNode node = (ProcessTreeNode) receiver;
- if(property.equals("isSystemRoot")) { //$NON-NLS-1$
- return "ProcRootNode".equals(node.type); //$NON-NLS-1$
- }
- else if ("isAttached".equals(property) && expectedValue instanceof Boolean) { //$NON-NLS-1$
- final AtomicBoolean isAttached = new AtomicBoolean();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- if (node.pContext != null) {
- isAttached.set(node.pContext.isAttached());
- }
- }
- };
- if (Protocol.isDispatchThread()) runnable.run();
- else Protocol.invokeAndWait(runnable);
-
- return ((Boolean)expectedValue).booleanValue() == isAttached.get();
- }
- }
- return false;
- }
-}
+/*******************************************************************************
+ * 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.processes.ui.internal.testers;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+
+/**
+ * The property tester for a process tree node.
+ */
+public class ProcessPropertyTester extends PropertyTester {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ */
+ @Override
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ if (receiver instanceof IProcessContextNode) {
+ final IProcessContextNode node = (IProcessContextNode) receiver;
+ if ("isAttached".equals(property) && expectedValue instanceof Boolean) { //$NON-NLS-1$
+ final AtomicBoolean isAttached = new AtomicBoolean();
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ if (node.getProcessContext() != null) {
+ isAttached.set(node.getProcessContext().isAttached());
+ }
+ }
+ };
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+
+ return ((Boolean) expectedValue).booleanValue() == isAttached.get();
+ }
+ }
+ return false;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/navigator/events/EventListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/navigator/events/EventListener.java
new file mode 100644
index 000000000..e3d5bc98d
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/navigator/events/EventListener.java
@@ -0,0 +1,56 @@
+/**
+ * EventListener.java
+ * Created on Jan 28, 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.processes.ui.navigator.events;
+
+import java.util.EventObject;
+
+import org.eclipse.tcf.te.runtime.events.ChangeEvent;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeModel;
+import org.eclipse.tcf.te.ui.views.events.AbstractEventListener;
+
+/**
+ * UI event listener updating the main view.
+ */
+public class EventListener extends AbstractEventListener {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.interfaces.events.IEventListener#eventFired(java.util.EventObject)
+ */
+ @Override
+ public void eventFired(EventObject event) {
+ if (event instanceof ChangeEvent) {
+ final ChangeEvent changeEvent = (ChangeEvent)event;
+ final Object source = changeEvent.getSource();
+
+ // Property changes for the runtime model refreshes the parent peer
+ // node. The runtime model is not visible by itself.
+ if (source instanceof IRuntimeModel) {
+ IPeerModel node = (IPeerModel)((IRuntimeModel)source).getAdapter(IPeerModel.class);
+ refresh(node, false);
+ }
+
+ // Property changes for individual context nodes refreshes the node only
+ else if (source instanceof IProcessContextNode) {
+ if ("expanded".equals(changeEvent.getEventId())) { //$NON-NLS-1$
+ // Expansion state of the node changed.
+ boolean expanded = ((Boolean)changeEvent.getNewValue()).booleanValue();
+ // Update the nodes expansion state
+ getViewer().setExpandedState(source, expanded);
+ } else {
+ refresh(source, false);
+ }
+ }
+ }
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/navigator/runtime/ContentProviderDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/navigator/runtime/ContentProviderDelegate.java
new file mode 100644
index 000000000..d79a1fa10
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/navigator/runtime/ContentProviderDelegate.java
@@ -0,0 +1,273 @@
+/*******************************************************************************
+ * Copyright (c) 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.processes.ui.navigator.runtime;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.tcf.protocol.Protocol;
+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.runtime.model.PendingOperationModelNode;
+import org.eclipse.tcf.te.runtime.model.interfaces.IContainerModelNode;
+import org.eclipse.tcf.te.runtime.model.interfaces.contexts.IAsyncRefreshableCtx;
+import org.eclipse.tcf.te.runtime.model.interfaces.contexts.IAsyncRefreshableCtx.QueryState;
+import org.eclipse.tcf.te.runtime.model.interfaces.contexts.IAsyncRefreshableCtx.QueryType;
+import org.eclipse.tcf.te.tcf.core.model.interfaces.services.IModelRefreshService;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.processes.core.model.ModelManager;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IPendingOperationNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeModel;
+import org.eclipse.tcf.te.tcf.processes.core.model.nodes.PendingOperationNode;
+
+
+/**
+ * Runtime model content provider delegate implementation.
+ */
+public class ContentProviderDelegate implements ITreeContentProvider {
+ private final static Object[] NO_ELEMENTS = new Object[0];
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+ */
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ Object[] children = NO_ELEMENTS;
+
+ // If the parent element is a peer model node, than return
+ // the children of the corresponding runtime model.
+ if (parentElement instanceof IPeerModel) {
+ IRuntimeModel model = ModelManager.getRuntimeModel((IPeerModel)parentElement);
+ return isRuntimeModelNodeVisible() ? new Object[] { model } : getChildren(model);
+ }
+
+ // If it is the runtime model, get the process contexts
+ if (parentElement instanceof IRuntimeModel) {
+ // Get the asynchronous refresh context adapter
+ final IAsyncRefreshableCtx refreshable = (IAsyncRefreshableCtx)((IRuntimeModel)parentElement).getAdapter(IAsyncRefreshableCtx.class);
+ if (refreshable != null) {
+ if (refreshable.getQueryState(QueryType.CHILD_LIST).equals(QueryState.PENDING)) {
+ // Mark the refresh as in progress
+ refreshable.setQueryState(QueryType.CHILD_LIST, QueryState.IN_PROGRESS);
+ // Create a new pending operation node and associate it with the refreshable
+ PendingOperationModelNode pendingNode = new PendingOperationNode();
+ pendingNode.setParent((IRuntimeModel)parentElement);
+ refreshable.setPendingOperationNode(pendingNode);
+ // Cast to the model instance
+ final IRuntimeModel model = (IRuntimeModel)parentElement;
+ // Create the runnable
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ // Don't send change events while refreshing
+ final boolean changed = model.setChangeEventsEnabled(false);
+ // Initiate the refresh of the model
+ model.getService(IModelRefreshService.class).refresh(new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ // Mark the refresh as done
+ refreshable.setQueryState(QueryType.CHILD_LIST, QueryState.DONE);
+ // Reset the pending operation node
+ refreshable.setPendingOperationNode(null);
+ // Re-enable the change events if they had been enabled before
+ if (changed) model.setChangeEventsEnabled(true);
+ // Trigger a refresh of the view content.
+ ChangeEvent event = new ChangeEvent(model, IContainerModelNode.NOTIFY_CHANGED, null, null);
+ EventManager.getInstance().fireEvent(event);
+ }
+ });
+ }
+ };
+ Protocol.invokeLater(runnable);
+
+ // Return the pending operation node
+ return new Object[] { refreshable.getPendingOperationNode() };
+ }
+ else if (refreshable.getQueryState(QueryType.CHILD_LIST).equals(QueryState.IN_PROGRESS)) {
+ // Refresh is still running -> return the pending operation node (if set)
+ return refreshable.getPendingOperationNode() != null ? new Object[] { refreshable.getPendingOperationNode() } : NO_ELEMENTS;
+ }
+ }
+
+ children = ((IRuntimeModel)parentElement).getChildren(IProcessContextNode.class).toArray();
+ }
+
+ // If it is a system context, get the system context children
+ else if (parentElement instanceof IProcessContextNode) {
+ // Get the asynchronous refresh context adapter
+ final IAsyncRefreshableCtx refreshable = (IAsyncRefreshableCtx)((IProcessContextNode)parentElement).getAdapter(IAsyncRefreshableCtx.class);
+ if (refreshable != null) {
+ if (refreshable.getQueryState(QueryType.CHILD_LIST).equals(QueryState.PENDING)) {
+ // Mark the refresh as in progress
+ refreshable.setQueryState(QueryType.CHILD_LIST, QueryState.IN_PROGRESS);
+ // Create a new pending operation node and associate it with the refreshable
+ PendingOperationModelNode pendingNode = new PendingOperationNode();
+ pendingNode.setParent((IProcessContextNode)parentElement);
+ refreshable.setPendingOperationNode(pendingNode);
+ // Cast to the context node instance
+ final IProcessContextNode node = (IProcessContextNode)parentElement;
+ // Create the runnable
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ // Don't send change events while refreshing
+ final boolean changed = node.setChangeEventsEnabled(false);
+ // Determine the runtime model
+ IRuntimeModel model = node.getParent(IRuntimeModel.class);
+ if (model != null) {
+ // Initiate the refresh of the node
+ model.getService(IModelRefreshService.class).refresh(node, new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ // Mark the refresh as done
+ refreshable.setQueryState(QueryType.CHILD_LIST, QueryState.DONE);
+ // Reset the pending operation node
+ refreshable.setPendingOperationNode(null);
+ // Re-enable the change events if they had been enabled before
+ if (changed) node.setChangeEventsEnabled(true);
+ // Trigger a refresh of the view content
+ ChangeEvent event = new ChangeEvent(node, IContainerModelNode.NOTIFY_CHANGED, null, null);
+ EventManager.getInstance().fireEvent(event);
+ }
+ });
+ }
+ }
+ };
+ Protocol.invokeLater(runnable);
+
+ // Return the pending operation node
+ return new Object[] { refreshable.getPendingOperationNode() };
+ }
+ else if (refreshable.getQueryState(QueryType.CHILD_LIST).equals(QueryState.IN_PROGRESS)) {
+ // Refresh is still running -> return the pending operation node (if set)
+ return refreshable.getPendingOperationNode() != null ? new Object[] { refreshable.getPendingOperationNode() } : NO_ELEMENTS;
+ }
+ }
+
+ children = ((IProcessContextNode)parentElement).getChildren(IProcessContextNode.class).toArray();
+ }
+
+ return children;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+ */
+ @Override
+ public Object getParent(final Object element) {
+ final AtomicReference<Object> parent = new AtomicReference<Object>();
+
+ // The parent of the runtime model is the peer model node
+ if (element instanceof IRuntimeModel) {
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ parent.set(((IRuntimeModel)element).getPeerModel());
+ }
+ };
+
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+ }
+ else if (element instanceof IProcessContextNode) {
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ parent.set(((IProcessContextNode)element).getParent());
+ }
+ };
+
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+ }
+ else if (element instanceof IPendingOperationNode) {
+ parent.set(((IPendingOperationNode)element).getParent());
+ }
+
+ if (parent.get() instanceof IRuntimeModel) {
+ parent.set(getParent(parent.get()));
+ }
+
+ return parent.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(final Object element) {
+ // Default to "no children". This applies to IProcessContextNode
+ // and IPendingOperationNode elements.
+ boolean hasChildren = false;
+
+ if (element instanceof IRuntimeModel) {
+ IRuntimeModel model = ((IRuntimeModel)element);
+ // Get the asynchronous refresh context adapter
+ final IAsyncRefreshableCtx refreshable = (IAsyncRefreshableCtx)model.getAdapter(IAsyncRefreshableCtx.class);
+ if (refreshable != null && refreshable.getQueryState(QueryType.CHILD_LIST).equals(QueryState.PENDING)) {
+ hasChildren = true;
+ } else {
+ hasChildren = model.hasChildren();
+ }
+ } else if (element instanceof IProcessContextNode) {
+ final IProcessContextNode context = (IProcessContextNode)element;
+
+ // Get the asynchronous refresh context adapter
+ final IAsyncRefreshableCtx refreshable = (IAsyncRefreshableCtx)context.getAdapter(IAsyncRefreshableCtx.class);
+ if (refreshable != null && refreshable.getQueryState(QueryType.CHILD_LIST).equals(QueryState.PENDING)) {
+ hasChildren = true;
+ } else {
+ hasChildren = context.hasChildren();
+ }
+ }
+ else if (element instanceof IPeerModel) {
+ hasChildren = true;
+ }
+
+ return hasChildren;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ @Override
+ public void dispose() {
+ ModelManager.disposeAllRuntimeModels();
+ }
+
+ /* (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) {
+ }
+
+ /**
+ * Returns if or if not the root node, the runtime model node, is
+ * visible.
+ *
+ * @return <code>True</code> if the runtime model node is visible, <code>false</code> otherwise.
+ */
+ protected boolean isRuntimeModelNodeVisible() {
+ return true;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/navigator/runtime/LabelProviderDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/navigator/runtime/LabelProviderDelegate.java
new file mode 100644
index 000000000..6dacfe965
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/navigator/runtime/LabelProviderDelegate.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 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.processes.ui.navigator.runtime;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.jface.viewers.IColorProvider;
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeModel;
+import org.eclipse.tcf.te.tcf.processes.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.processes.ui.interfaces.ImageConsts;
+import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
+
+
+/**
+ * Runtime model label provider delegate implementation.
+ */
+public class LabelProviderDelegate extends LabelProvider implements ILabelDecorator, IColorProvider {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+ */
+ @Override
+ public String getText(Object element) {
+ if (element instanceof IRuntimeModel) {
+ return Messages.ProcessLabelProvider_RootNodeLabel;
+ } else if (element instanceof IProcessContextNode) {
+ final IProcessContextNode node = (IProcessContextNode)element;
+ final AtomicReference<String> name = new AtomicReference<String>();
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ name.set(node.getName());
+ }
+ };
+
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+
+ if (name.get() != null && !"".equals(name.get().trim())) { //$NON-NLS-1$
+ return name.get();
+ }
+ }
+ else if (element instanceof IModelNode) {
+ return ((IModelNode)element).getName();
+ }
+
+ return ""; //$NON-NLS-1$
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+ */
+ @Override
+ public Image getImage(final Object element) {
+ if (element instanceof IRuntimeModel) {
+ return UIPlugin.getImage(ImageConsts.OBJ_Process_Root);
+ } else if (element instanceof IProcessContextNode) {
+ Image image = null;
+
+ final AtomicReference<IModelNode> parent = new AtomicReference<IModelNode>();
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ IProcessContextNode node = ((IProcessContextNode)element);
+ parent.set(node.getParent());
+ }
+ };
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+
+ image = UIPlugin.getImage(parent.get() instanceof IRuntimeModel ? ImageConsts.OBJ_Process : ImageConsts.OBJ_Thread);
+
+ return image;
+ }
+ else if (element instanceof IModelNode) {
+ return UIPlugin.getImage(((IModelNode)element).getImageId());
+ }
+
+ return super.getImage(element);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelDecorator#decorateImage(org.eclipse.swt.graphics.Image, java.lang.Object)
+ */
+ @Override
+ public Image decorateImage(final Image image, final Object element) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelDecorator#decorateText(java.lang.String, java.lang.Object)
+ */
+ @Override
+ public String decorateText(final String text, final Object element) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
+ */
+ @Override
+ public Color getForeground(final Object element) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
+ */
+ @Override
+ public Color getBackground(Object element) {
+ return null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/suites/AllProcessTests.java b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/suites/AllProcessTests.java
deleted file mode 100644
index 8f215dbad..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/suites/AllProcessTests.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.tests.suites;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.tests.tcf.processes.callbacks.QueryChildrenCallbackTest;
-
-/**
- * Links all process monitor tests.
- */
-public class AllProcessTests {
-
- /**
- * Main method called if the tests are running as part of the nightly
- * Workbench wheel. Use only the <code>junit.textui.TestRunner</code>
- * here to execute the tests!
- *
- * @param args The command line arguments passed.
- */
- public static void main (String[] args) {
- junit.textui.TestRunner.run(suite());
- }
-
- /**
- * Static method called by the several possible test runners to fetch
- * the test(s) to run.
- * Do not rename this method, otherwise tests will not be called anymore!
- *
- * @return Any object of type <code>Test</code> containing the test to run.
- */
- public static Test suite() {
- TestSuite suite = new TestSuite("All Process Monitor Tests"); //$NON-NLS-1$
- addTests(suite);
- return suite;
- }
-
- /**
- * Adds all related tests to the given test suite.
- *
- * @param suite The test suite. Must not be <code>null</code>.
- */
- public static void addTests(TestSuite suite) {
- Assert.isNotNull(suite);
-
- suite.addTestSuite(QueryChildrenCallbackTest.class);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/suites/AllTests.java b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/suites/AllTests.java
index cdda38519..c6e5ff698 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/suites/AllTests.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/suites/AllTests.java
@@ -72,6 +72,5 @@ public class AllTests {
suite.addTest(ProcessLauncherTestCase.getTestSuite());
AllFileSystemTests.addTests(suite);
- AllProcessTests.addTests(suite);
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/processes/ProcessesTestCase.java b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/processes/ProcessesTestCase.java
deleted file mode 100644
index fe0435dbc..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/processes/ProcessesTestCase.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.tests.tcf.processes;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessModel;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tests.tcf.TcfTestCase;
-
-public class ProcessesTestCase extends TcfTestCase {
- protected ProcessModel processModel;
- protected ProcessTreeNode processRoot;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- Assert.isNotNull(peerModel);
- processModel = ProcessModel.getProcessModel(peerModel);
- Assert.isNotNull(processModel);
- processRoot = processModel.getRoot();
- Assert.isNotNull(processRoot);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/processes/callbacks/QueryChildrenCallbackTest.java b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/processes/callbacks/QueryChildrenCallbackTest.java
deleted file mode 100644
index 10b28f639..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/processes/callbacks/QueryChildrenCallbackTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.tests.tcf.processes.callbacks;
-
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.tcf.te.runtime.callback.Callback;
-import org.eclipse.tcf.te.tcf.core.Tcf;
-import org.eclipse.tcf.te.tcf.processes.core.callbacks.QueryDoneOpenChannel;
-import org.eclipse.tcf.te.tcf.processes.core.callbacks.RefreshChildrenDoneOpenChannel;
-import org.eclipse.tcf.te.tcf.processes.core.callbacks.RefreshDoneOpenChannel;
-import org.eclipse.tcf.te.tests.tcf.processes.ProcessesTestCase;
-
-public class QueryChildrenCallbackTest extends ProcessesTestCase {
- public void testQueryChildren() throws Exception {
- Assert.isNotNull(processRoot);
- processRoot.childrenQueryRunning = true;
- final AtomicReference<IStatus> statusRef = new AtomicReference<IStatus>();
- final Callback callback = new Callback(){
- @Override
- protected void internalDone(Object caller, IStatus status) {
- Assert.isNotNull(statusRef);
- statusRef.set(status);
- }
- };
- Tcf.getChannelManager().openChannel(peer, null, new QueryDoneOpenChannel(processRoot,callback));
- waitAndDispatch(300000, callback.getDoneConditionTester(new NullProgressMonitor()));
- assertTrue(statusRef.get() != null && statusRef.get().isOK());
- }
-
- public void testRefreshChildren() throws Exception {
- Assert.isNotNull(processRoot);
- processRoot.childrenQueryRunning = true;
- final AtomicReference<IStatus> statusRef = new AtomicReference<IStatus>();
- final Callback callback = new Callback(){
- @Override
- protected void internalDone(Object caller, IStatus status) {
- Assert.isNotNull(statusRef);
- statusRef.set(status);
- }
- };
- Tcf.getChannelManager().openChannel(peer, null, new RefreshChildrenDoneOpenChannel(processRoot,callback));
- waitAndDispatch(300000, callback.getDoneConditionTester(new NullProgressMonitor()));
- assertTrue(statusRef.get() != null && statusRef.get().isOK());
- }
-
- public void testRefresh() throws Exception {
- Assert.isNotNull(processRoot);
- processRoot.childrenQueryRunning = true;
- final AtomicReference<IStatus> statusRef = new AtomicReference<IStatus>();
- final Callback callback = new Callback(){
- @Override
- protected void internalDone(Object caller, IStatus status) {
- Assert.isNotNull(statusRef);
- statusRef.set(status);
- }
- };
- Tcf.getChannelManager().openChannel(peer, null, new RefreshDoneOpenChannel(processRoot, callback));
- waitAndDispatch(300000, callback.getDoneConditionTester(new NullProgressMonitor()));
- assertTrue(statusRef.get() != null && statusRef.get().isOK());
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/internal/utils/QuickFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/internal/utils/QuickFilter.java
index 592345847..bd363ba43 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/internal/utils/QuickFilter.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/internal/utils/QuickFilter.java
@@ -1,264 +1,259 @@
-/*******************************************************************************
- * 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.ui.internal.utils;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.tcf.te.core.interfaces.IPropertyChangeProvider;
-import org.eclipse.tcf.te.ui.interfaces.ISchedulableEvent;
-/**
- * A quick filter is a viewer filter that selects elements,
- * which has the specified name pattern, under a certain tree path.
- * Other elements outside of this tree path is ignored.
- */
-public class QuickFilter extends TablePatternFilter implements PropertyChangeListener {
- // The tree viewer to filter.
- private TreeViewer viewer;
- // The root path to select from.
- private TreePath root;
- // If the current filtering is global
- private boolean global;
-
- /**
- * Create a quick filter for the specified viewer.
- */
- public QuickFilter(TreeViewer viewer, TreePath root) {
- super((ILabelProvider) viewer.getLabelProvider());
- this.viewer = viewer;
- this.root = root;
- this.addPropertyChangeListener(this);
- }
-
- /**
- * Show the pop up dialog for the specified root path.
- *
- * @param global If the filter is a global one.
- */
- public void showFilterPopup(boolean global) {
- this.global = global;
- if (!isFiltering()) {
- viewer.addFilter(this);
- }
- QuickFilterPopup popup = new QuickFilterPopup(viewer, this);
- Point location = computePopupLocation();
- popup.open();
- popup.getShell().setLocation(location);
- }
-
- /**
- * Compute the best location of the pop up dialog.
- *
- * @return The best location of the pop up dialog.
- */
- private Point computePopupLocation() {
- Point location = null;
- if (!global) {
- TreeItem[] items = viewer.getTree().getSelection();
- if (items != null && items.length > 0) {
- for(TreeItem item : items) {
- viewer.getTree().showItem(item);
- }
- TreeItem item = items[0];
- Rectangle bounds = item.getBounds();
- location = new Point(bounds.x, bounds.y-bounds.height);
- }
- else {
- location = new Point(0, -viewer.getTree().getItemHeight());
- }
- }
- else {
- location = new Point(0, -viewer.getTree().getItemHeight());
- }
- location = viewer.getTree().toDisplay(location);
- return location;
- }
-
- /**
- * Adjust the position of the pop up when the tree viewer has changed.
- *
- * @param popshell The shell of the pop up dialog.
- */
- void adjustPopup(Shell popshell) {
- if (!global) {
- Point location = computePopupLocation();
- Point shellLocation = popshell.getLocation();
- if (shellLocation != null && !shellLocation.equals(location)) {
- popshell.setLocation(location);
- }
- }
- }
-
- /**
- * Subclass PropertyChangeEvent and implement ISchedulable to provide
- * an event which should be scheduled when the key stroke pauses for
- * a certain time.
- */
- private static class QuickFilterEvent extends PropertyChangeEvent implements ISchedulableEvent {
- private static final long serialVersionUID = 1L;
- // Remember the last time of a property change event caused by a key stroke
- private static long last_enqueue;
- // Maximum delay before the event should be scheduled.
- private static final long MAXIMUM_DELAY = 300L;
- // The effective tree viewer;
- private TreeViewer viewer;
-
- /**
- * Constructor inherited.
- *
- * @param source
- * @param propertyName
- * @param oldValue
- * @param newValue
- */
- public QuickFilterEvent(TreeViewer viewer, Object source, String propertyName, Object oldValue, Object newValue) {
- super(source, propertyName, oldValue, newValue);
- this.viewer = viewer;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ISchedulable#eventQueued()
- */
- @Override
- public synchronized void eventQueued() {
- last_enqueue = System.currentTimeMillis();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ISchedulable#isSchedulable()
- */
- @Override
- public boolean isSchedulable() {
- return System.currentTimeMillis() - last_enqueue > MAXIMUM_DELAY;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ISchedulable#isApplicable(org.eclipse.jface.viewers.TreeViewer)
- */
- @Override
- public boolean isApplicable(TreeViewer viewer) {
- return this.viewer == viewer;
- }
- }
-
- /*
- * (non-Javadoc)
- * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
- */
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- Object element = root.getLastSegment();
- element = element == null ? viewer.getInput() : element;
- if(element != null) {
- IPropertyChangeProvider provider = getPropertyChangeProvider(element);
- if(provider!=null) {
- provider.firePropertyChange(new QuickFilterEvent(viewer, element, evt.getPropertyName(), evt.getOldValue(), evt.getNewValue()));
- }
- }
- }
-
- /**
- * Get an adapter of IPropertyChangeProvider from the specified element.
- *
- * @param element The element to get the adapter from.
- * @return The element's adapter or null if does not adapt to IPropertyChangeProvider.
- */
- private IPropertyChangeProvider getPropertyChangeProvider(Object element) {
- IPropertyChangeProvider provider = null;
- if(element instanceof IPropertyChangeProvider) {
- provider = (IPropertyChangeProvider) element;
- }
- if(provider == null && element instanceof IAdaptable) {
- provider = (IPropertyChangeProvider) ((IAdaptable)element).getAdapter(IPropertyChangeProvider.class);
- }
- if(provider == null && element != null) {
- provider = (IPropertyChangeProvider) Platform.getAdapterManager().getAdapter(element, IPropertyChangeProvider.class);
- }
- return provider;
- }
-
- /**
- * Reset the tree viewer to the original view by removing this filter.
- */
- public void resetViewer() {
- viewer.removeFilter(this);
- Map<TreePath, QuickFilter> filters = (Map<TreePath, QuickFilter>) viewer.getData("quick.filter"); //$NON-NLS-1$
- if (filters != null) {
- filters.remove(root);
- }
- setPattern(null);
- }
-
-
- /**
- * If the current viewer is being filtered.
- *
- * @return true if it has this filter.
- */
- private boolean isFiltering() {
- ViewerFilter[] filters = viewer.getFilters();
- if (filters != null) {
- for (ViewerFilter filter : filters) {
- if (filter == this) {
- return matcher != null;
- }
- }
- }
- return false;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.dialogs.TablePatternFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- Assert.isNotNull(parentElement);
- return !shouldSelect(parentElement) || super.select(viewer, parentElement, element);
- }
-
- /**
- * If the current parent element should be selected for matching.
- *
- * @param parentElement The parent element.
- * @return true if it should continue matching.
- */
- private boolean shouldSelect(Object parentElement) {
- Object rootElement = parentElement instanceof TreePath ? root :
- (root.getSegmentCount() == 0 ? viewer.getInput() : root.getLastSegment());
- return parentElement.equals(rootElement);
- }
-
- /**
- * If the element is being filtered.
- *
- * @param path The element to be checked.
- * @return true if it is filtering.
- */
- public boolean isFiltering(TreePath path) {
- return isFiltering() && matcher != null && root.equals(path);
- }
-}
+/*******************************************************************************
+ * 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.ui.internal.utils;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.tcf.te.core.interfaces.IPropertyChangeProvider;
+import org.eclipse.tcf.te.ui.interfaces.ISchedulableEvent;
+
+/**
+ * A quick filter is a viewer filter that selects elements, which has the specified name pattern,
+ * under a certain tree path. Other elements outside of this tree path is ignored.
+ */
+public class QuickFilter extends TablePatternFilter implements PropertyChangeListener {
+ // The tree viewer to filter.
+ private TreeViewer viewer;
+ // The root path to select from.
+ private TreePath root;
+ // If the current filtering is global
+ private boolean global;
+
+ /**
+ * Create a quick filter for the specified viewer.
+ */
+ public QuickFilter(TreeViewer viewer, TreePath root) {
+ super((ILabelProvider) viewer.getLabelProvider());
+ this.viewer = viewer;
+ this.root = root;
+ this.addPropertyChangeListener(this);
+ }
+
+ /**
+ * Show the pop up dialog for the specified root path.
+ *
+ * @param global If the filter is a global one.
+ */
+ public void showFilterPopup(boolean global) {
+ this.global = global;
+ if (!isFiltering()) {
+ viewer.addFilter(this);
+ }
+ QuickFilterPopup popup = new QuickFilterPopup(viewer, this);
+ Point location = computePopupLocation();
+ popup.open();
+ popup.getShell().setLocation(location);
+ }
+
+ /**
+ * Compute the best location of the pop up dialog.
+ *
+ * @return The best location of the pop up dialog.
+ */
+ private Point computePopupLocation() {
+ Point location = null;
+ if (!global) {
+ TreeItem[] items = viewer.getTree().getSelection();
+ if (items != null && items.length > 0) {
+ for (TreeItem item : items) {
+ viewer.getTree().showItem(item);
+ }
+ TreeItem item = items[0];
+ Rectangle bounds = item.getBounds();
+ location = new Point(bounds.x, bounds.y - bounds.height);
+ }
+ else {
+ location = new Point(0, -viewer.getTree().getItemHeight());
+ }
+ }
+ else {
+ location = new Point(0, -viewer.getTree().getItemHeight());
+ }
+ location = viewer.getTree().toDisplay(location);
+ return location;
+ }
+
+ /**
+ * Adjust the position of the pop up when the tree viewer has changed.
+ *
+ * @param popshell The shell of the pop up dialog.
+ */
+ void adjustPopup(Shell popshell) {
+ if (!global) {
+ Point location = computePopupLocation();
+ Point shellLocation = popshell.getLocation();
+ if (shellLocation != null && !shellLocation.equals(location)) {
+ popshell.setLocation(location);
+ }
+ }
+ }
+
+ /**
+ * Subclass PropertyChangeEvent and implement ISchedulable to provide an event which should be
+ * scheduled when the key stroke pauses for a certain time.
+ */
+ private static class QuickFilterEvent extends PropertyChangeEvent implements ISchedulableEvent {
+ private static final long serialVersionUID = 1L;
+ // Remember the last time of a property change event caused by a key stroke
+ private static long last_enqueue;
+ // Maximum delay before the event should be scheduled.
+ private static final long MAXIMUM_DELAY = 300L;
+ // The effective tree viewer;
+ private TreeViewer viewer;
+
+ /**
+ * Constructor inherited.
+ *
+ * @param source
+ * @param propertyName
+ * @param oldValue
+ * @param newValue
+ */
+ public QuickFilterEvent(TreeViewer viewer, Object source, String propertyName, Object oldValue, Object newValue) {
+ super(source, propertyName, oldValue, newValue);
+ this.viewer = viewer;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ISchedulable#eventQueued()
+ */
+ @Override
+ public synchronized void eventQueued() {
+ last_enqueue = System.currentTimeMillis();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ISchedulable#isSchedulable()
+ */
+ @Override
+ public boolean isSchedulable() {
+ return System.currentTimeMillis() - last_enqueue > MAXIMUM_DELAY;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ISchedulableEvent#isApplicable(org.eclipse.jface.viewers.TreeViewer)
+ */
+ @Override
+ public boolean isApplicable(TreeViewer viewer) {
+ return this.viewer == viewer;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
+ */
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ Object element = root.getLastSegment();
+ element = element == null ? viewer.getInput() : element;
+ if (element != null) {
+ IPropertyChangeProvider provider = getPropertyChangeProvider(element);
+ if (provider != null) {
+ provider.firePropertyChange(new QuickFilterEvent(viewer, element, evt.getPropertyName(), evt.getOldValue(), evt.getNewValue()));
+ } else {
+ viewer.refresh(element, true);
+ }
+ }
+ }
+
+ /**
+ * Get an adapter of IPropertyChangeProvider from the specified element.
+ *
+ * @param element The element to get the adapter from.
+ * @return The element's adapter or null if does not adapt to IPropertyChangeProvider.
+ */
+ private IPropertyChangeProvider getPropertyChangeProvider(Object element) {
+ IPropertyChangeProvider provider = null;
+ if (element instanceof IPropertyChangeProvider) {
+ provider = (IPropertyChangeProvider) element;
+ }
+ if (provider == null && element instanceof IAdaptable) {
+ provider = (IPropertyChangeProvider) ((IAdaptable) element).getAdapter(IPropertyChangeProvider.class);
+ }
+ if (provider == null && element != null) {
+ provider = (IPropertyChangeProvider) Platform.getAdapterManager().getAdapter(element, IPropertyChangeProvider.class);
+ }
+ return provider;
+ }
+
+ /**
+ * Reset the tree viewer to the original view by removing this filter.
+ */
+ public void resetViewer() {
+ viewer.removeFilter(this);
+ Map<TreePath, QuickFilter> filters = (Map<TreePath, QuickFilter>) viewer.getData("quick.filter"); //$NON-NLS-1$
+ if (filters != null) {
+ filters.remove(root);
+ }
+ setPattern(null);
+ }
+
+ /**
+ * If the current viewer is being filtered.
+ *
+ * @return true if it has this filter.
+ */
+ private boolean isFiltering() {
+ ViewerFilter[] filters = viewer.getFilters();
+ if (filters != null) {
+ for (ViewerFilter filter : filters) {
+ if (filter == this) {
+ return matcher != null;
+ }
+ }
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.internal.utils.TablePatternFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ Assert.isNotNull(parentElement);
+ return !shouldSelect(parentElement) || super.select(viewer, parentElement, element);
+ }
+
+ /**
+ * If the current parent element should be selected for matching.
+ *
+ * @param parentElement The parent element.
+ * @return true if it should continue matching.
+ */
+ private boolean shouldSelect(Object parentElement) {
+ Object rootElement = parentElement instanceof TreePath ? root : (root.getSegmentCount() == 0 ? viewer
+ .getInput() : root.getLastSegment());
+ return parentElement.equals(rootElement);
+ }
+
+ /**
+ * If the element is being filtered.
+ *
+ * @param path The element to be checked.
+ * @return true if it is filtering.
+ */
+ public boolean isFiltering(TreePath path) {
+ return isFiltering() && matcher != null && root.equals(path);
+ }
+}

Back to the top