X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/BecomeWorkingCopyOperation.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/BecomeWorkingCopyOperation.java index a3150db..41b83bb 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/BecomeWorkingCopyOperation.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/BecomeWorkingCopyOperation.java @@ -16,27 +16,34 @@ import net.sourceforge.phpdt.core.IProblemRequestor; import net.sourceforge.phpdt.core.JavaModelException; /** - * Switch and ICompilationUnit to working copy mode - * and signal the working copy addition through a delta. + * Switch and ICompilationUnit to working copy mode and signal the working copy + * addition through a delta. */ public class BecomeWorkingCopyOperation extends JavaModelOperation { - + IProblemRequestor problemRequestor; - + /* * Creates a BecomeWorkingCopyOperation for the given working copy. - * perOwnerWorkingCopies map is not null if the working copy is a shared working copy. + * perOwnerWorkingCopies map is not null if the working copy is a shared + * working copy. */ - public BecomeWorkingCopyOperation(CompilationUnit workingCopy, IProblemRequestor problemRequestor) { - super(new IJavaElement[] {workingCopy}); + public BecomeWorkingCopyOperation(CompilationUnit workingCopy, + IProblemRequestor problemRequestor) { + super(new IJavaElement[] { workingCopy }); this.problemRequestor = problemRequestor; } + protected void executeOperation() throws JavaModelException { - // open the working copy now to ensure contents are that of the current state of this element + // open the working copy now to ensure contents are that of the current + // state of this element CompilationUnit workingCopy = getWorkingCopy(); - JavaModelManager.getJavaModelManager().getPerWorkingCopyInfo(workingCopy, true/*create if needed*/, true/*record usage*/, this.problemRequestor); - workingCopy.openWhenClosed(workingCopy.createElementInfo(), this.progressMonitor); + JavaModelManager.getJavaModelManager().getPerWorkingCopyInfo( + workingCopy, true/* create if needed */, true/* record usage */, + this.problemRequestor); + workingCopy.openWhenClosed(workingCopy.createElementInfo(), + this.progressMonitor); if (!workingCopy.isPrimary()) { // report added java delta for a non-primary working copy @@ -45,26 +52,33 @@ public class BecomeWorkingCopyOperation extends JavaModelOperation { addDelta(delta); } else { if (workingCopy.getResource().isAccessible()) { - // report a F_PRIMARY_WORKING_COPY change delta for a primary working copy - JavaElementDelta delta = new JavaElementDelta(this.getJavaModel()); - delta.changed(workingCopy, IJavaElementDelta.F_PRIMARY_WORKING_COPY); + // report a F_PRIMARY_WORKING_COPY change delta for a primary + // working copy + JavaElementDelta delta = new JavaElementDelta(this + .getJavaModel()); + delta.changed(workingCopy, + IJavaElementDelta.F_PRIMARY_WORKING_COPY); addDelta(delta); } else { // report an ADDED delta - JavaElementDelta delta = new JavaElementDelta(this.getJavaModel()); - delta.added(workingCopy, IJavaElementDelta.F_PRIMARY_WORKING_COPY); + JavaElementDelta delta = new JavaElementDelta(this + .getJavaModel()); + delta.added(workingCopy, + IJavaElementDelta.F_PRIMARY_WORKING_COPY); addDelta(delta); } } - this.resultElements = new IJavaElement[] {workingCopy}; + this.resultElements = new IJavaElement[] { workingCopy }; } + /* * Returns the working copy this operation is working on. */ protected CompilationUnit getWorkingCopy() { - return (CompilationUnit)getElementToProcess(); + return (CompilationUnit) getElementToProcess(); } + /* * @see JavaModelOperation#isReadOnly */