Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepperOperationService.java18
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/services/AbstractStepperOperationService.java7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/utils/StepperHelper.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nodes/PeerNode.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/META-INF/MANIFEST.MF1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml16
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/delegates/AbstractDefaultContextToolbarDelegate.java60
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/ActionHistoryToolbarContribution.java101
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DefaultContextActionsToolbarContribution.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/interfaces/IDefaultContextToolbarDelegate.java35
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/PropertyTester.java26
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/services/DefaultContextService.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/AbstractNewConfigWizard.java43
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/handler/AbstractStepperCommandHandler.java63
16 files changed, 269 insertions, 124 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepperOperationService.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepperOperationService.java
index 2973fbdb6..0035fc365 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepperOperationService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepperOperationService.java
@@ -57,15 +57,6 @@ public interface IStepperOperationService extends IService {
public IStepContext getStepContext(Object context, String operation);
/**
- * Get the step data for the given context and operation.
- *
- * @param context The context. Must not be <code>null</code>.
- * @param operation The operation. Must not be <code>null</code>.
- * @return The step data or an empty properties container.
- */
- public IPropertiesContainer getStepData(Object context, String operation);
-
- /**
* Get the enabled state for the given operation.
*
* @param context The context. Must not be <code>null</code>.
@@ -81,4 +72,13 @@ public interface IStepperOperationService extends IService {
* @return <code>true</code> if the operation can be canceled.
*/
public boolean isCancelable(Object context, String operation);
+
+ /**
+ * Validates the step data to be used for the given context and operation.
+ * @param context The context. Must not be <code>null</code>.
+ * @param operation The operation. Must not be <code>null</code>.
+ * @param data The step data to be validated.
+ * @return <code>true</code> if the step data is valid.
+ */
+ public boolean validateStepData(Object context, String operation, IPropertiesContainer data);
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/services/AbstractStepperOperationService.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/services/AbstractStepperOperationService.java
index a3bc1370a..b6f53dee9 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/services/AbstractStepperOperationService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/services/AbstractStepperOperationService.java
@@ -13,7 +13,6 @@ package org.eclipse.tcf.te.runtime.stepper.services;
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.properties.PropertiesContainer;
import org.eclipse.tcf.te.runtime.services.AbstractService;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepperOperationService;
@@ -43,10 +42,10 @@ public abstract class AbstractStepperOperationService extends AbstractService im
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepperOperationService#getStepData(java.lang.Object, java.lang.String)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepperOperationService#validateStepData(java.lang.Object, java.lang.String, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
*/
@Override
- public IPropertiesContainer getStepData(Object context, String operation) {
- return new PropertiesContainer();
+ public boolean validateStepData(Object context, String operation, IPropertiesContainer data) {
+ return true;
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/utils/StepperHelper.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/utils/StepperHelper.java
index a39fb7f29..1957cccc0 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/utils/StepperHelper.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/utils/StepperHelper.java
@@ -36,12 +36,11 @@ public final class StepperHelper {
return stepperOperationService;
}
- public static final void scheduleStepperJob(Object context, String operation, IStepperOperationService service, ICallback callback, IProgressMonitor monitor) {
+ public static final void scheduleStepperJob(Object context, String operation, IStepperOperationService service, IPropertiesContainer data, ICallback callback, IProgressMonitor monitor) {
IStepContext stepContext = service.getStepContext(context, operation);
String stepGroupId = service.getStepGroupId(context, operation);
String name = service.getStepGroupName(context, operation);
boolean isCancelable = service.isCancelable(context, operation);
- IPropertiesContainer data = service.getStepData(context, operation);
if (stepGroupId != null && stepContext != null) {
StepperJob job = new StepperJob(name != null ? name : "", //$NON-NLS-1$
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nodes/PeerNode.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nodes/PeerNode.java
index 7ea2f6150..f96ef7cd2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nodes/PeerNode.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nodes/PeerNode.java
@@ -24,6 +24,7 @@ import org.eclipse.tcf.te.core.utils.ConnectStateHelper;
import org.eclipse.tcf.te.runtime.callback.Callback;
import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
import org.eclipse.tcf.te.runtime.model.ContainerModelNode;
+import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
import org.eclipse.tcf.te.runtime.services.ServiceManager;
import org.eclipse.tcf.te.runtime.services.interfaces.IDelegateService;
import org.eclipse.tcf.te.runtime.services.interfaces.IService;
@@ -387,7 +388,7 @@ public class PeerNode extends ContainerModelNode implements IPeerNode, IPeerNode
IStepperOperationService service = StepperHelper.getService(this, operation);
if (service != null) {
setConnectState(intermediateState);
- StepperHelper.scheduleStepperJob(this, operation, service, callback, monitor);
+ StepperHelper.scheduleStepperJob(this, operation, service, new PropertiesContainer(), callback, monitor);
}
else if (callback != null) {
callback.done(this, StatusHelper.getStatus(new NullPointerException("Missing stepper operation service for " + getName() + "."))); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/META-INF/MANIFEST.MF
index 44b23295a..eb727ce4f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/META-INF/MANIFEST.MF
@@ -35,6 +35,7 @@ Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Export-Package: org.eclipse.tcf.te.tcf.ui.activator,
org.eclipse.tcf.te.tcf.ui.controls,
+ org.eclipse.tcf.te.tcf.ui.delegates,
org.eclipse.tcf.te.tcf.ui.dialogs,
org.eclipse.tcf.te.tcf.ui.editor,
org.eclipse.tcf.te.tcf.ui.editor.controls,
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 2e0bd5831..ce16da572 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
@@ -90,5 +90,8 @@ command.launch.label=Launch Terminal...
command.launch.mnemonic=L
command.launch.tooltip=Opens a terminal on the selected target.
+command.history.label=Action History
+command.history.tooltip=Press 'CTRL' to open an action in the edit dialog.
+
toolbar.label=System Management
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 8585d982a..4b9453eed 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
@@ -68,7 +68,7 @@
class="org.eclipse.tcf.te.tcf.ui.internal.PropertyTester"
id="org.eclipse.tcf.te.tcf.ui.propertyTester.simulator"
namespace="org.eclipse.tcf.te.tcf.ui"
- properties="isValidSimulatorConfig,canDelete"
+ properties="isValidSimulatorConfig,canDelete,hasHistory"
type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode">
</propertyTester>
</extension>
@@ -610,6 +610,20 @@
</control>
</menuContribution>
+ <menuContribution locationURI="menu:org.eclipse.tcf.te.tcf.ui.DefaultContextActionsToolbarContribution?after=group.history">
+ <menu
+ label="%command.history.label"
+ tooltip="%command.history.tooltip">
+ <dynamic
+ class="org.eclipse.tcf.te.tcf.ui.handler.ActionHistoryToolbarContribution"
+ id="org.eclipse.tcf.te.tcf.ui.ActionHistoryToolbarContribution"/>
+ <visibleWhen>
+ <with variable="defaultContextSelection">
+ <test property="org.eclipse.tcf.te.tcf.ui.hasHistory"/>
+ </with>
+ </visibleWhen>
+ </menu>
+ </menuContribution>
<menuContribution locationURI="menu:org.eclipse.tcf.te.tcf.ui.DefaultContextActionsToolbarContribution?after=group.launch.rundebug">
<command commandId="org.eclipse.tcf.te.tcf.ui.toolbar.command.debug">
<visibleWhen checkEnabled="false">
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/delegates/AbstractDefaultContextToolbarDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/delegates/AbstractDefaultContextToolbarDelegate.java
new file mode 100644
index 000000000..b6d416f6e
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/delegates/AbstractDefaultContextToolbarDelegate.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.ui.delegates;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+import org.eclipse.tcf.te.tcf.ui.interfaces.IDefaultContextToolbarDelegate;
+
+/**
+ * AbstractDefaultContextToolbarDelegate
+ */
+public abstract class AbstractDefaultContextToolbarDelegate implements IDefaultContextToolbarDelegate {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.ui.interfaces.IDefaultContextToolbarDelegate#getToolbarNewConfigWizardIds(java.lang.Object)
+ */
+ @Override
+ public String[] getToolbarNewConfigWizardIds(Object context) {
+ return new String[0];
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.ui.interfaces.IDefaultContextToolbarDelegate#getToolbarHistoryIds(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode, java.lang.String[])
+ */
+ @Override
+ public String[] getToolbarHistoryIds(IPeerNode peerNode, String[] historyIds) {
+ return historyIds;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.ui.interfaces.IDefaultContextToolbarDelegate#getLabel(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode, java.lang.String, java.lang.String)
+ */
+ @Override
+ public String getLabel(IPeerNode peerNode, String historyId, String entry) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.ui.interfaces.IDefaultContextToolbarDelegate#getImageDescriptor(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode, java.lang.String, java.lang.String)
+ */
+ @Override
+ public ImageDescriptor getImageDescriptor(IPeerNode peerNode, String historyId, String entry) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.ui.interfaces.IDefaultContextToolbarDelegate#execute(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode, java.lang.String, java.lang.String, boolean)
+ */
+ @Override
+ public void execute(IPeerNode peerNode, String historyId, String entry, boolean showDialog) {
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/ActionHistoryToolbarContribution.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/ActionHistoryToolbarContribution.java
new file mode 100644
index 000000000..58f7572eb
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/ActionHistoryToolbarContribution.java
@@ -0,0 +1,101 @@
+package org.eclipse.tcf.te.tcf.ui.handler;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.tcf.te.core.interfaces.IConnectable;
+import org.eclipse.tcf.te.runtime.persistence.history.HistoryManager;
+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.IUIService;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+import org.eclipse.tcf.te.tcf.locator.interfaces.services.IDefaultContextService;
+import org.eclipse.tcf.te.tcf.ui.interfaces.IDefaultContextToolbarDelegate;
+import org.eclipse.ui.actions.CompoundContributionItem;
+import org.eclipse.ui.menus.IWorkbenchContribution;
+import org.eclipse.ui.services.IServiceLocator;
+
+public class ActionHistoryToolbarContribution extends CompoundContributionItem implements IWorkbenchContribution {
+
+ IServiceLocator serviceLocator;
+
+ @Override
+ public void initialize(IServiceLocator serviceLocator) {
+ this.serviceLocator = serviceLocator;
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
+
+ @Override
+ public boolean isDynamic() {
+ return true;
+ }
+
+ @Override
+ protected IContributionItem[] getContributionItems() {
+ List<IContributionItem> items = new ArrayList<IContributionItem>();
+ final IPeerNode peerNode = ServiceManager.getInstance().getService(IDefaultContextService.class).getDefaultContext(null);
+ boolean enabled = (peerNode != null && peerNode.getConnectState() == IConnectable.STATE_CONNECTED);
+
+ IService[] services = ServiceManager.getInstance().getServices(peerNode, IUIService.class, false);
+ Map<String, IDefaultContextToolbarDelegate> historyIds = new LinkedHashMap<String, IDefaultContextToolbarDelegate>();
+ String[] ids = new String[0];
+ for (IService service : services) {
+ if (service instanceof IUIService) {
+ IDefaultContextToolbarDelegate delegate = ((IUIService)service).getDelegate(peerNode, IDefaultContextToolbarDelegate.class);
+ if (delegate != null) {
+ ids = delegate.getToolbarHistoryIds(peerNode, ids);
+ for (String newId : ids) {
+ if (!historyIds.containsKey(newId)) {
+ historyIds.put(newId, delegate);
+ }
+ }
+ }
+ }
+ }
+
+ for (final String historyId : ids) {
+ String[] entries = HistoryManager.getInstance().getHistory(historyId);
+ final IDefaultContextToolbarDelegate delegate = historyIds.get(historyId);
+ if (entries != null && entries.length > 0) {
+ if (!items.isEmpty()) {
+ items.add(new Separator());
+ }
+ List<String> labels = new ArrayList<String>();
+ for (final String entry : entries) {
+ String label = delegate.getLabel(peerNode, historyId, entry);
+ if (labels.contains(label)) {
+ label += " ..."; //$NON-NLS-1$
+ }
+ else {
+ labels.add(label);
+ }
+ IAction action = new Action(label) {
+ @Override
+ public void runWithEvent(Event event) {
+ delegate.execute(peerNode, historyId, entry, (event.stateMask & SWT.CTRL) == SWT.CTRL);
+ }
+ };
+ action.setEnabled(enabled);
+ action.setImageDescriptor(delegate.getImageDescriptor(peerNode, historyId, entry));
+ IContributionItem item = new ActionContributionItem(action);
+ items.add(item);
+ }
+ }
+ }
+ return items.toArray(new IContributionItem[items.size()]);
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DefaultContextActionsToolbarContribution.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DefaultContextActionsToolbarContribution.java
index 05ac49302..e03ee008e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DefaultContextActionsToolbarContribution.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DefaultContextActionsToolbarContribution.java
@@ -13,6 +13,7 @@ package org.eclipse.tcf.te.tcf.ui.handler;
import java.util.EventObject;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.swt.SWT;
@@ -197,9 +198,13 @@ implements IWorkbenchContribution, IEventListener {
menuMgr.add(new Separator("group.connect")); //$NON-NLS-1$
menuMgr.add(new Separator("group.launch")); //$NON-NLS-1$
menuMgr.add(new Separator("group.launch.rundebug")); //$NON-NLS-1$
+ menuMgr.add(new Separator("group.history")); //$NON-NLS-1$
menuMgr.add(new Separator("group.additions")); //$NON-NLS-1$
final IMenuService service = (IMenuService) serviceLocator.getService(IMenuService.class);
service.populateContributionManager(menuMgr, "menu:" + getId()); //$NON-NLS-1$
+ for (IContributionItem item : menuMgr.getItems()) {
+ item.update();
+ }
menu = menuMgr.createContextMenu(panel);
}
catch (Exception e) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/interfaces/IDefaultContextToolbarDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/interfaces/IDefaultContextToolbarDelegate.java
index 4f13ac45b..157c068b4 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/interfaces/IDefaultContextToolbarDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/interfaces/IDefaultContextToolbarDelegate.java
@@ -10,6 +10,8 @@
package org.eclipse.tcf.te.tcf.ui.interfaces;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.ui.handler.DefaultContextSelectorToolbarContribution;
/**
@@ -27,8 +29,37 @@ public interface IDefaultContextToolbarDelegate {
/**
* Returns a list if history ids that should be used to diaply the "recently used actions" in the toolbar actions sub menu.
- * @param context The selected default context.
+ * @param peerNode The selected default context.
+ * @param historyIds
* @return Array of ids.
*/
- public String[] getToolbarHistoryIds(Object context);
+ public String[] getToolbarHistoryIds(IPeerNode peerNode, String[] historyIds);
+
+ /**
+ * Get the label for a history action.
+ * @param peerNode
+ * @param historyId
+ * @param entry
+ * @return
+ */
+ public String getLabel(IPeerNode peerNode, String historyId, String entry);
+
+ /**
+ * Get the image descriptor for a history action.
+ * @param peerNode
+ * @param historyId
+ * @param entry
+ * @return
+ */
+ public ImageDescriptor getImageDescriptor(IPeerNode peerNode, String historyId, String entry);
+
+ /**
+ * Execute a history action.
+ * Depending on showDialog, a dialog is shown first.
+ * @param peerNode
+ * @param historyId
+ * @param entry
+ * @param showDialog
+ */
+ public void execute(IPeerNode peerNode, String historyId, String entry, boolean showDialog);
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/PropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/PropertyTester.java
index c0ec484cd..e420ae047 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/PropertyTester.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/PropertyTester.java
@@ -15,12 +15,16 @@ import java.util.List;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.tcf.te.runtime.persistence.history.HistoryManager;
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.IUIService;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IDefaultContextService;
import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
import org.eclipse.tcf.te.tcf.locator.utils.SimulatorUtils;
import org.eclipse.tcf.te.tcf.ui.handler.DeleteHandler;
+import org.eclipse.tcf.te.tcf.ui.interfaces.IDefaultContextToolbarDelegate;
import org.eclipse.tcf.te.ui.views.navigator.nodes.NewWizardNode;
@@ -46,6 +50,28 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester
return testSelection(new StructuredSelection(receiver), property, args, expectedValue);
}
+ if ("hasHistory".equals(property) && receiver instanceof IPeerNode) { //$NON-NLS-1$
+ IPeerNode peerNode = (IPeerNode)receiver;
+ IService[] services = ServiceManager.getInstance().getServices(peerNode, IUIService.class, false);
+ for (IService service : services) {
+ if (service instanceof IUIService) {
+ IDefaultContextToolbarDelegate delegate = ((IUIService)service).getDelegate(peerNode, IDefaultContextToolbarDelegate.class);
+ if (delegate != null) {
+ String[] newIds = delegate.getToolbarHistoryIds(peerNode, new String[0]);
+ if (newIds != null) {
+ for (String newId : newIds) {
+ String[] entries = HistoryManager.getInstance().getHistory(newId);
+ if (entries != null && entries.length > 0) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
if ("isWizardId".equals(property) && receiver instanceof NewWizardNode) { //$NON-NLS-1$
return ((NewWizardNode)receiver).getWizardId().equals(expectedValue);
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/services/DefaultContextService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/services/DefaultContextService.java
index a0906a3b4..9f3996d67 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/services/DefaultContextService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/services/DefaultContextService.java
@@ -96,7 +96,7 @@ public class DefaultContextService extends AbstractService implements IDefaultCo
@Override
public IPeerNode getDefaultContext(IContextFilter filter) {
for (String peerId : HistoryManager.getInstance().getHistory(getClass().getName())) {
- IPeerNode peerNode = addCandidate(getPeerModel(peerId), filter, null);
+ IPeerNode peerNode = addCandidate(getPeerNode(peerId), filter, null);
if (peerNode != null) {
return peerNode;
}
@@ -136,13 +136,13 @@ public class DefaultContextService extends AbstractService implements IDefaultCo
List<IPeerNode> candidates = new ArrayList<IPeerNode>();
for (String peerId : HistoryManager.getInstance().getHistory(getClass().getName())) {
- addCandidate(getPeerModel(peerId), filter, candidates);
+ addCandidate(getPeerNode(peerId), filter, candidates);
}
return candidates.toArray(new IPeerNode[candidates.size()]);
}
- private IPeerNode getPeerModel(final String peerId) {
+ private IPeerNode getPeerNode(final String peerId) {
if (peerId != null) {
final AtomicReference<IPeerNode> peerNode = new AtomicReference<IPeerNode>();
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties
index 10f7cca53..db8da4f2f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties
@@ -156,7 +156,8 @@ DefaultContextSelectorToolbarContribution_tooltip_new=Click to create a new conn
DefaultContextSelectorToolbarContribution_label_new=New Connection...
DefaultContextSelectorToolbarContribution_tooltip_button=Click to change the default connection or create a new connection.
-DefaultContextActionsToolbarContribution_tooltip_button=Click to see actions for the selected default connection.
+DefaultContextActionsToolbarContribution_tooltip_button=Click to see actions for the selected default connection.\n\
+History actions can be edited by pressing 'CTRL'.
DefaultContextActionsToolbarContribution_tooltip_button_disabled=Please connect to see actions for the selected default connection.
DefaultContextActionsToolbarContribution_tooltip_button_noContext=Please create a new connection first.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/AbstractNewConfigWizard.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/AbstractNewConfigWizard.java
index f82e84922..ffb3401ce 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/AbstractNewConfigWizard.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/wizards/AbstractNewConfigWizard.java
@@ -12,17 +12,10 @@ package org.eclipse.tcf.te.tcf.ui.wizards;
import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.core.interfaces.IConnectable;
import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IService;
-import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
-import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepperOperationService;
-import org.eclipse.tcf.te.runtime.stepper.job.StepperJob;
-import org.eclipse.tcf.te.runtime.utils.StatusHelper;
-import org.eclipse.tcf.te.tcf.locator.interfaces.IStepperServiceOperations;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProperties;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IDefaultContextService;
@@ -93,39 +86,7 @@ public abstract class AbstractNewConfigWizard extends AbstractWizard implements
});
if (connect.get()) {
- IService[] services = ServiceManager.getInstance().getServices(peerNode, IStepperOperationService.class, false);
- IStepperOperationService stepperOperationService = null;
- for (IService service : services) {
- if (service instanceof IStepperOperationService && ((IStepperOperationService)service).isHandledOperation(peerNode, IStepperServiceOperations.CONNECT)) {
- stepperOperationService = (IStepperOperationService)service;
- break;
- }
- }
- if (stepperOperationService != null) {
- String stepGroupId = stepperOperationService.getStepGroupId(peerNode, IStepperServiceOperations.CONNECT);
- IStepContext stepContext = stepperOperationService.getStepContext(peerNode, IStepperServiceOperations.CONNECT);
- String name = stepperOperationService.getStepGroupName(peerNode, IStepperServiceOperations.CONNECT);
- IPropertiesContainer data = stepperOperationService.getStepData(peerNode, IStepperServiceOperations.CONNECT);
- boolean enabled = stepperOperationService.isEnabled(peerNode, IStepperServiceOperations.CONNECT);
-
- if (enabled && stepGroupId != null && stepContext != null) {
- try {
- StepperJob job = new StepperJob(name != null ? name : "", //$NON-NLS-1$
- stepContext,
- data,
- stepGroupId,
- IStepperServiceOperations.CONNECT,
- true,
- true);
-
- job.schedule();
- } catch (IllegalStateException e) {
- if (Platform.inDebugMode()) {
- UIPlugin.getDefault().getLog().log(StatusHelper.getStatus(e));
- }
- }
- }
- }
+ peerNode.changeConnectState(IConnectable.ACTION_CONNECT, null, null);
}
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/handler/AbstractStepperCommandHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/handler/AbstractStepperCommandHandler.java
index a174b9db6..f0774c86f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/handler/AbstractStepperCommandHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/handler/AbstractStepperCommandHandler.java
@@ -19,18 +19,12 @@ import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExecutableExtension;
-import org.eclipse.core.runtime.Platform;
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.IService;
-import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IStepperOperationService;
-import org.eclipse.tcf.te.runtime.stepper.job.StepperJob;
-import org.eclipse.tcf.te.runtime.utils.StatusHelper;
-import org.eclipse.tcf.te.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.runtime.stepper.utils.StepperHelper;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
@@ -63,16 +57,9 @@ public abstract class AbstractStepperCommandHandler extends AbstractCommandHandl
Object context = getContext(data);
- IStepperOperationService stepperOperationService = getStepperService(context, operation);
+ IStepperOperationService stepperOperationService = StepperHelper.getService(context, operation);
if (stepperOperationService != null) {
- IStepContext stepContext = stepperOperationService.getStepContext(context, operation);
- String stepGroupId = stepperOperationService.getStepGroupId(context, operation);
- String name = stepperOperationService.getStepGroupName(context, operation);
- boolean isCancelable = stepperOperationService.isCancelable(context, operation);
-
- if (stepGroupId != null && stepContext != null) {
- scheduleStepperJob(stepContext, cleanupData(data), stepGroupId, name, isCancelable);
- }
+ StepperHelper.scheduleStepperJob(context, operation, stepperOperationService, cleanupData(data), null, null);
}
return null;
@@ -103,25 +90,6 @@ public abstract class AbstractStepperCommandHandler extends AbstractCommandHandl
}
/**
- * Get the stepper service for the given context and operation.
- *
- * @param context The context.
- * @param operation The operation.
- * @return The stepper service or <code>null</code>.
- */
- protected IStepperOperationService getStepperService(Object context, String operation) {
- IService[] services = ServiceManager.getInstance().getServices(context, IStepperOperationService.class, false);
- IStepperOperationService stepperOperationService = null;
- for (IService service : services) {
- if (service instanceof IStepperOperationService && ((IStepperOperationService)service).isHandledOperation(context, operation)) {
- stepperOperationService = (IStepperOperationService)service;
- break;
- }
- }
- return stepperOperationService;
- }
-
- /**
* Get the selection for the handler execution.
*
* @param event The event.
@@ -153,31 +121,6 @@ public abstract class AbstractStepperCommandHandler extends AbstractCommandHandl
return (IStructuredSelection)selection;
}
- /**
- * Schedule the stepper job.
- * @param stepContext The step context.
- * @param data The execution data.
- * @param stepGroupId The step group id to execute.
- * @param name The job name.
- * @param isCancelable <code>true</code> if the job should be cancelable.
- */
- protected void scheduleStepperJob(IStepContext stepContext, IPropertiesContainer data, String stepGroupId, String name, boolean isCancelable) {
- try {
- StepperJob job = new StepperJob(name != null ? name : "", //$NON-NLS-1$
- stepContext,
- data,
- stepGroupId,
- operation,
- isCancelable,
- true);
- job.schedule();
- } catch (IllegalStateException e) {
- if (Platform.inDebugMode()) {
- UIPlugin.getDefault().getLog().log(StatusHelper.getStatus(e));
- }
- }
- }
-
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
*/

Back to the top