Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Tasse2019-07-09 17:13:32 -0400
committerPatrick Tasse2019-07-09 17:13:32 -0400
commit21b546fc7285881c1d7f96403de07a2cd8a0da9e (patch)
tree21d3853ef580ba9fafe17a57efdee7b2f65bf328
parent572e821736866664e5a63abad7a6bf72e6255631 (diff)
downloadorg.eclipse.swtbot-21b546fc7285881c1d7f96403de07a2cd8a0da9e.tar.gz
org.eclipse.swtbot-21b546fc7285881c1d7f96403de07a2cd8a0da9e.tar.xz
org.eclipse.swtbot-21b546fc7285881c1d7f96403de07a2cd8a0da9e.zip
Bug 549123: Support SWTBotPerspective.close()
Change-Id: Ice81d3aa4f3302a08f68148a4e957bda91e4e949 Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
-rw-r--r--org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotPerspective.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotPerspective.java b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotPerspective.java
index f6c43643..819b877c 100644
--- a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotPerspective.java
+++ b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotPerspective.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 SWTBot Committers and others
+ * Copyright (c) 2009, 2019 SWTBot Committers 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
@@ -63,6 +63,23 @@ public class SWTBotPerspective {
}
/**
+ * Closes the perspective.
+ */
+ public void close() {
+ UIThreadRunnable.syncExec(new VoidResult() {
+ @Override
+ public void run() {
+ try {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ workbench.getActiveWorkbenchWindow().getActivePage().closePerspective(perspectiveDescriptor, false, false);
+ } catch (Exception e) {
+ throw new WidgetNotFoundException(e.getMessage(), e);
+ }
+ }
+ });
+ }
+
+ /**
* @return true if this perspective is active in the active workbench page
*/
public boolean isActive() {

Back to the top