How to view hierarchical package structure in Eclipse package explorer
Asked Answered
B

3

432

OK here's what I would like: in the Eclipse package explorer, I see the following: (dot represents a clickable arrow that I can use to expand the folder)

  • PROJECT
    • Source Folder
      • Package
          Class
      • Package.SubPackage
          Foo
          Bar
      • Package.OtherSubPackage
      • Package.OtherSubPackage.VerySubPackage
      • OtherPackage
          Foobar
      • OtherPackage.SubPackage
          Baz

Long story short, I want to have many packages, each with many subpackages, in a source folder (and several source folders, so making more won't solve the problem)--so on the order of a couple hundred packages per source folder--ten to twenty packages each with fifteen subpackages. Therefore, I want the hierarchy to look like this:

  • PROJECT
    • Source Folder
      • Package
          Class
        • Package.SubPackage
            Foo
            Bar
        • Package.OtherSubPackage
          • Package.OtherSubPackage.VerySubPackage
      • OtherPackage
          Foobar
        • OtherPackage.SubPackage
            Baz

so I can open or close a package and see a list of subpackages instead of having package and subpackage all at the same level in the hierarchy--which again makes far too many packages simultaneously displayed. Note this is not a question about filesystem; the file system works fine as far as I can tell--it is only a question about the visual display in the Eclipse package explorer.

So: is there a way to add levels to the hierarchy? Thanks!! (Eclipse Helios on OS X 10.6)

Bemba answered 12/10, 2010 at 14:56 Comment(0)
B
813

Package Explorer / View Menu / Package Presentation... / Hierarchical

The "View Menu" can be opened with Ctrl + F10, or the small arrow-down icon in the top-right corner of the Package Explorer.

Beebeebe answered 12/10, 2010 at 15:5 Comment(11)
anybody knows how I get the "Folder Presentation" - "Grouped" option back? On my laptop it's not there :-{ (purpose: make groupo packages that contain only one subpackage) Remark: just saw that i have "Eclipse IDE for Java Developers" on my laptop whilst having "Eclipse Java EE IDE for Web Developers." on my desktop.Pinpoint
Yeah, on my Eclipse Indigo at work I have a button on the Package Explorer for this, but not on my fresh Indigo install at home. Wtf? Thanks for the CTRL+F10 trick, it saved the day!Listless
Folder Presentation applies to JavaScript Source Folders.Madgemadhouse
You can see them grouped alright but still need to assign/remove new sub-packages to/from groups by renaming them with the right prefix. No drag&drop support.Christianechristiania
why isn't this the default?Rowell
This option doesn't appear in the view menu on my installation of Eclipse (Luna 4.4.2), though it does appear in the documentation. That's odd (maybe a bug?).Miscellaneous
Note that the nested projects feature works in the Java EE perspective with the project explorer, but does not appear in the Java perspective with the package explorer. Also, if you have some working sets, then can cause havoc with the feature - making projects vanish in weird ways.Dixiedixieland
The View Menu is also accessible via Window > NavigationJaniecejanifer
Also see related question about the default value for this setting: #47837134Harrell
This solution is still working on eclipse latest versionFeil
I wonder if there is a way to do a combination of both oO - have the top 2 levels flat and then hierarchical -or maybe top2 levels flat one level hierarchical and then inside flat again sound most convenientRiboflavin
E
44

Here is representation of screen eclipse to make hierarachical.

enter image description here

Englis answered 4/10, 2018 at 13:21 Comment(2)
I appreciate this answer, as the screenshot helped me find what I needed. Thank you.Haiti
Not at all :) @HaitiEnglis
Q
19

For Eclipse in Macbook it is just 2 click process:

  • Click on view menu (3 dot symbol) in package explorer -> hover over package presentation -> Click on Hierarchical

enter image description here

Qp answered 14/9, 2020 at 22:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.