import net.sourceforge.phpdt.core.IPackageFragmentRoot;
import net.sourceforge.phpdt.core.JavaModelException;
import net.sourceforge.phpdt.internal.compiler.util.ObjectVector;
+import net.sourceforge.phpdt.internal.core.util.Util;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import net.sourceforge.phpdt.internal.core.JavaModelManager;
+import net.sourceforge.phpdt.internal.core.JavaProject;
/**
* This operation sets an <code>IJavaProject</code>'s classpath.
IClasspathEntry[] oldResolvedPath, newResolvedPath;
IClasspathEntry[] newRawPath;
- boolean canChangeResource;
+ boolean canChangeResources;
boolean needCycleCheck;
boolean needValidation;
boolean needSave;
IPath newOutputLocation;
+ JavaProject project;
+ boolean identicalRoots;
public static final IClasspathEntry[] ReuseClasspath = new IClasspathEntry[0];
public static final IClasspathEntry[] UpdateClasspath = new IClasspathEntry[0];
* When executed, this operation sets the classpath of the given project.
*/
public SetClasspathOperation(
- IJavaProject project,
+ JavaProject project,
IClasspathEntry[] oldResolvedPath,
IClasspathEntry[] newRawPath,
IPath newOutputLocation,
this.oldResolvedPath = oldResolvedPath;
this.newRawPath = newRawPath;
this.newOutputLocation = newOutputLocation;
- this.canChangeResource = canChangeResource;
+ this.canChangeResources = canChangeResource;
this.needValidation = needValidation;
this.needSave = needSave;
+ this.project = project;
}
/**
// }
// return fragments;
// }
-
/**
* Sets the classpath of the pre-specified project.
*/
JavaModelException originalException = null;
try {
- JavaProject project = getProject();
if (this.newRawPath == UpdateClasspath) this.newRawPath = project.getRawClasspath();
if (this.newRawPath != ReuseClasspath){
updateClasspath();
-// project.updatePackageFragmentRoots();
- JavaModelManager.getJavaModelManager().deltaProcessor.addForRefresh(project);
+ project.updatePackageFragmentRoots();
+ JavaModelManager.getJavaModelManager().getDeltaProcessor().addForRefresh(project);
}
} catch(JavaModelException e){
} catch(JavaModelException e){
if (originalException != null) throw originalException;
throw e;
+ } finally {
+ // ensures the project is getting rebuilt if only variable is modified
+ if (!this.identicalRoots && this.canChangeResources) {
+ try {
+ this.project.getProject().touch(this.progressMonitor);
+ } catch (CoreException e) {
+ if (JavaModelManager.CP_RESOLVE_VERBOSE){
+ Util.verbose("CPContainer INIT - FAILED to touch project: "+ this.project.getElementName(), System.err); //$NON-NLS-1$
+ e.printStackTrace();
+ }
+ }
+ }
}
}
done();
}
-
+
/**
* Generates the delta of removed/added/reordered roots.
* Use three deltas in case the same root is removed/added/reordered (for
* otherwise <code>false</code>. Subclasses must override.
*/
public boolean isReadOnly() {
- return !this.canChangeResource;
+ return !this.canChangeResources;
}
protected void saveClasspathIfNecessary() throws JavaModelException {
- if (!this.canChangeResource || !this.needSave) return;
+ if (!this.canChangeResources || !this.needSave) return;
IClasspathEntry[] classpathForSave;
JavaProject project = getProject();
// resolve new path (asking for marker creation if problems)
if (this.newResolvedPath == null) {
- this.newResolvedPath = project.getResolvedClasspath(true, this.canChangeResource);
+ this.newResolvedPath = project.getResolvedClasspath(true, this.canChangeResources);
}
// if (this.oldResolvedPath != null) {
project.setRawClasspath(
UpdateClasspath,
SetClasspathOperation.ReuseOutputLocation,
- this.fMonitor,
- this.canChangeResource,
+ this.progressMonitor,
+ this.canChangeResources,
project.getResolvedClasspath(true),
false, // updating only - no validation
false); // updating only - no need to save
protected void updateCycleMarkersIfNecessary(IClasspathEntry[] newResolvedPath) {
if (!this.needCycleCheck) return;
- if (!this.canChangeResource) return;
+ if (!this.canChangeResources) return;
try {
JavaProject project = getProject();
*/
protected void updateProjectReferencesIfNecessary() throws JavaModelException {
- if (!this.canChangeResource) return;
+ if (!this.canChangeResources) return;
if (this.newRawPath == ReuseClasspath || this.newRawPath == UpdateClasspath) return;
JavaProject jproject = getProject();
}
description.setReferencedProjects(requiredProjectArray);
- project.setDescription(description, this.fMonitor);
+ project.setDescription(description, this.progressMonitor);
} catch(CoreException e){
throw new JavaModelException(e);