View | Details | Raw Unified | Return to bug 178213
Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/MovePackageFragmentRootOperation.java (-1 / +1 lines)
Lines 224-230 Link Here
224
				throw new JavaModelException(e);
224
				throw new JavaModelException(e);
225
			}
225
			}
226
		}
226
		}
227
		this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); 
227
		setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); 
228
	}
228
	}
229
	/*
229
	/*
230
	 * Renames the classpath entries equal to the given path in all Java projects.
230
	 * Renames the classpath entries equal to the given path in all Java projects.
(-)model/org/eclipse/jdt/internal/core/JavaModelOperation.java (-12 / +15 lines)
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
		}
(-)model/org/eclipse/jdt/internal/core/DeletePackageFragmentRootOperation.java (-1 / +1 lines)
Lines 95-101 Link Here
95
				throw new JavaModelException(e);
95
				throw new JavaModelException(e);
96
			}
96
			}
97
		}
97
		}
98
		this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); 
98
		setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); 
99
	}
99
	}
100
100
101
101
(-)model/org/eclipse/jdt/internal/core/DeleteElementsOperation.java (-1 / +1 lines)
Lines 165-171 Link Here
165
			cu.save(getSubProgressMonitor(1), force);
165
			cu.save(getSubProgressMonitor(1), force);
166
			if (!cu.isWorkingCopy()) { // if unit is working copy, then save will have already fired the delta
166
			if (!cu.isWorkingCopy()) { // if unit is working copy, then save will have already fired the delta
167
				addDelta(delta);
167
				addDelta(delta);
168
				this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE);
168
				setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE);
169
			}
169
			}
170
		}
170
		}
171
	}
171
	}
(-)model/org/eclipse/jdt/internal/core/DeltaProcessor.java (+3 lines)
Lines 1368-1373 Link Here
1368
			// flush now so as to keep listener reactions to post their own deltas for subsequent iteration
1368
			// flush now so as to keep listener reactions to post their own deltas for subsequent iteration
1369
			this.flush();
1369
			this.flush();
1370
			
1370
			
1371
			// mark the operation stack has not modifying resources since resource deltas are being fired
1372
			JavaModelOperation.setAttribute(JavaModelOperation.HAS_MODIFIED_RESOURCE_ATTR, null);
1373
			
1371
			notifyListeners(deltaToNotify, ElementChangedEvent.POST_CHANGE, listeners, listenerMask, listenerCount);
1374
			notifyListeners(deltaToNotify, ElementChangedEvent.POST_CHANGE, listeners, listenerMask, listenerCount);
1372
		} 
1375
		} 
1373
	}		
1376
	}		
(-)model/org/eclipse/jdt/internal/core/CopyPackageFragmentRootOperation.java (-1 / +1 lines)
Lines 124-130 Link Here
124
				throw new JavaModelException(e);
124
				throw new JavaModelException(e);
125
			}
125
			}
126
		}
126
		}
127
		this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); 
127
		setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); 
128
	}
128
	}
129
	protected void addEntryToClasspath(IClasspathEntry rootEntry, IWorkspaceRoot workspaceRoot) throws JavaModelException {
129
	protected void addEntryToClasspath(IClasspathEntry rootEntry, IWorkspaceRoot workspaceRoot) throws JavaModelException {
130
		
130
		
(-)model/org/eclipse/jdt/internal/core/CopyResourceElementsOperation.java (-2 / +2 lines)
Lines 268-274 Link Here
268
						if (rewrite != null) flags |= IResource.KEEP_HISTORY;
268
						if (rewrite != null) flags |= IResource.KEEP_HISTORY;
269
						sourceResource.copy(destFile.getFullPath(), flags, getSubProgressMonitor(1));
269
						sourceResource.copy(destFile.getFullPath(), flags, getSubProgressMonitor(1));
270
					}
270
					}
271
					this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); 
271
					setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); 
272
				} else {
272
				} else {
273
					destCU.getBuffer().setContents(source.getBuffer().getContents());
273
					destCU.getBuffer().setContents(source.getBuffer().getContents());
274
				}
274
				}
Lines 404-410 Link Here
404
				if (sourceIsReadOnly) {
404
				if (sourceIsReadOnly) {
405
					Util.setReadOnly(srcFolder, true);
405
					Util.setReadOnly(srcFolder, true);
406
				}
406
				}
407
				this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); 
407
				setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); 
408
			} else {
408
			} else {
409
				// process the leaf resources
409
				// process the leaf resources
410
				if (resources.length > 0) {
410
				if (resources.length > 0) {
(-)model/org/eclipse/jdt/internal/core/CreateElementInCUOperation.java (-1 / +1 lines)
Lines 142-148 Link Here
142
				unit.save(null, false);
142
				unit.save(null, false);
143
				boolean isWorkingCopy = unit.isWorkingCopy();
143
				boolean isWorkingCopy = unit.isWorkingCopy();
144
				if (!isWorkingCopy)
144
				if (!isWorkingCopy)
145
					this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE);
145
					setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE);
146
				worked(1);
146
				worked(1);
147
				resultElements = generateResultHandles();
147
				resultElements = generateResultHandles();
148
				if (!isWorkingCopy // if unit is working copy, then save will have already fired the delta
148
				if (!isWorkingCopy // if unit is working copy, then save will have already fired the delta

Return to bug 178213