Bug 260909 - [Markers] markerImageProviders extension point does not work
Summary: [Markers] markerImageProviders extension point does not work
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: IDE (show other bugs)
Version: 3.4.1   Edit
Hardware: PC Windows XP
: P3 normal with 14 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
: 26029 (view as bug list)
Depends on: 121538
Blocks: 308608 36418 261596
  Show dependency tree
 
Reported: 2009-01-13 14:10 EST by Eugene Turkov CLA
Modified: 2020-03-10 16:17 EDT (History)
15 users (show)

See Also:


Attachments
possible solution (?) (35.16 KB, patch)
2009-01-28 08:47 EST, Hitesh CLA
no flags Details | Diff
Snippet to test the patch (14.90 KB, application/zip)
2009-01-28 08:54 EST, Hitesh CLA
no flags Details
Patch (38.77 KB, patch)
2009-02-02 08:52 EST, Hitesh CLA
no flags Details | Diff
tests code (10.00 KB, patch)
2009-02-05 04:00 EST, Hitesh CLA
no flags Details | Diff
tests icons (1.86 KB, application/zip)
2009-02-05 04:03 EST, Hitesh CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Turkov CLA 2009-01-13 14:10:39 EST
Build ID: M20080911-1700

Steps To Reproduce:
1. Create your own marker type through the org.eclipse.core.resources.markers extension point. 
2. Specify an image for the marker using the org.eclipse.ui.ide.markerImageProviders extension point.
3. Note that neither specifying an icon directly nor creating a class implementing IMarkerIMageProvider causes a marker image to be displayed with the marker in the Markers view. Also note that the getImagePath(IMarker marker) method on IMakerImageProvider implementing class never gets called.



More information:
The problem appears to be in classes extending the abstract class MarkerDescriptionField. Implementation of the method getImage(MarkerItem item) appears to be incorrect. For example, in MarkerProblemSeverityAndMessageField, it appears that the marker image is never retrieved - only an image for the severity is returned. I think what should happen is if a marker has an image specified, that image should be used, otherwise, the severity image can be used as a default. Also look at MarkerSeverityAndDescriptionField's getImage(MarkerItem item) method.
Comment 1 Hitesh CLA 2009-01-20 07:11:42 EST
Also see Bug 26029.
Comment 2 Hitesh CLA 2009-01-21 03:05:44 EST
Bug 36418, Bug 121538 indicate that this extension point is not yet API.

Also see Bug 36418 comment #1.

Tod, can you please shed some light on this ?
Comment 3 Tod Creasey CLA 2009-01-21 07:32:38 EST
We have never had the push to make this API because it has some inflexibility that made it generally not consumable - it was written early on to enable the first marker views for the 3 severities we use and as a result was not used by the markerSupport as it was not API.

It is confusing that we have an internal extension point (we don't generally do that) but removing it would likely break someone without warning.

It will require integration with markerSupport and some work on API. However it will bring up some difficult use cases - for instance if someone sorts on severity which icon should we use?

Comment 4 Hitesh CLA 2009-01-28 08:47:10 EST
Created attachment 124016 [details]
possible solution (?)

Thanks Tod. Are you referring to the inflexibility also mentioned on Bug 36418 comment #1?

I have attached a patch to the bug demonstrating my thoughts towards a possible solution. The MarkerTypesModel and MarkerType provide enough API to 
> (1) find the marker image provider that most closely matches the given marker's 
> type (i.e. fewest steps in the supertype chain)


> It will require integration with markerSupport and some work on API. However it
> will bring up some difficult use cases - for instance if someone sorts on
> severity which icon should we use?
>
Since markerGrouping need not always be based on severity, a different icon may be desired and be indicative of the grouping criterion in such a case.Let markerGroupingEntry have 'icon' as an optional attribute ? Could you please share your suggestions and your thoughts on the patch?
Comment 5 Hitesh CLA 2009-01-28 08:54:24 EST
Created attachment 124017 [details]
Snippet to test the patch
Comment 6 Tod Creasey CLA 2009-01-30 08:57:11 EST
I think generally the ideas are pretty good - the list below may look long but there are all pretty small issues. This has been a long standing feature request so I think it is worth pushing forward on.

As MarkerSeverityAndDescriptionField is not API I don't think you need a new class MarkerIconSeverityAndDescriptionField as you don't use both. Just change MarkerSeverityAndDescriptionField. 

MarkerGroupingEntry should use MarkerSupportInternalUtilities.ATTRIBUTE_ICON rather than defining it's own icon class.

I'm not exactly sure what you are doing in TypeMarkerGroup#findGroupValue. Why does not call the superclass? 

I am concerned with the image lookup being used when creating MarkerCategories in the buildHierarchy method. This happens all of the time (everytime the user saves) and so trying to figure out the image seems like a bad idea. You should look up images after the sorting is done for performance reasons.

A couple of style things:

1) Try to use positive logic - if you can avoid using 

if(!condition)
  falseBlock

it is more readable

2) You don't seem to be using the formatter which makes it hard to read. This may have been to make the patch easier however.

3) As this is a big patch try and clean up the warnings when it gets committed

4) Javadoc all new methods as it makes it hard for others to see what you were doing othereise

5) Don't forget the since markers for the new attributes in the schema

6) The javadoc for TypeMarkerGroup#findGroupValue is wrong
Comment 7 Hitesh CLA 2009-02-02 08:52:11 EST
Created attachment 124416 [details]
Patch

(In reply to comment #6)
I have updated the patch incorporating your suggestions. 

> I'm not exactly sure what you are doing in TypeMarkerGroup#findGroupValue. Why
> does not call the superclass? 
> 
TypeMarkerGroup is bit different compared to MarkerGroup in how it groups; it does not declare any grouping entries or attribute mappings,  it simply uses the different types as different groups.

> I am concerned with the image lookup being used when creating MarkerCategories
> in the buildHierarchy method. This happens all of the time (everytime the user
> saves) and so trying to figure out the image seems like a bad idea. You should
> look up images after the sorting is done for performance reasons.
> 

The 'buildHierarchy' happens after sorting (see method sortAndMakeCategories) . Actually, lookup for a type happens only once and is cached for later use.

I'll be posting a few tests for this shortly. 

Note: The class IMarkerImageProvider is still in an internal package.

Your thoughts? 
Thanks.
Comment 8 Hitesh CLA 2009-02-05 04:00:31 EST
Created attachment 124787 [details]
tests code
Comment 9 Hitesh CLA 2009-02-05 04:03:02 EST
Created attachment 124788 [details]
tests icons

place in org.eclipse.ui.tests/icons
Comment 10 Eric Moffatt CLA 2009-02-06 08:48:16 EST
Adding Boris for review....where should we put IMarkerImageProvider?
Comment 11 Eric Moffatt CLA 2009-03-05 10:01:17 EST
Hitesh, thanks for all of your work on this but after a talk with Boris we think that it is too late in the cycle to add it in now (our fault, sorry). 

This does not mean that we don't want the fix we're just ensuring that we err of the 'safe side' rather than jamming in an extensive API change late in the game...

Please keep track of this defect and we can return to it in 3.6...
Comment 12 rosane CLA 2009-03-31 14:00:29 EDT
I am new Eclipse' user and I've have the follow problem when I debug Applets in option Run...

Exception in thread "main" java.lang.NoClassDefFoundError: sun.applet.AppletViewer
   at gnu.java.lang.MainThread.run (libgcj.so.7)
Caused by: java.lang.ClassNotFoundException: sun.applet.AppletViewer not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:/home/alunos/rcaldeira/workspace/DEITEL/], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
   at java.net.URLClassLoader.findClass (libgcj.so.7)
   at java.lang.ClassLoader.loadClass (libgcj.so.7)
   at java.lang.ClassLoader.loadClass (libgcj.so.7)
   at java.lang.Class.forName (libgcj.so.7)
   at gnu.java.lang.MainThread.run (libgcj.so.7)
BECAUSE
when I run option Run... in main pallete there is a checkbox for 
component checkbox Applet viewer: sun.applet.AppletViewer that is checked and them when the checked button is off so it desability button Run  and I can-t run anymore.
 
So I do not know what can I run my applets into Eclipse. On the other hand, I am using html browser for call it, but I would like to run applets using appletviewer into Eclipse, wouldn´t I?

In resume: I would like to use appletviewer into Eclipse. Is it possible or not?

Thanks
Comment 13 Eric Moffatt CLA 2009-03-31 16:15:50 EDT
Rosane, being new I'll comment nicely...you should ask questions like this one in the newsgroups since you're asking whether /how something can be done. Most certainly you *MUST NOT* randomly attach questions onto defects completely unrelated to the issue being worked on...
Comment 14 Mário Guimarães CLA 2010-01-08 06:16:54 EST
Hello,

it has passed quite some time after the last post about this issue and this bug was open, so now I'd like to know if there is any easy workaround I can make to have custom marker icons in the "problems view", a "markers view", or someother view ...

Thanks
Mário
Comment 15 Dani Megert CLA 2010-04-09 03:31:49 EDT
*** Bug 26029 has been marked as a duplicate of this bug. ***
Comment 16 Oleg Besedin CLA 2011-02-11 16:10:58 EST
(In reply to comment #14)
> ... I'd like to know if there is any easy workaround I can make to
> have custom marker icons in the "problems view", a "markers view" ...

I don't think so.
Comment 17 Simon Pope CLA 2011-07-14 11:30:53 EDT
Is there any movement on this? I'd really like to see this bug nailed and this functionality available. 

Is there something I could do to assist getting this resolved?
Comment 18 Paul Webster CLA 2012-11-07 14:12:04 EST
(In reply to comment #17)
> Is there something I could do to assist getting this resolved?

If you are interested, you could continue work on the patch in http://git.eclipse.org/c/platform/eclipse.platform.ui.git

Bring it up so it applies to master, then we can evolve it.

See also http://wiki.eclipse.org/Platform_UI/How_to_Contribute

PW
Comment 19 Chris Boyd CLA 2017-04-09 22:38:57 EDT
(In reply to Paul Webster from comment #18)
> (In reply to comment #17)
> If you are interested, you could continue work on the patch in
> http://git.eclipse.org/c/platform/eclipse.platform.ui.git
> 
> Bring it up so it applies to master, then we can evolve it.
> 
> See also http://wiki.eclipse.org/Platform_UI/How_to_Contribute
> 
> PW
>
Hi Paul, and everyone.

Is the patch still relevant anymore? What can I do to help get this longstanding bug resolved?


Thank you,

Chris Boyd
Comment 20 Andrey Loskutov CLA 2017-04-10 06:00:16 EDT
(In reply to Chris Boyd from comment #19)
> (In reply to Paul Webster from comment #18)
> > (In reply to comment #17)
> > If you are interested, you could continue work on the patch in
> > http://git.eclipse.org/c/platform/eclipse.platform.ui.git
> > 
> > Bring it up so it applies to master, then we can evolve it.
> > 
> > See also http://wiki.eclipse.org/Platform_UI/How_to_Contribute
> > 
> > PW
> >
> Hi Paul, and everyone.
> 
> Is the patch still relevant anymore? What can I do to help get this
> longstanding bug resolved?

I can't say anything about patch, but yes, if you would like to see the problem fixed, you can follow the Paul's recommendation.
Comment 21 Eclipse Genie CLA 2020-03-10 16:17:12 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.