Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2011-11-16 01:06:44 -0500
committerUwe Stieber2011-11-16 01:06:44 -0500
commit67449886c09c8ec4da4f39082373ab62ccc3d978 (patch)
treee939ad861ec709fad9ceb6a862be8ed2ece3c13c
parent46b9c7fbf9fc67973b187030e7b77020bfd1e988 (diff)
parent5917b6046d3e0bd6608b7511fdaba455ebd7e516 (diff)
downloadorg.eclipse.tcf-67449886c09c8ec4da4f39082373ab62ccc3d978.tar.gz
org.eclipse.tcf-67449886c09c8ec4da4f39082373ab62ccc3d978.tar.xz
org.eclipse.tcf-67449886c09c8ec4da4f39082373ab62ccc3d978.zip
Merge branch 'master' into juno-refactoring
-rw-r--r--python/src/tcf/services/remote/SymbolsProxy.py2
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.core/META-INF/MANIFEST.MF2
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AbstractAsyncExecutableJob.java14
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AbstractAsyncExecutableStepperJob.java (renamed from target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AsyncExecutableStepperJob.java)6
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AsyncCallbackCollector.java29
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AsyncCallbackHandler.java30
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/model/ThreadSafeContainerModelNode.java28
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/model/ThreadSafeModelNode.java28
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.runtime.statushandler/src/org/eclipse/tm/te/runtime/statushandler/interfaces/IStatusHandler.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.runtime/src/org/eclipse/tm/te/runtime/extensions/AbstractExtensionPointManager.java49
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.runtime/src/org/eclipse/tm/te/runtime/extensions/ExecutableExtension.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.runtime/src/org/eclipse/tm/te/runtime/extensions/ExtensionPointComparator.java68
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.tcf.processes.core/src/org/eclipse/tm/te/tcf/processes/core/launcher/ProcessLauncher.java23
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.tcf.processes.core/src/org/eclipse/tm/te/tcf/processes/core/launcher/ProcessStreamsListener.java13
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.core/src/org/eclipse/tm/te/tcf/terminals/core/launcher/TerminalsLauncher.java27
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.core/src/org/eclipse/tm/te/tcf/terminals/core/launcher/TerminalsStreamsListener.java13
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/connector/TerminalsConnector.java37
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.tcf.ui/plugin.xml1
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.tests/plugin.xml3
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals.ssh/src/org/eclipse/tm/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals.ssh/src/org/eclipse/tm/te/ui/terminals/ssh/launcher/SshLauncherDelegate.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.terminals.ssh/src/org/eclipse/tm/te/ui/terminals/ssh/nls/Messages.properties2
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.views/plugin.xml5
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/ViewViewer.java14
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/ViewViewerSorter.java89
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/navigator/ContentProviderDelegate.java67
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/navigator/LabelProviderDelegate.java21
-rw-r--r--target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/statushandler/DefaultStatusHandler.java7
28 files changed, 454 insertions, 138 deletions
diff --git a/python/src/tcf/services/remote/SymbolsProxy.py b/python/src/tcf/services/remote/SymbolsProxy.py
index 67b9e9e9f..7d911f6c9 100644
--- a/python/src/tcf/services/remote/SymbolsProxy.py
+++ b/python/src/tcf/services/remote/SymbolsProxy.py
@@ -116,6 +116,6 @@ class SymbolsProxy(symbols.SymbolsService):
if not error:
assert len(args) == 5
error = self.toError(args[0])
- address, size, fp_cmds, reg_cmds = args[1:4]
+ address, size, fp_cmds, reg_cmds = args[1:5]
done.doneFindFrameInfo(self.token, error, address, size, fp_cmds, reg_cmds)
return FindFrameInfoCommand().token
diff --git a/target_explorer/plugins/org.eclipse.tm.te.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tm.te.core/META-INF/MANIFEST.MF
index 015f2121f..a9dd00f75 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.core/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tm.te.core/META-INF/MANIFEST.MF
@@ -7,7 +7,6 @@ Bundle-Activator: org.eclipse.tm.te.core.activator.CoreBundleActivator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0",
org.eclipse.tm.te.runtime;bundle-version="1.0.0",
- org.eclipse.tm.te.runtime.concurrent;bundle-version="1.0.0",
org.eclipse.tm.te.runtime.stepper;bundle-version="1.0.0",
org.eclipse.tm.te.runtime.services;bundle-version="1.0.0",
org.eclipse.tm.te.runtime.persistence;bundle-version="1.0.0",
@@ -23,7 +22,6 @@ Export-Package: org.eclipse.tm.te.core.activator;x-internal:=true,
org.eclipse.tm.te.core.connection.interfaces,
org.eclipse.tm.te.core.connection.managers,
org.eclipse.tm.te.core.connection.strategy,
- org.eclipse.tm.te.core.model,
org.eclipse.tm.te.core.model.interfaces,
org.eclipse.tm.te.core.nls;x-internal:=true,
org.eclipse.tm.te.core.utils.text
diff --git a/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AbstractAsyncExecutableJob.java b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AbstractAsyncExecutableJob.java
index c6b2536aa..4abd2a781 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AbstractAsyncExecutableJob.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AbstractAsyncExecutableJob.java
@@ -17,7 +17,7 @@ import org.eclipse.core.runtime.jobs.IJobManager;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.tm.te.core.async.interfaces.IAsyncExecutable;
import org.eclipse.tm.te.runtime.callback.Callback;
-import org.eclipse.tm.te.runtime.concurrent.util.ExecutorsUtil;
+import org.eclipse.tm.te.runtime.interfaces.IConditionTester;
import org.eclipse.tm.te.runtime.interfaces.callback.ICallback;
import org.eclipse.tm.te.runtime.utils.ProgressHelper;
@@ -186,6 +186,16 @@ public abstract class AbstractAsyncExecutableJob extends Job implements IAsyncEx
*/
protected abstract void internalExecute(final IProgressMonitor monitor, final ICallback callback);
+ /**
+ * Hold the execution of {@link #run(IProgressMonitor)} until the asynchronous executable
+ * has completed the execution and invoked the callback.
+ *
+ * @param timeout The timeout in milliseconds. <code>0</code> means wait forever.
+ * @param conditionTester The condition tester which condition must be fulfilled until
+ * the execution hold of {@link #run(IProgressMonitor)} can be released.
+ */
+ protected abstract void waitAndExecute(long timeout, IConditionTester conditionTester);
+
/* (non-Javadoc)
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
*/
@@ -196,7 +206,7 @@ public abstract class AbstractAsyncExecutableJob extends Job implements IAsyncEx
ProgressHelper.beginTask(monitor, "", jobTicks); //$NON-NLS-1$
final Callback callback = new Callback(monitor, ProgressHelper.PROGRESS_DONE, getJobCallback());
internalExecute(monitor, callback);
- ExecutorsUtil.waitAndExecute(0, callback.getDoneConditionTester(isCancelable() ? monitor : null));
+ waitAndExecute(0, callback.getDoneConditionTester(isCancelable() ? monitor : null));
finished = true;
if (getRescheduleDelay() >= 0 && Platform.isRunning() && (!isCancelable() || !monitor.isCanceled())) {
diff --git a/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AsyncExecutableStepperJob.java b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AbstractAsyncExecutableStepperJob.java
index 073fd5cd4..0c12489cf 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AsyncExecutableStepperJob.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AbstractAsyncExecutableStepperJob.java
@@ -19,12 +19,12 @@ import org.eclipse.tm.te.runtime.interfaces.callback.ICallback;
import org.eclipse.tm.te.runtime.utils.ProgressHelper;
/**
- * Asynchronous executable stepper job.
+ * Abstract asynchronous executable stepper job.
* <p>
* The job executes a list of actions. If any action returns with an error, the whole job will be
* aborted.
*/
-public class AsyncExecutableStepperJob extends AbstractAsyncExecutableJob {
+public abstract class AbstractAsyncExecutableStepperJob extends AbstractAsyncExecutableJob {
private final IAsyncExecutable[] actions;
/**
@@ -33,7 +33,7 @@ public class AsyncExecutableStepperJob extends AbstractAsyncExecutableJob {
* @param name The job name. Must not be <code>null</code>
* @param actions The actions to execute. Must not be <code>null</code>.
*/
- public AsyncExecutableStepperJob(String name, IAsyncExecutable[] actions) {
+ public AbstractAsyncExecutableStepperJob(String name, IAsyncExecutable[] actions) {
super(name);
Assert.isNotNull(actions);
diff --git a/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AsyncCallbackCollector.java b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AsyncCallbackCollector.java
index 92d171073..f0fb15908 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AsyncCallbackCollector.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AsyncCallbackCollector.java
@@ -17,7 +17,6 @@ import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.tm.te.core.activator.CoreBundleActivator;
import org.eclipse.tm.te.runtime.callback.Callback;
-import org.eclipse.tm.te.runtime.concurrent.util.ExecutorsUtil;
import org.eclipse.tm.te.runtime.interfaces.callback.ICallback;
/**
@@ -40,6 +39,23 @@ public class AsyncCallbackCollector extends AsyncCallbackHandler {
private boolean isFinished;
private boolean initDone;
+ // The reference to the callback invocation delegate
+ private ICallbackInvocationDelegate delegate = null;
+
+ /**
+ * Delegation interfaces used by the asynchronous callback collector to
+ * invoke the final callback.
+ */
+ public static interface ICallbackInvocationDelegate {
+
+ /**
+ * Invokes the given runnable.
+ *
+ * @param runnable The runnable. Must not be <code>null</code>.
+ */
+ public void invoke(Runnable runnable);
+ }
+
/**
* Simple target callback handling an asynchronous callback collector parent itself and remove
* themselves from the collector after callback has done.
@@ -90,21 +106,25 @@ public class AsyncCallbackCollector extends AsyncCallbackHandler {
* Constructor.
*/
public AsyncCallbackCollector() {
- this(null);
+ this(null, null);
}
/**
* Constructor.
*
* @param callback The final callback to invoke if the collector enters the finished state.
+ * @param delegate The callback invocation delegate. Must not be <code>null</code> if the callback is not <code>null</code>.
*/
- public AsyncCallbackCollector(ICallback callback) {
+ public AsyncCallbackCollector(ICallback callback, ICallbackInvocationDelegate delegate) {
super();
+ if (callback != null) Assert.isNotNull(delegate);
+
// We have to add our master callback to the list of callback to avoid that
// the collector is running empty to early!
addCallback(callback);
this.callback = callback;
+ this.delegate = delegate;
// We are not finished yet.
isFinished = false;
@@ -141,7 +161,8 @@ public class AsyncCallbackCollector extends AsyncCallbackHandler {
*/
protected void onCollectorFinished() {
if (callback != null) {
- ExecutorsUtil.execute(new Runnable() {
+ Assert.isNotNull(delegate);
+ delegate.invoke(new Runnable() {
@Override
public void run() {
Throwable error = getError();
diff --git a/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AsyncCallbackHandler.java b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AsyncCallbackHandler.java
index f854ec591..8ea299ebc 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AsyncCallbackHandler.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/async/AsyncCallbackHandler.java
@@ -16,7 +16,6 @@ import java.util.Map;
import java.util.Vector;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.tm.te.runtime.concurrent.util.ExecutorsUtil;
import org.eclipse.tm.te.runtime.interfaces.IConditionTester;
import org.eclipse.tm.te.runtime.interfaces.callback.ICallback;
@@ -26,7 +25,6 @@ import org.eclipse.tm.te.runtime.interfaces.callback.ICallback;
public class AsyncCallbackHandler {
private final List<ICallback> callbacks = new Vector<ICallback>();
private final IConditionTester conditionTester;
- private boolean timeoutOccurred;
private Throwable error;
private final static boolean TRACING_ENABLED = Boolean.parseBoolean(Platform.getDebugOption("org.eclipse.tm.te.runtime/trace/callbacks")); //$NON-NLS-1$
@@ -47,7 +45,6 @@ public class AsyncCallbackHandler {
*/
public AsyncCallbackHandler(IConditionTester tester) {
super();
- timeoutOccurred = false;
error = null;
conditionTester = new AsyncCallbackConditionTester(tester);
}
@@ -147,11 +144,14 @@ public class AsyncCallbackHandler {
}
/**
- * Returns <code>true</code> if the <code>wait</code> methods have been left because of timeout
- * and not because the waiting condition has been fulfilled.
+ * Returns the condition tester to use for waiting for the callback handler
+ * until all callbacks have been invoked and the external condition tester
+ * is fulfilled too.
+ *
+ * @return The condition tester instance.
*/
- public boolean isTimeoutOccurred() {
- return timeoutOccurred;
+ public IConditionTester getConditionTester() {
+ return conditionTester;
}
final class AsyncCallbackConditionTester implements IConditionTester {
@@ -170,8 +170,7 @@ public class AsyncCallbackHandler {
externalTester = tester;
}
- /*
- * (non-Javadoc)
+ /* (non-Javadoc)
* @see org.eclipse.tm.te.runtime.interfaces.IConditionTester#cleanup()
*/
@Override
@@ -181,8 +180,7 @@ public class AsyncCallbackHandler {
}
}
- /*
- * (non-Javadoc)
+ /* (non-Javadoc)
* @see org.eclipse.tm.te.runtime.interfaces.IConditionTester#isConditionFulfilled()
*/
@Override
@@ -191,14 +189,4 @@ public class AsyncCallbackHandler {
return isEmpty() || (externalTester != null && externalTester.isConditionFulfilled());
}
}
-
- /**
- * Wait for all associated callback's to finish or the specified timeout has been occurred.
- *
- * @param timeout The timeout in milliseconds. If <code>0</code>, the method waits forever till
- * all callback's have been returned.
- */
- public final void waitForFinishOrTimeout(long timeout) {
- timeoutOccurred = ExecutorsUtil.waitAndExecute(timeout, conditionTester);
- }
}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/model/ThreadSafeContainerModelNode.java b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/model/ThreadSafeContainerModelNode.java
deleted file mode 100644
index 73fe10a67..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/model/ThreadSafeContainerModelNode.java
+++ /dev/null
@@ -1,28 +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.tm.te.core.model;
-
-import org.eclipse.tm.te.runtime.concurrent.util.ExecutorsUtil;
-import org.eclipse.tm.te.runtime.model.ContainerModelNode;
-
-/**
- * Container model node implementation assuring thread safety by enforcing model operations to
- * happen in the executor thread.
- */
-public class ThreadSafeContainerModelNode extends ContainerModelNode {
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.runtime.nodes.PropertiesContainer#checkThreadAccess()
- */
- @Override
- protected boolean checkThreadAccess() {
- return ExecutorsUtil.isExecutorThread();
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/model/ThreadSafeModelNode.java b/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/model/ThreadSafeModelNode.java
deleted file mode 100644
index 357405372..000000000
--- a/target_explorer/plugins/org.eclipse.tm.te.core/src/org/eclipse/tm/te/core/model/ThreadSafeModelNode.java
+++ /dev/null
@@ -1,28 +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.tm.te.core.model;
-
-import org.eclipse.tm.te.runtime.concurrent.util.ExecutorsUtil;
-import org.eclipse.tm.te.runtime.model.ModelNode;
-
-/**
- * Model node implementation assuring thread safety by enforcing model operations to happen in the
- * executor thread.
- */
-public class ThreadSafeModelNode extends ModelNode {
-
- /* (non-Javadoc)
- * @see org.eclipse.tm.te.runtime.nodes.PropertiesContainer#checkThreadAccess()
- */
- @Override
- protected boolean checkThreadAccess() {
- return ExecutorsUtil.isExecutorThread();
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime.statushandler/src/org/eclipse/tm/te/runtime/statushandler/interfaces/IStatusHandler.java b/target_explorer/plugins/org.eclipse.tm.te.runtime.statushandler/src/org/eclipse/tm/te/runtime/statushandler/interfaces/IStatusHandler.java
index 6b324c316..50f0c172f 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.runtime.statushandler/src/org/eclipse/tm/te/runtime/statushandler/interfaces/IStatusHandler.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.runtime.statushandler/src/org/eclipse/tm/te/runtime/statushandler/interfaces/IStatusHandler.java
@@ -27,7 +27,7 @@ public interface IStatusHandler extends IExecutableExtension {
*
* @param status The status. Must not be <code>null</code>.
* @param data The custom status data object, or <code>null</code> if none.
- * @param done The callback. Must not be <code>null</code>.
+ * @param done The callback, or <code>null</code>.
*/
public void handleStatus(IStatus status, IPropertiesContainer data, DoneHandleStatus done);
diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime/src/org/eclipse/tm/te/runtime/extensions/AbstractExtensionPointManager.java b/target_explorer/plugins/org.eclipse.tm.te.runtime/src/org/eclipse/tm/te/runtime/extensions/AbstractExtensionPointManager.java
index d90270ad1..20b181269 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.runtime/src/org/eclipse/tm/te/runtime/extensions/AbstractExtensionPointManager.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.runtime/src/org/eclipse/tm/te/runtime/extensions/AbstractExtensionPointManager.java
@@ -9,7 +9,11 @@
*******************************************************************************/
package org.eclipse.tm.te.runtime.extensions;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
import java.util.LinkedHashMap;
+import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.Assert;
@@ -33,6 +37,8 @@ public abstract class AbstractExtensionPointManager<V> {
private boolean initialized = false;
// The map of loaded extension listed by their unique id's
private Map<String, ExecutableExtensionProxy<V>> extensionsMap = new LinkedHashMap<String, ExecutableExtensionProxy<V>>();
+ // The extension point comparator
+ private ExtensionPointComparator comparator = null;
/**
* Constructor.
@@ -78,6 +84,47 @@ public abstract class AbstractExtensionPointManager<V> {
}
/**
+ * Returns the extensions of the specified extension point sorted.
+ * <p>
+ * For the order of the extensions, see {@link ExtensionPointComparator}.
+ *
+ * @param point The extension point. Must be not <code>null</code>.
+ * @return The extensions in sorted order or an empty array if the extension point has no extensions.
+ */
+ protected IExtension[] getExtensionsSorted(IExtensionPoint point) {
+ assert point != null;
+
+ List<IExtension> extensions = new ArrayList<IExtension>(Arrays.asList(point.getExtensions()));
+ if (extensions.size() > 0) {
+ Collections.sort(extensions, getExtensionPointComparator());
+ }
+
+ return extensions.toArray(new IExtension[extensions.size()]);
+ }
+
+ /**
+ * Returns the extension point comparator instance. If not available,
+ * {@link #doCreateExtensionPointComparator()} is called to create a new instance.
+ *
+ * @return The extension point comparator or <code>null</code> if the instance creation fails.
+ */
+ protected final ExtensionPointComparator getExtensionPointComparator() {
+ if (comparator == null) {
+ comparator = doCreateExtensionPointComparator();
+ }
+ return comparator;
+ }
+
+ /**
+ * Creates a new extension point comparator instance.
+ *
+ * @return The extension point comparator instance.
+ */
+ protected ExtensionPointComparator doCreateExtensionPointComparator() {
+ return new ExtensionPointComparator();
+ }
+
+ /**
* Returns the extension point id to read. The method
* must return never <code>null</code>.
*
@@ -144,7 +191,7 @@ public abstract class AbstractExtensionPointManager<V> {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint point = registry.getExtensionPoint(getExtensionPointId());
if (point != null) {
- IExtension[] extensions = point.getExtensions();
+ IExtension[] extensions = getExtensionsSorted(point);
for (IExtension extension : extensions) {
IConfigurationElement[] elements = extension.getConfigurationElements();
for (IConfigurationElement element : elements) {
diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime/src/org/eclipse/tm/te/runtime/extensions/ExecutableExtension.java b/target_explorer/plugins/org.eclipse.tm.te.runtime/src/org/eclipse/tm/te/runtime/extensions/ExecutableExtension.java
index 731168a2c..983564b44 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.runtime/src/org/eclipse/tm/te/runtime/extensions/ExecutableExtension.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.runtime/src/org/eclipse/tm/te/runtime/extensions/ExecutableExtension.java
@@ -75,7 +75,7 @@ public class ExecutableExtension extends PlatformObject implements IExecutableEx
}
// Try the "label" attribute first
- String label = config != null ? config.getAttribute("label") : null; //$NON-NLS-1$
+ label = config != null ? config.getAttribute("label") : null; //$NON-NLS-1$
// If "label" is not found or empty, try the "name" attribute as fallback
if (label == null || "".equals(label.trim())) { //$NON-NLS-1$
label = config != null ? config.getAttribute("name") : null; //$NON-NLS-1$
diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime/src/org/eclipse/tm/te/runtime/extensions/ExtensionPointComparator.java b/target_explorer/plugins/org.eclipse.tm.te.runtime/src/org/eclipse/tm/te/runtime/extensions/ExtensionPointComparator.java
new file mode 100644
index 000000000..2af3730ed
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tm.te.runtime/src/org/eclipse/tm/te/runtime/extensions/ExtensionPointComparator.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.tm.te.runtime.extensions;
+
+import java.util.Comparator;
+
+import org.eclipse.core.runtime.IExtension;
+
+/**
+ * Extension point comparator implementation.
+ * <p>
+ * The comparator assure that extension are read in a predictable order.
+ * <p>
+ * The order of the extensions is defined as following:<br>
+ * <ul><li>Extensions contributed by Target Explorer plug-ins (<code>org.eclipse.tm.te.*</code>)
+ * in ascending alphabetic order and</li>
+ * <li>Extensions contributed by any other plug-in in ascending alphabetic order.</li>
+ * <li>Extensions contributed by the same plug-in in ascending alphabetic order by the
+ * extensions unique id</li>
+ */
+public class ExtensionPointComparator implements Comparator<IExtension> {
+ private final static String TARGET_EXPLORER_PLUGINS_PATTERN = "org.eclipse.tm.te."; //$NON-NLS-1$
+
+ /* (non-Javadoc)
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public int compare(IExtension o1, IExtension o2) {
+ // We ignore any comparisation with null and
+ if (o1 == null || o2 == null) return 0;
+ // Check if it is the exact same element
+ if (o1 == o2) return 0;
+
+ // The extensions are compared by the unique id of the contributing plugin first
+ String contributor1 = o1.getContributor().getName();
+ String contributor2 = o2.getContributor().getName();
+
+ // Contributions from Target Explorer plug-ins comes before 3rdParty plug-ins
+ if (contributor1.startsWith(TARGET_EXPLORER_PLUGINS_PATTERN) && !contributor2.startsWith(TARGET_EXPLORER_PLUGINS_PATTERN))
+ return -1;
+ if (!contributor1.startsWith(TARGET_EXPLORER_PLUGINS_PATTERN) && contributor2.startsWith(TARGET_EXPLORER_PLUGINS_PATTERN))
+ return 1;
+ if (contributor1.startsWith(TARGET_EXPLORER_PLUGINS_PATTERN) && contributor2.startsWith(TARGET_EXPLORER_PLUGINS_PATTERN)) {
+ int value = contributor1.compareTo(contributor2);
+ // Within the same plug-in, the extension are sorted by their unique id (if available)
+ if (value == 0 && o1.getUniqueIdentifier() != null && o2.getUniqueIdentifier() != null)
+ return o1.getUniqueIdentifier().compareTo(o2.getUniqueIdentifier());
+ // Otherwise, just return the comparisation result from the contributors
+ return value;
+ }
+
+ // Contributions from all other plug-ins are sorted alphabetical
+ int value = contributor1.compareTo(contributor2);
+ // Within the same plug-in, the extension are sorted by their unique id (if available)
+ if (value == 0 && o1.getUniqueIdentifier() != null && o2.getUniqueIdentifier() != null)
+ return o1.getUniqueIdentifier().compareTo(o2.getUniqueIdentifier());
+ // Otherwise, just return the comparisation result from the contributors
+ return value;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.processes.core/src/org/eclipse/tm/te/tcf/processes/core/launcher/ProcessLauncher.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.processes.core/src/org/eclipse/tm/te/tcf/processes/core/launcher/ProcessLauncher.java
index 8d857a363..05097371e 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.tcf.processes.core/src/org/eclipse/tm/te/tcf/processes/core/launcher/ProcessLauncher.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.processes.core/src/org/eclipse/tm/te/tcf/processes/core/launcher/ProcessLauncher.java
@@ -128,22 +128,25 @@ public class ProcessLauncher extends PlatformObject implements IProcessLauncher
eventListener = null;
}
+ // Create the callback invocation delegate
+ AsyncCallbackCollector.ICallbackInvocationDelegate delegate = new AsyncCallbackCollector.ICallbackInvocationDelegate() {
+ @Override
+ public void invoke(Runnable runnable) {
+ Assert.isNotNull(runnable);
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeLater(runnable);
+ }
+ };
+
// Create the callback collector
final AsyncCallbackCollector collector = new AsyncCallbackCollector(new Callback() {
@Override
protected void internalDone(Object caller, IStatus status) {
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
// Close the channel as all disposal is done
- if (finChannel != null) {
- if (Protocol.isDispatchThread()) finChannel.close();
- else Protocol.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- finChannel.close();
- }
- });
- }
+ if (finChannel != null) finChannel.close();
}
- });
+ }, delegate);
if (streamsListener != null) {
// Dispose the streams listener
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.processes.core/src/org/eclipse/tm/te/tcf/processes/core/launcher/ProcessStreamsListener.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.processes.core/src/org/eclipse/tm/te/tcf/processes/core/launcher/ProcessStreamsListener.java
index 98b95bf11..c5b47f198 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.tcf.processes.core/src/org/eclipse/tm/te/tcf/processes/core/launcher/ProcessStreamsListener.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.processes.core/src/org/eclipse/tm/te/tcf/processes/core/launcher/ProcessStreamsListener.java
@@ -646,6 +646,16 @@ public class ProcessStreamsListener implements IStreams.StreamsListener, IProces
dataReceiver.clear();
}
+ // Create the callback invocation delegate
+ AsyncCallbackCollector.ICallbackInvocationDelegate delegate = new AsyncCallbackCollector.ICallbackInvocationDelegate() {
+ @Override
+ public void invoke(Runnable runnable) {
+ Assert.isNotNull(runnable);
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeLater(runnable);
+ }
+ };
+
// Create a new collector to catch all runnable stop callback's
AsyncCallbackCollector collector = new AsyncCallbackCollector(new Callback() {
/* (non-Javadoc)
@@ -653,6 +663,7 @@ public class ProcessStreamsListener implements IStreams.StreamsListener, IProces
*/
@Override
protected void internalDone(final Object caller, final IStatus status) {
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
// Get the service instance from the parent
IStreams svcStreams = getParent().getSvcStreams();
// Unsubscribe the streams listener from the service
@@ -666,7 +677,7 @@ public class ProcessStreamsListener implements IStreams.StreamsListener, IProces
}
});
}
- });
+ }, delegate);
// Loop all runnable's and force them to stop
synchronized (runnables) {
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.core/src/org/eclipse/tm/te/tcf/terminals/core/launcher/TerminalsLauncher.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.core/src/org/eclipse/tm/te/tcf/terminals/core/launcher/TerminalsLauncher.java
index fab9a6812..bb8fa473c 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.core/src/org/eclipse/tm/te/tcf/terminals/core/launcher/TerminalsLauncher.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.core/src/org/eclipse/tm/te/tcf/terminals/core/launcher/TerminalsLauncher.java
@@ -112,22 +112,25 @@ public class TerminalsLauncher extends PlatformObject implements ITerminalsLaunc
eventListener = null;
}
+ // Create the callback invocation delegate
+ AsyncCallbackCollector.ICallbackInvocationDelegate delegate = new AsyncCallbackCollector.ICallbackInvocationDelegate() {
+ @Override
+ public void invoke(Runnable runnable) {
+ Assert.isNotNull(runnable);
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeLater(runnable);
+ }
+ };
+
// Create the callback collector
final AsyncCallbackCollector collector = new AsyncCallbackCollector(new Callback() {
@Override
protected void internalDone(Object caller, IStatus status) {
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
// Close the channel as all disposal is done
- if (finChannel != null) {
- if (Protocol.isDispatchThread()) finChannel.close();
- else Protocol.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- finChannel.close();
- }
- });
- }
+ if (finChannel != null) finChannel.close();
}
- });
+ }, delegate);
if (streamsListener != null) {
// Dispose the streams listener
@@ -590,9 +593,9 @@ public class TerminalsLauncher extends PlatformObject implements ITerminalsLaunc
// Get the terminal attributes
- // Terminal Type: Default to "vt100" if not explicitly specified
+ // Terminal Type: Default to "ansi" if not explicitly specified
String type = properties.getStringProperty(ITerminalsLauncher.PROP_TERMINAL_TYPE);
- if (type == null || "".equals(type.trim())) type = "vt100"; //$NON-NLS-1$ //$NON-NLS-2$
+ if (type == null || "".equals(type.trim())) type = "ansi"; //$NON-NLS-1$ //$NON-NLS-2$
// Terminal Encoding: Default to "null" if not explicitly specified
String encoding = properties.getStringProperty(ITerminalsLauncher.PROP_TERMINAL_ENCODING);
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.core/src/org/eclipse/tm/te/tcf/terminals/core/launcher/TerminalsStreamsListener.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.core/src/org/eclipse/tm/te/tcf/terminals/core/launcher/TerminalsStreamsListener.java
index d72d71d5a..9f3539a67 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.core/src/org/eclipse/tm/te/tcf/terminals/core/launcher/TerminalsStreamsListener.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.core/src/org/eclipse/tm/te/tcf/terminals/core/launcher/TerminalsStreamsListener.java
@@ -656,6 +656,16 @@ public class TerminalsStreamsListener implements IStreams.StreamsListener, ITerm
dataReceiver.clear();
}
+ // Create the callback invocation delegate
+ AsyncCallbackCollector.ICallbackInvocationDelegate delegate = new AsyncCallbackCollector.ICallbackInvocationDelegate() {
+ @Override
+ public void invoke(Runnable runnable) {
+ Assert.isNotNull(runnable);
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeLater(runnable);
+ }
+ };
+
// Create a new collector to catch all runnable stop callback's
AsyncCallbackCollector collector = new AsyncCallbackCollector(new Callback() {
/* (non-Javadoc)
@@ -663,6 +673,7 @@ public class TerminalsStreamsListener implements IStreams.StreamsListener, ITerm
*/
@Override
protected void internalDone(final Object caller, final IStatus status) {
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
// Get the service instance from the parent
IStreams svcStreams = getParent().getSvcStreams();
// Unsubscribe the streams listener from the service
@@ -676,7 +687,7 @@ public class TerminalsStreamsListener implements IStreams.StreamsListener, ITerm
}
});
}
- });
+ }, delegate);
// Loop all runnable's and force them to stop
synchronized (runnables) {
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/connector/TerminalsConnector.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/connector/TerminalsConnector.java
index e20cbc965..1dfe5125e 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/connector/TerminalsConnector.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.terminals.ui/src/org/eclipse/tm/te/tcf/terminals/ui/connector/TerminalsConnector.java
@@ -28,6 +28,10 @@ public class TerminalsConnector extends AbstractStreamsConnector implements IDis
// Reference to the terminals settings
private final TerminalsSettings settings;
+ // Remember the last set window size
+ private int width = -1;
+ private int height = -1;
+
/**
* Constructor.
*/
@@ -95,20 +99,25 @@ public class TerminalsConnector extends AbstractStreamsConnector implements IDis
*/
@Override
public void setTerminalSize(final int newWidth, final int newHeight) {
- if (fControl.getState() == TerminalState.CONNECTED && settings.getTerminalsLauncher() instanceof TerminalsLauncher) {
- final ITerminals service = ((TerminalsLauncher)settings.getTerminalsLauncher()).getSvcTerminals();
- final ITerminals.TerminalContext context = (ITerminals.TerminalContext)settings.getTerminalsLauncher().getAdapter(ITerminals.TerminalContext.class);
- if (service != null && context != null) {
- Protocol.invokeLater(new Runnable() {
- @Override
- public void run() {
- service.setWinSize(context.getID(), newWidth, newHeight, new ITerminals.DoneCommand() {
- @Override
- public void doneCommand(IToken token, Exception error) {
- }
- });
- }
- });
+ if (width == -1 || height == -1 || newWidth != width || newHeight != height) {
+ if (fControl.getState() == TerminalState.CONNECTED && settings.getTerminalsLauncher() instanceof TerminalsLauncher) {
+ final ITerminals service = ((TerminalsLauncher)settings.getTerminalsLauncher()).getSvcTerminals();
+ final ITerminals.TerminalContext context = (ITerminals.TerminalContext)settings.getTerminalsLauncher().getAdapter(ITerminals.TerminalContext.class);
+ if (service != null && context != null) {
+ width = newWidth;
+ height = newHeight;
+
+ Protocol.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ service.setWinSize(context.getID(), newWidth, newHeight, new ITerminals.DoneCommand() {
+ @Override
+ public void doneCommand(IToken token, Exception error) {
+ }
+ });
+ }
+ });
+ }
}
}
}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/plugin.xml
index 66d16e752..f76c57a7b 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/plugin.xml
@@ -23,7 +23,6 @@
name="Dynamic Target Discovery (TCF)"
priority="normal">
<enablement>
- <instanceof value="org.eclipse.tm.te.ui.views.interfaces.IRoot"/>
<instanceof value="org.eclipse.tm.te.tcf.locator.interfaces.nodes.IPeerModel"/>
</enablement>
<commonSorter
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tests/plugin.xml b/target_explorer/plugins/org.eclipse.tm.te.tests/plugin.xml
index 28d9e9da1..f63004576 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.tests/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tm.te.tests/plugin.xml
@@ -19,6 +19,9 @@
<binding
handlerId="org.eclipse.tm.te.tests.handler1"
id="org.eclipse.tm.te.tests.binding1">
+ <enablement>
+ <instanceof value="org.eclipse.tm.te.tests.CoreTestCase"/>
+ </enablement>
</binding>
<binding
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals.ssh/src/org/eclipse/tm/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals.ssh/src/org/eclipse/tm/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java
index a911ef172..c839182b2 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals.ssh/src/org/eclipse/tm/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals.ssh/src/org/eclipse/tm/te/ui/terminals/ssh/controls/SshWizardConfigurationPanel.java
@@ -206,7 +206,9 @@ public class SshWizardConfigurationPanel extends AbstractConfigurationPanel impl
settings.put(getSettingsKeyWithPrefix(host, ITerminalsConnectorConstants.PROP_SSH_KEEP_ALIVE), sshSettings.getKeepalive());
settings.put(getSettingsKeyWithPrefix(host, ITerminalsConnectorConstants.PROP_SSH_USER), sshSettings.getUser());
- saveSecurePassword(sshSettings.getHost(), sshSettings.getPassword());
+ if(sshSettings.getPassword()!=null && sshSettings.getPassword().length()!=0){
+ saveSecurePassword(host, sshSettings.getPassword());
+ }
}
/**
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals.ssh/src/org/eclipse/tm/te/ui/terminals/ssh/launcher/SshLauncherDelegate.java b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals.ssh/src/org/eclipse/tm/te/ui/terminals/ssh/launcher/SshLauncherDelegate.java
index 0be992931..91a533a1f 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals.ssh/src/org/eclipse/tm/te/ui/terminals/ssh/launcher/SshLauncherDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals.ssh/src/org/eclipse/tm/te/ui/terminals/ssh/launcher/SshLauncherDelegate.java
@@ -74,10 +74,12 @@ public class SshLauncherDelegate extends AbstractLauncherDelegate {
*/
private String getTerminalTitle(IPropertiesContainer properties) {
String host = properties.getStringProperty(ITerminalsConnectorConstants.PROP_IP_HOST);
- if (host != null) {
+ String user = properties.getStringProperty(ITerminalsConnectorConstants.PROP_SSH_USER);
+
+ if (host != null && user!= null) {
DateFormat format = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG);
String date = format.format(new Date(System.currentTimeMillis()));
- return NLS.bind(Messages.SshLauncherDelegate_terminalTitle, host, date);
+ return NLS.bind(Messages.SshLauncherDelegate_terminalTitle, new String[]{user, host, date});
}
return Messages.SshLauncherDelegate_terminalTitle_default;
}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals.ssh/src/org/eclipse/tm/te/ui/terminals/ssh/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals.ssh/src/org/eclipse/tm/te/ui/terminals/ssh/nls/Messages.properties
index 8b0211acb..32bb3aea9 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.terminals.ssh/src/org/eclipse/tm/te/ui/terminals/ssh/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.terminals.ssh/src/org/eclipse/tm/te/ui/terminals/ssh/nls/Messages.properties
@@ -3,5 +3,5 @@
# Externalized Strings.
#
-SshLauncherDelegate_terminalTitle=SSH @ {0} ({1})
+SshLauncherDelegate_terminalTitle=SSH {0}@{1} ({2})
SshLauncherDelegate_terminalTitle_default=SSH Terminal
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.views/plugin.xml b/target_explorer/plugins/org.eclipse.tm.te.ui.views/plugin.xml
index 19c362c78..bc8fa7e3a 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.views/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.views/plugin.xml
@@ -71,7 +71,10 @@
</extension>
<extension point="org.eclipse.ui.navigator.navigatorContent">
-<!-- Default navigator action contibutions -->
+
+<!-- Default navigator sorter contribution -->
+
+<!-- Default navigator action contributions -->
<actionProvider
class="org.eclipse.tm.te.ui.views.actions.NewActionProvider"
id="org.eclipse.tm.te.ui.views.navigator.actions.NewActionProvider">
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/ViewViewer.java b/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/ViewViewer.java
index 735eaf8f5..1c70b7552 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/ViewViewer.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/ViewViewer.java
@@ -9,10 +9,12 @@
*******************************************************************************/
package org.eclipse.tm.te.ui.views.internal;
+import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.tm.te.runtime.events.EventManager;
import org.eclipse.tm.te.ui.views.events.ViewerContentChangeEvent;
import org.eclipse.ui.navigator.CommonViewer;
+import org.eclipse.ui.navigator.CommonViewerSorter;
/**
* Target Explorer common viewer implementation.
@@ -89,4 +91,16 @@ public class ViewViewer extends CommonViewer {
ViewerContentChangeEvent event = new ViewerContentChangeEvent(this, ViewerContentChangeEvent.REFRESH);
EventManager.getInstance().fireEvent(event);
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.navigator.CommonViewer#setSorter(org.eclipse.jface.viewers.ViewerSorter)
+ */
+ @Override
+ public void setSorter(ViewerSorter sorter) {
+ if (sorter instanceof CommonViewerSorter) {
+ sorter = new ViewViewerSorter((CommonViewerSorter)sorter);
+ ((ViewViewerSorter)sorter).setContentService(getNavigatorContentService());
+ }
+ super.setSorter(sorter);
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/ViewViewerSorter.java b/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/ViewViewerSorter.java
new file mode 100644
index 000000000..628e1f982
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/ViewViewerSorter.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * 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.tm.te.ui.views.internal;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.TreePathViewerSorter;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.tm.te.ui.trees.TreeViewerSorter;
+import org.eclipse.ui.navigator.CommonViewerSorter;
+import org.eclipse.ui.navigator.INavigatorContentService;
+
+/**
+ * Wrapper for the common navigator sorter
+ */
+public final class ViewViewerSorter extends TreePathViewerSorter {
+ // Reference to the wrapped common navigator viewer sorter
+ private final CommonViewerSorter sorter;
+ // Reference to the default viewer sorter
+ private final TreeViewerSorter defaultSorter = new TreeViewerSorter();
+
+ /**
+ * Constructor.
+ *
+ * @param sorter the common navigator viewer sorter to wrap. Must not be <code>null</code>.
+ */
+ public ViewViewerSorter(CommonViewerSorter sorter) {
+ super();
+ Assert.isNotNull(sorter);
+ this.sorter = sorter;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ViewerComparator#category(java.lang.Object)
+ */
+ @Override
+ public int category(Object element) {
+ return sorter.category(element);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.TreePathViewerSorter#compare(org.eclipse.jface.viewers.Viewer, org.eclipse.jface.viewers.TreePath, java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public int compare(Viewer viewer, TreePath parentPath, Object e1, Object e2) {
+ int result = sorter.compare(viewer, parentPath, e1, e2);
+
+ if (result == category(e1) - category(e2)) {
+ int defaultSorterResult = defaultSorter.compare(viewer, parentPath, e1, e2);
+ if (defaultSorterResult != 0) result = defaultSorterResult;
+ }
+
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ViewerComparator#isSorterProperty(java.lang.Object, java.lang.String)
+ */
+ @Override
+ public boolean isSorterProperty(Object element, String property) {
+ return sorter.isSorterProperty(element, property);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.TreePathViewerSorter#isSorterProperty(org.eclipse.jface.viewers.TreePath, java.lang.Object, java.lang.String)
+ */
+ @Override
+ public boolean isSorterProperty(TreePath parentPath, Object element, String property) {
+ return sorter.isSorterProperty(parentPath, element, property);
+ }
+
+ /**
+ * Sets the content service instance to the common navigator viewer sorter.
+ *
+ * @param contentService The content service instance. Must not be <code>null</code>:
+ */
+ public void setContentService(INavigatorContentService contentService) {
+ Assert.isNotNull(contentService);
+ sorter.setContentService(contentService);
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/navigator/ContentProviderDelegate.java b/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/navigator/ContentProviderDelegate.java
new file mode 100644
index 000000000..136850299
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/navigator/ContentProviderDelegate.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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.tm.te.ui.views.internal.navigator;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+
+/**
+ * Content provider delegate implementation.
+ */
+public class ContentProviderDelegate implements ITreeContentProvider {
+ private final static Object[] NO_ELEMENTS = new Object[0];
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+ */
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ return NO_ELEMENTS;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+ */
+ @Override
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ @Override
+ public void dispose() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/navigator/LabelProviderDelegate.java b/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/navigator/LabelProviderDelegate.java
new file mode 100644
index 000000000..ac9e88d9f
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/navigator/LabelProviderDelegate.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * 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.tm.te.ui.views.internal.navigator;
+
+import org.eclipse.jface.viewers.LabelProvider;
+
+
+/**
+ * Label provider delegate implementation.
+ */
+public class LabelProviderDelegate extends LabelProvider {
+
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/statushandler/DefaultStatusHandler.java b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/statushandler/DefaultStatusHandler.java
index 73ab6dee4..c87c62037 100644
--- a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/statushandler/DefaultStatusHandler.java
+++ b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/statushandler/DefaultStatusHandler.java
@@ -44,7 +44,6 @@ public class DefaultStatusHandler extends AbstractStatusHandler {
@Override
public void handleStatus(final IStatus status, final IPropertiesContainer data, final DoneHandleStatus done) {
Assert.isNotNull(status);
- Assert.isNotNull(done);
// If the platform UI is not longer running or the display does not
// exist or is disposed already, don't do anything.
@@ -63,7 +62,11 @@ public class DefaultStatusHandler extends AbstractStatusHandler {
display.asyncExec(new Runnable() {
@Override
public void run() {
- doHandleStatus(status, data, done);
+ doHandleStatus(status, data, done != null ? done : new DoneHandleStatus() {
+ @Override
+ public void doneHandleStatus(Throwable error, IPropertiesContainer data) {
+ }
+ });
}
});
}

Back to the top