Reputation: 113
Is there any way to programmatically create project, but in another location on disc than workspace location? I know, that Eclipse workspace is only logical container for project resources, and project can be placed elsewhere (it is possible to change location of built-in project templates), but how to do it from java code?
PS: I found some clue on ProjectDescription, but I can't obtain it in other way but this:
IProjectDescription description = project.getDescription();
The trouble is, project have to be already created and opened, what involves project is placed in default location.
Upvotes: 0
Views: 478
Reputation: 111142
You create a project using the description with something like:
IWorkspace workspace = ResourcesPlugin.getWorkspace();
// Get a reference to the new project - does NOT create it
IProject project = workspace.getRoot().getProject("project name");
// Create a description for the new project
IProjectDescription description = workspace.newProjectDescription(project.getName());
description.setLocationURI(location);
// TODO fill in other things in the description
// Actually create the project
project.create(description, progressMonitor);
Upvotes: 1