Lines 247-253
Link Here
|
247 |
IWorkspace workspace = resources[0].getWorkspace(); |
247 |
IWorkspace workspace = resources[0].getWorkspace(); |
248 |
try { |
248 |
try { |
249 |
workspace.copy(resources, destinationPath, false, subProgressMonitor); |
249 |
workspace.copy(resources, destinationPath, false, subProgressMonitor); |
250 |
this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); |
250 |
setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); |
251 |
} catch (CoreException e) { |
251 |
} catch (CoreException e) { |
252 |
throw new JavaModelException(e); |
252 |
throw new JavaModelException(e); |
253 |
} |
253 |
} |
Lines 262-268
Link Here
|
262 |
contents, |
262 |
contents, |
263 |
forceFlag ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY, |
263 |
forceFlag ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY, |
264 |
getSubProgressMonitor(1)); |
264 |
getSubProgressMonitor(1)); |
265 |
this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); |
265 |
setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); |
266 |
} catch (CoreException e) { |
266 |
} catch (CoreException e) { |
267 |
throw new JavaModelException(e); |
267 |
throw new JavaModelException(e); |
268 |
} |
268 |
} |
Lines 278-284
Link Here
|
278 |
forceFlag ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY, |
278 |
forceFlag ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY, |
279 |
true, // local |
279 |
true, // local |
280 |
getSubProgressMonitor(1)); |
280 |
getSubProgressMonitor(1)); |
281 |
this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); |
281 |
setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); |
282 |
} catch (CoreException e) { |
282 |
} catch (CoreException e) { |
283 |
throw new JavaModelException(e); |
283 |
throw new JavaModelException(e); |
284 |
} |
284 |
} |
Lines 298-304
Link Here
|
298 |
resource.delete( |
298 |
resource.delete( |
299 |
forceFlag ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY, |
299 |
forceFlag ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY, |
300 |
getSubProgressMonitor(1)); |
300 |
getSubProgressMonitor(1)); |
301 |
this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); |
301 |
setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); |
302 |
while (resource instanceof IFolder) { |
302 |
while (resource instanceof IFolder) { |
303 |
// deleting a package: delete the parent if it is empty (eg. deleting x.y where folder x doesn't have resources but y) |
303 |
// deleting a package: delete the parent if it is empty (eg. deleting x.y where folder x doesn't have resources but y) |
304 |
// without deleting the package fragment root |
304 |
// without deleting the package fragment root |
Lines 307-313
Link Here
|
307 |
resource.delete( |
307 |
resource.delete( |
308 |
forceFlag ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY, |
308 |
forceFlag ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY, |
309 |
getSubProgressMonitor(1)); |
309 |
getSubProgressMonitor(1)); |
310 |
this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); |
310 |
setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); |
311 |
} |
311 |
} |
312 |
} |
312 |
} |
313 |
} catch (CoreException e) { |
313 |
} catch (CoreException e) { |
Lines 320-326
Link Here
|
320 |
protected void deleteResource(IResource resource,int flags) throws JavaModelException { |
320 |
protected void deleteResource(IResource resource,int flags) throws JavaModelException { |
321 |
try { |
321 |
try { |
322 |
resource.delete(flags, getSubProgressMonitor(1)); |
322 |
resource.delete(flags, getSubProgressMonitor(1)); |
323 |
this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); |
323 |
setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); |
324 |
} catch (CoreException e) { |
324 |
} catch (CoreException e) { |
325 |
throw new JavaModelException(e); |
325 |
throw new JavaModelException(e); |
326 |
} |
326 |
} |
Lines 337-343
Link Here
|
337 |
resources, |
337 |
resources, |
338 |
forceFlag ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY, |
338 |
forceFlag ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY, |
339 |
subProgressMonitor); |
339 |
subProgressMonitor); |
340 |
this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); |
340 |
setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); |
341 |
} catch (CoreException e) { |
341 |
} catch (CoreException e) { |
342 |
throw new JavaModelException(e); |
342 |
throw new JavaModelException(e); |
343 |
} |
343 |
} |
Lines 397-403
Link Here
|
397 |
* Returns the attribute registered at the given key with the top level operation. |
397 |
* Returns the attribute registered at the given key with the top level operation. |
398 |
* Returns null if no such attribute is found. |
398 |
* Returns null if no such attribute is found. |
399 |
*/ |
399 |
*/ |
400 |
protected Object getAttribute(Object key) { |
400 |
protected static Object getAttribute(Object key) { |
401 |
ArrayList stack = getCurrentOperationStack(); |
401 |
ArrayList stack = getCurrentOperationStack(); |
402 |
if (stack.size() == 0) return null; |
402 |
if (stack.size() == 0) return null; |
403 |
JavaModelOperation topLevelOp = (JavaModelOperation)stack.get(0); |
403 |
JavaModelOperation topLevelOp = (JavaModelOperation)stack.get(0); |
Lines 524-530
Link Here
|
524 |
* Returns false if this operation has not been executed yet. |
524 |
* Returns false if this operation has not been executed yet. |
525 |
*/ |
525 |
*/ |
526 |
public boolean hasModifiedResource() { |
526 |
public boolean hasModifiedResource() { |
527 |
return !this.isReadOnly() && this.getAttribute(HAS_MODIFIED_RESOURCE_ATTR) == TRUE; |
527 |
return !this.isReadOnly() && getAttribute(HAS_MODIFIED_RESOURCE_ATTR) == TRUE; |
528 |
} |
528 |
} |
529 |
public void internalWorked(double work) { |
529 |
public void internalWorked(double work) { |
530 |
if (progressMonitor != null) { |
530 |
if (progressMonitor != null) { |
Lines 580-586
Link Here
|
580 |
IWorkspace workspace = resources[0].getWorkspace(); |
580 |
IWorkspace workspace = resources[0].getWorkspace(); |
581 |
try { |
581 |
try { |
582 |
workspace.move(resources, destinationPath, false, subProgressMonitor); |
582 |
workspace.move(resources, destinationPath, false, subProgressMonitor); |
583 |
this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); |
583 |
setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); |
584 |
} catch (CoreException e) { |
584 |
} catch (CoreException e) { |
585 |
throw new JavaModelException(e); |
585 |
throw new JavaModelException(e); |
586 |
} |
586 |
} |
Lines 809-816
Link Here
|
809 |
/* |
809 |
/* |
810 |
* Registers the given attribute at the given key with the top level operation. |
810 |
* Registers the given attribute at the given key with the top level operation. |
811 |
*/ |
811 |
*/ |
812 |
protected void setAttribute(Object key, Object attribute) { |
812 |
protected static void setAttribute(Object key, Object attribute) { |
813 |
JavaModelOperation topLevelOp = (JavaModelOperation) getCurrentOperationStack().get(0); |
813 |
ArrayList operationStack = getCurrentOperationStack(); |
|
|
814 |
if (operationStack.size() == 0) |
815 |
return; |
816 |
JavaModelOperation topLevelOp = (JavaModelOperation) operationStack.get(0); |
814 |
if (topLevelOp.attributes == null) { |
817 |
if (topLevelOp.attributes == null) { |
815 |
topLevelOp.attributes = new HashMap(); |
818 |
topLevelOp.attributes = new HashMap(); |
816 |
} |
819 |
} |