eclipse-platform / eclipse-platform/eclipse.platform

DefaultHelpUI.displayContext() overwrites IContext method parameter (regression from bug 533828)

Open
#858 8 comments 0 reactions 0 assignees View on GitHub
regression
Dominant language
Java
Stars
165
Forks
174
Avg merge
2d 8h
Merged PRs (30d)
22

Description

## Current Situation

The `DefaultHelpUI` has a regression from [Bug 533828](https://bugs.eclipse.org/bugs/show_bug.cgi?id=533828). While the `displayContext(IContext, int, int, boolean)` method allowed to show contents according to the `IContext` passed to the method, it is now only able to show contents according to the help attached to the currently focussed control, if available.

The following example project adds a toolbar button to the problems view, which is supposed to open context-sensitive help for that view.

[BrokenHelpContents.zip](https://github.com/eclipse-platform/eclipse.platform/files/13368526/BrokenHelpContents.zip)

However, the current functionality will always open the general help attached to the problems view:

![context-help-broken](https://github.com/eclipse-platform/eclipse.platform/assets/755472/1cb77c7d-95b6-4b59-ad21-934eae4bd767)

The old implementation properly considers the passed context:

![context-help-proper](https://github.com/eclipse-platform/eclipse.platform/assets/755472/0c638106-3983-446a-b4be-8d84d9845fb0)

The example is a derivation of the one provided for concerns within [comment 24 of the original bug report](https://bugs.eclipse.org/bugs/show_bug.cgi?id=533828#c24)

## Expected Behavior

The `DefaultHelpUI` is expected to consider the passed context like before the changes for bug 533828. Still, it should incorporate the fix for the addressed issue of bug 533828.

## Additional Information

This is a copy of bug [Bug 572804](https://bugs.eclipse.org/bugs/show_bug.cgi?id=572804) that already documented the regression from [Bug 533828](https://bugs.eclipse.org/bugs/show_bug.cgi?id=533828). I repost it here because it's a pressing issue for us, which we will address soon.

> The DefaultUI class simply overwrites the passed IContext in org.eclipse.help.ui.internal.DefaultHelpUI.displayContext(IContext, int, int, boolean) line 333.

> This behaviour is a major change of the simple function of "simply displaying" the passed context.

> This change was introduced by Bug ID 533828 and it does not seem to be right. Even though the way to get the desired context using the IContextProvider.getContext(Object target) may be correct it is not the task of this method to retrieve it and overwrite the original passed IContext.
> This change made it impossible to display custom build help contexts when there is a context provider present for the active part.

> Further, the help context is only overwritten when displayed within the workbench. When the user sets the IHelpBaseConstants.P_KEY_WINDOW_INFOPOP in the preference store the original passed context is displayed in an extra window (Line 325). This seems to be inconsitent to overwrite the context in one case an d display the original context in another.

@jcompagner Since you have provided the original fix for bug 533828, I would like to contact you as soon as we make progress on this to ensure that the original bug remains fixed for you. In case you have an idea how deal with this regression since you have already worked on the issue, I would of course appreciate your input 🙂

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.