Bug 17463 Replace with previous element from local history should ignore unparseable versions
Build F1 If the previous version of a file can't be parsed, then 'Replace with previous element from local history' replaces the element with the entire contents of the previous edition. I believe that this behaviour is incorrect. It should either continue searching in older versions until it finds a version with the element, or do nothing. Create the following Java file and save it: public class Hello { public Hello() { super(); System.out.println("Hello world"); } } Replace the contents with the following and save: dfjlkfdjklnbv dfbdfjhkfldbf f dbfdsjlgvbsdb fdsgkldfsg Replace the contents with the following and save: public class Hello { public Hello() { super(); System.out.println("Hello world"); } } Now select the constructor in the Outline view. Choose 'Replace with previous element from local history'. The resulting file is: public class Hello { dfjlkfdjklnbv dfbdfjhkfldbf f dbfdsjlgvbsdb fdsgkldfsg }
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/compare/JavaReplaceWithEditionAction.java
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
	 */
	public void run(IAction action) {
		
		String errorTitle= CompareMessages.getString("ReplaceFromHistory.title"); 
		String errorMessage= CompareMessages.getString("ReplaceFromHistory.internalErrorMessage"); 
		
		Shell shell= JavaPlugin.getActiveWorkbenchShell();
		
		
		ISelection selection= getSelection();
		IMember input= getEditionElement(selection);
		if (input == null) {
			
			MessageDialog.openError(shell, errorTitle, errorMessage);
			return;
		}
		
		IFile file= getFile(input);
		if (file == null) {
			MessageDialog.openError(shell, errorTitle, errorMessage);
			return;
		}
										
		boolean inEditor= beingEdited(file);
		if (inEditor)
			input= (IMember) getWorkingCopy(input);
		
		TextBuffer buffer= null;
		try {