Community
Participate
Working Groups
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
Please do provide a patch, that will make it easier.
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.
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...
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.
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.