Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 361072 - [CommonNavigator] ILinkHelper: Provide optional interface to know about the context where the show in is being done
Summary: [CommonNavigator] ILinkHelper: Provide optional interface to know about the c...
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.1   Edit
Hardware: All Windows 7
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-15 21:57 EDT by Fabio Zadrozny CLA
Modified: 2019-11-14 03:38 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabio Zadrozny CLA 2011-10-15 21:57:49 EDT
Build Identifier: Build id: I20100608-0911

My use case is the following:

In the PyDev Package Explorer, I want to provide a show in/link with external files related to the interpreter which is related to a given project.

So, there's already an interpreter node which shows the interpreter info and the same interpreter info may appear on multiple places (i.e.: 3 projects use the same interpreter).

I've properly implemented the 'show in' functionality by overriding the method "boolean show(ShowInContext context)", to consider those nodes, but the problem is, as a file may appear in multiple places at once, I want to use an heuristic based on the current selection/expanded nodes (as I want to show the information close to where the developer is working and not in some other project). Also, in my case, the nodes are only really created in the content provider and don't really have some other model related -- the model would be the actual File, but as it'll appear in multiple places, another model which is only available in the content provider is used, so, I really need access to the viewer (to know the selection and to get the content provider).

So, my proposal is to have an ILinkHelperExtension that has a 'public void setCommonViewer(CommonViewer commonViewer)'. It seems that all the calls to the ILinkHelper come from the LinkHelperService, and it already has the NavigatorContentService, so, it'd be just a matter of checking that interface and passing the viewer as needed (or maybe the NavigatorContentService directly).

If needed I can provide a patch for that feature.

Reproducible: Always
Comment 1 Francis Upton IV CLA 2011-10-16 01:01:03 EDT
Please do provide a patch, that will make it easier.
Comment 2 Markus Keller CLA 2011-11-11 11:57:23 EST
Isn't this information already available in the ShowInContext's getSelection()? That should be an ITreeSelection from which you can get TreePaths that know the whole parent chain.
Comment 3 Fabio Zadrozny CLA 2011-11-11 12:33:56 EST
It's available in the ShowInContext, but it's not passed along to the  ILinkHelper. 

Also, only the selection isn't enough to do what I want (I also need access to the content provider to make queries on the tree -- as I'm searching for an item that for all effects only exists as a view of the file system in the tree).

See: https://github.com/aptana/Pydev/blob/release/plugins/org.python.pydev/src_navigator/org/python/pydev/navigator/actions/PythonLinkHelper.java for a reference on what's being done.

I still haven't gotten time to do a patch (and will enter vacations for 2 weeks now), but I expect to provide a patch right after that...
Comment 4 Heiko Böttger CLA 2011-12-09 07:59:06 EST
I have nearly the same problem in my LinkHelper implementation. I need to know the contentprovider in #findSelection. The second problem is, that the editorinput is not enought, we want to select the subnodes based on the editors selection. As a workaround I use an ActionProvider to install a SelectionListener on the active editor and set the selection directly on the commonnavigator.

To be consistent with the ICommonContentProvider & CommonActionProvider an init-method passing a CommonExtensionSite would be nice.
Comment 5 Lars Vogel CLA 2019-11-14 03:38:02 EST
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.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.