diff options
author | William Chen | 2012-04-23 03:01:34 +0000 |
---|---|---|
committer | William Chen | 2012-04-23 03:01:34 +0000 |
commit | 211dd04db2746cfe986402ebd2b5f9b9802c3fdb (patch) | |
tree | 30878bb62a073e3f8a7e675e500e3d595ea12c4b /target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui | |
parent | eedeeadbe3ce60666c196ff2a1c5bf8f6c04e6cb (diff) | |
download | org.eclipse.tcf-211dd04db2746cfe986402ebd2b5f9b9802c3fdb.tar.gz org.eclipse.tcf-211dd04db2746cfe986402ebd2b5f9b9802c3fdb.tar.xz org.eclipse.tcf-211dd04db2746cfe986402ebd2b5f9b9802c3fdb.zip |
Target Explorer: Refactoring, move some classes from processes.ui to
processes.core.
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui')
56 files changed, 102 insertions, 2366 deletions
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 e1fe52301..dfd3054bb 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 @@ -32,7 +32,6 @@ Export-Package: org.eclipse.tcf.te.tcf.processes.ui.activator;x-internal:=true, 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.callbacks;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, @@ -41,6 +40,4 @@ Export-Package: org.eclipse.tcf.te.tcf.processes.ui.activator;x-internal:=true, org.eclipse.tcf.te.tcf.processes.ui.internal.properties;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.model, - org.eclipse.tcf.te.tcf.processes.ui.model.steps, org.eclipse.tcf.te.tcf.processes.ui.nls;x-internal:=true 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 e51f97f83..794e97395 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 @@ -5,7 +5,7 @@ <!-- Adapter factory contributions -->
<extension point="org.eclipse.core.runtime.adapters">
<factory
- adaptableType="org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode"
+ 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"/>
@@ -236,7 +236,7 @@ operator="and">
<and>
<instanceof
- value="org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode">
+ value="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode">
</instanceof>
<not>
<test
@@ -266,7 +266,7 @@ operator="and">
<and>
<instanceof
- value="org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode">
+ value="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode">
</instanceof>
<not>
<test
@@ -348,7 +348,7 @@ <with variable="selection">
<count value="+"/>
<iterate operator="and" ifEmpty="false">
- <adapt type="org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode">
+ <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>
@@ -378,7 +378,7 @@ <with variable="selection">
<count value="+"/>
<iterate operator="and" ifEmpty="false">
- <adapt type="org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode">
+ <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>
@@ -416,7 +416,7 @@ ifEmpty="false"
operator="and">
<adapt
- type="org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode">
+ type="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode">
</adapt>
</iterate>
</with>
@@ -435,7 +435,7 @@ <count value="+"/>
<iterate operator="and" ifEmpty="false">
<and>
- <instanceof value="org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode"/>
+ <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"
@@ -557,7 +557,7 @@ </triggerPoints>
<possibleChildren>
<instanceof
- value="org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode">
+ value="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode">
</instanceof>
</possibleChildren>
<commonSorter
@@ -670,7 +670,7 @@ <enabledWhen>
<and>
<instanceof
- value="org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode">
+ value="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode">
</instanceof>
<not>
<test
@@ -687,7 +687,7 @@ <enabledWhen>
<and>
<instanceof
- value="org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode">
+ value="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode">
</instanceof>
<not>
<test
@@ -704,7 +704,7 @@ <enabledWhen>
<and>
<instanceof
- value="org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode">
+ value="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode">
</instanceof>
<not>
<test
@@ -722,7 +722,7 @@ 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.ui.model.ProcessTreeNode">
+ type="org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode">
</propertyTester>
</extension>
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 index e31cad9d2..a2bc2eb17 100644 --- 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 @@ -15,8 +15,8 @@ import org.eclipse.jface.viewers.TreeExpansionEvent; import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Display;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.processes.ui.model.ProcessModel;
-import org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode;
+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.ui.trees.TreeContentProvider;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.PlatformUI;
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 index 54fbb1303..749ab0671 100644 --- 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 @@ -11,8 +11,8 @@ 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.ui.model.ProcessModel; -import org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode; +import org.eclipse.tcf.te.tcf.processes.core.model.ProcessModel; +import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode; /** 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 index 5cac1f4d3..466cb653f 100644 --- 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 @@ -11,8 +11,8 @@ package org.eclipse.tcf.te.tcf.processes.ui.controls; import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
+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.tcf.processes.ui.model.ProcessTreeNode;
/**
* The common sorter for the process contribution to the target explorer.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/dialogs/ProcessSelectionDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/dialogs/ProcessSelectionDialog.java index 889adbe22..be6713d61 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/dialogs/ProcessSelectionDialog.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/dialogs/ProcessSelectionDialog.java @@ -18,10 +18,10 @@ import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; +import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode; import org.eclipse.tcf.te.tcf.processes.ui.controls.ProcessTreeContentProvider; import org.eclipse.tcf.te.tcf.processes.ui.controls.ProcessViewerSorter; import org.eclipse.tcf.te.tcf.processes.ui.internal.columns.ProcessLabelProvider; -import org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode; import org.eclipse.tcf.te.ui.activator.UIPlugin; import org.eclipse.tcf.te.ui.interfaces.IUIConstants; import org.eclipse.tcf.te.ui.trees.FilterDescriptor; diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/help/IContextHelpIds.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/help/IContextHelpIds.java index 36eb13558..675dacaab 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/help/IContextHelpIds.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/help/IContextHelpIds.java @@ -40,14 +40,4 @@ public interface IContextHelpIds { * Error dialog: remote process launch failed. */ public final static String LAUNCH_PROCESS_ERROR_DIALOG = PREFIX + "LaunchProcessErrorDialog"; //$NON-NLS-1$ - - /** - * Attach step: Operation failed. - */ - public final static String MESSAGE_ATTACH_FAILED = PREFIX + ".status.messageAttachFailed"; //$NON-NLS-1$ - - /** - * Detach step: Operation failed. - */ - public final static String MESSAGE_DETACH_FAILED = PREFIX + ".status.messageDetachFailed"; //$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/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 3f4e97291..a96cb9e34 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 @@ -12,8 +12,8 @@ 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.model.ProcessTreeNode;
import org.eclipse.tcf.te.ui.views.interfaces.handler.IRefreshHandlerDelegate;
/**
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/RefreshHandlerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/RefreshHandlerDelegate.java index 6150c22ef..7a8bad69d 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/RefreshHandlerDelegate.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/RefreshHandlerDelegate.java @@ -13,8 +13,8 @@ import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.Status;
import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.tcf.processes.ui.model.ProcessModel;
-import org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode;
+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.ui.views.interfaces.handler.IRefreshHandlerDelegate;
/**
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/CallbackMonitor.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/CallbackMonitor.java deleted file mode 100644 index b734b7381..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/CallbackMonitor.java +++ /dev/null @@ -1,183 +0,0 @@ -/*******************************************************************************
- * Copyright (c) 2011 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.callbacks;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.tcf.processes.ui.activator.UIPlugin;
-import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
-
-/**
- * A helper class used to synchronize multiple threads. It is used
- * to join multiple threads which collaborate to create the pre-condition
- * of the callback code.
- * <p>
- * A callback monitor maintains a map containing a set of locks.
- * The collaborating threads should unlock one of its own lock in
- * it and wake up the callback if all the locks in the map is opened.
- * <p>
- * The following is an example:
- * <pre>
- * class Thread1 extends Thread {
- * CallbackMonitor monitor;
- * public Thread1(CallbackMonitor monitor){
- * this.monitor = monitor;
- * }
- * public void run() {
- * // Do the work
- * ...
- * // Unlock this thread.
- * monitor.unlock(this)
- * }
- * }
- * class Thread2 extends Thread {
- * CallbackMonitor monitor;
- * public Thread2(CallbackMonitor monitor){
- * this.monitor = monitor;
- * }
- * public void run() {
- * // Do the work
- * ...
- * // Unlock this thread.
- * monitor.unlock(this)
- * }
- * }
- * ...
- * public void collaborate() {
- * Runnable callback = new Runnable() {
- * public void run() {
- * // Do something which must be done after all the threads end.
- * ...
- * }
- * };
- * CallbackMonitor monitor = new CallbackMonitor(callback);
- * Thread1 thread1 = new Thread1(monitor);
- * Thread2 thread2 = new Thread2(monitor);
- * ...
- * monitor.lock(thread1, thread2, ...);
- * thread1.start();
- * thread2.start();
- * ...
- * }
- * </pre>
- * <p>
- * The above creates multiple threads which lock on the monitor and
- * invoke unlock when they end. The keys they used can be anything which
- * are unique among the threads. Once all threads end, the callback defined
- * in the method will be invoked and do the thing which requires to be done
- * after the end of these threads.
- * <p>
- * <b>Note:</b><em>The threads which require collaboration on the callback
- * monitor should be started only after all the locks corresponding to them
- * are added. </em>
- * <p>
- * For example, the above threads are started after the monitor locks all the threads:
- * <pre>
- * monitor.lock(thread1, thread2, ...);
- * thread1.start();
- * thread2.start();
- * ...
- * </pre>
- */
-public class CallbackMonitor {
- // The callback which is invoked after all the locks are unlocked.
- private ICallback callback;
- // The lock map containing the keys and the corresponding running results.
- private Map<Object, IStatus> locks;
-
- /**
- * Create a callback monitor with the specified callback.
- *
- * @param callback The callback to be invoked after all the locks being unlocked.
- */
- public CallbackMonitor(ICallback callback) {
- Assert.isNotNull(callback);
- this.callback = callback;
- this.locks = Collections.synchronizedMap(new HashMap<Object, IStatus>());
- }
-
- /**
- * Create a callback monitor with the specified callback and the keys.
- *
- * @param callback The callback to be invoked after all the locks being unlocked.
- * @param keys The keys to lock and unlock the locks.
- */
- public CallbackMonitor(ICallback callback, Object... keys) {
- Assert.isNotNull(callback);
- this.callback = callback;
- this.locks = Collections.synchronizedMap(new HashMap<Object, IStatus>());
- for (Object key : keys) {
- this.locks.put(key, null);
- }
- }
-
- /**
- * Add multiple locks with the specified keys.
- *
- * @param keys The keys whose locks are added.
- */
- public synchronized void lock(Object... keys) {
- for(Object key : keys) {
- this.locks.put(key, null);
- }
- }
-
- /**
- * Add a lock with the specified key.
- *
- * @param key The key whose lock is added.
- */
- public synchronized void lock(Object key) {
- Assert.isNotNull(key);
- this.locks.put(key, null);
- }
-
- /**
- * Unlock the lock with the specified key and status
- * check if all the locks have been unlocked. If all the
- * locks have been unlocked, then invoke the callback.
- *
- * @param key The key to unlock its lock.
- */
- public synchronized void unlock(Object key, IStatus status) {
- Assert.isNotNull(key);
- Assert.isNotNull(status);
- locks.put(key, status);
- IStatus current = getCurrentStatus();
- if (current != null) {
- callback.done(this, current);
- }
- }
-
- /**
- * Check if all the locks are unlocked and return a running status.
- *
- * @return a MultiStatus object describing running result or null if not completed yet.
- */
- private synchronized IStatus getCurrentStatus() {
- List<IStatus> list = new ArrayList<IStatus>();
- for (Entry<Object, IStatus>entry : locks.entrySet()) {
- IStatus status = entry.getValue();
- if (status == null) return null;
- list.add(status);
- }
- IStatus[] children = list.toArray(new IStatus[list.size()]);
- return new MultiStatus(UIPlugin.getUniqueIdentifier(), 0, children, Messages.CallbackMonitor_AllTasksFinished, null);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/QueryDoneGetChildren.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/QueryDoneGetChildren.java deleted file mode 100644 index b82ee5d10..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/QueryDoneGetChildren.java +++ /dev/null @@ -1,74 +0,0 @@ -/*******************************************************************************
- * Copyright (c) 2011 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.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.processes.ui.activator.UIPlugin;
-import org.eclipse.tcf.te.tcf.processes.ui.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, UIPlugin.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.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/QueryDoneGetContext.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/QueryDoneGetContext.java deleted file mode 100644 index 9eccbee50..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/QueryDoneGetContext.java +++ /dev/null @@ -1,126 +0,0 @@ -/*******************************************************************************
- * Copyright (c) 2011 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.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.processes.ui.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.childrenQueryRunning = true;
- 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.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/QueryDoneOpenChannel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/QueryDoneOpenChannel.java deleted file mode 100644 index 63dcf89cf..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/QueryDoneOpenChannel.java +++ /dev/null @@ -1,85 +0,0 @@ -/*******************************************************************************
- * Copyright (c) 2011 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.callbacks;
-
-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.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.ui.activator.UIPlugin;
-import org.eclipse.tcf.te.tcf.processes.ui.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 && channel != 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.childrenQueryRunning = false;
- parentNode.childrenQueried = true;
- 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 (callback != null) {
- IStatus status = error == null ? Status.OK_STATUS : new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), error.getMessage(), error);
- callback.done(this, status);
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/RefreshChildrenDoneOpenChannel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/RefreshChildrenDoneOpenChannel.java deleted file mode 100644 index ffa78a541..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/RefreshChildrenDoneOpenChannel.java +++ /dev/null @@ -1,86 +0,0 @@ -/*******************************************************************************
- * Copyright (c) 2011 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.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.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.ui.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;
-
- /**
- * Create an instance with the specified field parameters.
- */
- public RefreshChildrenDoneOpenChannel(ProcessTreeNode parentNode) {
- 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 && channel != null) {
- ISysMonitor service = channel.getRemoteService(ISysMonitor.class);
- if (service != null) {
- final CallbackMonitor monitor = new CallbackMonitor(new Callback(){
- @Override
- protected void internalDone(Object caller, IStatus status) {
- Tcf.getChannelManager().closeChannel(channel);
- }}, getChildrenIds());
- 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);
- }
- }
- }
- }
- }
-
- /**
- * 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()) {
- ids.add(child.id);
- }
- return ids.toArray(new Object[ids.size()]);
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/RefreshDoneGetChildren.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/RefreshDoneGetChildren.java deleted file mode 100644 index b1aa519d0..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/RefreshDoneGetChildren.java +++ /dev/null @@ -1,94 +0,0 @@ -/*******************************************************************************
- * Copyright (c) 2011 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.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.processes.ui.activator.UIPlugin;
-import org.eclipse.tcf.te.tcf.processes.ui.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.childrenQueryRunning = false;
- parentNode.childrenQueried = true;
- 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.childrenQueryRunning = false;
- parentNode.childrenQueried = true;
- if(callback != null) {
- IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), error.getMessage(), error);
- callback.done(this, status);
- }
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/RefreshDoneGetContext.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/RefreshDoneGetContext.java deleted file mode 100644 index 753e042f8..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/RefreshDoneGetContext.java +++ /dev/null @@ -1,166 +0,0 @@ -/*******************************************************************************
- * Copyright (c) 2011 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.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.processes.ui.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.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/RefreshDoneMonitorCallback.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/RefreshDoneMonitorCallback.java deleted file mode 100644 index 4d4f3fd9b..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/RefreshDoneMonitorCallback.java +++ /dev/null @@ -1,113 +0,0 @@ -/*******************************************************************************
- * Copyright (c) 2011 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.callbacks;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Queue;
-
-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.ui.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.childrenQueryRunning = false;
- parentNode.childrenQueried = true;
- removeDead();
- for (ProcessTreeNode node : parentNode.getChildren()) {
- if (node.childrenQueried && !node.childrenQueryRunning) {
- 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.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/RefreshDoneOpenChannel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/RefreshDoneOpenChannel.java deleted file mode 100644 index fa8fe3882..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/callbacks/RefreshDoneOpenChannel.java +++ /dev/null @@ -1,65 +0,0 @@ -/*******************************************************************************
- * Copyright (c) 2011 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.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.ui.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(ICallback callback, ProcessTreeNode parentNode) {
- 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 && channel != 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.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 517d7969f..cd621ef72 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 @@ -12,7 +12,7 @@ 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.ui.model.ProcessTreeNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
/**
* The comparator for the tree column "PID".
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 36be34a3f..752b25e42 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 @@ -11,7 +11,7 @@ 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.ui.model.ProcessTreeNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
/**
* The label provider for the tree column "PID".
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 2eff73757..3893c23de 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 @@ -12,7 +12,7 @@ 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.ui.model.ProcessTreeNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
/**
* The comparator for the tree column "PPID".
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 216a5a217..ecfe4722c 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 @@ -11,7 +11,7 @@ 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.ui.model.ProcessTreeNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
/**
* The label provider for the tree column "PPID".
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 b0277f7ff..fb818c038 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 @@ -14,7 +14,7 @@ import java.util.Comparator; import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
/**
* The comparator for the tree column "name".
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 index 5dea397d3..ba62f4cc3 100644 --- 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 @@ -13,9 +13,9 @@ import java.io.File; import org.eclipse.jface.viewers.LabelProvider;
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.model.ProcessTreeNode;
import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
/**
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 d0dfb1f9c..dbaf7057c 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 @@ -12,7 +12,7 @@ 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.ui.model.ProcessTreeNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
/**
* The comparator for the tree column "state".
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 16465f684..b77384c19 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 @@ -11,7 +11,7 @@ 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.ui.model.ProcessTreeNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
/**
* The label provider for the tree column "state".
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 c2df3c95f..3e741517c 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 @@ -12,7 +12,7 @@ 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.ui.model.ProcessTreeNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
/**
* The comparator for the tree column "user".
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 a74cd3cf1..0d5949e53 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 @@ -11,7 +11,7 @@ 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.ui.model.ProcessTreeNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
/**
* The label provider for the tree column "user".
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/dialogs/IntervalConfigDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/dialogs/IntervalConfigDialog.java index 70c3235e4..44553e590 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/dialogs/IntervalConfigDialog.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/dialogs/IntervalConfigDialog.java @@ -31,7 +31,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text;
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.model.IntervalGrade;
import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
/**
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/model/IntervalGrade.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/dialogs/IntervalGrade.java index 749ba452d..9eb0bcf8c 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/model/IntervalGrade.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/dialogs/IntervalGrade.java @@ -7,7 +7,7 @@ * Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.tcf.te.tcf.processes.ui.model;
+package org.eclipse.tcf.te.tcf.processes.ui.internal.dialogs;
/**
* The data model to contain the information of a refreshing grade including
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 165d370f7..5f8e104d9 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 @@ -12,7 +12,7 @@ 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.ui.model.ProcessTreeNode;
+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
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/internal/handler/AttachHandler.java index 5037f9be6..0fdf4e66f 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/internal/handler/AttachHandler.java @@ -25,9 +25,9 @@ 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.tcf.te.tcf.processes.ui.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.ui.model.steps.AttachStep;
import org.eclipse.ui.ISources;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;
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/internal/handler/ConfigIntervalDynamicContribution.java index 227abf754..e05e10cb0 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/internal/handler/ConfigIntervalDynamicContribution.java @@ -27,9 +27,10 @@ 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.model.ProcessModel;
+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;
@@ -110,7 +111,7 @@ public class ConfigIntervalDynamicContribution extends CompoundContributionItem public void run() {
if (isChecked()) {
this.model.setInterval(seconds);
- model.addMRUInterval(seconds);
+ PreferencesInitializer.addMRUInterval(seconds);
}
}
}
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/internal/handler/ConfigRefreshIntervalHandler.java index 19b89f768..2c2d330be 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/internal/handler/ConfigRefreshIntervalHandler.java @@ -15,8 +15,9 @@ 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.model.ProcessModel;
+import org.eclipse.tcf.te.tcf.processes.ui.internal.preferences.PreferencesInitializer;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.handlers.HandlerUtil;
@@ -44,7 +45,7 @@ public class ConfigRefreshIntervalHandler extends AbstractHandler { interval = dialog.getResult();
ProcessModel processModel = ProcessModel.getProcessModel(peer);
processModel.setInterval(interval);
- processModel.addMRUInterval(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/internal/handler/DetachHandler.java index 4d19bf954..317079231 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/internal/handler/DetachHandler.java @@ -17,8 +17,8 @@ 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.ui.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.ui.model.steps.DetachStep;
+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;
/**
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/internal/handler/RefreshProcessListHandler.java index deab215d0..55c08efcd 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/internal/handler/RefreshProcessListHandler.java @@ -13,7 +13,7 @@ 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.ui.model.ProcessModel;
+import org.eclipse.tcf.te.tcf.processes.core.model.ProcessModel;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.handlers.HandlerUtil;
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/internal/handler/TerminateHandler.java index b932db9f1..e2b3d0927 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/internal/handler/TerminateHandler.java @@ -21,8 +21,8 @@ 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.ui.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.ui.model.steps.TerminateStep;
+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;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/preferences/PreferencesInitializer.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/preferences/PreferencesInitializer.java index dcdade538..5517cf3f1 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/preferences/PreferencesInitializer.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/preferences/PreferencesInitializer.java @@ -9,6 +9,8 @@ *******************************************************************************/ package org.eclipse.tcf.te.tcf.processes.ui.internal.preferences; +import java.util.StringTokenizer; + import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.tcf.te.tcf.processes.ui.activator.UIPlugin; @@ -35,4 +37,45 @@ public class PreferencesInitializer extends AbstractPreferenceInitializer implem preferenceStore.setDefault(PREF_INTERVAL_GRADES, DEFAULT_INTERVAL_GRADES); preferenceStore.setDefault(PREF_INTERVAL_MRU_COUNT, DEFAULT_INTERVAL_MRU_COUNT); } + + /** + * Update the most recently used interval adding + * a new interval. + * + * @param interval The new interval. + */ + public static void addMRUInterval(int interval){ + IPreferenceStore prefStore = UIPlugin.getDefault().getPreferenceStore(); + String mruList = prefStore.getString(PREF_INTERVAL_MRU_LIST); + if (mruList == null || mruList.trim().length() == 0) { + mruList = "" + interval; //$NON-NLS-1$ + }else{ + StringTokenizer st = new StringTokenizer(mruList, ":"); //$NON-NLS-1$ + int maxCount = prefStore.getInt(PREF_INTERVAL_MRU_COUNT); + boolean found = false; + while (st.hasMoreTokens()) { + String token = st.nextToken(); + try { + int s = Integer.parseInt(token); + if(s == interval ) { + found = true; + break; + } + } + catch (NumberFormatException nfe) { + } + } + if(!found) { + mruList = mruList + ":" + interval; //$NON-NLS-1$ + st = new StringTokenizer(mruList, ":"); //$NON-NLS-1$ + if(st.countTokens() > maxCount) { + int comma = mruList.indexOf(":"); //$NON-NLS-1$ + if(comma != -1) { + mruList = mruList.substring(comma+1); + } + } + } + } + prefStore.setValue(PREF_INTERVAL_MRU_LIST, mruList); + } } 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 34d81e39c..bd81ae577 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 @@ -20,9 +20,9 @@ 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.model.ProcessTreeNode;
import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
import org.eclipse.ui.dialogs.PropertyPage;
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 4b4a0b107..2598212f2 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 @@ -19,7 +19,7 @@ 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.ui.model.ProcessTreeNode;
+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;
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 33266e402..dcbca23c1 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 @@ -18,7 +18,7 @@ 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.ui.model.ProcessTreeNode;
+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;
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 014568ec6..db6579e03 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 @@ -21,7 +21,7 @@ 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.ui.model.ProcessTreeNode;
+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;
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 25081b7f4..99b92aeec 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 @@ -14,7 +14,7 @@ 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.ui.model.ProcessTreeNode;
+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.views.tabbed.BaseTitledSection;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
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 bcf3ebb7d..52d4d4daa 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 @@ -13,7 +13,7 @@ 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.ui.model.ProcessTreeNode;
+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.views.tabbed.BaseTitledSection;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
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 153167485..8ab98c99e 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 @@ -14,7 +14,7 @@ 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.ui.model.ProcessTreeNode;
+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.views.tabbed.BaseTitledSection;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
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 27998a977..60baec8cb 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 @@ -13,7 +13,7 @@ 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.ui.model.ProcessTreeNode;
+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.views.tabbed.BaseTitledSection;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
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 a33f198f4..dbd154a0b 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 @@ -14,7 +14,7 @@ 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.ui.model.ProcessTreeNode;
+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.views.tabbed.BaseTitledSection;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
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 index 912c73cbd..3be382821 100644 --- 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 @@ -10,7 +10,7 @@ package org.eclipse.tcf.te.tcf.processes.ui.internal.tabbed;
import org.eclipse.jface.viewers.IFilter;
-import org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
/**
* The filter to filter out root and pending process node.
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 8ddb69258..254e85c8c 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 @@ -13,7 +13,7 @@ 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.ui.model.ProcessTreeNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
/**
* The property tester for a process tree node.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/model/ProcessModel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/model/ProcessModel.java deleted file mode 100644 index 162fd9ca2..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/model/ProcessModel.java +++ /dev/null @@ -1,319 +0,0 @@ -/*******************************************************************************
- * Copyright (c) 2011 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.model;
-
-import java.beans.PropertyChangeEvent;
-import java.util.StringTokenizer;
-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.jface.preference.IPreferenceStore;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.core.interfaces.IViewerInput;
-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.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.processes.ui.activator.UIPlugin;
-import org.eclipse.tcf.te.tcf.processes.ui.internal.callbacks.QueryDoneOpenChannel;
-import org.eclipse.tcf.te.tcf.processes.ui.internal.callbacks.RefreshChildrenDoneOpenChannel;
-import org.eclipse.tcf.te.tcf.processes.ui.internal.callbacks.RefreshDoneOpenChannel;
-import org.eclipse.tcf.te.tcf.processes.ui.internal.preferences.IPreferenceConsts;
-
-/**
- * The process tree model implementation.
- */
-public class ProcessModel implements IPreferenceConsts{
- /* default */static final String PROCESS_ROOT_KEY = UIPlugin.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) {
- if (peerModel != null) {
- if (Protocol.isDispatchThread()) {
- ProcessModel model = (ProcessModel) peerModel.getProperty(PROCESS_ROOT_KEY);
- if (model == null) {
- model = new ProcessModel(peerModel);
- peerModel.setProperty(PROCESS_ROOT_KEY, model);
- }
- return model;
- }
- final AtomicReference<ProcessModel> reference = new AtomicReference<ProcessModel>();
- Protocol.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- reference.set(getProcessModel(peerModel));
- }
- });
- return reference.get();
- }
- return null;
- }
-
- // The root node of the peer model
- private 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;
- private IPeerModel peerModel;
-
- /**
- * Create a File System Model.
- */
- ProcessModel(IPeerModel peerModel) {
- this.peerModel = peerModel;
- this.stopped = true;
- }
-
- /**
- * Get the root node of the peer model.
- *
- * @return The root node.
- */
- public ProcessTreeNode getRoot() {
- return root;
- }
-
- /**
- * Set the root node of the peer model.
- *
- * @param root The root node
- */
- public void createRoot(IPeerModel peerModel ) {
- this.root = ProcessTreeNode.createRootNode(peerModel);
- }
-
- /**
- * Start the periodical polling.
- */
- void startPolling() {
- setStopped(false);
- pollingTimer = new Timer();
- schedulePolling();
- }
-
- /**
- * 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(peerModel, "stopped", oldValue, newValue); //$NON-NLS-1$
- IViewerInput viewerInput = (IViewerInput) peerModel.getAdapter(IViewerInput.class);
- viewerInput.firePropertyChange(event);
- }
- }
-
- /**
- * Stop the periodical polling.
- */
- void stopPolling() {
- setStopped(true);
- }
-
- /**
- * Schedule the periodical polling.
- */
- void schedulePolling() {
- TimerTask pollingTask = new TimerTask(){
- @Override
- public void run() {
- refresh(new Callback() {
- @Override
- protected void internalDone(Object caller, IStatus status) {
- if (!stopped) {
- schedulePolling();
- }
- else {
- pollingTimer.cancel();
- pollingTimer = null;
- }
- }
- });
- }};
- 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;
- }
-
- /**
- * Query the children of the given process context.
- *
- * @param parentNode The process context node. Must not be <code>null</code>.
- */
- public void queryChildren(ProcessTreeNode parentNode) {
- Assert.isNotNull(parentNode);
- parentNode.childrenQueryRunning = true;
- Tcf.getChannelManager().openChannel(parentNode.peerNode.getPeer(), null, new QueryDoneOpenChannel(parentNode));
- }
-
- /**
- * Recursively refresh the children of the given process context with a callback, which is
- * called when whole process is finished.
- *
- * @param parentNode The process context node. Must not be <code>null</code>.
- * @param callback The callback object, or <code>null</code> when callback is not needed.
- */
- public void refresh(final ProcessTreeNode parentNode, final ICallback callback) {
- Assert.isNotNull(parentNode);
- parentNode.childrenQueryRunning = true;
- Tcf.getChannelManager().openChannel(parentNode.peerNode.getPeer(), null, new RefreshDoneOpenChannel(callback, parentNode));
- }
-
- /**
- * Recursively refresh the children of the given process context.
- *
- * @param parentNode The process context node. Must not be <code>null</code>.
- */
- public void refresh(final ProcessTreeNode parentNode) {
- refresh(parentNode, null);
- }
-
- /**
- * Recursively refresh the tree from the root node with a callback, which
- * is called when the whole process is finished.
- *
- * @param callback The callback object or <code>null</code> when callback is not needed.
- */
- public void refresh(ICallback callback) {
- if (this.root.childrenQueried && !this.root.childrenQueryRunning) {
- refresh(this.root, callback);
- }
- else {
- if (callback != null) {
- callback.done(this, Status.OK_STATUS);
- }
- }
- }
-
- /**
- * Recursively refresh the tree from the root node.
- */
- public void refresh() {
- if(this.root.childrenQueried && !this.root.childrenQueryRunning) {
- refresh(this.root, null);
- }
- }
-
- /**
- * Update the most recently used interval adding
- * a new interval.
- *
- * @param interval The new interval.
- */
- public void addMRUInterval(int interval){
- IPreferenceStore prefStore = UIPlugin.getDefault().getPreferenceStore();
- String mruList = prefStore.getString(PREF_INTERVAL_MRU_LIST);
- if (mruList == null || mruList.trim().length() == 0) {
- mruList = "" + interval; //$NON-NLS-1$
- }else{
- StringTokenizer st = new StringTokenizer(mruList, ":"); //$NON-NLS-1$
- int maxCount = prefStore.getInt(PREF_INTERVAL_MRU_COUNT);
- boolean found = false;
- while (st.hasMoreTokens()) {
- String token = st.nextToken();
- try {
- int s = Integer.parseInt(token);
- if(s == interval ) {
- found = true;
- break;
- }
- }
- catch (NumberFormatException nfe) {
- }
- }
- if(!found) {
- mruList = mruList + ":" + interval; //$NON-NLS-1$
- st = new StringTokenizer(mruList, ":"); //$NON-NLS-1$
- if(st.countTokens() > maxCount) {
- int comma = mruList.indexOf(":"); //$NON-NLS-1$
- if(comma != -1) {
- mruList = mruList.substring(comma+1);
- }
- }
- }
- }
- prefStore.setValue(PREF_INTERVAL_MRU_LIST, mruList);
- }
-
- /**
- * If the polling has been stopped.
- *
- * @return true if it is stopped.
- */
- public boolean isRefreshStopped() {
- return stopped;
- }
-
- /**
- * Get the peer model associated with this model.
- *
- * @return The peer model.
- */
- IPeerModel getPeerModel() {
- return peerModel;
- }
-
- /**
- * Refresh the children without refreshing itself.
- *
- * @param parentNode The parent whose children are to be refreshed.
- */
- public void refreshChildren(ProcessTreeNode parentNode) {
- Assert.isNotNull(parentNode);
- Tcf.getChannelManager().openChannel(parentNode.peerNode.getPeer(), null, new RefreshChildrenDoneOpenChannel(parentNode));
- }
-}
-
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/model/ProcessTreeNode.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/model/ProcessTreeNode.java deleted file mode 100644 index aa2790b32..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/model/ProcessTreeNode.java +++ /dev/null @@ -1,385 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.model; - -import java.beans.PropertyChangeEvent; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.PlatformObject; -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.IViewerInput; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider; -import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages; - -/** - * Representation of a process tree node. - */ -public final class ProcessTreeNode extends PlatformObject implements IPeerModelProvider{ - public static final ProcessTreeNode PENDING_NODE = createPendingNode(); - - /** - * Create a pending node. - * - * @return A pending node. - */ - private static ProcessTreeNode createPendingNode() { - ProcessTreeNode node = new ProcessTreeNode(); - node.name = Messages.PendingOperation_label; - node.type = "ProcPendingNode"; //$NON-NLS-1$ - return node; - } - - /** - * Create a root process node. - * - * @param peerModel The peer model which this process belongs to. - * @return The root process node. - */ - public 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; - } - - private final UUID uuid = UUID.randomUUID(); - - /** - * The tree node name. - */ - public String name = null; - - /** - * The tree node type. - */ - public String type = null; - - /** - * 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; - - /** - * The tree node parent. - */ - public ProcessTreeNode parent = null; - - /** - * The tree node children. - */ - private List<ProcessTreeNode> children = new ArrayList<ProcessTreeNode>(); - - /** - * Flag to mark once the children of the node got queried - */ - public boolean childrenQueried = false; - - /** - * Flag to mark once the children query is running - */ - public boolean childrenQueryRunning = false; - - /** - * The peer node the process node is associated with. - */ - public IPeerModel peerNode; - - /** - * 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; - } - } - - /** - * Return if this node is a pending node. - * - * @return true if this node is a pending node. - */ - public boolean isPendingNode() { - return type != null && type.equals("ProcPendingNode"); //$NON-NLS-1$ - } - - /** - * Return if this node is a root node. - * - * @return true if it is a root node. - */ - public boolean isRootNode() { - 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$ - } - } - - /** - * 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$ - } - } - - /* - * (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - @Override - public final int hashCode() { - return uuid.hashCode(); - } - - /* - * (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public final boolean equals(Object obj) { - if (obj instanceof ProcessTreeNode) { - return uuid.equals(((ProcessTreeNode) obj).uuid); - } - return super.equals(obj); - } - - /* - * (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return name != null ? name : super.toString(); - } - - /** - * 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$ - } - } - - /** - * Fire a property change event to notify one of the node's property has changed. - * - * @param event The property change event. - */ - protected void firePropertyChange(PropertyChangeEvent event) { - if(peerNode != null) { - IViewerInput viewerInput = (IViewerInput) peerNode.getAdapter(IViewerInput.class); - viewerInput.firePropertyChange(event); - } else if(parent != null) { - parent.firePropertyChange(event); - } - } - - /** - * Add the specified the node to the children list. - * - * @param node The child node to be added. - */ - public void addChild(ProcessTreeNode child) { - children.add(child); - PropertyChangeEvent event = new PropertyChangeEvent(this, "state", null, null); //$NON-NLS-1$ - firePropertyChange(event); - } - - /** - * Remove the specified child node from its children list. - * - * @param node The child node to be removed. - */ - public void removeChild(ProcessTreeNode child) { - children.remove(child); - PropertyChangeEvent event = new PropertyChangeEvent(this, "state", null, null); //$NON-NLS-1$ - firePropertyChange(event); - } - - /** - * Clear the children of this folder. - */ - public void clearChildren() { - children.clear(); - PropertyChangeEvent event = new PropertyChangeEvent(this, "state", null, null); //$NON-NLS-1$ - firePropertyChange(event); - } - - /** - * Get the children process list. - * - * @return The children process list. - */ - public List<ProcessTreeNode> getChildren() { - return children; - } - - /* - * (non-Javadoc) - * @see org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider#getPeerModel() - */ - @Override - public IPeerModel getPeerModel() { - return peerNode; - } - - /** - * 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$ - } - } -} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/model/steps/AttachStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/model/steps/AttachStep.java deleted file mode 100644 index 5b5642fd1..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/model/steps/AttachStep.java +++ /dev/null @@ -1,213 +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.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.ui.activator.UIPlugin;
-import org.eclipse.tcf.te.tcf.processes.ui.help.IContextHelpIds;
-import org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.ui.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, error, 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, UIPlugin.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 {
- UIPlugin.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.ui/src/org/eclipse/tcf/te/tcf/processes/ui/model/steps/DetachStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/model/steps/DetachStep.java deleted file mode 100644 index c7d2ae3b2..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/model/steps/DetachStep.java +++ /dev/null @@ -1,190 +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.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.ui.activator.UIPlugin;
-import org.eclipse.tcf.te.tcf.processes.ui.help.IContextHelpIds;
-import org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.ui.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, error, 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, UIPlugin.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 {
- UIPlugin.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.ui/src/org/eclipse/tcf/te/tcf/processes/ui/model/steps/TerminateStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/model/steps/TerminateStep.java deleted file mode 100644 index 6c0c808e5..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/model/steps/TerminateStep.java +++ /dev/null @@ -1,167 +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.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.ui.activator.UIPlugin;
-import org.eclipse.tcf.te.tcf.processes.ui.help.IContextHelpIds;
-import org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.ui.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, error, 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, UIPlugin.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 {
- UIPlugin.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.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.java index 8b2c378bb..d91ecf6ba 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.java @@ -39,7 +39,6 @@ public class Messages extends NLS { public static String ProcessesTreeControl_column_user_label; public static String ProcessLabelProvider_NullNameNodeLabel; - public static String ProcessLabelProvider_RootNodeLabel; public static String ProcessPreferencePage_BiggerThanZero; public static String ProcessPreferencePage_DefineMoreThanOne; @@ -85,8 +84,6 @@ public class Messages extends NLS { public static String BasicInformationSection_Type; public static String BasicInformationSection_User; - public static String CallbackMonitor_AllTasksFinished; - public static String ConfigIntervalDynamicContribution_Custom; public static String ContextIDSection_ContextIDs; @@ -171,18 +168,6 @@ public class Messages extends NLS { public static String NewSpeedGradeDialog_NameLabel; public static String NewSpeedGradeDialog_ValueLabel; - public static String AttachStep_error_title; - public static String AttachStep_error_connect; - public static String AttachStep_error_getContext; - public static String AttachStep_error_attach; - public static String AttachStep_error_openChannel; - - public static String DetachStep_error_title; - public static String DetachStep_error_disconnect; - public static String DetachStep_error_getContext; - public static String DetachStep_error_detach; - public static String DetachStep_error_openChannel; - public static String GeneralInformationPage_InternalPID; public static String GeneralInformationPage_InternalPPID; @@ -199,7 +184,7 @@ public class Messages extends NLS { public static String GeneralInformationPage_User; - public static String PendingOperation_label; public static String TerminateHandler_TerminationError; + public static String ProcessLabelProvider_RootNodeLabel; } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.properties index 81ae69d90..a5fee1a74 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.properties +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.properties @@ -1,4 +1,3 @@ -# # org.eclipse.tcf.te.tcf.processes.ui # Externalized Strings. # @@ -11,7 +10,6 @@ ProcessesTreeControl_column_ppid_label=PPID ProcessesTreeControl_column_state_label=State ProcessesTreeControl_column_user_label=User ProcessLabelProvider_NullNameNodeLabel=System -ProcessLabelProvider_RootNodeLabel=Processes ProcessPreferencePage_BiggerThanZero=The number must be bigger than zero\! ProcessPreferencePage_DefineMoreThanOne=Please define at least one grade of speed\! ProcessPreferencePage_EditButtonLabel=&Edit... @@ -53,7 +51,6 @@ BasicInformationSection_Title=Basic Information BasicInformationSection_Type=Type: BasicInformationSection_User=User: -CallbackMonitor_AllTasksFinished=All tasks are finished\! ConfigIntervalDynamicContribution_Custom=Custom ... ContextIDSection_ContextIDs=Context IDs @@ -123,17 +120,6 @@ NewSpeedGradeDialog_GradeSameValue=Grade ''{0}'' has the same value. NewSpeedGradeDialog_NameLabel=Name: NewSpeedGradeDialog_ValueLabel=Value: -AttachStep_error_title=Error -AttachStep_error_connect=Failed to attach to context: {0} -AttachStep_error_getContext=Failed to get context: {0} -AttachStep_error_attach=Failed to attach context: {0} -AttachStep_error_openChannel=Failed to open channel: {0} - -DetachStep_error_title=Error -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} GeneralInformationPage_InternalPID=Internal PID: GeneralInformationPage_InternalPPID=Internal PPID: GeneralInformationPage_Name=Name: @@ -142,5 +128,5 @@ GeneralInformationPage_ProcessID=Process ID: GeneralInformationPage_State=State: GeneralInformationPage_Type=Type: GeneralInformationPage_User=User: -PendingOperation_label=Pending... TerminateHandler_TerminationError=Termination Error +ProcessLabelProvider_RootNodeLabel=Processes |