Bug 4381 Replace from local histroy - workspace element included
- modify a CU in the workspace - select the CU - activate "Replace from local history" - the workspace element is included in the local histroy, but a histroy never includes the actual element. I was really suprised seeing the element.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/compare/JavaAddElementFromHistory.java
TextBuffer buffer= null;
		try {
			buffer= TextBuffer.acquire(file);
		
			
			ITypedElement target= new JavaTextBufferNode(buffer, cu.getElementName());
			
			ITypedElement[] editions= new ITypedElement[states.length];
			for (int i= 0; i < states.length; i++)
				editions[i]= new HistoryItem(target, states[i]);
								
			ResourceBundle bundle= ResourceBundle.getBundle(BUNDLE_NAME);
			EditionSelectionDialog d= new EditionSelectionDialog(shell, bundle);
			d.setAddMode(true);
			ITypedElement ti= d.selectEdition(target, editions, parent);
			if (!(ti instanceof IStreamContentAccessor))
				return;	
			
			
			String[] lines= null;
			try {
				lines= JavaCompareUtilities.readLines(((IStreamContentAccessor) ti).getContents());								
			} catch (CoreException ex) {
				JavaPlugin.log(ex);
			}
			if (lines == null) {
				MessageDialog.openError(shell, errorTitle, "couldn't get text to insert");
				return;
			}