Moving packages eclipse

后端 未结 6 1233
萌比男神i
萌比男神i 2021-01-01 08:57

Maybe a stupid question but I have two packages in eclipse and now I would like to move the one package into the other for better structure.

Now I tried move but tha

相关标签:
6条回答
  • 2021-01-01 09:21

    I have found the solution, when you rename a package to the desired destination, check on the box "rename subpackages" and there you go! :) – user1525788 Jul 10 at 9:14

    0 讨论(0)
  • 2021-01-01 09:26

    if you have current package:

    • com.insect.fly

    and would like to add subpackage to it, then renaming will solve the purpose e.g.

    • com.insect.fly.mosquitto

    However, eclipse do not should it in nested style. Just do Package Explorer > click on v button on the pane next to minimize > package presentation > Hierarchical

    Hope that SOLVES !!

    0 讨论(0)
  • 2021-01-01 09:34

    If you have com.company.foo and com.company.bar, and want to move foo into bar, then just rename com.company.foo to com.company.bar.foo.

    If you package happens to have subpackages, tick Rename subpackages to move the subpackages as well.

    0 讨论(0)
  • 2021-01-01 09:34

    This is slightly non-intuitive, but the best way to do it is by right clicking on the package you wish to move, clicking on refactor, and then on rename.

    Then proceed to enter the fully qualified path which you desire.

    For example, if you wish that a package called dog be moved into a package called mammals which itself is in a package called animals you would essentially rename your dog package to animals.mammals.dog

    In other words, the package structure

    is represented as animals.mammals.dog in the world of Java packages, and a renaming achieves the desired effect.

    Please note that you must not try to achieve this by manually moving the folders in Windows explorer. These actions are best done using your IDE.

    0 讨论(0)
  • 2021-01-01 09:35

    Use the package explorer view and rename the package. It asks for renaming updating references, renaming sub packages, update textual references in comments and and also non-Java text files. Click on the preview and then ok.

    0 讨论(0)
  • 2021-01-01 09:40

    this is rlly old but try opening in hierarchy mode. in project explorer click the small arrow (pointing down) > package presentation > hierarchical.

    0 讨论(0)
提交回复
热议问题