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
private static final String BUNDLE_NAME= "org.eclipse.jdt.internal.ui.compare.ReplaceWithEditionAction"; 
	
	private boolean fPrevious= false;
	
	public JavaReplaceWithEditionAction() {
		super(true);
	}
	
	public JavaReplaceWithEditionAction(boolean previous) {
		this();
		fPrevious= previous;
	}	
	
	protected ITypedElement[] buildEditions(ITypedElement target, IFile file, IFileState[] states) {
		ITypedElement[] editions= new ITypedElement[states.length+1];
		editions[0]= new ResourceNode(file);
		for (int i= 0; i < states.length; i++)
			editions[i+1]= new HistoryItem(target, states[i]);
		return editions;
	}
	/*