Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Creating projects in workspace subfolders
Creating projects in workspace subfolders [message #550399] Fri, 30 July 2010 09:30 Go to next message
Baptiste Mesta is currently offline Baptiste Mesta
Messages: 31
Registered: September 2009
Member
Hi,

I was thinking that it would be great to be able to create (or move) project inside subfolders of the workspace.

It is currently possible to create a project, then move it in a folder inside the workspace, but the project is then linked with an absolute path and moving the workspace result in loosing it.

Is there a way to make this working even programatically (i'm working on a rcp app)

BR,


Re: Creating projects in workspace subfolders [message #550435 is a reply to message #550399] Fri, 30 July 2010 11:16 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

You can do that, but it won't be a project any more. If it's just about
directory structure, in theory you can create a
<workspace>/other/<projectDir> and then in your workspace create
<project> and specify the location as projectDir. I had heard that's
what the eGit/jGit guys do sometimes (but maybe it's just a rumour :-)

But "other" won't show up in your workspace, since as far as eclipse is
concerned it's just a folder in the file system.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Creating projects in workspace subfolders [message #551214 is a reply to message #550435] Thu, 05 August 2010 15:54 Go to previous message
Baptiste Mesta is currently offline Baptiste Mesta
Messages: 31
Registered: September 2009
Member
I've tried to set my project with an absolute url that is located inside the workspace but then my project is referenced with an absolute path.

I've tried to put a relative url to my project description but it's not working.

Here is my code.
			IProgressMonitor monitor = new NullProgressMonitor();
			if(!project.exists()) {
				project.create(monitor);
			}
			project.open(monitor);
			IProjectDescription description = project.getDescription();
                        IPath path = workspace.getRoot().getLocation().append(workspaceName).append(project.getName());
			URI newLocation = URIUtil.toURI(path.toOSString());
			if(!newLocation.equals(description.getLocationURI())){
				if (path.toFile().exists()) {
					path.toFile().delete();
				}
                                //use relative path, not working
				description.setLocationURI(workspace.getRoot().getLocationURI().relativize(newLocation));
				
				project.move(description, IResource.FORCE | IResource.SHALLOW, monitor);
			}


Anyway thank you for your reply Smile


Previous Topic:[eclipse plugin ] adding a command and control visibility
Next Topic:How to customize menu and toolbar in RCP application
Goto Forum:
  


Current Time: Sun Oct 26 01:53:36 GMT 2014

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

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