Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Goldthorpe2010-11-01 16:47:34 +0000
committerChris Goldthorpe2010-11-01 16:47:34 +0000
commite8ffae9abdd2b00bc4af1a3eebe1191d2815cd29 (patch)
tree843393287543467d4f727958c79a6c10130744e5
parentb7a2ee62e320c0f138a447242b389498f857e13a (diff)
downloadeclipse.platform.ua-e8ffae9abdd2b00bc4af1a3eebe1191d2815cd29.tar.gz
eclipse.platform.ua-e8ffae9abdd2b00bc4af1a3eebe1191d2815cd29.tar.xz
eclipse.platform.ua-e8ffae9abdd2b00bc4af1a3eebe1191d2815cd29.zip
Bug 328953 - [Cheatsheet] Using e4 SDK Commands launched from cheat sheets not workingv20101101
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/ExecuteCommandAction.java4
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/TestCommandExecution.java18
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CommandRunner.java6
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURL.java4
4 files changed, 23 insertions, 9 deletions
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/ExecuteCommandAction.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/ExecuteCommandAction.java
index 116919f0c..3de23d128 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/ExecuteCommandAction.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/ExecuteCommandAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 2010 IBM Corporation 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
@@ -112,7 +112,7 @@ public class ExecuteCommandAction implements ILiveHelpAction {
ICommandService commandService = getCommandService();
IHandlerService handlerService = getHandlerService();
ParameterizedCommand command = commandService.deserialize(serializedCommand);
- command.executeWithChecks(null, handlerService.getCurrentState());
+ handlerService.executeCommand(command, null);
} catch (CommandException ex) {
HelpUIPlugin.logError("There was an error executing the command: " + serializedCommand, ex); //$NON-NLS-1$
}
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/TestCommandExecution.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/TestCommandExecution.java
index 5962e32e2..73f239928 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/TestCommandExecution.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/TestCommandExecution.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 2010 IBM Corporation 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
@@ -24,7 +24,9 @@ import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.ua.tests.plugin.UserAssistanceTestPlugin;
import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.internal.cheatsheets.CommandRunner;
import org.eclipse.ui.internal.cheatsheets.data.CheatSheetCommand;
import org.eclipse.ui.internal.cheatsheets.registry.CheatSheetElement;
@@ -69,6 +71,18 @@ public class TestCommandExecution extends TestCase {
return null;
}
+ private IHandlerService getHandlerService() {
+ IWorkbench wb = PlatformUI.getWorkbench();
+ if (wb != null) {
+ Object serviceObject = wb.getAdapter(IHandlerService.class);
+ if (serviceObject != null) {
+ IHandlerService service = (IHandlerService)serviceObject;
+ return service;
+ }
+ }
+ return null;
+ }
+
/**
* Execute a command without using the command runner class
*/
@@ -76,7 +90,7 @@ public class TestCommandExecution extends TestCase {
ParameterizedCommand selectedCommand;
try {
selectedCommand = getService().deserialize(SERIALIZED_COMMAND);
- selectedCommand.executeWithChecks(null, null);
+ getHandlerService().executeCommand(selectedCommand, null);
} catch (NotDefinedException e) {
fail("Command not defined");
} catch (SerializationException e) {
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CommandRunner.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CommandRunner.java
index fa0594b85..a41fa429e 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CommandRunner.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CommandRunner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2010 IBM Corporation 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
@@ -79,8 +79,8 @@ public class CommandRunner {
try {
String substitutedSerialization = csm.performVariableSubstitution(rawSerialization);
selectedCommand = commandService.deserialize(substitutedSerialization);
- IEvaluationContext state = handlerService.getCurrentState();
- result = selectedCommand.executeWithChecks(null, state);
+ result = handlerService.executeCommand(selectedCommand, null);
+
String returnsAttribute = command.getReturns();
if ((returnsAttribute != null) && (result != null)) {
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURL.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURL.java
index 66059b21d..ffde98c9c 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURL.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURL.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 2010 IBM Corporation 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
@@ -324,7 +324,7 @@ public class IntroURL implements IIntroURL {
try {
ParameterizedCommand pCommand = commandService.deserialize(command);
- pCommand.executeWithChecks(null, handlerService.getCurrentState());
+ handlerService.executeCommand(pCommand, null);
// Executed command successfully. Now set intro standby if needed.
if (standbyState == null)

Back to the top