Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimeon Andreev2020-08-05 10:17:06 +0000
committerAndrey Loskutov2020-08-05 20:57:29 +0000
commit5d3ad17f0ce93bd4406872f503d626416a363991 (patch)
treeb69f5f4aaad3ccd4bca36d5b51714f8d462be2ec
parent2417c6a09bf8172439b1e70cc9236277437347f0 (diff)
downloadeclipse.platform.ua-5d3ad17f0ce93bd4406872f503d626416a363991.tar.gz
eclipse.platform.ua-5d3ad17f0ce93bd4406872f503d626416a363991.tar.xz
eclipse.platform.ua-5d3ad17f0ce93bd4406872f503d626416a363991.zip
Bug 565674 - Cheat Sheets view doesn't open via Help > Cheat SheetsI20200805-1800
Accessing cheat sheets via 'Help > Cheat Sheets...' does not open the Cheat Sheets view. This is due to CheatSheetCategoryBasedSelectionDialog.okPressed() hiding the shell of the dialog and OpenCheatSheetAction using the active shell as parent, in addition to the fix for bug 563555. Hiding the shell no longer results in changing the active shell, and so the cheat sheet has the hidden shell as a parent. As a result, nothing is shown to the user. This change adds a new public method, with which the parent shell of OpenCheatSheetAction can be specified. This is then used in CheatSheetCategoryBasedSelectionDialog to pass the parent shell to OpenCheatSheetAction. Change-Id: I494dbb7d7865fd504d17a007617658f2472de192 Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
-rw-r--r--org.eclipse.ui.cheatsheets/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.ui.cheatsheets/pom.xml2
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/cheatsheets/OpenCheatSheetAction.java23
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java8
4 files changed, 30 insertions, 5 deletions
diff --git a/org.eclipse.ui.cheatsheets/META-INF/MANIFEST.MF b/org.eclipse.ui.cheatsheets/META-INF/MANIFEST.MF
index e654bc100..848b75208 100644
--- a/org.eclipse.ui.cheatsheets/META-INF/MANIFEST.MF
+++ b/org.eclipse.ui.cheatsheets/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %PLUGIN_NAME
Bundle-SymbolicName: org.eclipse.ui.cheatsheets; singleton:=true
-Bundle-Version: 3.6.0.qualifier
+Bundle-Version: 3.7.0.qualifier
Bundle-Activator: org.eclipse.ui.internal.cheatsheets.CheatSheetPlugin
Bundle-Vendor: %PROVIDER_NAME
Bundle-Localization: plugin
diff --git a/org.eclipse.ui.cheatsheets/pom.xml b/org.eclipse.ui.cheatsheets/pom.xml
index 3f9d57eca..6ea6e7145 100644
--- a/org.eclipse.ui.cheatsheets/pom.xml
+++ b/org.eclipse.ui.cheatsheets/pom.xml
@@ -19,7 +19,7 @@
</parent>
<groupId>org.eclipse.ui</groupId>
<artifactId>org.eclipse.ui.cheatsheets</artifactId>
- <version>3.6.0-SNAPSHOT</version>
+ <version>3.7.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/cheatsheets/OpenCheatSheetAction.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/cheatsheets/OpenCheatSheetAction.java
index 837d930e0..4bccc164e 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/cheatsheets/OpenCheatSheetAction.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/cheatsheets/OpenCheatSheetAction.java
@@ -43,6 +43,7 @@ public final class OpenCheatSheetAction extends Action {
private URL url;
private String xml;
private String basePath;
+ private Shell targetShell;
/**
* Creates an action that opens the cheat sheet with the given id.
@@ -116,7 +117,7 @@ public final class OpenCheatSheetAction extends Action {
*/
@Override
public void run() {
- Shell shell = Display.getDefault().getActiveShell();
+ Shell shell = getShell();
// are we in a dialog that can show a cheat sheet?
if (shell != null && !shell.isFocusControl() && shell.getData() instanceof TrayDialog) {
TrayDialog dialog = (TrayDialog)shell.getData();
@@ -153,4 +154,24 @@ public final class OpenCheatSheetAction extends Action {
page.bringToTop(view);
}
}
+
+ /**
+ * Sets the shell in which the cheat sheet is opened. If this is not set,
+ * the active shell of the default display is used.
+ *
+ * @param shell
+ * The shell in which the cheat sheet is opened.
+ * @since 3.7
+ */
+ public void setTargetShell(Shell shell) {
+ this.targetShell = shell;
+ }
+
+ private Shell getShell() {
+ Shell shell = targetShell;
+ if (shell == null) {
+ shell = Display.getDefault().getActiveShell();
+ }
+ return shell;
+ }
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java
index 9570ba265..ecc3302d6 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java
@@ -571,7 +571,9 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends
.getTriggerPoint(ICheatSheetResource.TRIGGER_POINT_ID);
if (WorkbenchActivityHelper.allowUseOf(triggerPoint,
currentSelection)) {
- new OpenCheatSheetAction(currentSelection.getID()).run();
+ OpenCheatSheetAction openCheatSheetAction = new OpenCheatSheetAction(currentSelection.getID());
+ openCheatSheetAction.setTargetShell(getParentShell());
+ openCheatSheetAction.run();
}
}
}
@@ -591,7 +593,9 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends
try {
File contentFile = new File(selectFileCombo.getText());
url = contentFile.toURI().toURL();
- new OpenCheatSheetAction(id, id ,url).run();
+ OpenCheatSheetAction openCheatSheetAction = new OpenCheatSheetAction(id, id, url);
+ openCheatSheetAction.setTargetShell(getParentShell());
+ openCheatSheetAction.run();
opened = true;
} catch (MalformedURLException e) {
opened = false;

Back to the top