Bug 12283 exception in organize import dialog
20020321++ i pressed 'next' in the dialog that shows up on organize imports java.lang.ArrayIndexOutOfBoundsException: 2 at org.eclipse.jdt.internal.ui.dialogs.FilteredList.getSelection (FilteredList.java:337) at org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog.getSelect edElements(AbstractElementListSelectionDialog.java:222) at org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog.validateC urrentSelection(AbstractElementListSelectionDialog.java:270) at org.eclipse.jdt.internal.ui.dialogs.MultiElementListSelectionDialog.turnPage (MultiElementListSelectionDialog.java:240) at org.eclipse.jdt.internal.ui.dialogs.MultiElementListSelectionDialog.buttonPresse d(MultiElementListSelectionDialog.java:170) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:363) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.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.jface.window.Window.runEventLoop(Window.java(Compiled Code)) at org.eclipse.jface.window.Window.open(Window.java:525) at org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog.access$su perOpen(AbstractElementListSelectionDialog.java:400) at org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog.access$2 (AbstractElementListSelectionDialog.java:399) at org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog$4.run (AbstractElementListSelectionDialog.java:393) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java (Compiled Code)) at org.eclipse.jdt.internal.ui.dialogs.AbstractElementListSelectionDialog.open (AbstractElementListSelectionDialog.java:391) at org.eclipse.jdt.internal.ui.dialogs.MultiElementListSelectionDialog.open (MultiElementListSelectionDialog.java:99) at org.eclipse.jdt.internal.ui.javaeditor.OrganizeImportsAction.doChooseImports (OrganizeImportsAction.java:123) at org.eclipse.jdt.internal.ui.javaeditor.OrganizeImportsAction.access$0 (OrganizeImportsAction.java:107) at org.eclipse.jdt.internal.ui.javaeditor.OrganizeImportsAction$1.chooseImports (OrganizeImportsAction.java:102) at org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation.run (OrganizeImportsOperation.java:355) at org.eclipse.core.internal.resources.Workspace.run (Workspace.java:1338) at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run (WorkbenchRunnableAdapter.java:32) at org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext$BusyRunnable.inter nalRun(BusyIndicatorRunnableContext.java:107) at org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext$BusyRunnable.run (BusyIndicatorRunnableContext.java:74) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java (Compiled Code)) at org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext.run (BusyIndicatorRunnableContext.java:120) at org.eclipse.jdt.internal.ui.javaeditor.OrganizeImportsAction.run (OrganizeImportsAction.java:79) at org.eclipse.ui.texteditor.RetargetTextEditorAction.run (RetargetTextEditorAction.java:103) at org.eclipse.jface.action.Action.runWithEvent(Action.java:473) 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:705) 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/dialogs/MultiElementListSelectionDialog.java
/**
	 * @see AbstractElementListSelectionDialog#updateButtonsEnableState(IStatus)
	 */
	protected void updateButtonsEnableState(IStatus status) {
		boolean isOK= !status.matches(IStatus.ERROR);
		fPages[fCurrentPage].okState= isOK;
		fNextButton.setEnabled(isOK && (fCurrentPage < fNumberOfPages - 1));
		fBackButton.setEnabled(fCurrentPage != 0);
		
		boolean isAllOK= isOK;
		for (int i= 0; i != fNumberOfPages; i++)
			isAllOK = isAllOK && fPages[i].okState;
		
		fFinishButton.setEnabled(isAllOK);
	}
	private void turnPage(boolean toNextPage) {
		Page page= fPages[fCurrentPage];
		
				
		String filter= getFilter();
		if (filter == null)
			filter= ""; 
		page.filter= filter;
		
		Object[] selectedElements= getSelectedElements();
		List list= getInitialSelections();
		list.set(fCurrentPage, selectedElements);
		
		setResult(fCurrentPage, getSelectedElements());