Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Importing project programatically
Importing project programatically [message #870623] Wed, 09 May 2012 06:37 Go to next message
suresh nallamilli is currently offline suresh nallamilliFriend
Messages: 4
Registered: May 2012
Junior Member
I am using IResourceChangeListener and in handleProjectOpen API , am trying below steps
1. Create a copy of selected project.
2. changing some files in copied project as per business rules
3. Trying to load the copied project into workspace , using code

IProjectDescription description = null;
try {
description = ResourcesPlugin.getWorkspace().loadProjectDescription(new Path(NEW_PROJECT_PATH + "/.project"));
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(description.getName());
project.create(description, null);
project.open(null);
} catch (CoreException e) {
e.printStackTrace();
}


However @ step 3 , am getting
org.eclipse.core.internal.resources.ResourceException: The resource tree is locked for modifications.
at org.eclipse.core.internal.resources.WorkManager.checkIn(WorkManager.java:116)
at org.eclipse.core.internal.resources.Workspace.prepareOperation(Workspace.java:2282)
at org.eclipse.core.internal.resources.Project.create(Project.java:282)
at org.eclipse.core.internal.resources.Project.create(Project.java:269)


Re: Importing project programatically [message #870851 is a reply to message #870623] Wed, 09 May 2012 22:55 Go to previous message
suresh nallamilli is currently offline suresh nallamilliFriend
Messages: 4
Registered: May 2012
Junior Member
Got the solution. Posting it here so that it may be useful for others

Since there is lock on workspace , scheduled job and everything seems to be fine now. Wrote below code inside handleProjectOpen API

Job job = new Job("Load Project") {
@Override
protected IStatus run(IProgressMonitor monitor) {
// Put your logic here
return Status.OK_STATUS;
}
};
job.setUser(true);
job.schedule();

Previous Topic:com.sun.xml.internal.messaging.saaj.soap.impl.TextImpl cannot be cast to javax.xml.soap.SOAPElement
Next Topic:Abysmal performance on linux
Goto Forum:
  


Current Time: Fri Apr 19 22:23:14 GMT 2024

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

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

Back to the top