Bug 59229 AssertionFailed when restoring from local history
smoke for I20040420 1. open SimpleTest.java 2. select all in editor 3. delete 4. save 5. select SimpleTest.java in Package Explorer 6. context menu > Restore From Local Histore... 7. select all elements 8. click Restore ==> nothing restores and Assertion failure (see below) I looks as if restoring CU children always fails. Restoring elements for types works. org.eclipse.jface.util.Assert$AssertionFailedException: Assertion failed: at org.eclipse.jface.util.Assert.isTrue(Assert.java:168) at org.eclipse.jface.util.Assert.isTrue(Assert.java:154) at org.eclipse.jdt.internal.ui.compare.JavaAddElementFromHistory.getPlaceHolderType(JavaAddElementFromHistory.java:267) at org.eclipse.jdt.internal.ui.compare.JavaAddElementFromHistory.createASTNode(JavaAddElementFromHistory.java:204) at org.eclipse.jdt.internal.ui.compare.JavaAddElementFromHistory.run(JavaAddElementFromHistory.java:157) at org.eclipse.jdt.internal.ui.compare.JavaHistoryAction.run(JavaHistoryAction.java:361) at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:269) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:550) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:502) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:435) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:769) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2592) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2270) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1437) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1408) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:244) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:140) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:90) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:280) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:240) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:117) 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:267) at org.eclipse.core.launcher.Main.run(Main.java:699) at org.eclipse.core.launcher.Main.main(Main.java:683)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/compare/JavaAddElementFromHistory.java
* @param delimiter the line delimiter
	 * @return a ASTNode or null
	 * @throws CoreException
	 */
	private ASTNode createASTNode(OldASTRewrite rewriter, ITypedElement element, String delimiter) throws CoreException {
		if (element instanceof IStreamContentAccessor) {
			String content= JavaCompareUtilities.readString((IStreamContentAccessor)element);
			if (content != null) {
				content= trimTextBlock(content, delimiter);
				if (content != null) return rewriter.createStringPlaceholder(content, getPlaceHolderType(element));
			}
		}
		return null;
	}
	
	/**
	 * Finds the corresponding ASTNode for the given container and returns 
	 * its list of children. This list can be used to add a new child nodes to the container.
	 * @param container the container for which to return the children list
	 * @param root the AST
	 * @return list of children or null
	 * @throws JavaModelException
	 */
	private List getContainerList(IParent container, CompilationUnit root) throws JavaModelException {
		
		if (container instanceof ICompilationUnit)
			return root.types();
			
		if (container instanceof IType) {
			ISourceRange sourceRange= ((IType)container).getNameRange();