|
|
427f046 |
### Eclipse Workspace Patch 1.0
|
|
|
427f046 |
#P org.eclipse.linuxtools.cdt.autotools.core
|
|
|
427f046 |
Index: src/org/eclipse/linuxtools/cdt/autotools/core/AutotoolsNewProjectNature.java
|
|
|
427f046 |
===================================================================
|
|
|
427f046 |
--- src/org/eclipse/linuxtools/cdt/autotools/core/AutotoolsNewProjectNature.java (revision 24339)
|
|
|
427f046 |
+++ src/org/eclipse/linuxtools/cdt/autotools/core/AutotoolsNewProjectNature.java (working copy)
|
|
|
427f046 |
@@ -20,9 +20,16 @@
|
|
|
427f046 |
import org.eclipse.core.resources.IProject;
|
|
|
427f046 |
import org.eclipse.core.resources.IProjectDescription;
|
|
|
427f046 |
import org.eclipse.core.resources.IProjectNature;
|
|
|
427f046 |
+import org.eclipse.core.resources.IWorkspace;
|
|
|
427f046 |
+import org.eclipse.core.resources.IWorkspaceRunnable;
|
|
|
427f046 |
+import org.eclipse.core.resources.ResourcesPlugin;
|
|
|
427f046 |
import org.eclipse.core.runtime.CoreException;
|
|
|
427f046 |
import org.eclipse.core.runtime.IProgressMonitor;
|
|
|
427f046 |
+import org.eclipse.core.runtime.IStatus;
|
|
|
427f046 |
import org.eclipse.core.runtime.NullProgressMonitor;
|
|
|
427f046 |
+import org.eclipse.core.runtime.Status;
|
|
|
427f046 |
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
|
|
427f046 |
+import org.eclipse.core.runtime.jobs.Job;
|
|
|
427f046 |
import org.eclipse.linuxtools.internal.cdt.autotools.core.AutotoolsConfigurationBuilder;
|
|
|
427f046 |
|
|
|
427f046 |
public class AutotoolsNewProjectNature implements IProjectNature {
|
|
|
427f046 |
@@ -94,9 +101,45 @@
|
|
|
427f046 |
commandList.add(command);
|
|
|
427f046 |
}
|
|
|
427f046 |
}
|
|
|
427f046 |
- ICommand[] newCommands = new ICommand[commandList.size()];
|
|
|
427f046 |
- description.setBuildSpec(commandList.toArray(newCommands));
|
|
|
427f046 |
- project.setDescription(description, new NullProgressMonitor());
|
|
|
427f046 |
+ final ICommand[] newCommands = commandList.toArray(new ICommand[commandList.size()]);
|
|
|
427f046 |
+ if (newCommands.length == commands.length) {
|
|
|
427f046 |
+ boolean hasCorrectBuilderCommands = true;
|
|
|
427f046 |
+ for (int j = 0; j < commands.length; ++j) {
|
|
|
427f046 |
+ if (!commands[j].getBuilderName().equals(newCommands[j])) {
|
|
|
427f046 |
+ hasCorrectBuilderCommands = false;
|
|
|
427f046 |
+ break;
|
|
|
427f046 |
+ }
|
|
|
427f046 |
+ }
|
|
|
427f046 |
+ if (hasCorrectBuilderCommands)
|
|
|
427f046 |
+ return;
|
|
|
427f046 |
+ }
|
|
|
427f046 |
+ final ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot();
|
|
|
427f046 |
+ final IProject proj = project;
|
|
|
427f046 |
+
|
|
|
427f046 |
+ Job backgroundJob = new Job("Autotools Set Project Description") {
|
|
|
427f046 |
+ /* (non-Javadoc)
|
|
|
427f046 |
+ * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
|
|
|
427f046 |
+ */
|
|
|
427f046 |
+ protected IStatus run(IProgressMonitor monitor) {
|
|
|
427f046 |
+ try {
|
|
|
427f046 |
+ ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
|
|
|
427f046 |
+
|
|
|
427f046 |
+ public void run(IProgressMonitor monitor) throws CoreException {
|
|
|
427f046 |
+
|
|
|
427f046 |
+ IProjectDescription description = proj.getDescription();
|
|
|
427f046 |
+ description.setBuildSpec(newCommands);
|
|
|
427f046 |
+ proj.setDescription(description, new NullProgressMonitor());
|
|
|
427f046 |
+ }
|
|
|
427f046 |
+ }, rule, IWorkspace.AVOID_UPDATE, monitor);
|
|
|
427f046 |
+ } catch (CoreException e) {
|
|
|
427f046 |
+ return e.getStatus();
|
|
|
427f046 |
+ }
|
|
|
427f046 |
+ IStatus returnStatus = Status.OK_STATUS;
|
|
|
427f046 |
+ return returnStatus;
|
|
|
427f046 |
+ }
|
|
|
427f046 |
+ };
|
|
|
427f046 |
+ backgroundJob.setRule(rule);
|
|
|
427f046 |
+ backgroundJob.schedule();
|
|
|
427f046 |
}
|
|
|
427f046 |
|
|
|
427f046 |
/**
|