Bug 181647 - [Markers] Problems view does not properly process ResourceMapping
Summary: [Markers] Problems view does not properly process ResourceMapping
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2007-04-09 15:11 EDT by Nick Edgar CLA
Modified: 2019-09-06 15:30 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Edgar CLA 2007-04-09 15:11:42 EDT
3.3 M5

- change the Problems view to show markers for selected element and children
- in a project with 2 packages a and a.b, with errors on some CUs in a.b but not in a,
- select a in the PE
- the Problems view still shows markers for CUs in a.b

Expectation: the marker views should honour ResourceMapping (which I believe JDT properly adapts to).
Comment 1 Nick Edgar CLA 2007-04-09 15:12:14 EDT
Tod pointed me at the code that's supposed to do this.  I'll look into it...
Comment 2 Nick Edgar CLA 2007-04-09 16:32:03 EDT
The problem is due to the java element adapting to ITaskListResourceAdapter.
E.g. it maps from the package fragment for 'a' to its ITaskListResourceAdapter to the IFolder for a.  So by that time it has lost the depth info.

Also, if the element adapts to IResource or IFile, then the DefaultTaskListResourceAdapter will return that rather than trying to adapt to ResourceMapping (see code in MarkerView.focusSelectionChanged).

I'd expect the ResourceMapping, if available, to take precedence over an IResource or IFile adapter.  Maybe the DefaultTaskListResourceAdapter case should be done after the ResourceMapping case?

Looks like we could use an ITaskListResourceAdapter2 equivalent to IContributorResourceAdapter2 that can return a resource mapping instead of a single resource.

Also noticed that MarkerView.addResources(Collection, ResourceMapping) ignores the  depth on the traversals.  This raises an interesting question: how should the traversal depth and the view filter's depth interact?  Right now it looks like the implementation ignores the traversal's depth and just uses the view's.  But I think it would make more sense to have them compose somehow.  For example, if I have the filter set to show "selected element only" then for 'a' it should just show me only markers on the folder itself (depth = 0).  But if I have "selected elements and its children" then I'd expect it to show me markers on the folder for 'a' and its direct children, but not those for folder 'a/b' or its children.  So basically, if filtering by "selected element only" it would use depth==0, but if filtering by "selected element and its children" it would use the traversal's depth (not infinite).

Should probably also honour ResourceMapping.getProjects() for the "any element in same project".  Right now it looks like it finds the corresponding resources first, then selects their project(s).
Comment 3 Nick Edgar CLA 2007-04-09 16:36:32 EDT
Another item to consider is whether the model elements needs to implement IAdaptable.  Currently the code assumes they do, but it would probably be good to handle the case where it doesn't (e.g. use IAdapterManager.getAdapter).

John, I thought you added a convenience method for handling both cases while avoiding redundant lookups, but I couldn't find it.

Comment 4 Paul Webster CLA 2007-04-09 18:50:28 EDT
In ui.workbench we've been using org.eclipse.ui.internal.util.Util#getAdapter(*) as our common code.

Is there lower-level utility method?
PW
Comment 5 John Arthorne CLA 2007-04-12 10:30:31 EDT
There is a proposed convenience method in bug 118560, but it hasn't been added.
Comment 6 Susan McCourt CLA 2009-07-09 19:18:50 EDT
As per http://wiki.eclipse.org/Platform_UI/Bug_Triage_Change_2009
Comment 7 Eclipse Webmaster CLA 2019-09-06 15:30:58 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.

If you have further information on the current state of the bug, please add it. 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.