Search code examples
eclipsepackagehierarchical

Hierarchical package structure in Eclipse


I am working with eclipse on an android project. I want to have packages inside of packages inside of packages and so on...

The problem is I can only have 1 type of subpackage. (I want more depth) At the moment my project looks like this:

- com.company.main
  - subpackone
    + class1
    + class2
    + class3
  - subpacktwo
    + class4
  - subpackthree
    + class5

But what I want is something like this:

- com.company.main
  - subpackone
    + class1
    + class2
    + class3
    - subpacktwo
      + class4
      - subpackthree
        + class5

When I try to create more packages inside of subpackages it just changes the name of the already existing subpackage. I already set the Package Presentation to Hierarchical in eclipse.


Solution

  • flafoux gave me the right answer in their comment:

    You should have class in the package parent to be displayed, otherwise it will rename to the child you create

    – flafoux Jun 11 '15 at 6:37

    My problem was that I tried to create new packages inside of packages that have no classes (to test it). But if I create a class inside the package first I then can create new subpackages.