diff options
author | Tobias Schwarz | 2013-04-15 07:11:36 +0000 |
---|---|---|
committer | Tobias Schwarz | 2013-04-15 07:11:36 +0000 |
commit | a429bbdb4dd1fc554688cee94f6a13185b33db65 (patch) | |
tree | 89f44ec6014bc06547d3c5086d2fe9d42480bd37 | |
parent | bc7419e92bbf4fea2b35fe61f58e38cb04307cd0 (diff) | |
download | org.eclipse.tcf-a429bbdb4dd1fc554688cee94f6a13185b33db65.tar.gz org.eclipse.tcf-a429bbdb4dd1fc554688cee94f6a13185b33db65.tar.xz org.eclipse.tcf-a429bbdb4dd1fc554688cee94f6a13185b33db65.zip |
Target Explorer: use stepper for connect/disconnect
54 files changed, 2905 insertions, 1294 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/iterators/LaunchContextIterator.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/iterators/LaunchContextIterator.java index 424a154a6..060b01053 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/iterators/LaunchContextIterator.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/steps/iterators/LaunchContextIterator.java @@ -12,9 +12,6 @@ package org.eclipse.tcf.te.launch.core.steps.iterators; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.tcf.te.launch.core.activator.CoreBundleActivator;
import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
@@ -32,32 +29,17 @@ public class LaunchContextIterator extends AbstractLaunchStepGroupIterator { * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#initialize(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- public void initialize(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) {
+ public void initialize(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
super.initialize(context, data, fullQualifiedId, monitor);
contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(getLaunchConfiguration(context));
+ setIterations(contexts != null ? contexts.length : 0);
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#getNumIterations()
+ * @see org.eclipse.tcf.te.runtime.stepper.iterators.AbstractStepGroupIterator#internalNext(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- public int getNumIterations() {
- return contexts != null ? contexts.length : 0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#next(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public void next(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
- if (getIteration() < 0) {
- throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "iterator not initialized")); //$NON-NLS-1$
- }
- if (getIteration() >= getNumIterations()) {
- throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "no more iterations")); //$NON-NLS-1$
- }
+ public void internalNext(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
setActiveContext(contexts[getIteration()], data, fullQualifiedId);
-
- super.next(context, data, fullQualifiedId, monitor);
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/IConnectionService.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/IConnectionService.java deleted file mode 100644 index ec375ffa1..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/IConnectionService.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 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.runtime.services.interfaces; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback; - -/** - * Connection service. - * <p> - * Allows to connect or disconnect to a given connectable context. - */ -public interface IConnectionService extends IService { - - /** - * The constants for the (cached) connection state. - */ - public enum State { Disconnected, Connecting, Connected, Disconnecting } - - /** - * Returns the connection state of the given connectable context. - * - * @param context The connectable context. Must not be <code>null</code>. - * @return The connection state. - */ - public State getState(Object context); - - /** - * Connects the given connectable context. - * <p> - * If the given context is in connecting state, the callback is invoked once the - * connectable enters the connected state. - * <p> - * If the given context is in connected state, the callback is invoked immediately. - * <p> - * If the given context is in disconnecting state, the callback is invoked immediately - * with an cancel status. - * - * @param context The connectable context. Must not be <code>null</code>. - * @param callback The callback. Must not be <code>null</code>. - * @param monitor The progress monitor or <code>null</code>. - */ - public void connect(Object context, ICallback callback, IProgressMonitor monitor); - - /** - * Disconnects the given connectable context. - * <p> - * If the given context is in disconnecting state, the callback is invoked once the - * connectable enters the disconnected state. - * <p> - * If the given context is in disconnected state, the callback is invoked immediately. - * <p> - * If the given context is in connecting state, the connect sequence is aborted and - * rolled back. The callback is invoked once the connectable enters the disconnected state. - * - * @param context The connectable context. Must not be <code>null</code>. - * @param callback The callback. Must not be <code>null</code>. - * @param monitor The progress monitor or <code>null</code>. - */ - public void disconnect(Object context, ICallback callback, IProgressMonitor monitor); -} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/IDebugService.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/IDebugService.java index 7a1aa975b..444b30513 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/IDebugService.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/IDebugService.java @@ -1,39 +1,52 @@ -/******************************************************************************* - * 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.runtime.services.interfaces; - -import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback; -import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; - -/** - * Debug service. - * <p> - * Allow to start and control the debugger for a set of given debug contexts. - */ -public interface IDebugService extends IService { - - /** - * Launches a debug session for the given context and attaches to it. The attach - * can be parameterized via the data properties. - * - * @param context The debug context. Must not be <code>null</code>. - * @param data The data properties to parameterize the attach. Must not be <code>null</code>. - * @param callback The callback to invoke once the operation completed. Must not be <code>null</code>. - */ - public void attach(Object context, IPropertiesContainer data, ICallback callback); - - /** - * Returns if or if not the debugger has been launched for the given context. - * - * @param context The debug context. Must not be <code>null</code>. - * @return <code>True</code> if the debugger has been launched for the context, <code>false</code> otherwise. - */ - public boolean isLaunched(Object context); -} +/*******************************************************************************
+ * 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.runtime.services.interfaces;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+
+/**
+ * Debug service.
+ * <p>
+ * Allow to start and control the debugger for a set of given debug contexts.
+ */
+public interface IDebugService extends IService {
+
+ /**
+ * Launches a debug session for the given context and attaches to it. The attach
+ * can be parameterized via the data properties.
+ *
+ * @param context The debug context. Must not be <code>null</code>.
+ * @param data The data properties to parameterize the attach. Must not be <code>null</code>.
+ * @param monitor The progress monitor.
+ * @param callback The callback to invoke once the operation completed. Must not be <code>null</code>.
+ */
+ public void attach(Object context, IPropertiesContainer data, IProgressMonitor monitor, ICallback callback);
+
+ /**
+ * Terminates a debug session for the given context and detaches it. The detach
+ * can be parameterized via the data properties.
+ *
+ * @param context The debug context. Must not be <code>null</code>.
+ * @param data The data properties to parameterize the detach. Must not be <code>null</code>.
+ * @param monitor The progress monitor.
+ * @param callback The callback to invoke once the operation completed. Must not be <code>null</code>.
+ */
+ public void detach(Object context, IPropertiesContainer data, IProgressMonitor monitor, ICallback callback);
+
+ /**
+ * Returns if or if not the debugger has been launched for the given context.
+ *
+ * @param context The debug context. Must not be <code>null</code>.
+ * @return <code>True</code> if the debugger has been launched for the context, <code>false</code> otherwise.
+ */
+ public boolean isLaunched(Object context);
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/internal/MenuServicePropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/internal/MenuServicePropertyTester.java index 6c2f9e8f7..7bae967ae 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/internal/MenuServicePropertyTester.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/internal/MenuServicePropertyTester.java @@ -1,42 +1,41 @@ -/******************************************************************************* - * 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.runtime.services.internal; - -import org.eclipse.tcf.te.runtime.services.ServiceManager; -import org.eclipse.tcf.te.runtime.services.interfaces.IMenuService; - - -/** - * Services plug-in property tester implementation. - */ -public class MenuServicePropertyTester extends org.eclipse.core.expressions.PropertyTester { - - /* (non-Javadoc) - * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object) - */ - @Override - public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { - // Get the menu service instance for the given receiver - IMenuService service = ServiceManager.getInstance().getService(receiver, IMenuService.class); - if (service != null) { - - // "isVisible": Checks if a given menu contribution shall be visible for the given receiver. - if ("isVisible".equals(property)) { //$NON-NLS-1$ - // The menu contribution ID is the first argument - String contributionID = args.length > 0 && args[0] instanceof String ? (String)args[0] : null; - boolean isVisible = service.isVisible(receiver, contributionID); - return expectedValue instanceof Boolean ? ((Boolean)expectedValue).booleanValue() == isVisible : false; - } - } - - return false; - } - -} +/*******************************************************************************
+ * 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.runtime.services.internal;
+
+import org.eclipse.tcf.te.runtime.services.ServiceManager;
+import org.eclipse.tcf.te.runtime.services.interfaces.IMenuService;
+
+/**
+ * Services plug-in property tester implementation.
+ */
+public class MenuServicePropertyTester extends org.eclipse.core.expressions.PropertyTester {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ */
+ @Override
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ // Get the menu service instance for the given receiver
+ IMenuService service = ServiceManager.getInstance().getService(receiver, IMenuService.class);
+ if (service != null) {
+
+ // "isVisible": Checks if a given menu contribution shall be visible for the given receiver.
+ if ("isVisible".equals(property)) { //$NON-NLS-1$
+ // The menu contribution ID is the first argument
+ String contributionID = args.length > 0 && args[0] instanceof String ? (String)args[0] : null;
+ boolean isVisible = service.isVisible(receiver, contributionID);
+ return expectedValue instanceof Boolean ? ((Boolean)expectedValue).booleanValue() == isVisible : false;
+ }
+ }
+
+ return false;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/META-INF/MANIFEST.MF index ab92a0bec..3267cdd8b 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/META-INF/MANIFEST.MF @@ -9,7 +9,8 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0", org.eclipse.core.expressions;bundle-version="3.4.400",
org.eclipse.tcf.te.runtime;bundle-version="1.1.0",
org.eclipse.tcf.te.runtime.concurrent;bundle-version="1.1.0",
- org.eclipse.tcf.te.runtime.model;bundle-version="1.1.0"
+ org.eclipse.tcf.te.runtime.model;bundle-version="1.1.0",
+ org.eclipse.tcf.te.runtime.services;bundle-version="1.1.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
@@ -20,7 +21,9 @@ Export-Package: org.eclipse.tcf.te.runtime.stepper, org.eclipse.tcf.te.runtime.stepper.extensions.manager,
org.eclipse.tcf.te.runtime.stepper.interfaces,
org.eclipse.tcf.te.runtime.stepper.interfaces.tracing,
+ org.eclipse.tcf.te.runtime.stepper.internal,
org.eclipse.tcf.te.runtime.stepper.iterators,
+ org.eclipse.tcf.te.runtime.stepper.job,
org.eclipse.tcf.te.runtime.stepper.nls;x-internal:=true,
org.eclipse.tcf.te.runtime.stepper.stepper,
org.eclipse.tcf.te.runtime.stepper.steps
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/plugin.xml index c9bd2efb8..5293e8f5b 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/plugin.xml @@ -6,4 +6,15 @@ <extension-point id="steps" name="%Extension.Steps.name" schema="schema/steps.exsd"/>
<extension-point id="stepGroups" name="%Extension.StepGroups.name" schema="schema/stepGroups.exsd"/>
+<!-- Property tester contributions -->
+ <extension point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ class="org.eclipse.tcf.te.runtime.stepper.internal.PropertyTester"
+ id="org.eclipse.tcf.te.runtime.services.PropertyTester"
+ namespace="org.eclipse.tcf.te.runtime.stepper"
+ properties="isEnabled,isRunning,isRunningOrCanceled"
+ type="java.lang.Object">
+ </propertyTester>
+ </extension>
+
</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepGroupIterator.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepGroupIterator.java index 5345e3fac..0c5ce6f4c 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepGroupIterator.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepGroupIterator.java @@ -1,59 +1,53 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.tcf.te.runtime.stepper.interfaces; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.tcf.te.runtime.interfaces.extensions.IExecutableExtension; -import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; - -/** - * A step group iterator. - */ -public interface IStepGroupIterator extends IExecutableExtension { - - /** - * Initialize the iterator. - * - * @param context The context. Must not be <code>null</code>. - * @param data The data. Must not be <code>null</code>. - * @param fullQualifiedId The full qualified id for this step. Must not be <code>null</code>. - * @param monitor The progress monitor. Must not be <code>null</code>. - */ - public void initialize(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor); - - /** - * Return the number of calculated iterations. If the iterator was not initialized, - * <code>-1</code> is returned. - */ - public int getNumIterations(); - - /** - * Check if there is a next iteration possible. - * - * @param context The context. Must not be <code>null</code>. - * @param data The data. Must not be <code>null</code>. - * @param fullQualifiedId The full qualified id for this step. Must not be <code>null</code>. - * @param monitor The progress monitor. Must not be <code>null</code>. - * @return <code>true</code> if another iteration is possible. - */ - public boolean hasNext(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor); - - /** - * Set the next iteration to the data using the full qualified id. - * - * @param context The context. Must not be <code>null</code>. - * @param data The data. Must not be <code>null</code>. - * @param fullQualifiedId The full qualified id for this step. Must not be <code>null</code>. - * @param monitor The progress monitor. Must not be <code>null</code>. - * @throws CoreException - */ - public void next(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException; -} +/*******************************************************************************
+ * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.runtime.stepper.interfaces;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.tcf.te.runtime.interfaces.extensions.IExecutableExtension;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+
+/**
+ * A step group iterator.
+ */
+public interface IStepGroupIterator extends IExecutableExtension {
+
+ /**
+ * Initialize the iterator.
+ *
+ * @param context The context. Must not be <code>null</code>.
+ * @param data The data. Must not be <code>null</code>.
+ * @param fullQualifiedId The full qualified id for this step. Must not be <code>null</code>.
+ * @param monitor The progress monitor. Must not be <code>null</code>.
+ */
+ public void initialize(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException;
+
+ /**
+ * Check if there is a next iteration possible.
+ *
+ * @param context The context. Must not be <code>null</code>.
+ * @param data The data. Must not be <code>null</code>.
+ * @param fullQualifiedId The full qualified id for this step. Must not be <code>null</code>.
+ * @param monitor The progress monitor. Must not be <code>null</code>.
+ * @return <code>true</code> if another iteration is possible.
+ */
+ public boolean hasNext(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException;
+
+ /**
+ * Set the next iteration to the data using the full qualified id.
+ *
+ * @param context The context. Must not be <code>null</code>.
+ * @param data The data. Must not be <code>null</code>.
+ * @param fullQualifiedId The full qualified id for this step. Must not be <code>null</code>.
+ * @param monitor The progress monitor. Must not be <code>null</code>.
+ * @throws CoreException
+ */
+ public void next(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException;
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepperService.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepperService.java new file mode 100644 index 000000000..02d1b7af3 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepperService.java @@ -0,0 +1,61 @@ +/*******************************************************************************
+ * Copyright (c) 2013 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.runtime.stepper.interfaces;
+
+import org.eclipse.tcf.te.runtime.services.interfaces.IService;
+
+/**
+ * Stepper service.
+ */
+public interface IStepperService extends IService {
+
+ public static final String OPERATION_CONNECT = "connect"; //$NON-NLS-1$
+ public static final String OPERATION_DISCONNECT = "disconnect"; //$NON-NLS-1$
+
+ /**
+ * Get the step group id for the given context and operation
+ * or <code>null</code> if this operation is not available.
+ *
+ * @param context The context. Must not be <code>null</code>.
+ * @param operation The operation. Must not be <code>null</code>.
+ * @return The step group id or <code>null</code>.
+ */
+ public String getStepGroupId(Object context, String operation);
+
+
+ /**
+ * Get the step group name for the given context and operation
+ * or <code>null</code> if this operation is not available.
+ *
+ * @param context The context. Must not be <code>null</code>.
+ * @param operation The operation. Must not be <code>null</code>.
+ * @return The step group name or <code>null</code>.
+ */
+ public String getStepGroupName(Object context, String operation);
+
+ /**
+ * Get the step context for the given context and operation
+ * or <code>null</code> if this operation is not available.
+ *
+ * @param context The context. Must not be <code>null</code>.
+ * @param operation The operation. Must not be <code>null</code>.
+ * @return The step context or <code>null</code>.
+ */
+ public IStepContext getStepContext(Object context, String operation);
+
+ /**
+ * Get the enabled state for the given operation.
+ *
+ * @param context The context. Must not be <code>null</code>.
+ * @param operation The operation. Must not be <code>null</code>.
+ * @return <code>true</code> if the operation is enabled.
+ */
+ public boolean isEnabled(Object context, String operation);
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/internal/PropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/internal/PropertyTester.java new file mode 100644 index 000000000..7fc2e8132 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/internal/PropertyTester.java @@ -0,0 +1,64 @@ +/*******************************************************************************
+ * 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.runtime.stepper.internal;
+
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.services.ServiceManager;
+import org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepperService;
+import org.eclipse.tcf.te.runtime.stepper.job.StepperJob;
+
+
+
+/**
+ * Services plug-in property tester implementation.
+ */
+public class PropertyTester extends org.eclipse.core.expressions.PropertyTester {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ */
+ @Override
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+
+ String operation = expectedValue instanceof String ? (String)expectedValue : null;
+
+ if ("isRunning".equals(property)) { //$NON-NLS-1$
+ if (operation != null && receiver instanceof IPropertiesContainer) {
+ IPropertiesAccessService service = ServiceManager.getInstance().getService(receiver, IPropertiesAccessService.class);
+ StepperJob job = service != null ? (StepperJob)service.getProperty(receiver, StepperJob.class.getName() + "." + operation) : null; //$NON-NLS-1$
+ if (service == null && receiver instanceof IPropertiesContainer)
+ job = (StepperJob)((IPropertiesContainer)receiver).getProperty(StepperJob.class.getName() + "." + operation); //$NON-NLS-1$
+ return job != null && !job.isCanceled() && !job.isFinished();
+ }
+ }
+
+ if ("isRunningOrCanceled".equals(property)) { //$NON-NLS-1$
+ if (operation != null && receiver instanceof IPropertiesContainer) {
+ IPropertiesAccessService service = ServiceManager.getInstance().getService(receiver, IPropertiesAccessService.class);
+ StepperJob job = service != null ? (StepperJob)service.getProperty(receiver, StepperJob.class.getName() + "." + operation) : null; //$NON-NLS-1$
+ if (service == null && receiver instanceof IPropertiesContainer)
+ job = (StepperJob)((IPropertiesContainer)receiver).getProperty(StepperJob.class.getName() + "." + operation); //$NON-NLS-1$
+ return job != null && !job.isFinished();
+ }
+ }
+
+ if ("isEnabled".equals(property)) { //$NON-NLS-1$
+ if (operation != null) {
+ IStepperService service = ServiceManager.getInstance().getService(receiver, IStepperService.class);
+ if (service != null) {
+ return service.isEnabled(receiver, operation);
+ }
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/iterators/AbstractStepGroupIterator.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/iterators/AbstractStepGroupIterator.java index b9b1b6a37..bba60e012 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/iterators/AbstractStepGroupIterator.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/iterators/AbstractStepGroupIterator.java @@ -13,9 +13,12 @@ package org.eclipse.tcf.te.runtime.stepper.iterators; import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.tcf.te.runtime.extensions.ExecutableExtension;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
+import org.eclipse.tcf.te.runtime.stepper.activator.CoreBundleActivator;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepAttributes;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
@@ -27,12 +30,13 @@ import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator; public abstract class AbstractStepGroupIterator extends ExecutableExtension implements IStepGroupIterator {
private int iteration = -1;
+ private int iterations = -1;
/* (non-Javadoc)
* @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#initialize(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- public void initialize(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) {
+ public void initialize(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
iteration = 0;
}
@@ -40,8 +44,19 @@ public abstract class AbstractStepGroupIterator extends ExecutableExtension impl * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#hasNext(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- public final boolean hasNext(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) {
- return iteration < getNumIterations();
+ public final boolean hasNext(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ return iteration < iterations;
+ }
+
+ /**
+ * Set the nuumber of iterations.
+ * @param iterations The number of iterations.
+ */
+ protected final void setIterations(int iterations) throws CoreException {
+ if (iteration > 0) {
+ throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "cannot change iterations during run")); //$NON-NLS-1$
+ }
+ this.iterations = iterations;
}
/**
@@ -56,11 +71,31 @@ public abstract class AbstractStepGroupIterator extends ExecutableExtension impl * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#next(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- public void next(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ public final void next(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ if (iterations < 0 || iteration < 0) {
+ throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "iterator not initialized")); //$NON-NLS-1$
+ }
+ if (iteration >= iterations) {
+ throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "no more iterations")); //$NON-NLS-1$
+ }
+
+ internalNext(context, data, fullQualifiedId, monitor);
+
iteration++;
}
/**
+ * Set the next iteration to the data using the full qualified id.
+ *
+ * @param context The context. Must not be <code>null</code>.
+ * @param data The data. Must not be <code>null</code>.
+ * @param fullQualifiedId The full qualified id for this step. Must not be <code>null</code>.
+ * @param monitor The progress monitor. Must not be <code>null</code>.
+ * @throws CoreException
+ */
+ public abstract void internalNext(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException;
+
+ /**
* Set the active context.
*
* @param activeContext The new active context.
@@ -85,6 +120,10 @@ public abstract class AbstractStepGroupIterator extends ExecutableExtension impl protected Object getActiveContext(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId) {
Assert.isNotNull(data);
Assert.isNotNull(fullQualifiedId);
- return StepperAttributeUtil.getProperty(IStepAttributes.ATTR_ACTIVE_CONTEXT, fullQualifiedId, data);
+ Object activeContext = StepperAttributeUtil.getProperty(IStepAttributes.ATTR_ACTIVE_CONTEXT, fullQualifiedId, data);
+ if (activeContext == null)
+ activeContext = context.getContextObject();
+
+ return activeContext;
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/job/StepperJob.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/job/StepperJob.java new file mode 100644 index 000000000..520ee27e4 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/job/StepperJob.java @@ -0,0 +1,148 @@ +/******************************************************************************* + * Copyright (c) 2013 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.runtime.stepper.job; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.ISchedulingRule; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback; +import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; +import org.eclipse.tcf.te.runtime.services.ServiceManager; +import org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService; +import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext; +import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepper; +import org.eclipse.tcf.te.runtime.stepper.stepper.Stepper; + +/** + * Stepper job implementation. + */ +public class StepperJob extends Job { + + final private IStepContext stepContext; + final private IPropertiesContainer data; + final private String stepGroupId; + final private String operation; + + private ICallback jobCallback = null; + private boolean isFinished = false; + private boolean isCanceled = false; + + /** + * Constructor. + * + * @param name The job name. + * @param stepContext The step context. + * @param data The stepper data. + * @param stepGroupId The step group id to execute. + * @param operation The operation to execute. + */ + public StepperJob(String name, IStepContext stepContext, IPropertiesContainer data, String stepGroupId, String operation) { + super(name); + setPriority(Job.INTERACTIVE); + + Assert.isNotNull(stepContext); + Assert.isNotNull(data); + Assert.isNotNull(stepGroupId); + Assert.isNotNull(operation); + + this.stepContext = stepContext; + this.data = data; + this.stepGroupId = stepGroupId; + this.operation = operation; + + if (stepContext.getContextObject() instanceof ISchedulingRule) { + setRule((ISchedulingRule)stepContext.getContextObject()); + } + + IPropertiesAccessService service = ServiceManager.getInstance().getService(stepContext.getContextObject(), IPropertiesAccessService.class); + StepperJob job = service != null ? (StepperJob)service.getProperty(stepContext.getContextObject(), StepperJob.class.getName() + "." + operation) : null; //$NON-NLS-1$ + if (service == null && stepContext.getContextObject() instanceof IPropertiesContainer) + job = (StepperJob)((IPropertiesContainer)stepContext.getContextObject()).getProperty(StepperJob.class.getName() + "." + operation); //$NON-NLS-1$ + Assert.isTrue(job == null); + + if (service != null) + service.setProperty(stepContext.getContextObject(), StepperJob.class.getName() + "." + operation, this); //$NON-NLS-1$ + else if (stepContext.getContextObject() instanceof IPropertiesContainer) + ((IPropertiesContainer)stepContext.getContextObject()).setProperty(StepperJob.class.getName() + "." + operation, this); //$NON-NLS-1$ + } + + /** + * Set the callback for the job. + * @param callback The callback. + */ + public final void setJobCallback(ICallback callback) { + jobCallback = callback; + } + + /** + * Return the job callback. + */ + public final ICallback getJobCallback() { + return jobCallback; + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) + */ + @Override + protected final IStatus run(IProgressMonitor monitor) { + + // The stepper instance to be used + IStepper stepper = new Stepper(getName()); + IStatus status = Status.OK_STATUS; + + try { + // Initialize stepper + stepper.initialize(stepContext, stepGroupId, data, monitor); + + // Execute stepper + stepper.execute(); + } catch (CoreException e) { + status = e.getStatus(); + } finally { + // Cleanup the stepper + stepper.cleanup(); + + IPropertiesAccessService service = ServiceManager.getInstance().getService(stepContext.getContextObject(), IPropertiesAccessService.class); + if (service != null) + service.setProperty(stepContext.getContextObject(), StepperJob.class.getName() + "." + operation, null); //$NON-NLS-1$ + else if (stepContext.getContextObject() instanceof IPropertiesContainer) + ((IPropertiesContainer)stepContext.getContextObject()).setProperty(StepperJob.class.getName() + "." + operation, null); //$NON-NLS-1$ + } + + if (jobCallback != null) + jobCallback.done(this, status); + + isFinished = true; + + return status; + } + + public boolean isFinished() { + return isFinished; + } + + public boolean isCanceled() { + return isCanceled; + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.jobs.Job#canceling() + */ + @Override + protected void canceling() { + super.canceling(); + isCanceled = true; + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/META-INF/MANIFEST.MF index 1fc85deaf..59b0cc287 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/META-INF/MANIFEST.MF @@ -26,6 +26,7 @@ Export-Package: org.eclipse.tcf.te.tcf.core, org.eclipse.tcf.te.tcf.core.interfaces.tracing,
org.eclipse.tcf.te.tcf.core.internal;x-internal:=true,
org.eclipse.tcf.te.tcf.core.internal.utils;x-internal:=true,
+ org.eclipse.tcf.te.tcf.core.iterators,
org.eclipse.tcf.te.tcf.core.listeners,
org.eclipse.tcf.te.tcf.core.listeners.interfaces,
org.eclipse.tcf.te.tcf.core.nls;x-internal:=true,
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.properties index dbda8ef88..efb4816a3 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.properties +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.properties @@ -19,5 +19,6 @@ ExtensionPoint.valueaddBindings.name=Value Add Bindings # ***** Steps *****
-OpenChannelStep.name=Open TCF Channel
-CloseChannelStep.name=Close TCF Channel
+OpenChannelStep.name=Open TCF channel
+CloseChannelStep.name=Close TCF channel
+ShutDownStep.name=Close all TCF channels
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.xml index c62dbb592..640c496b7 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.xml @@ -22,6 +22,10 @@ label="%CloseChannelStep.name">
<requires id="org.eclipse.tcf.te.tcf.core.openChannelStep"/>
</step>
+ <step
+ id="org.eclipse.tcf.te.tcf.core.shutDownStep"
+ class="org.eclipse.tcf.te.tcf.core.steps.ShutDownStep"
+ label="%ShutDownStep.name"/>
</extension>
</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/iterators/AbstractPeerStepGroupIterator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/iterators/AbstractPeerStepGroupIterator.java new file mode 100644 index 000000000..06571f79b --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/iterators/AbstractPeerStepGroupIterator.java @@ -0,0 +1,46 @@ +/*******************************************************************************
+ * Copyright (c) 2013 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.core.iterators;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.runtime.stepper.iterators.AbstractStepGroupIterator;
+
+/**
+ * Abstract TCF launch step group iterator.
+ */
+public abstract class AbstractPeerStepGroupIterator extends AbstractStepGroupIterator {
+
+ /**
+ * Returns the active peer context that is currently used.
+ *
+ * @param context The step context. Must not be <code>null</code>.
+ * @param data The data giving object. Must not be <code>null</code>.
+ * @param fullQualifiedId The full qualfied id for this step. Must not be <code>null</code>.
+ * @return The active peer context.
+ */
+ protected IPeer getActivePeerContext(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId) {
+ Object activeContext = getActiveContext(context, data, fullQualifiedId);
+ IPeer peer = null;
+ if (activeContext instanceof IPeer)
+ return (IPeer)activeContext;
+ if (activeContext instanceof IAdaptable)
+ peer = (IPeer)((IAdaptable)activeContext).getAdapter(IPeer.class);
+ if (peer == null)
+ peer = (IPeer)Platform.getAdapterManager().getAdapter(activeContext, IPeer.class);
+
+ return peer;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/ShutDownStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/ShutDownStep.java new file mode 100644 index 000000000..d21f5b95e --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/steps/ShutDownStep.java @@ -0,0 +1,53 @@ +/*******************************************************************************
+ * Copyright (c) 2013 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.core.steps;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+
+/**
+ * Shutdown step implementation.
+ */
+public class ShutDownStep extends AbstractPeerStep {
+
+ /**
+ * Constructor.
+ */
+ public ShutDownStep() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IExtendedStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(final IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, ICallback callback) {
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ Tcf.getChannelManager().shutdown(getActivePeerContext(context, data, fullQualifiedId));
+ }
+ });
+ callback.done(this, Status.OK_STATUS);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/FileTransferIterator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/FileTransferIterator.java index 6ac3c8275..39facd55c 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/FileTransferIterator.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/FileTransferIterator.java @@ -12,8 +12,6 @@ package org.eclipse.tcf.te.tcf.launch.core.steps.iterators; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.tcf.te.launch.core.persistence.filetransfer.FileTransfersPersistenceDelegate;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem;
@@ -21,7 +19,6 @@ import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil; import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.steps.IFileSystemStepAttributes;
-import org.eclipse.tcf.te.tcf.launch.core.activator.CoreBundleActivator;
/**
* Step group iterator for file transfer.
@@ -41,32 +38,17 @@ public class FileTransferIterator extends AbstractTcfLaunchStepGroupIterator { * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#initialize(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- public void initialize(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) {
+ public void initialize(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
super.initialize(context, data, fullQualifiedId, monitor);
items = FileTransfersPersistenceDelegate.getFileTransfers(getLaunchConfiguration(context));
+ setIterations(items != null ? items.length : 0);
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#getNumIterations()
+ * @see org.eclipse.tcf.te.runtime.stepper.iterators.AbstractStepGroupIterator#internalNext(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- public int getNumIterations() {
- return items != null ? items.length : 0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#next(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public void next(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
- if (getIteration() < 0) {
- throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "iterator not initialized")); //$NON-NLS-1$
- }
- if (getIteration() >= getNumIterations()) {
- throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "no more iterations")); //$NON-NLS-1$
- }
+ public void internalNext(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
StepperAttributeUtil.setProperty(IFileSystemStepAttributes.ATTR_FILE_TRANSFER_ITEM, fullQualifiedId, data, items[getIteration()]);
-
- super.next(context, data, fullQualifiedId, monitor);
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/LaunchProcessIterator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/LaunchProcessIterator.java index af344fa9d..8ffad1081 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/LaunchProcessIterator.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/iterators/LaunchProcessIterator.java @@ -33,18 +33,19 @@ public class LaunchProcessIterator extends AbstractTcfLaunchStepGroupIterator { }
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#getNumIterations()
+ * @see org.eclipse.tcf.te.runtime.stepper.iterators.AbstractStepGroupIterator#initialize(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- public int getNumIterations() {
- return 1;
+ public void initialize(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ super.initialize(context, data, fullQualifiedId, monitor);
+ setIterations(1);
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupIterator#next(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ * @see org.eclipse.tcf.te.runtime.stepper.iterators.AbstractStepGroupIterator#internalNext(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- public void next(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ public void internalNext(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
String processImage = DefaultPersistenceDelegate.getAttribute(getLaunchConfiguration(context), IProcessesStepAttributes.ATTR_PROCESS_IMAGE, (String)null);
String processArguments = DefaultPersistenceDelegate.getAttribute(getLaunchConfiguration(context), IProcessesStepAttributes.ATTR_PROCESS_ARGUMENTS, (String)null);
@@ -65,7 +66,5 @@ public class LaunchProcessIterator extends AbstractTcfLaunchStepGroupIterator { StepperAttributeUtil.setProperty(IProcessesStepAttributes.ATTR_STOP_AT_MAIN, fullQualifiedId, data, stopAtMain);
StepperAttributeUtil.setProperty(IProcessesStepAttributes.ATTR_OUTPUT_CONSOLE, fullQualifiedId, data, outputConsole);
StepperAttributeUtil.setProperty(IProcessesStepAttributes.ATTR_OUTPUT_FILE, fullQualifiedId, data, outputFile);
-
- super.next(context, data, fullQualifiedId, monitor);
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/plugin.xml index 5e1ff3973..8d5bee550 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/plugin.xml @@ -352,6 +352,31 @@ </visibleWhen>
</menu>
</menuContribution>
+
+ <menuContribution locationURI="toolbar:org.eclipse.tcf.te.tcf.launch.ui.MemoryMapEditorPage?after=group.launch.rundebug">
+ <command commandId="org.eclipse.tcf.te.tcf.ui.editor.command.debug">
+ <visibleWhen checkEnabled="false">
+ <reference definitionId="te.expressions.editor.hasRunControl"/>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+
+ <menuContribution locationURI="toolbar:org.eclipse.tcf.te.tcf.launch.ui.PathMapEditorPage?after=group.launch.rundebug">
+ <command commandId="org.eclipse.tcf.te.tcf.ui.editor.command.debug">
+ <visibleWhen checkEnabled="false">
+ <reference definitionId="te.expressions.editor.hasRunControl"/>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+
+ <menuContribution locationURI="toolbar:org.eclipse.tcf.te.launch.ui.SourceLookupEditorPage?after=group.launch.rundebug">
+ <command commandId="org.eclipse.tcf.te.tcf.ui.editor.command.debug">
+ <visibleWhen checkEnabled="false">
+ <reference definitionId="te.expressions.editor.hasRunControl"/>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+
</extension>
<!-- Command contributions -->
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/services/DebugService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/services/DebugService.java index 08620bf05..e6ac0f6e0 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/services/DebugService.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/services/DebugService.java @@ -1,162 +1,191 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.tcf.te.tcf.launch.ui.internal.services; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationType; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.core.ILaunchesListener; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.tcf.protocol.Protocol; -import org.eclipse.tcf.te.launch.core.lm.LaunchManager; -import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchManagerDelegate; -import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification; -import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate; -import org.eclipse.tcf.te.launch.core.selection.LaunchSelection; -import org.eclipse.tcf.te.launch.core.selection.RemoteSelectionContext; -import org.eclipse.tcf.te.launch.core.selection.interfaces.ILaunchSelection; -import org.eclipse.tcf.te.runtime.concurrent.util.ExecutorsUtil; -import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback; -import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; -import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode; -import org.eclipse.tcf.te.runtime.services.AbstractService; -import org.eclipse.tcf.te.runtime.services.interfaces.IDebugService; -import org.eclipse.tcf.te.runtime.utils.StatusHelper; -import org.eclipse.tcf.te.tcf.launch.core.interfaces.ILaunchTypes; - -/** - * Debug service implementations for TCF contexts. - */ -public class DebugService extends AbstractService implements IDebugService { - // Reference to the launches listener - private final ILaunchesListener listener; - - /** - * Constructor - */ - public DebugService() { - super(); - - // Create and register the launches listener instance - listener = new DebugServicesLaunchesListener(); - DebugPlugin.getDefault().getLaunchManager().addLaunchListener(listener); - } - - /* (non-Javadoc) - * @see org.eclipse.tcf.te.runtime.services.interfaces.IDebugService#attach(java.lang.Object, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback) - */ - @Override - public void attach(final Object context, final IPropertiesContainer data, final ICallback callback) { - if (!Protocol.isDispatchThread()) { - internalAttach(context, data, callback); - } - else { - ExecutorsUtil.execute(new Runnable() { - @Override - public void run() { - internalAttach(context, data, callback); - } - }); - } - } - - protected void internalAttach(final Object context, final IPropertiesContainer data, final ICallback callback) { - Assert.isTrue(!Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$ - - Assert.isNotNull(context); - Assert.isNotNull(data); - Assert.isNotNull(callback); - - if (context instanceof IModelNode) { - ILaunchConfigurationType launchConfigType = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(ILaunchTypes.ATTACH); - try { - ILaunchSelection launchSelection = new LaunchSelection(ILaunchManager.DEBUG_MODE, new RemoteSelectionContext((IModelNode)context, true)); - ILaunchManagerDelegate delegate = LaunchManager.getInstance().getLaunchManagerDelegate(launchConfigType, ILaunchManager.DEBUG_MODE); - if (delegate != null) { - // create an empty launch configuration specification to initialize all attributes with their default defaults. - ILaunchSpecification launchSpec = delegate.getLaunchSpecification(launchConfigType.getIdentifier(), launchSelection); - for (String key : data.getProperties().keySet()) { - launchSpec.addAttribute(key, data.getProperty(key)); - } - delegate.validate(launchSpec); - if (launchSpec != null && launchSpec.isValid()) { - ILaunchConfiguration[] launchConfigs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(launchConfigType); - launchConfigs = delegate.getMatchingLaunchConfigurations(launchSpec, launchConfigs); - - ILaunchConfiguration config = launchConfigs != null && launchConfigs.length > 0 ? launchConfigs[0] : null; - - boolean skip = false; - if (config != null) { - - ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches(); - for (ILaunch launch : launches) { - if (launch.getLaunchConfiguration().getType().getIdentifier().equals(ILaunchTypes.ATTACH) && !launch.isTerminated()) { - IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(launch.getLaunchConfiguration()); - if (contexts != null && contexts.length == 1 && contexts[0].equals(context)) { - skip = true; - } - } - } - } - - if (!skip) { - config = LaunchManager.getInstance().createOrUpdateLaunchConfiguration(config, launchSpec); - - delegate.validate(ILaunchManager.DEBUG_MODE, config); - DebugUITools.launch(config, ILaunchManager.DEBUG_MODE); - } - } - } - callback.done(this, Status.OK_STATUS); - } - catch (Exception e) { - callback.done(this, StatusHelper.getStatus(e)); - } - } - else { - callback.done(this, Status.OK_STATUS); - } - } - - /* (non-Javadoc) - * @see org.eclipse.tcf.te.runtime.services.interfaces.IDebugService#isLaunched(java.lang.Object) - */ - @Override - public boolean isLaunched(Object context) { - Assert.isNotNull(context); - - boolean isLaunched = false; - - if (context instanceof IModelNode) { - ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches(); - for (ILaunch launch : launches) { - try { - if (launch.getLaunchConfiguration().getType().getIdentifier().equals(ILaunchTypes.ATTACH) && !launch.isTerminated()) { - IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(launch.getLaunchConfiguration()); - if (contexts != null && contexts.length == 1 && contexts[0].equals(context)) { - isLaunched = true; - break; - } - } - } catch (CoreException e) { - if (Platform.inDebugMode()) e.printStackTrace(); - } - } - } - - return isLaunched; - } -} +/*******************************************************************************
+ * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.launch.ui.internal.services;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.ILaunchesListener;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.launch.core.lm.LaunchManager;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchManagerDelegate;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification;
+import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate;
+import org.eclipse.tcf.te.launch.core.selection.LaunchSelection;
+import org.eclipse.tcf.te.launch.core.selection.RemoteSelectionContext;
+import org.eclipse.tcf.te.launch.core.selection.interfaces.ILaunchSelection;
+import org.eclipse.tcf.te.runtime.concurrent.util.ExecutorsUtil;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.runtime.services.AbstractService;
+import org.eclipse.tcf.te.runtime.services.interfaces.IDebugService;
+import org.eclipse.tcf.te.runtime.utils.StatusHelper;
+import org.eclipse.tcf.te.tcf.launch.core.interfaces.ILaunchTypes;
+
+/**
+ * Debug service implementations for TCF contexts.
+ */
+public class DebugService extends AbstractService implements IDebugService {
+ // Reference to the launches listener
+ private final ILaunchesListener listener;
+
+ /**
+ * Constructor
+ */
+ public DebugService() {
+ super();
+
+ // Create and register the launches listener instance
+ listener = new DebugServicesLaunchesListener();
+ DebugPlugin.getDefault().getLaunchManager().addLaunchListener(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.services.interfaces.IDebugService#attach(java.lang.Object, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void attach(final Object context, final IPropertiesContainer data, final IProgressMonitor monitor, final ICallback callback) {
+ if (!Protocol.isDispatchThread()) {
+ internalAttach(context, data, monitor, callback);
+ }
+ else {
+ ExecutorsUtil.execute(new Runnable() {
+ @Override
+ public void run() {
+ internalAttach(context, data, monitor, callback);
+ }
+ });
+ }
+ }
+
+ protected void internalAttach(final Object context, final IPropertiesContainer data, final IProgressMonitor monitor, final ICallback callback) {
+ Assert.isTrue(!Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
+
+ Assert.isNotNull(context);
+ Assert.isNotNull(data);
+ Assert.isNotNull(callback);
+
+ if (context instanceof IModelNode) {
+ ILaunchConfigurationType launchConfigType = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(ILaunchTypes.ATTACH);
+ try {
+ ILaunchSelection launchSelection = new LaunchSelection(ILaunchManager.DEBUG_MODE, new RemoteSelectionContext((IModelNode)context, true));
+ ILaunchManagerDelegate delegate = LaunchManager.getInstance().getLaunchManagerDelegate(launchConfigType, ILaunchManager.DEBUG_MODE);
+ if (delegate != null) {
+ // create an empty launch configuration specification to initialize all attributes with their default defaults.
+ ILaunchSpecification launchSpec = delegate.getLaunchSpecification(launchConfigType.getIdentifier(), launchSelection);
+ for (String key : data.getProperties().keySet()) {
+ launchSpec.addAttribute(key, data.getProperty(key));
+ }
+ delegate.validate(launchSpec);
+ if (launchSpec != null && launchSpec.isValid()) {
+ ILaunchConfiguration[] launchConfigs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(launchConfigType);
+ launchConfigs = delegate.getMatchingLaunchConfigurations(launchSpec, launchConfigs);
+
+ ILaunchConfiguration config = launchConfigs != null && launchConfigs.length > 0 ? launchConfigs[0] : null;
+
+ boolean skip = false;
+ if (config != null) {
+
+ ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
+ for (ILaunch launch : launches) {
+ if (launch.getLaunchConfiguration().getType().getIdentifier().equals(ILaunchTypes.ATTACH) && !launch.isTerminated()) {
+ IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(launch.getLaunchConfiguration());
+ if (contexts != null && contexts.length == 1 && contexts[0].equals(context)) {
+ skip = true;
+ }
+ }
+ }
+ }
+
+ if (!skip) {
+ config = LaunchManager.getInstance().createOrUpdateLaunchConfiguration(config, launchSpec);
+
+ delegate.validate(ILaunchManager.DEBUG_MODE, config);
+ DebugUITools.launch(config, ILaunchManager.DEBUG_MODE);
+ }
+ }
+ }
+ callback.done(this, Status.OK_STATUS);
+ }
+ catch (Exception e) {
+ callback.done(this, StatusHelper.getStatus(e));
+ }
+ }
+ else {
+ callback.done(this, Status.OK_STATUS);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.services.interfaces.IDebugService#detach(java.lang.Object, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void detach(Object context, IPropertiesContainer data, final IProgressMonitor monitor, ICallback callback) {
+ Assert.isNotNull(context);
+ Assert.isNotNull(data);
+ Assert.isNotNull(callback);
+
+ if (context instanceof IModelNode) {
+ ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
+ for (ILaunch launch : launches) {
+ try {
+ if (launch.getLaunchConfiguration().getType().getIdentifier().equals(ILaunchTypes.ATTACH) && !launch.isTerminated()) {
+ IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(launch.getLaunchConfiguration());
+ if (contexts != null && contexts.length == 1 && contexts[0].equals(context)) {
+ launch.terminate();
+ }
+ }
+ } catch (Exception e) {
+ callback.done(this, StatusHelper.getStatus(e));
+ return;
+ }
+ }
+ }
+ callback.done(this, Status.OK_STATUS);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.services.interfaces.IDebugService#isLaunched(java.lang.Object)
+ */
+ @Override
+ public boolean isLaunched(Object context) {
+ Assert.isNotNull(context);
+
+ boolean isLaunched = false;
+
+ if (context instanceof IModelNode) {
+ ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
+ for (ILaunch launch : launches) {
+ try {
+ if (launch.getLaunchConfiguration().getType().getIdentifier().equals(ILaunchTypes.ATTACH) && !launch.isTerminated()) {
+ IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(launch.getLaunchConfiguration());
+ if (contexts != null && contexts.length == 1 && contexts[0].equals(context)) {
+ isLaunched = true;
+ break;
+ }
+ }
+ } catch (CoreException e) {
+ if (Platform.inDebugMode()) e.printStackTrace();
+ }
+ }
+ }
+
+ return isLaunched;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/META-INF/MANIFEST.MF index 0dce76325..377f4b0fc 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/META-INF/MANIFEST.MF @@ -20,18 +20,21 @@ Bundle-ActivationPolicy: lazy Bundle-Localization: plugin
Export-Package: org.eclipse.tcf.te.tcf.locator,
org.eclipse.tcf.te.tcf.locator.activator;x-internal:=true,
+ org.eclipse.tcf.te.tcf.locator.help,
org.eclipse.tcf.te.tcf.locator.interfaces,
org.eclipse.tcf.te.tcf.locator.interfaces.nodes,
org.eclipse.tcf.te.tcf.locator.interfaces.preferences,
org.eclipse.tcf.te.tcf.locator.interfaces.services,
org.eclipse.tcf.te.tcf.locator.internal;x-internal:=true,
org.eclipse.tcf.te.tcf.locator.internal.adapters;x-internal:=true,
- org.eclipse.tcf.te.tcf.locator.internal.nls;x-internal:=true,
org.eclipse.tcf.te.tcf.locator.internal.nodes;x-internal:=true,
org.eclipse.tcf.te.tcf.locator.internal.services;x-internal:=true,
+ org.eclipse.tcf.te.tcf.locator.iterators,
org.eclipse.tcf.te.tcf.locator.listener,
org.eclipse.tcf.te.tcf.locator.model,
+ org.eclipse.tcf.te.tcf.locator.nls,
org.eclipse.tcf.te.tcf.locator.nodes,
org.eclipse.tcf.te.tcf.locator.persistence,
org.eclipse.tcf.te.tcf.locator.services,
- org.eclipse.tcf.te.tcf.locator.steps
+ org.eclipse.tcf.te.tcf.locator.steps,
+ org.eclipse.tcf.te.tcf.locator.utils
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.properties index 6453ec460..98ee9509d 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.properties +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.properties @@ -14,3 +14,8 @@ providerName = Eclipse.org - Target Explorer # ***** Steps *****
CheckServiceStep.name=Check TCF Service
+StartSimulatorStep.name=Start Simulator
+StopSimulatorStep.name=Stop Simulator
+StartDebuggerStep.name=Start Debugger
+StopDebuggerStep.name=Stop Debugger
+WaitForReadyStep.name=Wait until peer becomes ready
\ No newline at end of file diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml index 209626c84..21ddb5bdc 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml @@ -127,7 +127,7 @@ </service>
</extension>
-<!-- Launch Step contributions -->
+<!-- Step contributions -->
<extension point="org.eclipse.tcf.te.runtime.stepper.steps">
<step
id="org.eclipse.tcf.te.tcf.locator.checkServiceStep"
@@ -135,6 +135,55 @@ label="%CheckServiceStep.name">
<requires id="org.eclipse.tcf.te.tcf.core.openChannelStep"/>
</step>
+ <step
+ id="org.eclipse.tcf.te.tcf.locator.startSimulatorStep"
+ class="org.eclipse.tcf.te.tcf.locator.steps.StartSimulatorStep"
+ label="%StartSimulatorStep.name"/>
+ <step
+ id="org.eclipse.tcf.te.tcf.locator.stopSimulatorStep"
+ class="org.eclipse.tcf.te.tcf.locator.steps.StopSimulatorStep"
+ label="%StopSimulatorStep.name"/>
+ <step
+ id="org.eclipse.tcf.te.tcf.locator.startDebuggerStep"
+ class="org.eclipse.tcf.te.tcf.locator.steps.StartDebuggerStep"
+ label="%StartDebuggerStep.name"/>
+ <step
+ id="org.eclipse.tcf.te.tcf.locator.stopDebuggerStep"
+ class="org.eclipse.tcf.te.tcf.locator.steps.StopDebuggerStep"
+ label="%StopDebuggerStep.name"/>
+ <step
+ id="org.eclipse.tcf.te.tcf.locator.waitForReadyStep"
+ class="org.eclipse.tcf.te.tcf.locator.steps.WaitForReadyStep"
+ label="%WaitForReadyStep.name"/>
+ </extension>
+
+<!-- Step group contributions -->
+ <extension point="org.eclipse.tcf.te.runtime.stepper.stepGroups">
+ <stepGroup
+ id="org.eclipse.tcf.te.tcf.locator.connectStepGroup">
+ <references>
+ <reference id="org.eclipse.tcf.te.tcf.locator.startSimulatorStep"/>
+ <reference id="org.eclipse.tcf.te.tcf.locator.startDebuggerStepGroup"/>
+ </references>
+ </stepGroup>
+
+ <stepGroup
+ id="org.eclipse.tcf.te.tcf.locator.disconnectStepGroup">
+ <references>
+ <reference id="org.eclipse.tcf.te.tcf.locator.stopDebuggerStep"/>
+ <reference id="org.eclipse.tcf.te.tcf.core.shutDownStep"/>
+ <reference id="org.eclipse.tcf.te.tcf.locator.stopSimulatorStep"/>
+ </references>
+ </stepGroup>
+
+ <stepGroup
+ id="org.eclipse.tcf.te.tcf.locator.startDebuggerStepGroup"
+ iterator="org.eclipse.tcf.te.tcf.locator.iterators.StartDebuggerIterator">
+ <references>
+ <reference id="org.eclipse.tcf.te.tcf.locator.waitForReadyStep"/>
+ <reference id="org.eclipse.tcf.te.tcf.locator.startDebuggerStep"/>
+ </references>
+ </stepGroup>
</extension>
</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/help/IContextHelpIds.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/help/IContextHelpIds.java new file mode 100644 index 000000000..341a01279 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/help/IContextHelpIds.java @@ -0,0 +1,35 @@ +/**
+ * IContextHelpIds.java
+ * Created on Feb 13, 2013
+ *
+ * Copyright (c) 2013 Wind River Systems, Inc.
+ *
+ * The right to copy, distribute, modify, or otherwise make use
+ * of this software may be licensed only pursuant to the terms
+ * of an applicable Wind River license agreement.
+ */
+package org.eclipse.tcf.te.tcf.locator.help;
+
+import org.eclipse.tcf.te.tcf.locator.activator.CoreBundleActivator;
+
+
+/**
+ * Context help id definitions.
+ */
+public interface IContextHelpIds {
+
+ /**
+ * UI plug-in common context help id prefix.
+ */
+ public final static String PREFIX = CoreBundleActivator.getUniqueIdentifier() + "."; //$NON-NLS-1$
+
+ /**
+ * Simulator utilities: Simulator start failed.
+ */
+ public final static String MESSAGE_SIM_START_FAILED = PREFIX + ".status.messageSimStartFailed"; //$NON-NLS-1$
+
+ /**
+ * Simulator utilities: Simulator stop failed.
+ */
+ public final static String MESSAGE_SIM_STOP_FAILED = PREFIX + ".status.messageSimStopFailed"; //$NON-NLS-1$
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/SimulatorPropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/SimulatorPropertyTester.java index 6a3740c4c..f5c1a2343 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/SimulatorPropertyTester.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/SimulatorPropertyTester.java @@ -10,15 +10,10 @@ */
package org.eclipse.tcf.te.tcf.locator.internal;
-import org.eclipse.tcf.protocol.Protocol;
-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.IService;
-import org.eclipse.tcf.te.runtime.services.interfaces.ISimulatorService;
import org.eclipse.tcf.te.runtime.services.interfaces.ISimulatorService.State;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties;
+import org.eclipse.tcf.te.tcf.locator.utils.SimulatorUtils;
+import org.eclipse.tcf.te.tcf.locator.utils.SimulatorUtils.Result;
/**
* Property tester implementation.
@@ -34,41 +29,16 @@ public class SimulatorPropertyTester extends org.eclipse.core.expressions.Proper public boolean test(final Object receiver, String property, Object[] args, Object expectedValue) {
if (receiver instanceof IPeerModel) {
final IPeerModel peerModel = (IPeerModel) receiver;
- final IPropertiesContainer simSetting = new PropertiesContainer();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- simSetting.setProperty(IPeerModelProperties.PROP_SIM_ENABLED, peerModel.getPeer().getAttributes().get(IPeerModelProperties.PROP_SIM_ENABLED));
- simSetting.setProperty(IPeerModelProperties.PROP_SIM_TYPE, peerModel.getPeer().getAttributes().get(IPeerModelProperties.PROP_SIM_TYPE));
- simSetting.setProperty(IPeerModelProperties.PROP_SIM_PROPERTIES, peerModel.getPeer().getAttributes().get(IPeerModelProperties.PROP_SIM_PROPERTIES));
- }
- };
-
- if (Protocol.isDispatchThread()) {
- runnable.run();
- }
- else {
- Protocol.invokeAndWait(runnable);
- }
-
- ISimulatorService simService = null;
- for (IService service : ServiceManager.getInstance().getServices(receiver, ISimulatorService.class, false)) {
- if (service instanceof ISimulatorService &&
- service.getId().equals(simSetting.getStringProperty(IPeerModelProperties.PROP_SIM_TYPE))) {
- simService = (ISimulatorService) service;
- break;
- }
- }
+ Result result = SimulatorUtils.getSimulatorService(peerModel);
- if (simService != null) {
+ if (result.service != null) {
if ("isSimulatorState".equals(property) && expectedValue instanceof String) { //$NON-NLS-1$
- State state = simService.getState(receiver, simSetting.getStringProperty(IPeerModelProperties.PROP_SIM_PROPERTIES));
+ State state = result.service.getState(receiver, result.settings);
return state.toString().equalsIgnoreCase((String) expectedValue);
}
if ("canStartSimulator".equals(property) && expectedValue instanceof Boolean) { //$NON-NLS-1$
- State state = simService.getState(receiver, simSetting.getStringProperty(IPeerModelProperties.PROP_SIM_PROPERTIES));
- return state.equals(State.Stopped) &&
- simSetting.getBooleanProperty(IPeerModelProperties.PROP_SIM_ENABLED) == ((Boolean) expectedValue).booleanValue();
+ State state = result.service.getState(receiver, result.settings);
+ return state.equals(State.Stopped);
}
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/iterators/AbstractPeerModelStepGroupIterator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/iterators/AbstractPeerModelStepGroupIterator.java new file mode 100644 index 000000000..52e840308 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/iterators/AbstractPeerModelStepGroupIterator.java @@ -0,0 +1,46 @@ +/*******************************************************************************
+ * Copyright (c) 2013 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.locator.iterators;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.core.iterators.AbstractPeerStepGroupIterator;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+
+/**
+ * Abstract launch stepgroup iterator.
+ */
+public abstract class AbstractPeerModelStepGroupIterator extends AbstractPeerStepGroupIterator {
+
+ /**
+ * Returns the active peer model context that is currently used.
+ *
+ * @param context The step context. Must not be <code>null</code>.
+ * @param data The data giving object. Must not be <code>null</code>.
+ * @param fullQualifiedId The full qualfied id for this step. Must not be <code>null</code>.
+ * @return The active peer model context.
+ */
+ protected IPeerModel getActivePeerModelContext(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId) {
+ Object activeContext = getActiveContext(context, data, fullQualifiedId);
+ IPeerModel peerModel = null;
+ if (activeContext instanceof IPeerModel)
+ return (IPeerModel)activeContext;
+ if (activeContext instanceof IAdaptable)
+ peerModel = (IPeerModel)((IAdaptable)activeContext).getAdapter(IPeerModel.class);
+ if (peerModel == null)
+ peerModel = (IPeerModel)Platform.getAdapterManager().getAdapter(activeContext, IPeerModel.class);
+
+ return peerModel;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/iterators/StartDebuggerIterator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/iterators/StartDebuggerIterator.java new file mode 100644 index 000000000..2a9efe0b4 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/iterators/StartDebuggerIterator.java @@ -0,0 +1,64 @@ +/*******************************************************************************
+ * Copyright (c) 2013 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.locator.iterators;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties;
+
+/**
+ * Step group iterator for file transfer.
+ */
+public class StartDebuggerIterator extends AbstractPeerModelStepGroupIterator {
+
+ /**
+ * Constructor.
+ */
+ public StartDebuggerIterator() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.iterators.AbstractStepGroupIterator#initialize(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void initialize(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ super.initialize(context, data, fullQualifiedId, monitor);
+
+ final AtomicBoolean autoStartDbg = new AtomicBoolean(false);
+
+ final IPeer peer = getActivePeerContext(context, data, fullQualifiedId);
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ String value = peer.getAttributes().get(IPeerModelProperties.PROP_AUTO_START_DEBUGGER);
+ autoStartDbg.set(value != null ? Boolean.parseBoolean(value) : false);
+ }
+ };
+ Protocol.invokeAndWait(runnable);
+
+ setIterations(autoStartDbg.get() ? 1 : 0);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.iterators.AbstractStepGroupIterator#internalNext(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void internalNext(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nls/Messages.java index fcbc25f02..e607a4841 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/nls/Messages.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nls/Messages.java @@ -1,73 +1,72 @@ -/******************************************************************************* - * 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.locator.internal.nls; - -import java.lang.reflect.Field; - -import org.eclipse.osgi.util.NLS; - -/** - * Target Explorer TCF Locator plug-in externalized strings management. - */ -public class Messages extends NLS { - - // The plug-in resource bundle name - private static final String BUNDLE_NAME = "org.eclipse.tcf.te.tcf.locator.internal.nls.Messages"; //$NON-NLS-1$ - - /** - * Static constructor. - */ - static { - // Load message values from bundle file - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - /** - * Returns if or if not this NLS manager contains a constant for - * the given externalized strings key. - * - * @param key The externalized strings key or <code>null</code>. - * @return <code>True</code> if a constant for the given key exists, <code>false</code> otherwise. - */ - public static boolean hasString(String key) { - if (key != null) { - try { - Field field = Messages.class.getDeclaredField(key); - return field != null; - } catch (NoSuchFieldException e) { /* ignored on purpose */ } - } - - return false; - } - - /** - * Returns the corresponding string for the given externalized strings - * key or <code>null</code> if the key does not exist. - * - * @param key The externalized strings key or <code>null</code>. - * @return The corresponding string or <code>null</code>. - */ - public static String getString(String key) { - if (key != null) { - try { - Field field = Messages.class.getDeclaredField(key); - return (String)field.get(null); - } catch (Exception e) { /* ignored on purpose */ } - } - - return null; - } - - // **** Declare externalized string id's down here ***** - - public static String PeersPersistenceDelegate_error_noRootLocation; - - public static String AbstractPeerModelContextStep_error_invalidPeerModel; -} +/*******************************************************************************
+ * 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.locator.nls;
+
+import java.lang.reflect.Field;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Target Explorer TCF Locator plug-in externalized strings management.
+ */
+public class Messages extends NLS {
+
+ // The plug-in resource bundle name
+ private static final String BUNDLE_NAME = "org.eclipse.tcf.te.tcf.locator.internal.nls.Messages"; //$NON-NLS-1$
+
+ /**
+ * Static constructor.
+ */
+ static {
+ // Load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ /**
+ * Returns if or if not this NLS manager contains a constant for
+ * the given externalized strings key.
+ *
+ * @param key The externalized strings key or <code>null</code>.
+ * @return <code>True</code> if a constant for the given key exists, <code>false</code> otherwise.
+ */
+ public static boolean hasString(String key) {
+ if (key != null) {
+ try {
+ Field field = Messages.class.getDeclaredField(key);
+ return field != null;
+ } catch (NoSuchFieldException e) { /* ignored on purpose */ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns the corresponding string for the given externalized strings
+ * key or <code>null</code> if the key does not exist.
+ *
+ * @param key The externalized strings key or <code>null</code>.
+ * @return The corresponding string or <code>null</code>.
+ */
+ public static String getString(String key) {
+ if (key != null) {
+ try {
+ Field field = Messages.class.getDeclaredField(key);
+ return (String)field.get(null);
+ } catch (Exception e) { /* ignored on purpose */ }
+ }
+
+ return null;
+ }
+
+ // **** Declare externalized string id's down here *****
+
+ public static String WaitForReadyStep_error_timeout;
+ public static String WaitForReadyStep_error_state;
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nls/Messages.properties index bc185a5e4..392288e5f 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/nls/Messages.properties +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nls/Messages.properties @@ -1,13 +1,12 @@ -############################################################################### -# 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 -############################################################################### - -PeersPersistenceDelegate_error_noRootLocation=Failed to determine persistence storage root location - -AbstractPeerModelContextStep_error_invalidPeerModel=Failed to determine the peer model node from the step context. +###############################################################################
+# 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
+###############################################################################
+
+WaitForReadyStep_error_timeout=Timeout waiting for peer to become ready
+WaitForReadyStep_error_state=Illegal peer state
\ No newline at end of file diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/AbstractSimulatorService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/AbstractSimulatorService.java index 2ab3d672c..5e0d5a20e 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/AbstractSimulatorService.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/AbstractSimulatorService.java @@ -10,59 +10,11 @@ */
package org.eclipse.tcf.te.tcf.locator.services;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.runtime.callback.Callback;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
import org.eclipse.tcf.te.runtime.services.AbstractService;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IDebugService;
import org.eclipse.tcf.te.runtime.services.interfaces.ISimulatorService;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties;
/**
* Abstract simulator service implementation.
*/
public abstract class AbstractSimulatorService extends AbstractService implements ISimulatorService {
-
- public static final String CALLBACK_SIMULATOR_EXIT_VALUE = "simulatorExitValue"; //$NON-NLS-1$
-
- /* (non-Javadoc)
- * @see com.windriver.te.tcf.core.interfaces.agents.IAgentService#autoStartDebugger(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void autoStartDebugger(final IPeerModel peerModel, final IProgressMonitor monitor) {
- Assert.isNotNull(peerModel);
-
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- String value = peerModel.getPeer().getAttributes().get(IPeerModelProperties.PROP_AUTO_START_DEBUGGER);
- boolean autoStartDbg = value != null ? Boolean.parseBoolean(value) : false;
-
- // Auto-start the debugger now, if requested
- if (autoStartDbg) {
- // If the peer model is in state WAITING_FOR_READY, the debugger
- // launch needs to be delayed until the state is reseted.
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- IDebugService dbgService = ServiceManager.getInstance().getService(peerModel, IDebugService.class, false);
- if (dbgService != null) {
- // Attach the debugger and all cores (OCDDevices)
- IPropertiesContainer props = new PropertiesContainer();
- dbgService.attach(peerModel, props, new Callback());
- }
- }
- };
-
- Protocol.invokeLater(runnable);
- }
- }
- };
-
- Protocol.invokeLater(runnable);
- }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/StartDebuggerStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/StartDebuggerStep.java new file mode 100644 index 000000000..40e62a59d --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/StartDebuggerStep.java @@ -0,0 +1,82 @@ +/*******************************************************************************
+ * Copyright (c) 2013 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.locator.steps;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.protocol.Protocol;
+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.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.runtime.stepper.steps.AbstractStep;
+
+/**
+ * Start debugger step implementation.
+ */
+public class StartDebuggerStep extends AbstractStep {
+
+ /**
+ * Constructor.
+ */
+ public StartDebuggerStep() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void validateExecute(final IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, final IProgressMonitor monitor) throws CoreException {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(final IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, final IProgressMonitor monitor, final ICallback callback) {
+ final Object activeContext = getActiveContext(context, data, fullQualifiedId);
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ IDebugService dbgService = ServiceManager.getInstance().getService(activeContext, IDebugService.class, false);
+ if (dbgService != null) {
+ // Attach the debugger and all cores (OCDDevices)
+ IPropertiesContainer props = new PropertiesContainer();
+ dbgService.attach(activeContext, props, monitor, callback);
+ }
+ else {
+ callback.done(StartDebuggerStep.this, Status.OK_STATUS);
+ }
+ }
+ };
+ Protocol.invokeLater(runnable);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.steps.AbstractStep#rollback(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.core.runtime.IStatus, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void rollback(IStepContext context, IPropertiesContainer data, IStatus status, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, ICallback callback) {
+ final Object activeContext = getActiveContext(context, data, fullQualifiedId);
+ IDebugService dbgService = ServiceManager.getInstance().getService(activeContext, IDebugService.class, false);
+ if (dbgService != null) {
+ IPropertiesContainer props = new PropertiesContainer();
+ dbgService.detach(activeContext, props, null, callback);
+ }
+ else {
+ callback.done(this, Status.OK_STATUS);
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/StartSimulatorStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/StartSimulatorStep.java new file mode 100644 index 000000000..ef96a6528 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/StartSimulatorStep.java @@ -0,0 +1,54 @@ +/*******************************************************************************
+ * Copyright (c) 2013 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.locator.steps;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.locator.utils.SimulatorUtils;
+
+/**
+ * Start simulator step implementation.
+ */
+public class StartSimulatorStep extends AbstractPeerModelStep {
+
+ /**
+ * Constructor.
+ */
+ public StartSimulatorStep() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IExtendedStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void validateExecute(final IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, final IProgressMonitor monitor) throws CoreException {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(final IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, final IProgressMonitor monitor, final ICallback callback) {
+ SimulatorUtils.start(getActivePeerModelContext(context, data, fullQualifiedId), monitor, callback);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.steps.AbstractStep#rollback(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.core.runtime.IStatus, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void rollback(IStepContext context, IPropertiesContainer data, IStatus status, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, ICallback callback) {
+ SimulatorUtils.stop(getActivePeerModelContext(context, data, fullQualifiedId), null, callback);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/StopDebuggerStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/StopDebuggerStep.java new file mode 100644 index 000000000..3fe928a33 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/StopDebuggerStep.java @@ -0,0 +1,55 @@ +/*******************************************************************************
+ * Copyright (c) 2013 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.locator.steps;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+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.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.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+
+/**
+ * Stop debugger step implementation.
+ */
+public class StopDebuggerStep extends AbstractPeerModelStep {
+
+ /**
+ * Constructor.
+ */
+ public StopDebuggerStep() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IExtendedStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void validateExecute(final IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, final IProgressMonitor monitor) throws CoreException {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(final IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, final IProgressMonitor monitor, final ICallback callback) {
+ IDebugService dbgService = ServiceManager.getInstance().getService(getActivePeerModelContext(context, data, fullQualifiedId), IDebugService.class, false);
+ if (dbgService != null) {
+ IPropertiesContainer props = new PropertiesContainer();
+ dbgService.detach(getActivePeerModelContext(context, data, fullQualifiedId), props, monitor, callback);
+ }
+ else {
+ callback.done(this, Status.OK_STATUS);
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/StopSimulatorStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/StopSimulatorStep.java new file mode 100644 index 000000000..3edf32507 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/StopSimulatorStep.java @@ -0,0 +1,45 @@ +/*******************************************************************************
+ * Copyright (c) 2013 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.locator.steps;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.tcf.locator.utils.SimulatorUtils;
+
+/**
+ * Stop simulator step implementation.
+ */
+public class StopSimulatorStep extends AbstractPeerModelStep {
+
+ /**
+ * Constructor.
+ */
+ public StopSimulatorStep() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IExtendedStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void validateExecute(final IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, final IProgressMonitor monitor) throws CoreException {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(final IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, final IProgressMonitor monitor, final ICallback callback) {
+ SimulatorUtils.stop(getActivePeerModelContext(context, data, fullQualifiedId), monitor, callback);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/WaitForReadyStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/WaitForReadyStep.java new file mode 100644 index 000000000..b400aa3a5 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/steps/WaitForReadyStep.java @@ -0,0 +1,120 @@ +/*******************************************************************************
+ * Copyright (c) 2013 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.locator.steps;
+
+import java.util.concurrent.TimeoutException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.protocol.Protocol;
+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.stepper.interfaces.IFullQualifiedId;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.runtime.utils.ProgressHelper;
+import org.eclipse.tcf.te.runtime.utils.StatusHelper;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.locator.activator.CoreBundleActivator;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties;
+import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService;
+import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.locator.nls.Messages;
+
+/**
+ * WaitForReadyStep
+ */
+public class WaitForReadyStep extends AbstractPeerModelStep {
+
+ /**
+ * Constructor.
+ */
+ public WaitForReadyStep() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#validateExecute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void execute(final IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, final IProgressMonitor monitor, final ICallback callback) {
+ // Trigger a refresh of the model to read in the newly created static peer
+ final ILocatorModelRefreshService service = Model.getModel().getService(ILocatorModelRefreshService.class);
+ if (service != null) {
+ Protocol.invokeLater(new Runnable() {
+ final Runnable thisRunnable = this;
+ int refreshCount = 0;
+ @Override
+ public void run() {
+ if (monitor.isCanceled()) {
+ callback.done(WaitForReadyStep.this, Status.CANCEL_STATUS);
+ }
+ else if (refreshCount >= getTotalWork(context, data)) {
+ callback.done(WaitForReadyStep.this, StatusHelper.getStatus(new TimeoutException(Messages.WaitForReadyStep_error_timeout)));
+ }
+ else if (getActivePeerModelContext(context, data, fullQualifiedId).isProperty(IPeerModelProperties.PROP_STATE, IPeerModelProperties.STATE_WAITING_FOR_READY)) {
+ // Refresh the model now (must be executed within the TCF dispatch thread)
+ service.refresh(new Callback() {
+ @Override
+ protected void internalDone(Object caller, org.eclipse.core.runtime.IStatus status) {
+ refreshCount++;
+ ProgressHelper.worked(monitor, 1);
+ Protocol.invokeLater(refreshCount < 20 ? 500 : 1000, thisRunnable);
+ }
+ });
+ }
+ else {
+ int state = getActivePeerModelContext(context, data, fullQualifiedId).getIntProperty(IPeerModelProperties.PROP_STATE);
+ if (state == IPeerModelProperties.STATE_CONNECTED || state == IPeerModelProperties.STATE_REACHABLE)
+ callback.done(WaitForReadyStep.this, Status.OK_STATUS);
+ else
+ callback.done(WaitForReadyStep.this, StatusHelper.getStatus(new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), Messages.WaitForReadyStep_error_state))));
+ }
+ }
+ });
+ }
+ else {
+ callback.done(this, Status.OK_STATUS);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.steps.AbstractStep#getTotalWork(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ */
+ @Override
+ public int getTotalWork(IStepContext context, IPropertiesContainer data) {
+ return 100;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.steps.AbstractStep#rollback(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.core.runtime.IStatus, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void rollback(IStepContext context, IPropertiesContainer data, IStatus status, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, ICallback callback) {
+ final IPeer peer = getActivePeerContext(context, data, fullQualifiedId);
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ Tcf.getChannelManager().shutdown(peer);
+ }
+ });
+ super.rollback(context, data, status, fullQualifiedId, monitor, callback);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/utils/SimulatorUtils.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/utils/SimulatorUtils.java new file mode 100644 index 000000000..4aa36a2ec --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/utils/SimulatorUtils.java @@ -0,0 +1,178 @@ +/**
+ * SimulatorUtils.java
+ * Created on Jan 22, 2013
+ *
+ * Copyright (c) 2013 Wind River Systems, Inc.
+ *
+ * The right to copy, distribute, modify, or otherwise make use
+ * of this software may be licensed only pursuant to the terms
+ * of an applicable Wind River license agreement.
+ */
+package org.eclipse.tcf.te.tcf.locator.utils;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.runtime.callback.Callback;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.services.ServiceManager;
+import org.eclipse.tcf.te.runtime.services.interfaces.IService;
+import org.eclipse.tcf.te.runtime.services.interfaces.ISimulatorService;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties;
+
+/**
+ * Simulator related utilities.
+ */
+public final class SimulatorUtils {
+
+ /**
+ * Result of getSimulatorService.
+ */
+ public static class Result {
+ public ISimulatorService service;
+ public String id;
+ public String settings;
+ }
+
+ /**
+ * Returns the simulator service and the settings for the simulator launch.
+ * If no simulator service is configured in the peer
+ * or the configured service is not available, <code>null</code> will be returned.
+ *
+ * @param peerModel The peer model node. Must not be <code>null</code>.
+ * @return The {@link Result} containing the simulator service and the settings or <code>null</code>.
+ */
+ public static Result getSimulatorService(final IPeerModel peerModel) {
+ Assert.isNotNull(peerModel);
+
+ final AtomicBoolean isEnabled = new AtomicBoolean(false);
+ final AtomicReference<String> type = new AtomicReference<String>();
+ final AtomicReference<String> properties = new AtomicReference<String>();
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ String value = peerModel.getPeer().getAttributes().get(IPeerModelProperties.PROP_SIM_ENABLED);
+ if (value != null) {
+ isEnabled.set(Boolean.parseBoolean(value));
+ }
+
+ type.set(peerModel.getPeer().getAttributes().get(IPeerModelProperties.PROP_SIM_TYPE));
+ properties.set(peerModel.getPeer().getAttributes().get(IPeerModelProperties.PROP_SIM_PROPERTIES));
+ }
+ };
+
+ if (Protocol.isDispatchThread()) {
+ runnable.run();
+ }
+ else {
+ Protocol.invokeAndWait(runnable);
+ }
+
+ Result result = null;
+
+ if (isEnabled.get()) {
+ IService[] services = ServiceManager.getInstance().getServices(peerModel, ISimulatorService.class, false);
+ for (IService service : services) {
+ Assert.isTrue(service instanceof ISimulatorService);
+ // Get the UI service which is associated with the simulator service
+ String id = service.getId();
+ if (id != null && id.equals(type.get())) {
+ result = new Result();
+ result.service = (ISimulatorService)service;
+ result.id = id;
+ result.settings = properties.get();
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Starts the simulator if the simulator launch is enabled for the given peer
+ * model node and the configured simulator service type is available. In any
+ * other cases, the given callback is invoked immediately.
+ *
+ * @param peerModel The peer model node. Must not be <code>null</code>.
+ * @param monitor The progress monitor.
+ * @param callback The callback to invoke if finished. Must not be <code>null</code>.
+ */
+ public static void start(final IPeerModel peerModel, final IProgressMonitor monitor, final ICallback callback) {
+ Assert.isNotNull(peerModel);
+ Assert.isNotNull(callback);
+
+ // Determine if we have to start a simulator first
+ final Result result = getSimulatorService(peerModel);
+ if (result != null && result.service != null) {
+ // Check if the simulator is already running
+ result.service.isRunning(peerModel, result.settings, new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ Object cbResult = getResult();
+ if (cbResult instanceof Boolean && !((Boolean)cbResult).booleanValue()) {
+ // Start the simulator
+ result.service.start(peerModel, result.settings, new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ callback.setResult(new Boolean(status.isOK()));
+ callback.done(caller, status);
+ }
+ }, monitor);
+ } else {
+ callback.setResult(Boolean.FALSE);
+ callback.done(this, Status.OK_STATUS);
+ }
+ }
+ });
+ } else {
+ callback.setResult(Boolean.FALSE);
+ callback.done(null, Status.OK_STATUS);
+ }
+ }
+
+ /**
+ * Stops the simulator if the simulator launch is enabled for the given peer
+ * model node and the configured simulator service type is available. In any
+ * other cases, the given callback is invoked immediately.
+ *
+ * @param peerModel The peer model node. Must not be <code>null</code>.
+ * @param monitor The progress monitor.
+ * @param callback The callback to invoke if finished. Must not be <code>null</code>.
+ */
+ public static void stop(final IPeerModel peerModel, final IProgressMonitor monitor, final ICallback callback) {
+ Assert.isNotNull(peerModel);
+ Assert.isNotNull(callback);
+
+ // Get the associated simulator service
+ final Result result = getSimulatorService(peerModel);
+ if (result != null && result.service != null) {
+ // Determine if the simulator is at all running
+ result.service.isRunning(peerModel, result.settings, new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ Object cbResult = getResult();
+ if (cbResult instanceof Boolean && ((Boolean)cbResult).booleanValue()) {
+ // Stop the simulator
+ result.service.stop(peerModel, result.settings, new Callback(callback) {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ callback.done(caller, status);
+ }
+ }, monitor);
+ } else {
+ callback.done(null, Status.OK_STATUS);
+ }
+ }
+ });
+ } else {
+ callback.done(null, Status.OK_STATUS);
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/steps/AttachStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/steps/AttachStep.java index 5edb56ebe..a71a45a04 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/steps/AttachStep.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/steps/AttachStep.java @@ -1,207 +1,207 @@ -/******************************************************************************* - * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.tcf.te.tcf.processes.core.model.steps; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.osgi.util.NLS; -import org.eclipse.tcf.protocol.IChannel; -import org.eclipse.tcf.protocol.IToken; -import org.eclipse.tcf.protocol.Protocol; -import org.eclipse.tcf.services.IProcesses; -import org.eclipse.tcf.services.IProcesses.ProcessContext; -import org.eclipse.tcf.te.runtime.callback.Callback; -import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback; -import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; -import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode; -import org.eclipse.tcf.te.runtime.properties.PropertiesContainer; -import org.eclipse.tcf.te.runtime.services.ServiceManager; -import org.eclipse.tcf.te.runtime.services.interfaces.IDebugService; -import org.eclipse.tcf.te.runtime.statushandler.StatusHandlerManager; -import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandler; -import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandlerConstants; -import org.eclipse.tcf.te.tcf.core.Tcf; -import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager; -import org.eclipse.tcf.te.tcf.core.model.interfaces.IModel; -import org.eclipse.tcf.te.tcf.core.model.interfaces.services.IModelRefreshService; -import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel; -import org.eclipse.tcf.te.tcf.processes.core.activator.CoreBundleActivator; -import org.eclipse.tcf.te.tcf.processes.core.interfaces.IContextHelpIds; -import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode; -import org.eclipse.tcf.te.tcf.processes.core.nls.Messages; - -/** - * Process attach step implementation. - */ -public class AttachStep { - - /** - * Attach to the given process context. - * <p> - * <b>Note:</b> This method must be called from within the TCF dispatch thread. - * - * @param node The context. Must not be <code>null</code>. - * @param callback The callback to invoke once the operation completed, or<code>null</code>. - */ - public void executeAttach(final IProcessContextNode node, final ICallback callback) { - Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$ - Assert.isNotNull(node); - - // If the context is already attached, there is nothing to do - if (node.getProcessContext() != null && !node.getProcessContext().isAttached()) { - IPeerModel peerNode = (IPeerModel)node.getAdapter(IPeerModel.class); - if (peerNode != null) { - // Determine the debug service to attach to the peer node - IDebugService dbgService = ServiceManager.getInstance().getService(peerNode, IDebugService.class, false); - if (dbgService != null) { - // Attach to the peer node first - dbgService.attach(peerNode, new PropertiesContainer(), new Callback() { - @Override - protected void internalDone(Object caller, IStatus status) { - callback.setProperty("launch", getProperty("launch")); //$NON-NLS-1$ //$NON-NLS-2$ - Runnable runnable = new Runnable() { - @Override - public void run() { - doAttach(node, callback); - } - }; - if (Protocol.isDispatchThread()) runnable.run(); - else Protocol.invokeLater(runnable); - } - }); - } else { - doAttach(node, callback); - } - } else { - onError(node, Messages.AttachStep_error_connect, null, callback); - } - } else { - if (node.getProcessContext() == null) { - onError(node, Messages.AttachStep_error_connect, null, callback); - } else { - onDone(callback); - } - } - } - - /** - * Opens a channel and perform the attach to the given context node. - * <p> - * <b>Note:</b> This method must be called from within the TCF dispatch thread. - * - * @param node The context node. Must not be <code>null</code>. - * @param callback The callback to invoke once the operation completed, or<code>null</code>. - */ - protected void doAttach(final IProcessContextNode node, final ICallback callback) { - Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$ - Assert.isNotNull(node); - - // Determine the peer model node - final IPeerModel peerNode = (IPeerModel)node.getAdapter(IPeerModel.class); - - // Open a channel - Tcf.getChannelManager().openChannel(peerNode.getPeer(), null, new IChannelManager.DoneOpenChannel() { - @Override - public void doneOpenChannel(final Throwable error, final IChannel channel) { - if (error == null) { - final IProcesses service = channel.getRemoteService(IProcesses.class); - if (service != null) { - service.getContext(node.getStringProperty(IModelNode.PROPERTY_ID), new IProcesses.DoneGetContext() { - @Override - public void doneGetContext(IToken token, Exception error, ProcessContext context) { - if (error == null && context != null) { - context.attach(new IProcesses.DoneCommand() { - @Override - public void doneCommand(IToken token, Exception error) { - if (error == null) { - // We are attached now, trigger a refresh of the node - IModel model = node.getParent(IModel.class); - Assert.isNotNull(model); - model.getService(IModelRefreshService.class).refresh(node, new Callback() { - @Override - protected void internalDone(Object caller, IStatus status) { - onDone(callback); - } - }); - } else { - onError(node, Messages.AttachStep_error_attach, error, callback); - } - } - }); - } else { - onError(node, Messages.AttachStep_error_getContext, error, callback); - } - } - }); - } else { - onError(node, Messages.AttachStep_error_connect, null, callback); - } - } else { - onError(node, Messages.AttachStep_error_openChannel, error, callback); - } - } - }); - } - - /** - * Error handler. Called if a step failed. - * - * @param channel The channel or <code>null</code>. - * @param context The status handler context. Must not be <code>null</code>: - * @param message The message or <code>null</code>. - * @param error The error or <code>null</code>. - * @param callback The callback or <code>null</code>. - */ - protected void onError(Object context, String message, Throwable error, ICallback callback) { - Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$ - - String detailMessage = error != null ? error.getMessage() : null; - if (detailMessage != null && detailMessage.contains("\n")) { //$NON-NLS-1$ - detailMessage = detailMessage.replaceAll("\n", ", "); //$NON-NLS-1$ //$NON-NLS-2$ - detailMessage = detailMessage.replaceAll(":, ", ": "); //$NON-NLS-1$ //$NON-NLS-2$ - } - - String fullMessage = message; - if (fullMessage != null) fullMessage = NLS.bind(fullMessage, detailMessage != null ? detailMessage : ""); //$NON-NLS-1$ - else fullMessage = detailMessage; - - if (fullMessage != null) { - IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), fullMessage, error); - - if (callback == null) { - IStatusHandler[] handlers = StatusHandlerManager.getInstance().getHandler(context); - if (handlers.length > 0) { - IPropertiesContainer data = new PropertiesContainer(); - data.setProperty(IStatusHandlerConstants.PROPERTY_TITLE, Messages.AttachStep_error_title); - data.setProperty(IStatusHandlerConstants.PROPERTY_CONTEXT_HELP_ID, IContextHelpIds.MESSAGE_ATTACH_FAILED); - data.setProperty(IStatusHandlerConstants.PROPERTY_CALLER, this); - - handlers[0].handleStatus(status, data, null); - } else { - CoreBundleActivator.getDefault().getLog().log(status); - } - } - else { - callback.done(this, status); - } - } - } - - /** - * Done handler. Called if all necessary steps are completed. - * - * @param callback The callback to invoke or <code>null</code> - */ - protected void onDone(ICallback callback) { - Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$ - if (callback != null) callback.done(this, Status.OK_STATUS); - } -} +/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.processes.core.model.steps;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.IProcesses;
+import org.eclipse.tcf.services.IProcesses.ProcessContext;
+import org.eclipse.tcf.te.runtime.callback.Callback;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
+import org.eclipse.tcf.te.runtime.services.ServiceManager;
+import org.eclipse.tcf.te.runtime.services.interfaces.IDebugService;
+import org.eclipse.tcf.te.runtime.statushandler.StatusHandlerManager;
+import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandler;
+import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandlerConstants;
+import org.eclipse.tcf.te.tcf.core.Tcf;
+import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
+import org.eclipse.tcf.te.tcf.core.model.interfaces.IModel;
+import org.eclipse.tcf.te.tcf.core.model.interfaces.services.IModelRefreshService;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.processes.core.activator.CoreBundleActivator;
+import org.eclipse.tcf.te.tcf.processes.core.interfaces.IContextHelpIds;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.core.nls.Messages;
+
+/**
+ * Process attach step implementation.
+ */
+public class AttachStep {
+
+ /**
+ * Attach to the given process context.
+ * <p>
+ * <b>Note:</b> This method must be called from within the TCF dispatch thread.
+ *
+ * @param node The context. Must not be <code>null</code>.
+ * @param callback The callback to invoke once the operation completed, or<code>null</code>.
+ */
+ public void executeAttach(final IProcessContextNode node, final ICallback callback) {
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
+ Assert.isNotNull(node);
+
+ // If the context is already attached, there is nothing to do
+ if (node.getProcessContext() != null && !node.getProcessContext().isAttached()) {
+ IPeerModel peerNode = (IPeerModel)node.getAdapter(IPeerModel.class);
+ if (peerNode != null) {
+ // Determine the debug service to attach to the peer node
+ IDebugService dbgService = ServiceManager.getInstance().getService(peerNode, IDebugService.class, false);
+ if (dbgService != null) {
+ // Attach to the peer node first
+ dbgService.attach(peerNode, new PropertiesContainer(), null, new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ callback.setProperty("launch", getProperty("launch")); //$NON-NLS-1$ //$NON-NLS-2$
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ doAttach(node, callback);
+ }
+ };
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeLater(runnable);
+ }
+ });
+ } else {
+ doAttach(node, callback);
+ }
+ } else {
+ onError(node, Messages.AttachStep_error_connect, null, callback);
+ }
+ } else {
+ if (node.getProcessContext() == null) {
+ onError(node, Messages.AttachStep_error_connect, null, callback);
+ } else {
+ onDone(callback);
+ }
+ }
+ }
+
+ /**
+ * Opens a channel and perform the attach to the given context node.
+ * <p>
+ * <b>Note:</b> This method must be called from within the TCF dispatch thread.
+ *
+ * @param node The context node. Must not be <code>null</code>.
+ * @param callback The callback to invoke once the operation completed, or<code>null</code>.
+ */
+ protected void doAttach(final IProcessContextNode node, final ICallback callback) {
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
+ Assert.isNotNull(node);
+
+ // Determine the peer model node
+ final IPeerModel peerNode = (IPeerModel)node.getAdapter(IPeerModel.class);
+
+ // Open a channel
+ Tcf.getChannelManager().openChannel(peerNode.getPeer(), null, new IChannelManager.DoneOpenChannel() {
+ @Override
+ public void doneOpenChannel(final Throwable error, final IChannel channel) {
+ if (error == null) {
+ final IProcesses service = channel.getRemoteService(IProcesses.class);
+ if (service != null) {
+ service.getContext(node.getStringProperty(IModelNode.PROPERTY_ID), new IProcesses.DoneGetContext() {
+ @Override
+ public void doneGetContext(IToken token, Exception error, ProcessContext context) {
+ if (error == null && context != null) {
+ context.attach(new IProcesses.DoneCommand() {
+ @Override
+ public void doneCommand(IToken token, Exception error) {
+ if (error == null) {
+ // We are attached now, trigger a refresh of the node
+ IModel model = node.getParent(IModel.class);
+ Assert.isNotNull(model);
+ model.getService(IModelRefreshService.class).refresh(node, new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ onDone(callback);
+ }
+ });
+ } else {
+ onError(node, Messages.AttachStep_error_attach, error, callback);
+ }
+ }
+ });
+ } else {
+ onError(node, Messages.AttachStep_error_getContext, error, callback);
+ }
+ }
+ });
+ } else {
+ onError(node, Messages.AttachStep_error_connect, null, callback);
+ }
+ } else {
+ onError(node, Messages.AttachStep_error_openChannel, error, callback);
+ }
+ }
+ });
+ }
+
+ /**
+ * Error handler. Called if a step failed.
+ *
+ * @param channel The channel or <code>null</code>.
+ * @param context The status handler context. Must not be <code>null</code>:
+ * @param message The message or <code>null</code>.
+ * @param error The error or <code>null</code>.
+ * @param callback The callback or <code>null</code>.
+ */
+ protected void onError(Object context, String message, Throwable error, ICallback callback) {
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
+
+ String detailMessage = error != null ? error.getMessage() : null;
+ if (detailMessage != null && detailMessage.contains("\n")) { //$NON-NLS-1$
+ detailMessage = detailMessage.replaceAll("\n", ", "); //$NON-NLS-1$ //$NON-NLS-2$
+ detailMessage = detailMessage.replaceAll(":, ", ": "); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ String fullMessage = message;
+ if (fullMessage != null) fullMessage = NLS.bind(fullMessage, detailMessage != null ? detailMessage : ""); //$NON-NLS-1$
+ else fullMessage = detailMessage;
+
+ if (fullMessage != null) {
+ IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), fullMessage, error);
+
+ if (callback == null) {
+ IStatusHandler[] handlers = StatusHandlerManager.getInstance().getHandler(context);
+ if (handlers.length > 0) {
+ IPropertiesContainer data = new PropertiesContainer();
+ data.setProperty(IStatusHandlerConstants.PROPERTY_TITLE, Messages.AttachStep_error_title);
+ data.setProperty(IStatusHandlerConstants.PROPERTY_CONTEXT_HELP_ID, IContextHelpIds.MESSAGE_ATTACH_FAILED);
+ data.setProperty(IStatusHandlerConstants.PROPERTY_CALLER, this);
+
+ handlers[0].handleStatus(status, data, null);
+ } else {
+ CoreBundleActivator.getDefault().getLog().log(status);
+ }
+ }
+ else {
+ callback.done(this, status);
+ }
+ }
+ }
+
+ /**
+ * Done handler. Called if all necessary steps are completed.
+ *
+ * @param callback The callback to invoke or <code>null</code>
+ */
+ protected void onDone(ICallback callback) {
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
+ if (callback != null) callback.done(this, Status.OK_STATUS);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/icons/etool16/debug_exc.gif b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/icons/etool16/debug_exc.gif Binary files differnew file mode 100644 index 000000000..afe775b5a --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/icons/etool16/debug_exc.gif diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties index 9af867401..9d41e5e17 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties @@ -1,85 +1,75 @@ -################################################################################## -# Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved. -# This program and the accompanying materials are made available under the terms -# of the Eclipse Public License v1.0 which accompanies this distribution, and is -# available at http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Wind River Systems - initial API and implementation -################################################################################## - -pluginName = Target Explorer, TCF UI Plug-in -providerName = Eclipse.org - Target Explorer - -# ***** Navigator Content ***** - -navigatorContent.name = Dynamic Target Discovery - -# ***** Filter ***** - -UnreachablePeersFilter.name=Unreachable targets -RedirectPeersFilter.name=Redirected Targets (Root Level) -PeersByCurrentUserFilter.name=Only show targets started by me - -# ***** Import/Export Wizards ***** - -ImportWizards.Category.TCF=System Management -ImportWizards.Peer=Configurations -ImportWizards.PeerDescription= - -ExportWizards.Category.TCF=System Management -ExportWizards.Peer=Configurations -ExportWizards.PeerDescription= - -# ***** Decorators ***** - -peerhost.decorator.label = Target Node Decorator - -# ***** Wizards ***** - -NewWizards.category.name=Target Communication Framework - -NewTargetWizard.name=Target -NewTargetWizard.description=Specify the attributes of the target to connect to. - -# ***** Editor Pages ***** - -OverviewEditorPage.name=Overview - -# ***** Property Tabs ***** - -propertyTab.general.label = General - -# ***** Preference and Property Pages ***** - -preference.page.name = Logging - -# ***** Command Contributions ***** - -command.delete.label=Delete -command.delete.description=Delete the selected target - -command.refresh.label=Refresh -command.refresh.description=Refresh the selected target - -command.redirect.name=Redirect Command -command.redirect.label=Redirect... -command.redirect.tooltip=Redirect communication to this node through a proxy - -command.resetredirect.name=Reset Redirect Command -command.resetredirect.label=Reset Redirect -command.resetredirect.tooltip=Reset communication redirection of this node - -command.offline.name=Always Available Offline Command -command.offline.label=Always Available Offline -command.offline.tooltip=Creates an offline copy of the target attributes. - -command.rename.label=Rename -command.rename.tooltip=Rename the selected target -command.rename.description=Rename the selected target - -command.redirect.mnemonic = e -command.resetredirect.mnemonic = s -command.delete.mnemonic = D -command.offline.mnemonic = f -command.rename.mnemonic = R
\ No newline at end of file +##################################################################################
+# Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
+# This program and the accompanying materials are made available under the terms
+# of the Eclipse Public License v1.0 which accompanies this distribution, and is
+# available at http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Wind River Systems - initial API and implementation
+##################################################################################
+
+pluginName = Target Explorer, TCF UI Plug-in
+providerName = Eclipse.org - Target Explorer
+
+# ***** Navigator Content *****
+
+navigatorContent.name = Dynamic Target Discovery
+
+# ***** Filter *****
+
+UnreachablePeersFilter.name=Unreachable targets
+RedirectPeersFilter.name=Redirected Targets (Root Level)
+PeersByCurrentUserFilter.name=Only show targets started by me
+
+# ***** Import/Export Wizards *****
+
+ImportWizards.Category.TCF=System Management
+ImportWizards.Peer=Configurations
+ImportWizards.PeerDescription=
+
+ExportWizards.Category.TCF=System Management
+ExportWizards.Peer=Configurations
+ExportWizards.PeerDescription=
+
+# ***** Decorators *****
+
+peerhost.decorator.label = Target Node Decorator
+
+# ***** Wizards *****
+
+NewWizards.category.name=Target Communication Framework
+
+NewTargetWizard.name=Target
+NewTargetWizard.description=Specify the attributes of the target to connect to.
+
+# ***** Editor Pages *****
+
+OverviewEditorPage.name=Overview
+
+# ***** Property Tabs *****
+
+propertyTab.general.label = General
+
+# ***** Preference and Property Pages *****
+
+preference.page.name = Logging
+
+# ***** Command Contributions *****
+
+command.delete.label=Delete
+command.delete.tooltip=Delete the selected target
+command.delete.mnemonic = D
+
+command.rename.label=Rename
+command.rename.tooltip=Rename the selected target
+command.rename.mnemonic = R
+
+command.refresh.label=Refresh
+command.refresh.tooltip=Refresh the selected target
+
+command.offline.label=Always Available Offline
+command.offline.tooltip=Creates an offline copy of the target attributes.
+command.offline.mnemonic = f
+
+command.debug.label=Debug
+command.debug.tooltip=Starts the debugger
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml index 16267e532..bc33b3b03 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml @@ -254,51 +254,8 @@ <!-- Menu contributions -->
<extension point="org.eclipse.ui.menus">
-<!--
- <menuContribution locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.redirect">
- <command
- commandId="org.eclipse.tcf.te.tcf.ui.command.redirect"
- helpContextId="org.eclipse.tcf.te.tcf.ui.command_Redirect"
- id="org.eclipse.tcf.te.tcf.ui.commands.redirect"
- label="%command.redirect.label"
- mnemonic="%command.redirect.mnemonic"
- style="push"
- tooltip="%command.redirect.tooltip">
- <visibleWhen checkEnabled="false">
- <with variable="selection">
- <count value="+"/>
- <iterate operator="and" ifEmpty="false">
- <and>
- <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
- <test property="org.eclipse.tcf.te.tcf.locator.isStaticPeer" value="true"/>
- </and>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.tcf.te.tcf.ui.command.resetredirect"
- helpContextId="org.eclipse.tcf.te.tcf.ui.command_ResetRedirect"
- id="org.eclipse.tcf.te.tcf.ui.commands.resetredirect"
- label="%command.resetredirect.label"
- mnemonic="%command.resetredirect.mnemonic"
- style="push"
- tooltip="%command.resetredirect.tooltip">
- <visibleWhen checkEnabled="false">
- <with variable="selection">
- <count value="+"/>
- <iterate operator="and" ifEmpty="false">
- <and>
- <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
- <test property="org.eclipse.tcf.te.tcf.locator.isStaticPeer" value="true"/>
- </and>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- </menuContribution>
--->
+ <!-- View context menu contributions -->
<menuContribution locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.delete">
<command
commandId="org.eclipse.ui.edit.delete"
@@ -308,8 +265,7 @@ id="org.eclipse.tcf.te.ui.commands.delete"
label="%command.delete.label"
mnemonic="%command.delete.mnemonic"
- style="push"
- tooltip="%command.delete.description">
+ tooltip="%command.delete.tooltip">
<visibleWhen checkEnabled="false">
<with variable="selection">
<count value="+"/>
@@ -326,7 +282,6 @@ id="org.eclipse.tcf.te.tcf.ui.commands.rename"
label="%command.rename.label"
mnemonic="%command.rename.mnemonic"
- style="push"
tooltip="%command.rename.tooltip">
<visibleWhen checkEnabled="false">
<with variable="selection">
@@ -341,16 +296,12 @@ </visibleWhen>
</command>
</menuContribution>
-
<menuContribution locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.categories">
<command
commandId="org.eclipse.tcf.te.tcf.ui.command.offline"
helpContextId="org.eclipse.tcf.te.tcf.ui.command_Offline"
id="org.eclipse.tcf.te.tcf.ui.commands.offline"
- label="%command.offline.label"
- mnemonic="%command.offline.mnemonic"
- style="push"
- tooltip="%command.offline.tooltip">
+ mnemonic="%command.offline.mnemonic">
<visibleWhen checkEnabled="true">
<with variable="selection">
<count value="+"/>
@@ -376,13 +327,12 @@ </visibleWhen>
</command>
</menuContribution>
-
<menuContribution locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.refresh">
<command
commandId="org.eclipse.tcf.te.ui.command.refresh"
label="%command.refresh.label"
style="push"
- tooltip="%command.refresh.description">
+ tooltip="%command.refresh.tooltip">
<visibleWhen checkEnabled="false">
<with variable="selection">
<count value="+"/>
@@ -407,77 +357,79 @@ </visibleWhen>
</command>
</menuContribution>
+ <menuContribution locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.launch.rundebug">
+ <command commandId="org.eclipse.tcf.te.tcf.ui.command.debug">
+ <visibleWhen checkEnabled="false">
+ <with variable="selection">
+ <count value="1"/>
+ <iterate operator="and" ifEmpty="false">
+ <adapt type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel">
+ <or>
+ <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="RunControl"/>
+ <test property="org.eclipse.tcf.te.tcf.locator.hasOfflineService" value="RunControl"/>
+ <not>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.tcf.te.runtime.services.hasService"
+ value="org.eclipse.tcf.te.runtime.services.interfaces.IMenuService"/>
+ </not>
+ <test
+ property="org.eclipse.tcf.te.runtime.services.menu.isVisible"
+ args="org.eclipse.tcf.te.tcf.ui.command.debug"
+ value="true"/>
+ </or>
+ </adapt>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+
+ <menuContribution locationURI="toolbar:org.eclipse.tcf.te.tcf.ui.OverviewEditorPage?after=group.launch.rundebug">
+ <command commandId="org.eclipse.tcf.te.tcf.ui.editor.command.debug"/>
+ </menuContribution>
+
</extension>
<!-- Command contributions -->
<extension point="org.eclipse.ui.commands">
-<!--
<command
+ id="org.eclipse.tcf.te.tcf.ui.command.offline"
categoryId="org.eclipse.tcf.te.ui.commands.category"
- helpContextId="org.eclipse.tcf.te.tcf.ui.command_Redirect"
- id="org.eclipse.tcf.te.tcf.ui.command.redirect"
- name="%command.redirect.name">
+ helpContextId="org.eclipse.tcf.te.tcf.ui.command_Offline"
+ name="%command.offline.label"
+ description="%command.offline.tooltip">
</command>
<command
+ id="org.eclipse.tcf.te.tcf.ui.command.debug"
categoryId="org.eclipse.tcf.te.ui.commands.category"
- helpContextId="org.eclipse.tcf.te.tcf.ui.command_ResetRedirect"
- id="org.eclipse.tcf.te.tcf.ui.command.resetredirect"
- name="%command.resetredirect.name">
+ helpContextId="org.eclipse.tcf.te.tcf.ui.command_Debug"
+ name="%command.debug.label"
+ description="%command.debug.tooltip">
</command>
--->
<command
+ id="org.eclipse.tcf.te.tcf.ui.editor.command.debug"
categoryId="org.eclipse.tcf.te.ui.commands.category"
- helpContextId="org.eclipse.tcf.te.tcf.ui.command_Offline"
- id="org.eclipse.tcf.te.tcf.ui.command.offline"
- name="%command.offline.name">
+ helpContextId="org.eclipse.tcf.te.tcf.ui.command_Debug"
+ name="%command.debug.label"
+ description="%command.debug.tooltip">
</command>
</extension>
+<!-- Command image contributions -->
+ <extension point="org.eclipse.ui.commandImages">
+ <image
+ commandId="org.eclipse.tcf.te.tcf.ui.command.debug"
+ icon="icons/etool16/debug_exc.gif">
+ </image>
+ <image
+ commandId="org.eclipse.tcf.te.tcf.ui.editor.command.debug"
+ icon="icons/etool16/debug_exc.gif">
+ </image>
+ </extension>
+
<!-- Handler contributions -->
<extension point="org.eclipse.ui.handlers">
-<!--
- <handler
- class="org.eclipse.tcf.te.tcf.ui.handler.RedirectHandler"
- commandId="org.eclipse.tcf.te.tcf.ui.command.redirect">
- <activeWhen>
- <with variable="activePartId">
- <equals value="org.eclipse.tcf.te.ui.views.View"/>
- </with>
- </activeWhen>
- <enabledWhen>
- <with variable="selection">
- <count value="1"/>
- <iterate operator="and" ifEmpty="false">
- <and>
- <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
- <test property="org.eclipse.tcf.te.tcf.locator.isRedirected" value="false"/>
- </and>
- </iterate>
- </with>
- </enabledWhen>
- </handler>
-
- <handler
- class="org.eclipse.tcf.te.tcf.ui.handler.ResetRedirectHandler"
- commandId="org.eclipse.tcf.te.tcf.ui.command.resetredirect">
- <activeWhen>
- <with variable="activePartId">
- <equals value="org.eclipse.tcf.te.ui.views.View"/>
- </with>
- </activeWhen>
- <enabledWhen>
- <with variable="selection">
- <count value="1"/>
- <iterate operator="and" ifEmpty="false">
- <and>
- <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
- <test property="org.eclipse.tcf.te.tcf.locator.isRedirected" value="true"/>
- </and>
- </iterate>
- </with>
- </enabledWhen>
- </handler>
--->
<handler
commandId="org.eclipse.ui.edit.delete"
class="org.eclipse.tcf.te.tcf.ui.handler.DeleteHandler">
@@ -572,6 +524,46 @@ </with>
</enabledWhen>
</handler>
+
+ <handler
+ commandId="org.eclipse.tcf.te.tcf.ui.command.debug"
+ class="org.eclipse.tcf.te.tcf.ui.handler.StartDebugCommandHandler">
+ <activeWhen>
+ <with variable="systemManagerViewSelection">
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
+ </iterate>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <with variable="systemManagerViewSelection">
+ <count value="1"/>
+ <iterate operator="and" ifEmpty="false">
+ <adapt type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel">
+ <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="RunControl"/>
+ <test property="org.eclipse.tcf.te.launch.core.isLaunched" value="false"/>
+ </adapt>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
+ <handler
+ commandId="org.eclipse.tcf.te.tcf.ui.editor.command.debug"
+ class="org.eclipse.tcf.te.tcf.ui.handler.StartDebugCommandHandler">
+ <activeWhen>
+ <with variable="activeEditorInput">
+ <adapt type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <with variable="activeEditorInput">
+ <adapt type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel">
+ <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="RunControl"/>
+ <test property="org.eclipse.tcf.te.launch.core.isLaunched" value="false"/>
+ </adapt>
+ </with>
+ </enabledWhen>
+ </handler>
</extension>
<!-- Tabbed properties view contributions -->
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/StartDebugCommandHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/StartDebugCommandHandler.java new file mode 100644 index 000000000..c6e1e3fb5 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/StartDebugCommandHandler.java @@ -0,0 +1,106 @@ +/**
+ * StartDebugCommandHandler.java
+ * Created on Jun 29, 2012
+ *
+ * Copyright (c) 2012 Wind River Systems, Inc.
+ *
+ * The right to copy, distribute, modify, or otherwise make use
+ * of this software may be licensed only pursuant to the terms
+ * of an applicable Wind River license agreement.
+ */
+package org.eclipse.tcf.te.tcf.ui.handler;
+
+import java.util.Iterator;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.tcf.te.core.async.AsyncCallbackCollector;
+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.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.ui.async.UICallbackInvocationDelegate;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.part.EditorPart;
+
+/**
+ * Start debugger command handler implementation.
+ */
+public class StartDebugCommandHandler extends AbstractHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ // Get the active part
+ IWorkbenchPart part = HandlerUtil.getActivePart(event);
+ // Get the current selection
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+
+ // If the handler is invoked from an editor part, ignore the selection and
+ // construct an artificial selection from the active editor input.
+ if (part instanceof EditorPart) {
+ IEditorInput input = ((EditorPart)part).getEditorInput();
+ Object element = input != null ? input.getAdapter(Object.class) : null;
+ if (element != null) {
+ selection = new StructuredSelection(element);
+ }
+ }
+
+ // If the selection is not empty, iterate over the selection and execute
+ // the operation for each peer model node in the selection.
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ // Create the collector keeping track of the callbacks for each peer model
+ // node within the selection
+ final AsyncCallbackCollector collector = new AsyncCallbackCollector(new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ // Signal that all operations completed
+ }
+ }, new UICallbackInvocationDelegate());
+
+ Iterator<?> iterator = ((IStructuredSelection)selection).iterator();
+ while (iterator.hasNext()) {
+ final Object element = iterator.next();
+ if (element instanceof IPeerModel) {
+ startDebugger((IPeerModel)element, new AsyncCallbackCollector.SimpleCollectorCallback(collector));
+ }
+ }
+
+ // Mark the collector initialization done
+ collector.initDone();
+ }
+
+ return null;
+ }
+
+ /**
+ * Starts the debugger for the given peer model node.
+ *
+ * @param peerModel The peer model node. Must not be <code>null</code>.
+ * @param callback The callback. Must not be <code>null</code>.
+ */
+ public void startDebugger(final IPeerModel peerModel, final ICallback callback) {
+ Assert.isNotNull(peerModel);
+ Assert.isNotNull(callback);
+
+ IDebugService dbgService = ServiceManager.getInstance().getService(peerModel, IDebugService.class, false);
+ if (dbgService != null) {
+ // Attach the debugger and all cores (OCDDevices)
+ IPropertiesContainer props = new PropertiesContainer();
+ dbgService.attach(peerModel, props, null, callback);
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.properties index 4c7c3d6d0..469302286 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.properties +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.properties @@ -67,23 +67,23 @@ command.showin.name = Show In Group menu.find.label = Find...
menu.find.mnemonic = f
-command.find.name = Find...
-
menu.filter.label = Filter...
menu.filter.mnemonic = t
menu.reset.label = Reset
menu.reset.mnemonic = r
+command.find.name = Find...
command.find.description = Find elements in a tree viewer
-command.filter.description = Filter elements in a tree viewer
+
command.filter.name = Quick Filter
+command.filter.description = Filter elements in a tree viewer
-command.reset.description = Reset quick filter in a tree viewer
command.reset.name = Reset Quick Filter
+command.reset.description = Reset quick filter in a tree viewer
-command.showInSM.name=Show In System Management View Command
-command.showInSM.description=Show In System Management
+command.showInSM.name=Show In System Management
+command.showInSM.description=Show In System Management View
-command.apply.name=Apply Command
+command.apply.name=Apply
command.apply.description=Apply changes
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.xml index 15e5f48c2..7ff058cb1 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.xml @@ -948,16 +948,17 @@ <factory
adaptableType="org.eclipse.tcf.te.ui.views.internal.View"
class="org.eclipse.tcf.te.ui.views.internal.adapters.ViewAdapterFactory">
- <adapter
- type="org.eclipse.ui.navigator.CommonViewer">
- </adapter>
+ <adapter type="org.eclipse.ui.navigator.CommonViewer"/>
</factory>
<factory
adaptableType="org.eclipse.tcf.te.ui.views.editor.Editor"
class="org.eclipse.tcf.te.ui.views.internal.adapters.EditorAdapterFactory">
- <adapter
- type="org.eclipse.jface.viewers.TreeViewer">
- </adapter>
+ <adapter type="org.eclipse.jface.viewers.TreeViewer"/>
+ </factory>
+ <factory
+ adaptableType="org.eclipse.tcf.te.ui.views.editor.EditorInput"
+ class="org.eclipse.tcf.te.ui.views.internal.adapters.EditorAdapterFactory">
+ <adapter type="org.eclipse.tcf.te.runtime.model.interfaces.IModelNode"/>
</factory>
</extension>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractCustomFormToolkitEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractCustomFormToolkitEditorPage.java index d6c5db062..678c234dc 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractCustomFormToolkitEditorPage.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/AbstractCustomFormToolkitEditorPage.java @@ -31,6 +31,8 @@ import org.eclipse.ui.ISharedImages; import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.menus.CommandContributionItem;
+import org.eclipse.ui.menus.CommandContributionItemParameter;
import org.eclipse.ui.menus.IMenuService;
/**
@@ -258,9 +260,16 @@ public abstract class AbstractCustomFormToolkitEditorPage extends AbstractEditor manager.add(new GroupMarker("group.launch.rundebug")); //$NON-NLS-1$
manager.add(new GroupMarker("group.launch.modes")); //$NON-NLS-1$
manager.add(new GroupMarker("group.launch.additions")); //$NON-NLS-1$
+
manager.add(new Separator("group.showIn")); //$NON-NLS-1$
- manager.add(new Separator("group.save")); //$NON-NLS-1$
+ if (hasShowInSystemManagementAction()) {
+ manager.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(),
+ "org.eclipse.tcf.te.ui.views.command.showIn.systemManagement", //$NON-NLS-1$
+ "org.eclipse.tcf.te.ui.command.showIn.systemManagement", //$NON-NLS-1$
+ CommandContributionItem.STYLE_PUSH)));
+ }
+ manager.add(new Separator("group.save")); //$NON-NLS-1$
// If the page should have an apply button, add one to the toolbar
if (hasApplyAction()) {
Action applyAction = doCreateApplyAction(getEditor());
@@ -268,7 +277,6 @@ public abstract class AbstractCustomFormToolkitEditorPage extends AbstractEditor }
manager.add(new Separator("group.help")); //$NON-NLS-1$
-
// If the page is associated with a context help id, add a default
// help action button into the toolbar
if (getContextHelpId() != null) {
@@ -300,6 +308,18 @@ public abstract class AbstractCustomFormToolkitEditorPage extends AbstractEditor }
/**
+ * Returns if or if not the page should have an
+ * ShowInSystemManagementView button in the toolbar.
+ * <p>
+ * The default implementation returns <code>true</code>.
+ *
+ * @return <code>True</code> if the page does have an ShowInSystemManagementView button, <code>false</code> otherwise.
+ */
+ protected boolean hasShowInSystemManagementAction() {
+ return true;
+ }
+
+ /**
* Returns if or if not the page should have an apply button in
* the toolbar.
* <p>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/adapters/EditorAdapterFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/adapters/EditorAdapterFactory.java index 966908e39..aea74c19e 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/adapters/EditorAdapterFactory.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/adapters/EditorAdapterFactory.java @@ -11,7 +11,9 @@ package org.eclipse.tcf.te.ui.views.internal.adapters; import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
import org.eclipse.tcf.te.ui.views.editor.Editor;
+import org.eclipse.tcf.te.ui.views.editor.EditorInput;
import org.eclipse.ui.forms.editor.IFormPage;
/**
@@ -34,6 +36,12 @@ public class EditorAdapterFactory implements IAdapterFactory { }
}
}
+ if(adaptableObject instanceof EditorInput) {
+ EditorInput editorInput = (EditorInput) adaptableObject;
+ if(IModelNode.class.equals(adapterType)) {
+ return editorInput.getAdapter(IModelNode.class);
+ }
+ }
return null;
}
@@ -43,7 +51,7 @@ public class EditorAdapterFactory implements IAdapterFactory { */
@Override
public Class[] getAdapterList() {
- return new Class[]{TreeViewer.class};
+ return new Class[]{TreeViewer.class, IModelNode.class};
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.ui/META-INF/MANIFEST.MF index 6cc48651d..5eaf1c9e3 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/META-INF/MANIFEST.MF @@ -1,48 +1,49 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.tcf.te.ui;singleton:=true -Bundle-Version: 1.1.0.qualifier -Bundle-Activator: org.eclipse.tcf.te.ui.activator.UIPlugin -Bundle-Vendor: %providerName -Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0", - org.eclipse.core.expressions;bundle-version="3.4.400", - org.eclipse.help;bundle-version="3.6.0", - org.eclipse.ui;bundle-version="3.8.0", - org.eclipse.ui.forms;bundle-version="3.5.200", - org.eclipse.ui.navigator;bundle-version="3.5.200", - org.eclipse.tcf.te.runtime;bundle-version="1.1.0", - org.eclipse.tcf.te.runtime.concurrent;bundle-version="1.1.0", - org.eclipse.tcf.te.runtime.model;bundle-version="1.1.0", - org.eclipse.tcf.te.runtime.services;bundle-version="1.1.0", - org.eclipse.tcf.te.runtime.statushandler;bundle-version="1.1.0", - org.eclipse.tcf.te.core;bundle-version="1.1.0", - org.eclipse.tcf.te.ui.forms;bundle-version="1.1.0", - org.eclipse.tcf.te.ui.swt;bundle-version="1.1.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Bundle-ActivationPolicy: lazy -Bundle-Localization: plugin -Export-Package: org.eclipse.tcf.te.ui, - org.eclipse.tcf.te.ui.activator, - org.eclipse.tcf.te.ui.async, - org.eclipse.tcf.te.ui.dialogs, - org.eclipse.tcf.te.ui.events, - org.eclipse.tcf.te.ui.handler, - org.eclipse.tcf.te.ui.help, - org.eclipse.tcf.te.ui.interfaces, - org.eclipse.tcf.te.ui.interfaces.data, - org.eclipse.tcf.te.ui.interfaces.handler, - org.eclipse.tcf.te.ui.interfaces.services, - org.eclipse.tcf.te.ui.internal.executors;x-internal:=true, - org.eclipse.tcf.te.ui.internal.utils;x-internal:=true, - org.eclipse.tcf.te.ui.nls, - org.eclipse.tcf.te.ui.preferences, - org.eclipse.tcf.te.ui.statushandler, - org.eclipse.tcf.te.ui.tables, - org.eclipse.tcf.te.ui.tables.properties, - org.eclipse.tcf.te.ui.trees, - org.eclipse.tcf.te.ui.utils, - org.eclipse.tcf.te.ui.wizards, - org.eclipse.tcf.te.ui.wizards.interfaces, - org.eclipse.tcf.te.ui.wizards.newWizard, - org.eclipse.tcf.te.ui.wizards.pages +Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.tcf.te.ui;singleton:=true
+Bundle-Version: 1.1.0.qualifier
+Bundle-Activator: org.eclipse.tcf.te.ui.activator.UIPlugin
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
+ org.eclipse.core.expressions;bundle-version="3.4.400",
+ org.eclipse.help;bundle-version="3.6.0",
+ org.eclipse.ui;bundle-version="3.8.0",
+ org.eclipse.ui.forms;bundle-version="3.5.200",
+ org.eclipse.ui.navigator;bundle-version="3.5.200",
+ org.eclipse.tcf.te.runtime;bundle-version="1.1.0",
+ org.eclipse.tcf.te.runtime.concurrent;bundle-version="1.1.0",
+ org.eclipse.tcf.te.runtime.model;bundle-version="1.1.0",
+ org.eclipse.tcf.te.runtime.services;bundle-version="1.1.0",
+ org.eclipse.tcf.te.runtime.stepper;bundle-version="1.1.0",
+ org.eclipse.tcf.te.runtime.statushandler;bundle-version="1.1.0",
+ org.eclipse.tcf.te.core;bundle-version="1.1.0",
+ org.eclipse.tcf.te.ui.forms;bundle-version="1.1.0",
+ org.eclipse.tcf.te.ui.swt;bundle-version="1.1.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
+Export-Package: org.eclipse.tcf.te.ui,
+ org.eclipse.tcf.te.ui.activator,
+ org.eclipse.tcf.te.ui.async,
+ org.eclipse.tcf.te.ui.dialogs,
+ org.eclipse.tcf.te.ui.events,
+ org.eclipse.tcf.te.ui.handler,
+ org.eclipse.tcf.te.ui.help,
+ org.eclipse.tcf.te.ui.interfaces,
+ org.eclipse.tcf.te.ui.interfaces.data,
+ org.eclipse.tcf.te.ui.interfaces.handler,
+ org.eclipse.tcf.te.ui.interfaces.services,
+ org.eclipse.tcf.te.ui.internal.executors;x-internal:=true,
+ org.eclipse.tcf.te.ui.internal.utils;x-internal:=true,
+ org.eclipse.tcf.te.ui.nls,
+ org.eclipse.tcf.te.ui.preferences,
+ org.eclipse.tcf.te.ui.statushandler,
+ org.eclipse.tcf.te.ui.tables,
+ org.eclipse.tcf.te.ui.tables.properties,
+ org.eclipse.tcf.te.ui.trees,
+ org.eclipse.tcf.te.ui.utils,
+ org.eclipse.tcf.te.ui.wizards,
+ org.eclipse.tcf.te.ui.wizards.interfaces,
+ org.eclipse.tcf.te.ui.wizards.newWizard,
+ org.eclipse.tcf.te.ui.wizards.pages
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/icons/dlcl16/connect.gif b/target_explorer/plugins/org.eclipse.tcf.te.ui/icons/dlcl16/connect.gif Binary files differnew file mode 100644 index 000000000..3d52eb47f --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/icons/dlcl16/connect.gif diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/icons/dlcl16/disconnect.gif b/target_explorer/plugins/org.eclipse.tcf.te.ui/icons/dlcl16/disconnect.gif Binary files differnew file mode 100644 index 000000000..1ca9213a4 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/icons/dlcl16/disconnect.gif diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/icons/elcl16/connect.gif b/target_explorer/plugins/org.eclipse.tcf.te.ui/icons/elcl16/connect.gif Binary files differnew file mode 100644 index 000000000..7c84b6bbf --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/icons/elcl16/connect.gif diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/icons/elcl16/disconnect.gif b/target_explorer/plugins/org.eclipse.tcf.te.ui/icons/elcl16/disconnect.gif Binary files differnew file mode 100644 index 000000000..d61dd776e --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/icons/elcl16/disconnect.gif diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui/plugin.properties index d5142a9d1..03237be43 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui/plugin.properties +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/plugin.properties @@ -1,59 +1,65 @@ -################################################################################## -# Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved. -# This program and the accompanying materials are made available under the terms -# of the Eclipse Public License v1.0 which accompanies this distribution, and is -# available at http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Wind River Systems - initial API and implementation -################################################################################## - -pluginName = Target Explorer, Common UI and Helper -providerName = Eclipse.org - Target Explorer - -# ***** Extension Points ***** - -extension-point.newWizards.name = New Wizards -extension-point.wizardProviders.name=New Wizard Providers -extension-point.viewers.name = Tree Viewer Extension -extension-point.cellEditors.name = Common Viewer Cell Editors - -# ***** Views ***** - -ViewCategory.name=Target Explorer Views - -# ***** Wizards ***** - -NewWizards.category.name=General - -# ***** Context and binding contributions ***** - -context.view.name=In Target Explorer View -context.view.description=The Target Explorer view is active - -context.editor.name=In Target Explorer Editor -context.editor.description=The Target Explorer properties editor is active - -# ***** Command contributions ***** -command.category.name=Target Explorer Commands - -command.newWizards.name=New Target -command.newWizards.description=Open the New target wizard - -command.refresh.name=Refresh Command -command.refresh.description=Refresh the selected node - -command.showConsoleView.name=Show Console View Command -command.showConsoleView.description=Shows the Console View - -# ***** Status Handler ***** - -DefaultStatusHandler.label=Default Status Handler - -# ***** Executors / Executor Utility Delegates ***** - -SWTDisplayExecutorUtilDelegate.label=SWT Display Executor Utility Delegate - -# ***** Preference Pages ***** - -preference.page.name=Target Explorer +##################################################################################
+# Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. All rights reserved.
+# This program and the accompanying materials are made available under the terms
+# of the Eclipse Public License v1.0 which accompanies this distribution, and is
+# available at http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Wind River Systems - initial API and implementation
+##################################################################################
+
+pluginName = Target Explorer, Common UI and Helper
+providerName = Eclipse.org - Target Explorer
+
+# ***** Extension Points *****
+
+extension-point.newWizards.name = New Wizards
+extension-point.wizardProviders.name=New Wizard Providers
+extension-point.viewers.name = Tree Viewer Extension
+extension-point.cellEditors.name = Common Viewer Cell Editors
+
+# ***** Views *****
+
+ViewCategory.name=Target Explorer Views
+
+# ***** Wizards *****
+
+NewWizards.category.name=General
+
+# ***** Context and binding contributions *****
+
+context.view.name=In Target Explorer View
+context.view.description=The Target Explorer view is active
+
+context.editor.name=In Target Explorer Editor
+context.editor.description=The Target Explorer properties editor is active
+
+# ***** Command contributions *****
+command.category.name=Target Explorer Commands
+
+command.newWizards.name=New Target
+command.newWizards.description=Open the New target wizard
+
+command.refresh.name=Refresh
+command.refresh.description=Refresh the selected node
+
+command.showConsoleView.name=Show Console View Command
+command.showConsoleView.description=Shows the Console View
+
+command.connect.name=Connect
+command.connect.description=Connect the selected node
+
+command.disconnect.name=Disconnect
+command.disconnect.description=Disconnect the selected node
+
+# ***** Status Handler *****
+
+DefaultStatusHandler.label=Default Status Handler
+
+# ***** Executors / Executor Utility Delegates *****
+
+SWTDisplayExecutorUtilDelegate.label=SWT Display Executor Utility Delegate
+
+# ***** Preference Pages *****
+
+preference.page.name=Target Explorer
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui/plugin.xml index 689f93f05..86929ca6c 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/plugin.xml @@ -1,168 +1,420 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.4"?> -<plugin> - <extension-point id="newWizards" name="%extension-point.newWizards.name" schema="schema/newWizards.exsd"/> - <extension-point id="wizardProviders" name="%extension-point.wizardProviders.name" schema="schema/wizardProviders.exsd"/> - <extension-point id="viewers" name="%extension-point.viewers.name" schema="schema/viewers.exsd"/> - <extension-point id="cellEditors" name="%extension-point.cellEditors.name" schema="schema/cellEditors.exsd"/> - -<!-- View contributions --> - <extension point="org.eclipse.ui.views"> - <category - id="org.eclipse.tcf.te.ui.views.category" - name="%ViewCategory.name"> - </category> - </extension> - -<!-- New target wizard contributions --> - <extension point="org.eclipse.tcf.te.ui.newWizards"> - <category - id="org.eclipse.tcf.te.ui.newWizards.category.general" - name="%NewWizards.category.name"> - </category> - </extension> - -<!-- Command contributions --> - <extension point="org.eclipse.ui.commands"> - <category - id="org.eclipse.tcf.te.ui.commands.category" - name="%command.category.name"> - </category> - - <command - categoryId="org.eclipse.tcf.te.ui.commands.category" - defaultHandler="org.eclipse.tcf.te.ui.wizards.newWizard.NewWizardCommandHandler" - description="%command.newWizards.description" - helpContextId="org.eclipse.tcf.te.ui.command_NewWizards" - id="org.eclipse.tcf.te.ui.command.newWizards" - name="%command.newWizards.name"> - </command> - - <command - categoryId="org.eclipse.tcf.te.ui.commands.category" - description="%command.refresh.description" - helpContextId="org.eclipse.tcf.te.ui.command_Refresh" - id="org.eclipse.tcf.te.ui.command.refresh" - name="%command.refresh.name"> - </command> - - <command - categoryId="org.eclipse.tcf.te.ui.commands.category" - description="%command.showConsoleView.description" - helpContextId="org.eclipse.tcf.te.ui.command_ShowConsoleView" - id="org.eclipse.tcf.te.ui.command.showConsoleView" - name="%command.showConsoleView.name"> - </command> - </extension> - -<!-- Command image contributions --> - <extension point="org.eclipse.ui.commandImages"> - <image - commandId="org.eclipse.tcf.te.ui.command.newWizards" - disabledIcon="icons/dlcl16/newtarget_wiz.gif" - icon="icons/elcl16/newtarget_wiz.gif"> - </image> - - <image - commandId="org.eclipse.tcf.te.ui.command.refresh" - disabledIcon="platform:/plugin/org.eclipse.ui/icons/full/dlcl16/refresh_nav.gif" - icon="platform:/plugin/org.eclipse.ui/icons/full/elcl16/refresh_nav.gif"> - </image> - </extension> - -<!-- COmmand handler contributions --> - <extension point="org.eclipse.ui.handlers"> - <handler - class="org.eclipse.tcf.te.ui.handler.ShowConsoleViewCommandHandler" - commandId="org.eclipse.tcf.te.ui.command.showConsoleView"> - </handler> - </extension> - -<!-- Context and binding contributions --> - <extension point="org.eclipse.ui.contexts"> - <context - description="%context.view.description" - id="org.eclipse.tcf.te.ui.views.View" - name="%context.view.name" - parentId="org.eclipse.ui.contexts.window"> - </context> - <context - description="%context.editor.description" - id="org.eclipse.tcf.te.ui.views.Editor" - name="%context.editor.name" - parentId="org.eclipse.ui.contexts.window"> - </context> - </extension> - - <extension point="org.eclipse.ui.bindings"> - <key - commandId="org.eclipse.tcf.te.ui.command.newWizards" - contextId="org.eclipse.tcf.te.ui.views.View" - schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" - sequence="M1+N"> - </key> - - <key - commandId="org.eclipse.tcf.te.ui.command.refresh" - contextId="org.eclipse.tcf.te.ui.views.View" - schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" - sequence="F5"> - </key> - - <key - commandId="org.eclipse.tcf.te.ui.command.refresh" - contextId="org.eclipse.tcf.te.ui.views.Editor" - schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" - sequence="F5"> - </key> - </extension> - -<!-- Status handler contributions --> - <extension point="org.eclipse.tcf.te.runtime.statushandler.handlers"> - <handler - class="org.eclipse.tcf.te.ui.statushandler.DefaultStatusHandler" - id="org.eclipse.tcf.te.statushandler.default" - label="%DefaultStatusHandler.label"> - </handler> - </extension> - -<!-- Executor service contributions --> - <extension point="org.eclipse.tcf.te.runtime.concurrent.executorServices"> - <executorService - id="org.eclipse.tcf.te.ui.executors.SWTDisplay" - label="Eclipse Platform Display Executor" - class="org.eclipse.tcf.te.ui.internal.executors.SWTDisplayExecutor"> - </executorService> - </extension> - -<!-- Executor utility delegate contributions --> - <extension point="org.eclipse.tcf.te.runtime.concurrent.executorUtilDelegates"> - <executorUtilDelegate - class="org.eclipse.tcf.te.ui.internal.executors.SWTDisplayExecutorUtilDelegate" - id="org.eclipse.tcf.te.ui.executors.delegate.SWTDisplay" - label="%SWTDisplayExecutorUtilDelegate.label"> - </executorUtilDelegate> - </extension> - -<!-- Event listener contributions --> - <extension point="org.eclipse.tcf.te.runtime.eventListeners"> - <eventListener class="org.eclipse.tcf.te.ui.events.TriggerCommandEventListener"> - <eventType class="org.eclipse.tcf.te.runtime.events.TriggerCommandEvent"/> - </eventListener> - </extension> - -<!-- Preference page contributions --> - <extension point="org.eclipse.ui.preferencePages"> - <page - class="org.eclipse.tcf.te.ui.preferences.PreferencePage" - id="org.eclipse.tcf.te.ui.preferences.general" - name="%preference.page.name"> - </page> - </extension> - -<!-- Preference contributions --> - <extension point="org.eclipse.core.runtime.preferences"> - <initializer class="org.eclipse.tcf.te.ui.preferences.PreferencesInitializer"/> - </extension> - -</plugin> +<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension-point id="newWizards" name="%extension-point.newWizards.name" schema="schema/newWizards.exsd"/>
+ <extension-point id="wizardProviders" name="%extension-point.wizardProviders.name" schema="schema/wizardProviders.exsd"/>
+ <extension-point id="viewers" name="%extension-point.viewers.name" schema="schema/viewers.exsd"/>
+ <extension-point id="cellEditors" name="%extension-point.cellEditors.name" schema="schema/cellEditors.exsd"/>
+
+<!-- View contributions -->
+ <extension point="org.eclipse.ui.views">
+ <category
+ id="org.eclipse.tcf.te.ui.views.category"
+ name="%ViewCategory.name">
+ </category>
+ </extension>
+
+<!-- New target wizard contributions -->
+ <extension point="org.eclipse.tcf.te.ui.newWizards">
+ <category
+ id="org.eclipse.tcf.te.ui.newWizards.category.general"
+ name="%NewWizards.category.name">
+ </category>
+ </extension>
+
+<!-- Command contributions -->
+ <extension point="org.eclipse.ui.commands">
+ <category
+ id="org.eclipse.tcf.te.ui.commands.category"
+ name="%command.category.name">
+ </category>
+
+ <command
+ id="org.eclipse.tcf.te.ui.command.newWizards"
+ categoryId="org.eclipse.tcf.te.ui.commands.category"
+ defaultHandler="org.eclipse.tcf.te.ui.wizards.newWizard.NewWizardCommandHandler"
+ description="%command.newWizards.description"
+ helpContextId="org.eclipse.tcf.te.ui.command_NewWizards"
+ name="%command.newWizards.name">
+ </command>
+
+ <command
+ id="org.eclipse.tcf.te.ui.command.refresh"
+ categoryId="org.eclipse.tcf.te.ui.commands.category"
+ description="%command.refresh.description"
+ helpContextId="org.eclipse.tcf.te.ui.command_Refresh"
+ name="%command.refresh.name">
+ </command>
+
+ <command
+ id="org.eclipse.tcf.te.ui.command.showConsoleView"
+ categoryId="org.eclipse.tcf.te.ui.commands.category"
+ description="%command.showConsoleView.description"
+ helpContextId="org.eclipse.tcf.te.ui.command_ShowConsoleView"
+ name="%command.showConsoleView.name">
+ </command>
+
+ <command
+ id="org.eclipse.tcf.te.ui.command.connect"
+ categoryId="org.eclipse.tcf.te.ui.commands.category"
+ helpContextId="org.eclipse.tcf.te.ui.command_Connect"
+ description="%command.connect.description"
+ name="%command.connect.name">
+ </command>
+
+ <command
+ id="org.eclipse.tcf.te.ui.editor.command.connect"
+ categoryId="org.eclipse.tcf.te.ui.commands.category"
+ helpContextId="org.eclipse.tcf.te.ui.command_Connect"
+ description="%command.connect.description"
+ name="%command.connect.name">
+ </command>
+
+ <command
+ id="org.eclipse.tcf.te.ui.command.disconnect"
+ categoryId="org.eclipse.tcf.te.ui.commands.category"
+ helpContextId="org.eclipse.tcf.te.ui.command_Disconnect"
+ description="%command.disconnect.description"
+ name="%command.disconnect.name">
+ </command>
+
+ <command
+ id="org.eclipse.tcf.te.ui.editor.command.disconnect"
+ categoryId="org.eclipse.tcf.te.ui.commands.category"
+ helpContextId="org.eclipse.tcf.te.ui.command_Disconnect"
+ description="%command.disconnect.description"
+ name="%command.disconnect.name">
+ </command>
+ </extension>
+
+<!-- Command image contributions -->
+ <extension point="org.eclipse.ui.commandImages">
+ <image
+ commandId="org.eclipse.tcf.te.ui.command.connect"
+ disabledIcon="icons/dlcl16/connect.gif"
+ icon="icons/elcl16/connect.gif">
+ </image>
+ <image
+ commandId="org.eclipse.tcf.te.ui.editor.command.connect"
+ disabledIcon="icons/dlcl16/connect.gif"
+ icon="icons/elcl16/connect.gif">
+ </image>
+ <image
+ commandId="org.eclipse.tcf.te.ui.command.disconnect"
+ disabledIcon="icons/dlcl16/disconnect.gif"
+ icon="icons/elcl16/disconnect.gif">
+ </image>
+ <image
+ commandId="org.eclipse.tcf.te.ui.editor.command.disconnect"
+ disabledIcon="icons/dlcl16/disconnect.gif"
+ icon="icons/elcl16/disconnect.gif">
+ </image>
+ <image
+ commandId="org.eclipse.tcf.te.ui.command.newWizards"
+ disabledIcon="icons/dlcl16/newtarget_wiz.gif"
+ icon="icons/elcl16/newtarget_wiz.gif">
+ </image>
+ <image
+ commandId="org.eclipse.tcf.te.ui.command.refresh"
+ disabledIcon="platform:/plugin/org.eclipse.ui/icons/full/dlcl16/refresh_nav.gif"
+ icon="platform:/plugin/org.eclipse.ui/icons/full/elcl16/refresh_nav.gif">
+ </image>
+ </extension>
+
+<!-- Command handler contributions -->
+ <extension point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.tcf.te.ui.handler.ShowConsoleViewCommandHandler"
+ commandId="org.eclipse.tcf.te.ui.command.showConsoleView">
+ </handler>
+
+ <handler commandId="org.eclipse.tcf.te.ui.command.connect">
+ <class class="org.eclipse.tcf.te.ui.handler.StepperCommandHandler">
+ <parameter name="operation" value="connect"/>
+ </class>
+ <activeWhen>
+ <with variable="systemManagerViewSelection">
+ <iterate operator="and" ifEmpty="false">
+ <adapt type="org.eclipse.tcf.te.runtime.model.interfaces.IModelNode">
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.runtime.services.hasService"
+ value="org.eclipse.tcf.te.runtime.stepper.interfaces.IStepperService"/>
+ <not>
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.runtime.stepper.isRunningOrCanceled"
+ value="connect"/>
+ </not>
+ <not>
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.runtime.stepper.isRunningOrCanceled"
+ value="disconnect"/>
+ </not>
+ </adapt>
+ </iterate>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <with variable="systemManagerViewSelection">
+ <count value="1"/>
+ <iterate operator="and" ifEmpty="false">
+ <adapt type="org.eclipse.tcf.te.runtime.model.interfaces.IModelNode">
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.runtime.stepper.isEnabled"
+ value="connect"/>
+ </adapt>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
+ <handler commandId="org.eclipse.tcf.te.ui.editor.command.connect">
+ <class class="org.eclipse.tcf.te.ui.handler.StepperCommandHandler">
+ <parameter name="operation" value="connect"/>
+ </class>
+ <activeWhen>
+ <with variable="activeEditorInput">
+ <adapt type="org.eclipse.tcf.te.runtime.model.interfaces.IModelNode">
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.runtime.services.hasService"
+ value="org.eclipse.tcf.te.runtime.stepper.interfaces.IStepperService"/>
+ <not>
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.runtime.stepper.isRunningOrCanceled"
+ value="connect"/>
+ </not>
+ <not>
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.runtime.stepper.isRunningOrCanceled"
+ value="disconnect"/>
+ </not>
+ </adapt>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <and>
+ <with variable="activeEditor">
+ <test property="org.eclipse.tcf.te.ui.views.isDirty" value="false"/>
+ </with>
+ <with variable="activeEditorInput">
+ <adapt type="org.eclipse.tcf.te.runtime.model.interfaces.IModelNode">
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.runtime.stepper.isEnabled"
+ value="connect"/>
+ </adapt>
+ </with>
+ </and>
+ </enabledWhen>
+ </handler>
+
+ <handler commandId="org.eclipse.tcf.te.ui.command.disconnect">
+ <class class="org.eclipse.tcf.te.ui.handler.StepperCommandHandler">
+ <parameter name="operation" value="disconnect"/>
+ </class>
+ <activeWhen>
+ <with variable="systemManagerViewSelection">
+ <iterate operator="and" ifEmpty="false">
+ <adapt type="org.eclipse.tcf.te.runtime.model.interfaces.IModelNode">
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.runtime.services.hasService"
+ value="org.eclipse.tcf.te.runtime.stepper.interfaces.IStepperService"/>
+ <not>
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.runtime.stepper.isRunningOrCanceled"
+ value="connect"/>
+ </not>
+ <not>
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.runtime.stepper.isRunningOrCanceled"
+ value="disconnect"/>
+ </not>
+ </adapt>
+ </iterate>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <with variable="systemManagerViewSelection">
+ <count value="1"/>
+ <iterate operator="and" ifEmpty="false">
+ <adapt type="org.eclipse.tcf.te.runtime.model.interfaces.IModelNode">
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.runtime.stepper.isEnabled"
+ value="disconnect"/>
+ </adapt>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
+ <handler commandId="org.eclipse.tcf.te.ui.editor.command.disconnect">
+ <class class="org.eclipse.tcf.te.ui.handler.StepperCommandHandler">
+ <parameter name="operation" value="disconnect"/>
+ </class>
+ <activeWhen>
+ <with variable="activeEditorInput">
+ <adapt type="org.eclipse.tcf.te.runtime.model.interfaces.IModelNode">
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.runtime.services.hasService"
+ value="org.eclipse.tcf.te.runtime.stepper.interfaces.IStepperService"/>
+ <not>
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.runtime.stepper.isRunningOrCanceled"
+ value="connect"/>
+ </not>
+ <not>
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.runtime.stepper.isRunningOrCanceled"
+ value="disconnect"/>
+ </not>
+ </adapt>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <with variable="activeEditorInput">
+ <adapt type="org.eclipse.tcf.te.runtime.model.interfaces.IModelNode">
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.runtime.stepper.isEnabled"
+ value="disconnect"/>
+ </adapt>
+ </with>
+ </enabledWhen>
+ </handler>
+
+ <handler commandId="org.eclipse.tcf.te.ui.command.disconnect">
+ <class class="org.eclipse.tcf.te.ui.handler.CancelStepperCommandHandler">
+ <parameter name="operation" value="connect"/>
+ </class>
+ <activeWhen>
+ <with variable="systemManagerViewSelection">
+ <iterate operator="and" ifEmpty="false">
+ <adapt type="org.eclipse.tcf.te.runtime.model.interfaces.IModelNode">
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.runtime.stepper.isRunning"
+ value="connect"/>
+ </adapt>
+ </iterate>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <with variable="systemManagerViewSelection">
+ <count value="1"/>
+ <iterate operator="and" ifEmpty="false">
+ <adapt type="org.eclipse.tcf.te.runtime.model.interfaces.IModelNode">
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.runtime.stepper.isRunning"
+ value="connect"/>
+ </adapt>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
+ <handler commandId="org.eclipse.tcf.te.ui.editor.command.disconnect">
+ <class class="org.eclipse.tcf.te.ui.handler.CancelStepperCommandHandler">
+ <parameter name="operation" value="connect"/>
+ </class>
+ <activeWhen>
+ <with variable="activeEditorInput">
+ <adapt type="org.eclipse.tcf.te.runtime.model.interfaces.IModelNode">
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.runtime.stepper.isRunning"
+ value="connect"/>
+ </adapt>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <with variable="activeEditorInput">
+ <adapt type="org.eclipse.tcf.te.runtime.model.interfaces.IModelNode">
+ <test forcePluginActivation="true"
+ property="org.eclipse.tcf.te.runtime.stepper.isRunning"
+ value="connect"/>
+ </adapt>
+ </with>
+ </enabledWhen>
+ </handler>
+ </extension>
+
+<!-- Context and binding contributions -->
+ <extension point="org.eclipse.ui.contexts">
+ <context
+ description="%context.view.description"
+ id="org.eclipse.tcf.te.ui.views.View"
+ name="%context.view.name"
+ parentId="org.eclipse.ui.contexts.window">
+ </context>
+ <context
+ description="%context.editor.description"
+ id="org.eclipse.tcf.te.ui.views.Editor"
+ name="%context.editor.name"
+ parentId="org.eclipse.ui.contexts.window">
+ </context>
+ </extension>
+
+ <extension point="org.eclipse.ui.bindings">
+ <key
+ commandId="org.eclipse.tcf.te.ui.command.newWizards"
+ contextId="org.eclipse.tcf.te.ui.views.View"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+N">
+ </key>
+
+ <key
+ commandId="org.eclipse.tcf.te.ui.command.refresh"
+ contextId="org.eclipse.tcf.te.ui.views.View"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="F5">
+ </key>
+
+ <key
+ commandId="org.eclipse.tcf.te.ui.command.refresh"
+ contextId="org.eclipse.tcf.te.ui.views.Editor"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="F5">
+ </key>
+ </extension>
+
+<!-- Status handler contributions -->
+ <extension point="org.eclipse.tcf.te.runtime.statushandler.handlers">
+ <handler
+ class="org.eclipse.tcf.te.ui.statushandler.DefaultStatusHandler"
+ id="org.eclipse.tcf.te.statushandler.default"
+ label="%DefaultStatusHandler.label">
+ </handler>
+ </extension>
+
+<!-- Executor service contributions -->
+ <extension point="org.eclipse.tcf.te.runtime.concurrent.executorServices">
+ <executorService
+ id="org.eclipse.tcf.te.ui.executors.SWTDisplay"
+ label="Eclipse Platform Display Executor"
+ class="org.eclipse.tcf.te.ui.internal.executors.SWTDisplayExecutor">
+ </executorService>
+ </extension>
+
+<!-- Executor utility delegate contributions -->
+ <extension point="org.eclipse.tcf.te.runtime.concurrent.executorUtilDelegates">
+ <executorUtilDelegate
+ class="org.eclipse.tcf.te.ui.internal.executors.SWTDisplayExecutorUtilDelegate"
+ id="org.eclipse.tcf.te.ui.executors.delegate.SWTDisplay"
+ label="%SWTDisplayExecutorUtilDelegate.label">
+ </executorUtilDelegate>
+ </extension>
+
+<!-- Event listener contributions -->
+ <extension point="org.eclipse.tcf.te.runtime.eventListeners">
+ <eventListener class="org.eclipse.tcf.te.ui.events.TriggerCommandEventListener">
+ <eventType class="org.eclipse.tcf.te.runtime.events.TriggerCommandEvent"/>
+ </eventListener>
+ </extension>
+
+<!-- Preference page contributions -->
+ <extension point="org.eclipse.ui.preferencePages">
+ <page
+ class="org.eclipse.tcf.te.ui.preferences.PreferencePage"
+ id="org.eclipse.tcf.te.ui.preferences.general"
+ name="%preference.page.name">
+ </page>
+ </extension>
+
+<!-- Preference contributions -->
+ <extension point="org.eclipse.core.runtime.preferences">
+ <initializer class="org.eclipse.tcf.te.ui.preferences.PreferencesInitializer"/>
+ </extension>
+
+</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/handler/CancelStepperCommandHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/handler/CancelStepperCommandHandler.java new file mode 100644 index 000000000..fa07350e6 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/handler/CancelStepperCommandHandler.java @@ -0,0 +1,90 @@ +/*******************************************************************************
+ * Copyright (c) 2013 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.handler;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExecutableExtension;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.services.ServiceManager;
+import org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService;
+import org.eclipse.tcf.te.runtime.stepper.job.StepperJob;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.part.EditorPart;
+
+/**
+ * Cancel stepper command handler implementation.
+ */
+public class CancelStepperCommandHandler extends AbstractHandler implements IExecutableExtension {
+
+ private String operation = null;
+
+ /* (non-Javadoc)
+ * @see com.windriver.te.tcf.ui.handler.AbstractAgentCommandHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ Assert.isNotNull(operation);
+
+ // Get the active part
+ IWorkbenchPart part = HandlerUtil.getActivePart(event);
+ // Get the current selection
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+
+ // If the handler is invoked from an editor part, ignore the selection and
+ // construct an artificial selection from the active editor input.
+ if (part instanceof EditorPart) {
+ IEditorInput input = ((EditorPart)part).getEditorInput();
+ Object element = input != null ? input.getAdapter(Object.class) : null;
+ if (element != null) {
+ selection = new StructuredSelection(element);
+ }
+ }
+
+ // If the selection is not empty, iterate over the selection and execute
+ // the operation for each peer model node in the selection.
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ Iterator<?> iterator = ((IStructuredSelection)selection).iterator();
+ while (iterator.hasNext()) {
+ final Object element = iterator.next();
+ IPropertiesAccessService service = ServiceManager.getInstance().getService(element, IPropertiesAccessService.class);
+ StepperJob job = service != null ? (StepperJob)service.getProperty(element, StepperJob.class.getName() + "." + operation) : null; //$NON-NLS-1$
+ if (service == null && element instanceof IPropertiesContainer)
+ job = (StepperJob)((IPropertiesContainer)element).getProperty(StepperJob.class.getName() + "." + operation); //$NON-NLS-1$
+ if (job != null)
+ job.cancel();
+ }
+ }
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
+ */
+ @Override
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
+ if (data instanceof Map && ((Map<?,?>)data).get("operation") instanceof String) { //$NON-NLS-1$
+ this.operation = ((Map<?,?>)data).get("operation").toString(); //$NON-NLS-1$
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/handler/StepperCommandHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/handler/StepperCommandHandler.java new file mode 100644 index 000000000..5aacb23d1 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/handler/StepperCommandHandler.java @@ -0,0 +1,103 @@ +/*******************************************************************************
+ * Copyright (c) 2013 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.handler;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExecutableExtension;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+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.stepper.interfaces.IStepContext;
+import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepperService;
+import org.eclipse.tcf.te.runtime.stepper.job.StepperJob;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.part.EditorPart;
+
+/**
+ * Stepper command handler implementation.
+ */
+public class StepperCommandHandler extends AbstractHandler implements IExecutableExtension {
+
+ private String operation = null;
+
+ /* (non-Javadoc)
+ * @see com.windriver.te.tcf.ui.handler.AbstractAgentCommandHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ Assert.isNotNull(operation);
+
+ // Get the active part
+ IWorkbenchPart part = HandlerUtil.getActivePart(event);
+ // Get the current selection
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+
+ // If the handler is invoked from an editor part, ignore the selection and
+ // construct an artificial selection from the active editor input.
+ if (part instanceof EditorPart) {
+ IEditorInput input = ((EditorPart)part).getEditorInput();
+ Object element = input != null ? input.getAdapter(Object.class) : null;
+ if (element != null) {
+ selection = new StructuredSelection(element);
+ }
+ }
+
+ // If the selection is not empty, iterate over the selection and execute
+ // the operation for each peer model node in the selection.
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ Iterator<?> iterator = ((IStructuredSelection)selection).iterator();
+ while (iterator.hasNext()) {
+ final Object element = iterator.next();
+ IStepperService service = ServiceManager.getInstance().getService(element, IStepperService.class);
+ if (service != null) {
+ String stepGroupId = service.getStepGroupId(element, operation);
+ IStepContext stepContext = service.getStepContext(element, operation);
+ String name = service.getStepGroupName(element, operation);
+
+ if (stepGroupId != null && stepContext != null) {
+ IPropertiesContainer data = new PropertiesContainer();
+ StepperJob job = new StepperJob(name != null ? name : "", //$NON-NLS-1$
+ stepContext,
+ data,
+ stepGroupId,
+ operation);
+
+ job.schedule();
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
+ */
+ @Override
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
+ if (data instanceof Map && ((Map<?,?>)data).get("operation") instanceof String) { //$NON-NLS-1$
+ this.operation = ((Map<?,?>)data).get("operation").toString(); //$NON-NLS-1$
+ }
+ }
+}
|