Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Hierarhical organization of projects(Is there any possibility?)
Hierarhical organization of projects [message #1508413] Fri, 12 December 2014 11:41 Go to next message
Michail Vokhm is currently offline Michail VokhmFriend
Messages: 11
Registered: November 2014
Junior Member
Hello! I'm new in Eclipse, and I wonder if there is any possibility to organize projects hierarchically, so that a folder might contain individual projects and folders containing other folders and projects? I think it would be a useful and important feature, and it seems rather strange, but I can not find a way to do so.
Re: Hierarhical organization of projects [message #1508485 is a reply to message #1508413] Fri, 12 December 2014 13:01 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Michail,

No, but you can define working sets that are groups of projects and a
project can be in more than one working set, but that's it.

On 12/12/2014 12:41 PM, Michail Vokhm wrote:
> Hello! I'm new in Eclipse, and I wonder if there is any possibility to
> organize projects hierarchically, so that a folder might contain
> individual projects and folders containing other folders and projects?
> I think it would be a useful and important feature, and it seems
> rather strange, but I can not find a way to do so.


Ed Merks
Professional Support: https://www.macromodeling.com/
icon5.gif  Re: Hierarhical organization of projects [message #1508510 is a reply to message #1508413] Fri, 12 December 2014 13:26 Go to previous messageGo to next message
Michail Vokhm is currently offline Michail VokhmFriend
Messages: 11
Registered: November 2014
Junior Member
Te issue also relates to package structures. If I have packages org.domain.pack1 and org.domain.pack2, I expect to find their respective files in folders someplace/org/domain/pack1, someplace/org/domain/pack2, but not in workspace/project1/org/domain/pack1, workspace/project2/org/domain/pack1. Why do I have to duplicate the same subfolder structure in separate project folders to hold related projects? What is the right way to avoid this? There would be a workaround if I could make the Eclipse to discover package names in the java files located in the subfolders, and to show these packages and respective java files in the package explorer; but how can I do it?
Re: Hierarhical organization of projects [message #1508527 is a reply to message #1508485] Fri, 12 December 2014 13:44 Go to previous messageGo to next message
Michail Vokhm is currently offline Michail VokhmFriend
Messages: 11
Registered: November 2014
Junior Member
Ed Merks wrote on Fri, 12 December 2014 13:01

No, but you can define working sets that are groups of projects...

Yes, thank you, I do use working sets, but they are not quite adequate solution.
Sad, I find it to be a regretable drawback...
Re: Hierarhical organization of projects [message #1508582 is a reply to message #1508510] Fri, 12 December 2014 14:34 Go to previous messageGo to next message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3070
Registered: July 2009
Senior Member
Michail Vokhm wrote on Fri, 12 December 2014 13:26
Te issue also relates to package structures. If I have packages org.domain.pack1 and org.domain.pack2, I expect to find their respective files in folders someplace/org/domain/pack1, someplace/org/domain/pack2, but not in workspace/project1/org/domain/pack1, workspace/project2/org/domain/pack1. Why do I have to duplicate the same subfolder structure in separate project folders to hold related projects? What is the right way to avoid this? There would be a workaround if I could make the Eclipse to discover package names in the java files located in the subfolders, and to show these packages and respective java files in the package explorer; but how can I do it?


It's not clear what you're trying to achieve. Package names are really not hierarchical, they just appear to be because of the dot-based naming convention and because virtually every tool presents them as hierarchical.
Having said that, if the two packages org.domain.pack1 and org.domain.pack2 are part of separate projects, I don't see why you'd expect their files to be mixed together in one folder (logical or physical). If they're part of separate projects, they're in separate folders.
Can you explain in more detail what you're trying to achieve?
Re: Hierarhical organization of projects [message #1508701 is a reply to message #1508582] Fri, 12 December 2014 16:40 Go to previous messageGo to next message
Michail Vokhm is currently offline Michail VokhmFriend
Messages: 11
Registered: November 2014
Junior Member
Well, for example, I have standard swt examples which form packages:
package org.eclipse.swt.examples.texteditor;
package org.eclipse.swt.examples.accessibility
etc.
Their sources (as they are given) are organized in folders like
org/
   eclipse/
      swt/
         examples/
            accessibility/            
            texteditor/            
            etc.../

I would like to keep them on their places, in the example folder, yet to be able to compile them and otherwise play with them. If i place the whole tree in the workspace and then import each of them like a separate project, i get something like
workspace/
   org/
      eclipse/
         swt/
            examples/
               accessibility/            /// was pointed to as a project location
                  org/                          /// From this point, built by 
                                                /// Eclipse according to package name
                     eclipse/
                        swt/
                           examples/
                              accessibility/ ;           
   org/
      eclipse/
         swt/
            examples/
               texteditor/            /// was pointed to as a project location
                  org/                          /// From this point, built by 
                                                /// Eclipse according to package name
                     eclipse/
                        swt/
                           examples/
                              texteditor/ ;           
....

And I have a dozen of projects in the workspace.
I definitely dislike this.
I would prefer to keep them all as subfolders of a single folder that traditonally reflects the package names, as they are placed in the jar; and I would like to see them as subbranches of a single tree in the package explorer and project explorer.
As I mentioned, there could be a workaround if I could make Eclipse to see (and show in the package explorer) all the packages in the subfolders within a single project (say, "SWTExamples"), but it can see nothing located in the subfolders unless I "import" a contents of a subfolder as a separate project.
So, if Eclipse can not maintain an hierarchical structure of projects, there will be another question: how do I make it see packages in subfolders when I just put a folder with subfolders in its workspace? When I create a project with a few packages in it, it makes a folder in the workspace and builds subfolders for these packages and can see these packages afterwards, but when I create a similar directory structure manually (or take it somewhere else) - Eclipse can see nothing in such a directory. Why is this? What is the difference between my own handmade folder with subfolders with java files, and a folder with subfolders with java files, made by Eclipse?
Re: Hierarhical organization of projects [message #1508724 is a reply to message #1508701] Fri, 12 December 2014 17:09 Go to previous messageGo to next message
Michail Vokhm is currently offline Michail VokhmFriend
Messages: 11
Registered: November 2014
Junior Member
Yes, the second question is revoked. There's no difference between eclipse-made folders with java files and hand-made folders of similar structure. Eclipse can see java files of various adjacent packages, located in adjacent subfolders according to package names. It just requires the project to be refreshed (f5, when the project in the package explorer is selected) after manual reorganization of the folder.

[Updated on: Fri, 12 December 2014 17:15]

Report message to a moderator

Re: Hierarhical organization of projects [message #1514671 is a reply to message #1508724] Wed, 17 December 2014 13:50 Go to previous messageGo to next message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3070
Registered: July 2009
Senior Member
I still don't understand what you're trying to achieve; is it that you want a separate project, for example, for the "accessibility" and the "texteditor" examples? That's possible, but only as separate source trees. If you want to keep them in their existing location, where the packages are rooted under a common folder, then they'd have to be single (logical) Project in Eclipse.
A few things that you might not be aware of:
1) The Eclipse workspace is primarily a logical container, but can also be a physical container, of projects. That means that projects and their files can be stored outside of the workspace directory on your file system. In fact this is quite common and encouraged. It's unfortunate, in my opinion, that the default location when creating a new project is in the workspace directory.
2) Eclipse has the notion of "source locations" in every Java project, and there can be more than one and they are totally configurable by the user. The default is /src under the project root, and if you import or create code files without otherwise configuring your project, that's where they will go.
3) Eclipse enforces that the directory structure to contain .java files exactly match the package structure declared in the code. This isn't a hard requirement of the JDK, but is a universal "best-practice" that Eclipse enforces. This is the primary reason why Eclipse does not (can not) allow source locations to be nested inside other source locations, because doing so would violate this rule.

If you open the Eclipse Help Contents and navigate to "Java development user guide" > Getting Started > Project Configuration Tutorial, you might gain some more understanding of this stuff. Maybe that will help you get close to what you're trying to achieve.

[Updated on: Wed, 17 December 2014 13:53]

Report message to a moderator

Re: Hierarhical organization of projects [message #1704902 is a reply to message #1514671] Mon, 10 August 2015 14:15 Go to previous message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

Eclipse Mars provide a new feature that allows projects to be navigated hier viewarchically: use the project explorer view and in the view menu, set "Projects presentation" to "Hierarchical".
Previous Topic:Moving lines of code without doing cut and paste
Next Topic:Unable to find a javac compiler
Goto Forum:
  


Current Time: Wed Apr 24 14:26:40 GMT 2024

Powered by FUDForum. Page generated in 0.08497 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top