Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 545615

Summary: In the Problems view, the help icon should only show if help is really available
Product: [Eclipse Project] Platform Reporter: Tim Neumann <tim.neumann>
Component: UIAssignee: Tim Neumann <tim.neumann>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, karsten.thoms, loskutov, ma.becker
Version: 3.8.2   
Target Milestone: 4.12 M1   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/139209
https://bugs.eclipse.org/bugs/show_bug.cgi?id=122967
https://git.eclipse.org/r/139512
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=7ec315532f01dc7fcbc1bb60b2ee29ce81abae72
Whiteboard:
Attachments:
Description Flags
Screenshot Testproject
none
Example Project
karsten.thoms: iplog+
Example project none

Description Tim Neumann CLA 2019-03-21 04:55:44 EDT
Current situation:
If a marker has a help context id it will show with a little question mark besides its icon in the problem view.

Shortcomings of the current situation:
If a marker has a help context id but no valid help context the icon still shows, but no help will open.

Proposed solution:
Add a check to org.eclipse.ui.views.markers.MarkerField:annotateImage() which calls HelpSystem.getContext(contextId) and compares the result to null.

I plan to submit a patch shortly.
Comment 1 Eclipse Genie CLA 2019-03-21 05:11:33 EDT
New Gerrit change created: https://git.eclipse.org/r/139209
Comment 2 Dani Megert CLA 2019-03-21 12:36:26 EDT
Please provide steps to reproduce this and validate your fix.
Comment 3 Andrey Loskutov CLA 2019-03-25 08:12:30 EDT
Note: for the implementation we should take care of bug 122967 (RemoteContextProvider aka org.eclipse.help.internal.base.remote.RemoteHelp.isEnabled()) and also possible custom implementations of org.eclipse.help.AbstractContextProvider.getContext(String, String) which *may* block UI if called some thousands times on refreshing Problems view with a lot of problems with attached help context id's.

This will block the UI in worst cases for indefinite time (assuming the remote connection is slow).

Because the "most common" use case is local help, it makes sense to enable the proposed fix by default.

To allow product owners with "specific" help disable this bugfix, I would propose a similar flag like in bug 122967 comment 12, to *disable* the new functionality in case it causes problems.

The proposed flag to disable the bugfix would be:

org.eclipse.ui.ide/helpContextAvailabilityCheck=false

Note: this would mean also to set the new value to true in the org.eclipse.ui.internal.ide.IDEPreferenceInitializer.
Comment 4 Tim Neumann CLA 2019-03-25 08:16:08 EDT
For normal setups, which only use ContextFileProvider, I did some tests with up to 100 000 Markers and never saw more than a 2% increase in the time to render the problem view. 
I tested with available context, without correct context in contexts.xml and without a fitting contexts.xml.
Comment 5 Tim Neumann CLA 2019-03-25 08:20:21 EDT
(In reply to Dani Megert from comment #2)
> Please provide steps to reproduce this and validate your fix.

In any plugin add marker help via the org.eclipse.ui.ide.markerHelp extension point, but give it a helpContextId, which does not exist.
Then start eclipse and view a marker, which fits the defined restrictions for the marker help.

Without the proposed fix it will have a little question mark in the top right of the icon, but when pressing Shift-F1 on it no help opens.

With the proposed fix, no question mark will be shown in the icon.
Comment 6 Dani Megert CLA 2019-03-25 13:33:52 EDT
(In reply to Tim Neumann from comment #5)
> (In reply to Dani Megert from comment #2)
> > Please provide steps to reproduce this and validate your fix.
> 
> In any plugin add marker help via the org.eclipse.ui.ide.markerHelp
> extension point, but give it a helpContextId, which does not exist.
> Then start eclipse and view a marker, which fits the defined restrictions
> for the marker help.
Please attach an example project. This makes it easy to verify a fix.
Comment 7 Eclipse Genie CLA 2019-03-26 11:08:43 EDT
New Gerrit change created: https://git.eclipse.org/r/139512
Comment 8 Tim Neumann CLA 2019-03-26 11:10:05 EDT
(In reply to Dani Megert from comment #6)
> Please attach an example project. This makes it easy to verify a fix.

See https://git.eclipse.org/r/139512.
Run it as Eclipse Application, bind the command "Create Example Markers" to any key and press that key. 
Before the changes of Bug 545615, all markers will have a small question mark, but only "Test 1" has help (Shift-F1).
After the changes of Bug 545615, only "Test 1" will have a small question mark.
Comment 9 Karsten Thoms CLA 2019-03-26 18:12:54 EDT
Created attachment 278025 [details]
Screenshot Testproject

After importing the test project I could create "Test Markers". But unlike the problem report, I only recognize Info overlay icons on the warning markers "Test 1", while the other categories do not show the overlay. If I understand the report correct, this should be the desired state *after* the patch applied, but it is for me *without* applying the patch. What am I missing?
Comment 10 Karsten Thoms CLA 2019-03-26 18:22:08 EDT
Forget about my last comment. Fetching the example pulled also the patch. So I can confirm the bug and that patch does fix it.
Comment 11 Karsten Thoms CLA 2019-03-26 18:24:28 EDT
Created attachment 278027 [details]
Example Project
Comment 13 Andrey Loskutov CLA 2019-03-27 10:55:00 EDT
Thanks Tim.
Comment 14 Dani Megert CLA 2019-03-27 11:07:42 EDT
(In reply to Karsten Thoms from comment #11)
> Created attachment 278027 [details]
> Example Project
How does one use this?
Comment 15 Matthias Becker CLA 2020-05-27 05:44:20 EDT
Created attachment 283034 [details]
Example project

The previous example project did not work. In this example the errors are fixed and it should work as described above.