Bug 264404 - [CommonNavigator] Project Explorer misses decorators for Problem Markers if *DT provider is not enabled
Summary: [CommonNavigator] Project Explorer misses decorators for Problem Markers if *...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4.1   Edit
Hardware: PC All
: P3 enhancement with 11 votes (vote)
Target Milestone: 4.7 M4   Edit
Assignee: Mickael Istria CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 268839 413082 (view as bug list)
Depends on: 509821
Blocks:
  Show dependency tree
 
Reported: 2009-02-10 13:52 EST by Amir Kouchekinia CLA
Modified: 2020-05-21 23:22 EDT (History)
21 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Amir Kouchekinia CLA 2009-02-10 13:52:17 EST
I have a custom editor that validates its contents and produces Problem markers on the resource when it finds problems.

Problem markers show up in the editor's vertical ruler, the Problems view, and the Project Explorer resource nodes.

The problem icon decorators in the Project Explorer are displayed when my plug-in is installed under Eclipse SDK distribution.

But, when I install the plug-in under Eclipse Platform Runtime Binary distribution, the problem icon decorators do not display in the Project Explorer.

Project Explorer is the default resource navigator for the Resource Perspective.

I would like to get the same behavior with problem icon decorators under the Platform IDE, as I do with the SDK.

I do not know if this is a bug, or a missing implementation on my part.

I have asked this in the Platform forum and have not had a response either way.

Please advise.

Thanks.

Amir
Comment 1 Francis Upton IV CLA 2009-02-10 14:05:29 EST
Probably related to bug 262415
Comment 2 maarten meijer CLA 2009-02-11 16:41:58 EST
I would say that it also appears with a different RCP app on Mac OSX. 
For me there is the situation that I have several validators adding markers.
When I disable one in particular the markers do show.

Maybe there is some uncaught and UNLOGGED exception that makes the marker decoration abort early...
Comment 3 Christian Pontesegger CLA 2010-02-17 02:55:48 EST
(In reply to comment #0)
> But, when I install the plug-in under Eclipse Platform Runtime Binary
> distribution, the problem icon decorators do not display in the Project
> Explorer.

I ran into the same problem recently.

According to some google research I found a workaround:
Add org.eclipse.jdt.ui plugin to your RCP and magically the problem markers get visible.

As some of us might not need JAVA support in our custom RCP app, it would be fine to move the necessary code from jdt.ui to the core bundle where the project explorer is located.
Comment 4 Anton Leherbauer CLA 2010-02-18 06:15:01 EST
Note that the PE without JDT extension works like the Resource Navigator, which does not support problem marker decoration.
JDT is not part of the Platform Runtime environment and therefore you don't get the decorators.  JDT is part of the SDK, though, that's why you see the decorators there.
Comment 5 Christian Pontesegger CLA 2010-02-18 06:38:10 EST
(In reply to comment #4)
> Note that the PE without JDT extension works like the Resource Navigator, which
> does not support problem marker decoration.

Why does the project explorer natively not support problem markers? I guess there is not only java that needs those markers.

So I propose to add marker support to the platform runtime to have it available even without JDT.
Comment 6 Dani Megert CLA 2010-03-24 07:14:16 EDT
*** Bug 268839 has been marked as a duplicate of this bug. ***
Comment 7 Francis Upton IV CLA 2011-04-21 16:34:25 EDT
See the partial patch in bug 268839 as well as the comments that this needs to be handled by the CNF.

This is really an enhancement request in my view, as far as I know the CNF was not designed to deal with these decorators from the beginning. It's also not clear if this should be the CNF itself or the ProjectExplorer. Certainly if working sets to are to be involved, then it would be ProjectExplorer (since the CNF does not know anything about working sets. On the other hand, there is some argument that the CNF should handle working sets more directly.
Comment 8 Francis Upton IV CLA 2011-04-21 16:35:08 EDT
> So I propose to add marker support to the platform runtime to have it available
> even without JDT.
I agree with you, and if you would like to working on this I would be happy to help. Right now I don't have a lot of time to spend on the CNF.
Comment 9 Dani Megert CLA 2011-04-22 02:48:21 EDT
I(In reply to comment #7)
> This is really an enhancement request in my view, as far as I know the CNF was
> not designed to deal with these decorators from the beginning.
Which is a bug ;-)
Comment 10 Ron CLA 2011-10-04 15:09:59 EDT
I used to have a Windows XP computer, and never encountered this problem (Error marks not showing in Navigator, but errors marks can be seen in Package Explorer). A week ago, switched to Windows 7, and error marks are not shown in Navigator.
Don't know if this observation useful in solving this bug, thanks.
Comment 11 Dani Megert CLA 2011-10-05 03:40:35 EDT
(In reply to comment #10)
> I used to have a Windows XP computer, and never encountered this problem (Error
> marks not showing in Navigator, but errors marks can be seen in Package
> Explorer). A week ago, switched to Windows 7, and error marks are not shown in
> Navigator.
> Don't know if this observation useful in solving this bug, thanks.
The 'Navigator' view never showed/shows error or warnings out of the box. Maybe you had some additional plug-in installed on Windows XP that did this.
Comment 12 Tobias Liefke CLA 2011-11-03 11:01:55 EDT
Any progress in this? 

If its difficult to extract the decorator from JDT, could we add at least a new (explicit) decorator for markers that is disabled per default to avoid any side effects for the JDT, but may be enabled using preferenceCustomization for a specific product (which doesn't include the JDT)?
Comment 13 Dani Megert CLA 2013-07-22 05:53:13 EDT
*** Bug 413082 has been marked as a duplicate of this bug. ***
Comment 14 Mickael Istria CLA 2016-09-30 06:35:59 EDT
The JS EPP package, which doesn't have JDT installed, reports problem to the Project Explorer.
AFAIK, the C++ one does too.
Comment 15 Mickael Istria CLA 2016-09-30 07:50:19 EDT
This is very simple to reproduce:
Take whatever IDE, which reports problem markers on Project Explorer. Create a problem, and see the problem marker on Project Explorer.
Go in Project Explorer view menu > Customize View... (or Filters and cusotmization... iwith Oxygen) > tab "Content". Deselect content coming from JDT, JSDT, CDT... The problem marker disappeared.

The reason seems to be that the Problem decorator is contributed by those CNF providers. However, Problems are language-indepedent.
So a solution would be to create a specific extension for problems in Project Explorator (let's name it "Problem markers decoration") and to enable it by default. People who don't want it would have the opportunity to remove it by going to the "Filters and Cusotmization... > Content" and unticking the "Problem marker decoration" checkbox.

Thoughts?
Comment 16 Mickael Istria CLA 2016-09-30 09:18:07 EDT
I'll copy and adapt "ProblemLabelDecorator" from EGit.
@Robin: as the author of this class, do you have any objection or concern?
Comment 17 Robin Stocker CLA 2016-10-01 22:23:31 EDT
(In reply to Mickael Istria from comment #16)
> I'll copy and adapt "ProblemLabelDecorator" from EGit.
> @Robin: as the author of this class, do you have any objection or concern?

No I don't, go ahead :).
Comment 18 Mickael Istria CLA 2016-10-02 13:59:06 EDT
Thanks Robin.
I'm taking this one and targeting it for 4.7.M3 as I think it's an important issue in Platform's 4.7 theme "simplify new languages support".
Comment 19 Eclipse Genie CLA 2016-10-03 08:46:51 EDT
New Gerrit change created: https://git.eclipse.org/r/82357
Comment 21 Mickael Istria CLA 2016-10-05 12:45:39 EDT
There is now a decoration provider (via the Decoration preference page) for Problems on IResources.
Comment 22 Eclipse Genie CLA 2016-10-10 08:24:22 EDT
New Gerrit change created: https://git.eclipse.org/r/82839
Comment 24 Mickael Istria CLA 2016-10-10 08:29:42 EDT
@Dani: what's the issue?
Comment 25 Dani Megert CLA 2016-10-10 08:53:13 EDT
(In reply to Mickael Istria from comment #21)
> There is now a decoration provider (via the Decoration preference page) for
> Problems on IResources.

This is a no go and I had to revert it.

You can't enable the decorator on generic elements, be it 'Object or 'IResource'. This can only be done per view. Views that already decorate problems now do it twice - unacceptable performance hit. Views can also decide to not show problems on their elements or do it differently.

There are tons of errors logged for closed projects and this also writes to the console (see bug 505644).

It looks like code got copied (comment 16), but the original author is not listed in the Gerrit change and that author has no valid ECA. Just a comment from the author in bugzilla is not enough.
Comment 26 Mickael Istria CLA 2016-10-10 09:05:08 EDT
(In reply to Dani Megert from comment #25)
> You can't enable the decorator on generic elements, be it 'Object or
> 'IResource'. This can only be done per view. Views that already decorate
> problems now do it twice - unacceptable performance hit.
> Views can also
> decide to not show problems on their elements or do it differently.

Here, I thought the grain and target of the requested functionality was the same as team decorators. EGit binds decorator on all view that allow it (as far as I understood), and no one complained as far as I know.
The performance hit is very acceptable in term of user  perspective. As I experienced it, it's far from being a blocker IMHO, it's not even noticed.

Also, I'm curious about it. How can a view that allows Git decorators be annoyed by problems report?

> There are tons of errors logged for closed projects

This was definitely a bug in the proposed patch.

> It looks like code got copied (comment 16), but the original author is not
> listed in the Gerrit change and that author has no valid ECA. Just a comment
> from the author in bugzilla is not enough.

Ok, thanks for the hint.
@Robin: Can you please sign the ECA ?
Comment 27 Dani Megert CLA 2016-10-10 09:17:10 EDT
(In reply to Mickael Istria from comment #26)
> (In reply to Dani Megert from comment #25)
> > You can't enable the decorator on generic elements, be it 'Object or
> > 'IResource'. This can only be done per view. Views that already decorate
> > problems now do it twice - unacceptable performance hit.
> > Views can also
> > decide to not show problems on their elements or do it differently.
> 

> The performance hit is very acceptable in term of user  perspective. As I
> experienced it, it's far from being a blocker IMHO, it's not even noticed.

No, it is not acceptable to do something twice. It not only slows down problem marker decoration but other decorations that are done in the same thread. It is a blocker. The second thing, that a view might not want to have them and spoil them with problem decorators is also a blocker.

 
> Also, I'm curious about it. How can a view that allows Git decorators be
> annoyed by problems report?

Because you only use one UI plug-in for EGit, this works.
Comment 28 Mickael Istria CLA 2016-10-10 09:26:03 EDT
So it means that the solution should be specific to Project Explorer only?

As JDT/CDT/JSDT contribute error report to Project Explorer, so in any case, the fact that JDT/CDT/JSDT already does it makes that decoration will most likely happen twice. Does that mean that we'll never be able to fix this issue because other plugins already do it (at the wrong place of the IDE)?
Comment 29 Dani Megert CLA 2016-10-10 09:32:04 EDT
(In reply to Mickael Istria from comment #28)
> So it means that the solution should be specific to Project Explorer only?
> 
> As JDT/CDT/JSDT contribute error report to Project Explorer, so in any case,
> the fact that JDT/CDT/JSDT already does it makes that decoration will most
> likely happen twice. Does that mean that we'll never be able to fix this
> issue because other plugins already do it (at the wrong place of the IDE)?

Even the Project Explorer can do it for most cases. You are trying to fix a corner case where the specific content extensions, like 'Java Elements' are disabled or not there. And "no", it's not done at the wrong place because the Platform does not know how to decorate a Java field or a CDT element.

So, it should be implemented inside the Project Explorer for only the cases mentioned above.
Comment 30 Mickael Istria CLA 2016-10-10 09:46:37 EDT
(In reply to Dani Megert from comment #29)
> You are trying to fix a
> corner case where the specific content extensions, like 'Java Elements' are
> disabled or not there.

I'm quite disappointed by this answer.

Seems like I failed at sharing my vision and goals for the Eclipse IDE and all the work related to Platform's 4.7 theme "simplify new languages support".

Here is the user story: as an Eclipse plug-in developer, I want to create an Eclipse-based C# IDE (actually, more something like "Eclipse IDE for .NET Developers") with all the state-of-art usability of an IDE, with the lowest amount of effort.
If we focus on this user story, I read your answer as "please install JDT into your C# IDE if you want error report on resources". It's not an acceptable answer.
Another answer would be "Please implement your own content provider to put markers on *.cs files", which is basically what JDT, JSDT, CDT are already duplicating.

If we focus only on cases where JDT is present, then Eclipse Platform is missing its own goal and is failing at delivering the expected value of being an efficient platform to develop IDEs (and RCP apps).
Eclipse can live without JDT, the Platform should be designed gathering requirements from JDT, not relying on it to provide solutions to common problems.

The IDE should have as much features as possible to enrich user experience without a need for language tools. The problem markers on resources are a very interesting one.
With this patch, I could have my .cs, .json or whatever files showing a red cross in Project Explorer without any specific contribution to Project Explorer. It was a very pleasant thing.

>  And "no", it's not done at the wrong place because
> the Platform does not know how to decorate a Java field or a CDT element.

The Platform knows how to decorate whatever IResource according to Problem markers, there is no need for more semantic here.


I'd like to propose a trade-off: what about having this decorator listed, but off by default? At least, packages that will like to use it in some future could, without high cost of development.
Comment 31 Dani Megert CLA 2016-10-10 09:59:11 EDT
(In reply to Mickael Istria from comment #30)
> The IDE should have as much features as possible to enrich user experience
> without a need for language tools. The problem markers on resources are a
> very interesting one.

Sure, but not at the cost of breaking things and slowing down performance.


> >  And "no", it's not done at the wrong place because
> > the Platform does not know how to decorate a Java field or a CDT element.
> 
> The Platform knows how to decorate whatever IResource according to Problem
> markers, there is no need for more semantic here.

Yes there is, because you can't know how to decorate Java fields for example. That's why the decoration and the content belong together.

Here's one way to fix this:
1. You only enable this on resources where no content provider is registered.
2. You add a new implict attribute to the 'org.eclipse.ui.navigator.navigatorContent' extension point, where one can specify that the generic problem decoration should be used (false by default).
Comment 32 Andrey Loskutov CLA 2016-10-10 10:05:15 EDT
(In reply to Mickael Istria from comment #30)
> Seems like I failed at sharing my vision and goals for the Eclipse IDE and
> all the work related to Platform's 4.7 theme "simplify new languages
> support".

There are much more use cases as "simplify new languages support". One of the use case is that the products require a highly scalable IDE. I don't want to have decorators to run twice or more time for displaying same markers on our projects. What is "acceptable" for small projects doesn't scale for 100.000 files.

I have not checked API, but is this possible to know if the JDT (or any) decorator was configured to the navigator and run the "generic" decorator only if there were no other decorators contributed/enabled?

Also can we try to eliminate default problem decorations for files/folders from existing decorator contributions in CDT/JDT/you name it for 4.7 and document that this will be done by the framework "by default"?
Comment 33 Mickael Istria CLA 2016-10-10 10:37:02 EDT
Ok, thanks for your insights, all. I believe this discussion is fruitful as it makes me consider simpler approaches. I've something else in mind to try, but it would be nice if I could get your opinion on it before starting to actually code it.
Can I simply add the marker decoration in the ResourceExtensionLabelProvider? I believe it would do what I'd like (decorate resources when none of JDT/JSDT/CDT is there) and would not apply to content provided by other CNF extensions than the Resourses one. WDYT?
Comment 34 Andrey Loskutov CLA 2016-10-10 10:47:48 EDT
(In reply to Mickael Istria from comment #33)
> Can I simply add the marker decoration in the
> ResourceExtensionLabelProvider? I believe it would do what I'd like
> (decorate resources when none of JDT/JSDT/CDT is there) and would not apply
> to content provided by other CNF extensions than the Resourses one. WDYT?

I must confess I don't know the CNF API enough to suggest here anything but looking at the code it seems to be the best fit. Please note, that this one can be disabled by user in same way as the rest of CNF contributions!
Comment 35 Dani Megert CLA 2016-10-10 11:59:18 EDT
(In reply to Mickael Istria from comment #33)
> Ok, thanks for your insights, all. I believe this discussion is fruitful as
> it makes me consider simpler approaches. I've something else in mind to try,
> but it would be nice if I could get your opinion on it before starting to
> actually code it.
> Can I simply add the marker decoration in the
> ResourceExtensionLabelProvider? I believe it would do what I'd like
> (decorate resources when none of JDT/JSDT/CDT is there) and would not apply
> to content provided by other CNF extensions than the Resourses one. WDYT?

This is a very good step into the right direction, as it no longer pollutes other views, but it still has the problem of duplicate decoration as long as other extensions are enabled. You still have to follow my advice from comment 31.


(In reply to Andrey Loskutov from comment #34)
> Please note, that this one
> can be disabled by user in same way as the rest of CNF contributions!

Yes, but if you disable the resource extension, no resource will be shown ;-).
Comment 36 Mickael Istria CLA 2016-10-10 12:09:04 EDT
(In reply to Dani Megert from comment #35)
> This is a very good step into the right direction, as it no longer pollutes
> other views,

ok, cool.

> but it still has the problem of duplicate decoration as long as
> other extensions are enabled. You still have to follow my advice from
> comment 31.

I'm a bit confused here. In a previous comment you say "the decoration and the content belong together.". Doesn't it apply to CNF? Ie doesn't a label provider apply only to elements that were contributed by the content provider of the same extension?
If it only applies to the elements provided by related content provider, then it seems like JDT won't decorate resources.
Comment 37 Dani Megert CLA 2016-10-10 13:04:05 EDT
(In reply to Mickael Istria from comment #36)
> > but it still has the problem of duplicate decoration as long as
> > other extensions are enabled. You still have to follow my advice from
> > comment 31.
> 
> I'm a bit confused here. In a previous comment you say "the decoration and
> the content belong together.". Doesn't it apply to CNF? Ie doesn't a label
> provider apply only to elements that were contributed by the content
> provider of the same extension?
> If it only applies to the elements provided by related content provider,
> then it seems like JDT won't decorate resources.

You're right! :-)
Comment 38 Eclipse Genie CLA 2016-10-11 03:37:57 EDT
New Gerrit change created: https://git.eclipse.org/r/82899
Comment 39 Mickael Istria CLA 2016-10-21 12:15:07 EDT
Delayed.
Comment 41 Dani Megert CLA 2017-04-12 10:21:37 EDT
Verified in I20170411-2000.