Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Keppler2019-01-19 17:32:45 +0000
committerMichael Keppler2019-02-05 06:55:11 +0000
commit83d739c1308dcc5647503ad0153d3ca4b0386ac5 (patch)
tree19210d266702dfe318a1b01c4082270a214dfd73 /org.eclipse.egit.ui.test/src/org/eclipse/egit
parentc34b1b4e2500c7e4b5b0044b1999e6d3601506b9 (diff)
downloadegit-83d739c1308dcc5647503ad0153d3ca4b0386ac5.tar.gz
egit-83d739c1308dcc5647503ad0153d3ca4b0386ac5.tar.xz
egit-83d739c1308dcc5647503ad0153d3ca4b0386ac5.zip
Replace deprecated SWTBotCommand
Since the SWTBotCommand usage was merely a thin wrapper around calling a command, we can replicate the deprecated code by executing the command directly. Change-Id: I3e2bf981c5312e37702f5aaea1a44058b3d3a4f0 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Diffstat (limited to 'org.eclipse.egit.ui.test/src/org/eclipse/egit')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/CommandEnablementTest.java20
1 files changed, 16 insertions, 4 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/CommandEnablementTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/CommandEnablementTest.java
index e5d88268b6..198f722e2c 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/CommandEnablementTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/CommandEnablementTest.java
@@ -21,12 +21,14 @@ import org.eclipse.egit.gitflow.ui.internal.UIText;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.internal.repository.RepositoriesView;
import org.eclipse.egit.ui.test.TestUtil;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotCommand;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.handlers.IHandlerService;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -112,9 +114,19 @@ public class CommandEnablementTest extends AbstractGitflowHandlerTest {
private void runCommand(String commandId) throws Exception {
- final Command command = getCommandService().getCommand(commandId);
- SWTBotCommand swtBotCommand = new SWTBotCommand(command);
- swtBotCommand.click();
+ IHandlerService handlerService = PlatformUI.getWorkbench()
+ .getService(IHandlerService.class);
+ UIThreadRunnable.asyncExec(new VoidResult() {
+ @Override
+ public void run() {
+ try {
+ handlerService.executeCommand(commandId, null);
+ } catch (Exception e) {
+ throw new RuntimeException(
+ "Failed to execute the command - " + commandId, e); //$NON-NLS-1$
+ }
+ }
+ });
}
@SuppressWarnings("boxing")

Back to the top