Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Compagner2018-04-19 16:28:00 +0000
committerLars Vogel2019-12-17 16:33:05 +0000
commit92bbc9d49d2378e04ec24fe15840374b7c23dc3c (patch)
treead1fffa842ec82c06dd4571a76c6e6506fa6b3a3
parent59ea3827679a488ce69b8cf3882d3b788ca7303e (diff)
downloadeclipse.platform.ua-92bbc9d49d2378e04ec24fe15840374b7c23dc3c.tar.gz
eclipse.platform.ua-92bbc9d49d2378e04ec24fe15840374b7c23dc3c.tar.xz
eclipse.platform.ua-92bbc9d49d2378e04ec24fe15840374b7c23dc3c.zip
Bug 533828 - DefaultHelpUI is inconsitent and doesn't always show theI20191218-1805I20191218-0015I20191217-1800
right help in the same way Change-Id: Icd77d6a86e3410d1854342a1b3efa6c44a27c7f5 Signed-off-by: Johan Compagner <jcompagner@gmail.com>
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/DefaultHelpUI.java16
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ReusableHelpPart.java22
2 files changed, 28 insertions, 10 deletions
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/DefaultHelpUI.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/DefaultHelpUI.java
index af046ffe2..b41979787 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/DefaultHelpUI.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/DefaultHelpUI.java
@@ -20,6 +20,7 @@ import java.net.URLEncoder;
import org.eclipse.core.runtime.Platform;
import org.eclipse.help.IContext;
+import org.eclipse.help.IContextProvider;
import org.eclipse.help.IHelpResource;
import org.eclipse.help.browser.IBrowser;
import org.eclipse.help.internal.base.BaseHelpSystem;
@@ -325,10 +326,15 @@ public class DefaultHelpUI extends AbstractHelpUI {
return;
}
try {
- /*
- * If the context help has no description text and exactly one
- * topic, go straight to the topic and skip context help.
- */
+ IWorkbenchPart activePart = page.getActivePart();
+ Control c = window.getShell().getDisplay().getFocusControl();
+ IContextProvider adapter = activePart.getAdapter(IContextProvider.class);
+ if (adapter != null)
+ context = adapter
+ .getContext(c); /*
+ * If the context help has no description text and exactly one
+ * topic, go straight to the topic and skip context help.
+ */
String contextText = context.getText();
IHelpResource[] topics = context.getRelatedTopics();
boolean isSingleChoiceWithoutDescription = contextText == null && topics.length == 1;
@@ -339,8 +345,6 @@ public class DefaultHelpUI extends AbstractHelpUI {
} else if (isSingleChoiceWithoutDescription && IHelpBaseConstants.P_IN_BROWSER.equals(openMode)) {
BaseHelpSystem.getHelpDisplay().displayHelpResource(topics[0].getHref(), true);
} else {
- IWorkbenchPart activePart = page.getActivePart();
- Control c = window.getShell().getDisplay().getFocusControl();
openingHelpView = true;
IViewPart part = page.showView(HELP_VIEW_ID);
openingHelpView = false;
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ReusableHelpPart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ReusableHelpPart.java
index ec5366ad0..a623130df 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ReusableHelpPart.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ReusableHelpPart.java
@@ -1127,8 +1127,8 @@ public class ReusableHelpPart implements IHelpUIConstants,
}
public boolean isMonitoringContextHelp() {
- return currentPage != null
- && currentPage.getId().equals(HV_CONTEXT_HELP_PAGE);
+ return currentPage != null && (currentPage.getId().equals(HV_CONTEXT_HELP_PAGE)
+ || currentPage.getId().equals(HV_BROWSER_PAGE));
}
public Control getControl() {
@@ -1186,8 +1186,22 @@ public class ReusableHelpPart implements IHelpUIConstants,
* @param isExplicitRequest is true if this is the result of a direct user request such as
* pressing F1 and false if it is in response to a focus change listener
*/
- public void update(IContextProvider provider, IContext context, IWorkbenchPart part,
- Control control, boolean isExplicitRequest) {
+ public void update(IContextProvider provider, IContext context, IWorkbenchPart part, Control control,
+ boolean isExplicitRequest) {
+ IContext realContext = context;
+ if (provider != null) {
+ realContext = provider.getContext(control);
+ }
+ if (realContext != null) {
+ String contextText = realContext.getText();
+ IHelpResource[] topics = realContext.getRelatedTopics();
+ if (contextText == null && topics.length == 1) {
+ showURL(topics[0].getHref());
+ return;
+ }
+ }
+ // Ensure that context help is currently showing
+ showPage(IHelpUIConstants.HV_CONTEXT_HELP_PAGE);
mform.setInput(new ContextHelpProviderInput(provider, context, control, part, isExplicitRequest));
}

Back to the top