Bug 460901 - Navigate to package
Summary: Navigate to package
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.5   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-26 04:39 EST by Lukas Eder CLA
Modified: 2015-03-02 08:46 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Eder CLA 2015-02-26 04:39:02 EST
This would be a nice-to-have feature. When I Ctrl-Click or F3 on a package name of a package that is on the classpath, I'd like to go to the location in the Package Explorer view, where that package is declared, in order to introspect its contents.

Optionally, if there is a package-info.java, then that file should be opened.

An example:

----------------------------------------------------------------
import static java.util  .  Arrays.asList;
//            ^^^^ ^^^^     ^^^^^^ ^^^^^^ --- clicking on these already works
//            ||||-||||---------------------- clicking on these would be useful, too

class Test {
    private java.util  .  Map m;
//          ^^^^ ^^^^     ^^^ --------------- clicking on this already works
//          ||||-||||------------------------ clicking on this would be useful, too
         
}
----------------------------------------------------------------

I know it's not the same kind of action, because that action would be executed in a view, not in the editor - so my above description is probably not 100% consistent with general Eclipse behaviour. But I would still find the general idea very useful.
Comment 1 Stephan Herrmann CLA 2015-02-28 10:33:03 EST
Hi Lukas,

I guess, one option for creating the connection from Java editor to Package Explorer would be to say "Show in > Package Explorer". I was actually expecting this to work when invoked on the type name, but the "Show in" command doesn't resolve the type I'm referring to. It always uses the enclosing element within the current compilation unit.

@Team, is there a deeper meaning behind this, or could this command be changed to mean "show declaration in package explorer", when invoked over a reference?
Comment 2 Dani Megert CLA 2015-03-02 08:46:26 EST
(In reply to Stephan Herrmann from comment #1)
> Hi Lukas,
> 
> I guess, one option for creating the connection from Java editor to Package
> Explorer would be to say "Show in > Package Explorer". I was actually
> expecting this to work when invoked on the type name, but the "Show in"
> command doesn't resolve the type I'm referring to. It always uses the
> enclosing element within the current compilation unit.
> 
> @Team, is there a deeper meaning behind this, or could this command be
> changed to mean "show declaration in package explorer", when invoked over a
> reference?

For the Java editor, Show In reveals the same element as Link With Editor. I would not like to change that. Extending Ctrl+Click / F3 seems more natural. If you hover over the imports, you'll see an Open Declaration button, which does what's requested in comment 0.