Bug 12596 exception on saving dirty editors
20020328 Log: Tue Apr 02 14:42:49 GMT+02:00 2002 4 org.eclipse.jdt.ui 1 Internal Error java.lang.reflect.InvocationTargetException: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 at java.util.ArrayList.RangeCheck(ArrayList.java(Compiled Code)) at java.util.ArrayList.get(ArrayList.java(Compiled Code)) at org.eclipse.jdt.internal.ui.reorg.ReorgDestinationAction$1.run (ReorgDestinationAction.java:199) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:296) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:249) at org.eclipse.jface.dialogs.ProgressMonitorDialog.run (ProgressMonitorDialog.java:335) at org.eclipse.jdt.internal.ui.reorg.ReorgDestinationAction.ensureSaved (ReorgDestinationAction.java:168) at org.eclipse.jdt.internal.ui.reorg.ReorgDestinationAction.run (ReorgDestinationAction.java:80) at org.eclipse.jdt.internal.ui.reorg.JdtCopyAction.run (JdtCopyAction.java:58) at org.eclipse.jdt.internal.ui.reorg.PasteResourcesFromClipboardAction.pasteResourc es(PasteResourcesFromClipboardAction.java:60) at org.eclipse.jdt.internal.ui.reorg.PasteResourcesFromClipboardAction.run (PasteResourcesFromClipboardAction.java:53) at org.eclipse.jdt.internal.ui.reorg.DualReorgAction.run (DualReorgAction.java:49) at org.eclipse.jface.action.Action.runWithEvent(Action.java:590) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:407) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java(Compiled Code)) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java(Compiled Code)) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java(Compiled Code)) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java (Compiled Code)) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java(Compiled Code)) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java (Compiled Code)) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java (Compiled Code)) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java (Compiled Code)) at org.eclipse.ui.internal.Workbench.run(Workbench.java:738) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:777) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:319) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:196) at org.eclipse.core.launcher.Main.run(Main.java:555) at org.eclipse.core.launcher.Main.main(Main.java:396)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/reorg/ReorgDestinationAction.java
IResource parentRes= getResource(parent);
		IJavaElement parentElement= JavaCore.create(parentRes);
		if (parentElement != null)
			return parentElement;
		return getResource(parent);	
	}
	
	private static Object computeCommonParent(Object e1, Object e2){
		IResource r1= getResource(e1);
		IResource r2= getResource(e2);	
		if (r1 == null && r2 == null)
			return null;
		if (r1 == null)
			return r2.getParent();
		if (r2 == null)
			return r1.getParent();
		
		if (r1.equals(r2))
			return r1.getParent();
			
		if (r1.getFullPath().isPrefixOf(r2.getFullPath()))
			return r1;
		if (r2.getFullPath().isPrefixOf(r1.getFullPath()))
			return r2;
						
		IPath p1= r1.getParent().getFullPath();
		IPath p2= r2.getParent().getFullPath();
		IPath commonPath= new Path("");
		int segCount= Math.min(p1.segmentCount(), p2.segmentCount());
		for (int i= 0; i < segCount; i++){