Bug 35866 Refactoring doesn't handle resource changes [refactoring]
When you want to refactor and it affect some resources but those resources are read-only. You get a pop up saying they are read-only. when you then change those resources to writable outside of eclipse and click back on the pop-up and try to redo the refactoring you get an unhandled exception: Java Model Exception: Core Exception [code 274] Resource is out of sync with the file system: /TPCommon/source/Java/common/com/teamphone/common/xml/dom/html/SelectBui lder.java. at org.eclipse.jdt.internal.corext.refactoring.changes.TextChange.getPreviewTextBuf fer(TextChange.java:217) at org.eclipse.jdt.internal.corext.refactoring.rename.RenameAnalyzeUtil.getNewWorki ngCopies(RenameAnalyzeUtil.java:74) at org.eclipse.jdt.internal.corext.refactoring.rename.RenameFieldRefactoring.getNew Occurrences(RenameFieldRefactoring.java:399) at org.eclipse.jdt.internal.corext.refactoring.rename.RenameFieldRefactoring.analyz eRenameChanges(RenameFieldRefactoring.java:379) at org.eclipse.jdt.internal.corext.refactoring.rename.RenameFieldRefactoring.checkI nput(RenameFieldRefactoring.java:354) at org.eclipse.jdt.internal.ui.refactoring.CheckConditionsOperation.run (CheckConditionsOperation.java:65) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:100) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run (PerformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:302) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:252) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run (RefactoringWizardDialog2.java:266) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.performRefactorin g(PerformRefactoringUtil.java:53) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:363) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFinish (UserInputWizardPage.java:119) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFinish (RefactoringWizard.java:426) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPressed (RefactoringWizardDialog2.java:383) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:256) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:423) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:89) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:81) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:840) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1838) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1545) at org.eclipse.jface.window.Window.runEventLoop(Window.java:583) at org.eclipse.jface.window.Window.open(Window.java:563) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate (RefactoringStarter.java:70) at org.eclipse.jdt.internal.ui.refactoring.RefactoringSupport$AbstractRenameSupport .rename(RefactoringSupport.java:168) at org.eclipse.jdt.ui.refactoring.RenameSupport.openDialog (RenameSupport.java:98) at org.eclipse.jdt.internal.ui.refactoring.actions.RenameJavaElementAction.run (RenameJavaElementAction.java:147) at org.eclipse.jdt.internal.ui.refactoring.actions.RenameJavaElementAction.run (RenameJavaElementAction.java:110) at org.eclipse.jdt.ui.actions.RenameAction.run(RenameAction.java:127) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:842) at org.eclipse.ui.internal.WWinKeyBindingService.pressed (WWinKeyBindingService.java:214) at org.eclipse.ui.internal.WWinKeyBindingService$5.widgetSelected (WWinKeyBindingService.java:332) at org.eclipse.ui.internal.AcceleratorMenu$2.handleEvent (AcceleratorMenu.java:65) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:81) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:840) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1838) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1545) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1402) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1385) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:291) at org.eclipse.core.launcher.Main.run(Main.java:747) at org.eclipse.core.launcher.Main.main(Main.java:583) !ENTRY org.eclipse.core.resources 4 274 Mar 31, 2003 13:55:19.361 !MESSAGE Resource is out of sync with the file system: /TPCommon/source/Java/common/com/teamphone/common/xml/dom/html/SelectBui lder.java.
org.eclipse.ltk.core.refactoring/src/org/eclipse/ltk/core/refactoring/TextFileChange.java
pm.worked(1);
		return result;
	}
	/**
	 * {@inheritDoc}
	 */
	public void dispose() {
		fValidationState.dispose();
	}
	
	/**
	 * {@inheritDoc}
	 */
	protected IDocument acquireDocument(IProgressMonitor pm) throws CoreException {
		if (fAquireCount > 0)
			return fBuffer.getDocument();
		
		ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
		IPath path= fFile.getFullPath();
		manager.connect(path, pm);
		fAquireCount++;
		fBuffer= manager.getTextFileBuffer(path);
		fContentStamp= ContentStamps.get(fFile, true);
		return fBuffer.getDocument();
	}
	
	/**
	 * {@inheritDoc}
	 */
	protected void commit(IDocument document, IProgressMonitor pm) throws CoreException {