Bug 464418 - Cannot navigate to class that is in a dependency of a dependency
Summary: Cannot navigate to class that is in a dependency of a dependency
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.5   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on: 73957
Blocks:
  Show dependency tree
 
Reported: 2015-04-10 15:54 EDT by Marc-André Laperle CLA
Modified: 2023-03-09 17:32 EST (History)
5 users (show)

See Also:


Attachments
Test project (1.28 KB, application/zip)
2015-04-10 15:54 EDT, Marc-André Laperle CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marc-André Laperle CLA 2015-04-10 15:54:34 EDT
Created attachment 252304 [details]
Test project

Using Eclipse SDK 4.5-I20150408-1100

For example, I have a plugin in my workspace that depends on o.e.jface. If I open JFaceResources, I cannot navigate to the import "org.eclipse.core.runtime.FileLocator", even if I have the source jar in my target platform. I realize this might be by design but it's not very practical. I have to resort to adding org.eclipse.core.runtime to the required bundle of some dummy plugin in my workspace.

I attached an example project. 
1. Import the project into the workspace (with no other project opened)
2. Open JFaceResources with Open Type dialog (Ctrl-Shift-T).
4. In the imports, try to navigate to org.eclipse.core.runtime.FileLocator using the hyperlink.
Comment 1 Vikas Chandra CLA 2015-04-13 01:07:56 EDT
Moving to platform UI for comments
Comment 2 Marc-André Laperle CLA 2015-04-13 11:39:51 EDT
This is not a UI bug, it's PDE (or JDT) not computing the fact that the class can be found on the classpath.
Comment 3 Lars Vogel CLA 2015-04-13 11:52:32 EDT
Moving to JDT core for analysis.
Comment 4 Vikas Chandra CLA 2015-04-14 03:19:05 EDT
I think it could be JDT UI.
Comment 5 Jay Arthanareeswaran CLA 2015-04-14 12:47:19 EDT
Unfortunately target platform doesn't influence the project's build path, which is what JDT relies on to find types.

Anyway, JDT UI has nothing to do with it, if the types are made available from Core, there will be hyperlinks. I don't think we have the resources to invest in it at the moment, though.
Comment 6 Markus Keller CLA 2015-04-14 13:31:47 EDT
This is essentially the problem from bug 73957 comment 50.

A workaround to at least get FileLocator in the Open Type dialog is to enable Preferences > Plug-in Development > Include all plug-ins from target in Java search. That creates/maintains the dummy "External Plug-in Libraries" project in your workspace.
Comment 7 Marc-André Laperle CLA 2015-04-14 14:07:05 EDT
(In reply to Markus Keller from comment #6)
> This is essentially the problem from bug 73957 comment 50.
> 
> A workaround to at least get FileLocator in the Open Type dialog is to
> enable Preferences > Plug-in Development > Include all plug-ins from target
> in Java search. That creates/maintains the dummy "External Plug-in
> Libraries" project in your workspace.

Interesting, I tried enabling that but it didn't fix the problem for the hyperlink (at first) but it did work for the Open Type dialog. But after closing and reopening the project it worked for the hyperlink as well. I can reproduce this behavior with the test project. So from my perspective, this is what could be improved: the fact that the project has to be reopened for hyperlink to start working. Restarting Eclipse also doesn't fix it, only closing and reopening the project.
Comment 8 Randy Hudson CLA 2015-04-14 21:36:13 EDT
In my experience, opening "JFaceResources" doesn't do something predictable.  It opens the class in the context of the "first" project that happens to have that class on its classpath (turn on breadcrumbs to see this).  You end up limited to what JFaceResource can see in that arbitrary project.  Closing and reopening the project just reshuffles the order of all of the projects, which changes where "JFaceResource" is found.

This problem also confuses the debugger when trying to evaluate snippets, use content assist, custom formatters, etc.
Comment 9 Marc-André Laperle CLA 2015-04-15 13:32:43 EDT
(In reply to Randy Hudson from comment #8)
> In my experience, opening "JFaceResources" doesn't do something predictable.
> It opens the class in the context of the "first" project that happens to
> have that class on its classpath (turn on breadcrumbs to see this).  

Nice trick! (breadcrumbs)

> Closing
> and reopening the project just reshuffles the order of all of the projects,
> which changes where "JFaceResource" is found.

OK that makes sense and would explain the behavior I see. So I think if "Include all plug-ins from target in Java search" is enabled, it should always try to find the classes (from a plugin dependency) in the context of External Plug-in Libraries.
Comment 10 Eclipse Genie CLA 2020-10-03 16:50:16 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.

--
The automated Eclipse Genie.
Comment 11 Eclipse Genie CLA 2023-03-09 17:32:26 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.

--
The automated Eclipse Genie.