ISelection sel= fEditor.getSelectionProvider().getSelection();
ISelection sel= fEditor != null ? fEditor.getSelectionProvider().getSelection() : null;
	private TypeInfo[] doChooseImports(TypeInfo[][] openChoices, final ISourceRange[] ranges) {		// remember selection		ISelection sel= fEditor.getSelectionProvider().getSelection();		TypeInfo[] result= null;;		ILabelProvider labelProvider= new TypeInfoLabelProvider(TypeInfoLabelProvider.SHOW_FULLYQUALIFIED);				MultiElementListSelectionDialog dialog= new MultiElementListSelectionDialog(getShell(), labelProvider) {			protected void handleSelectionChanged() {				super.handleSelectionChanged();				// show choices in editor				doListSelectionChanged(getCurrentPage(), ranges);			}		};		dialog.setTitle(ActionMessages.getString("OrganizeImportsAction.selectiondialog.title")); //$NON-NLS-1$		dialog.setMessage(ActionMessages.getString("OrganizeImportsAction.selectiondialog.message")); //$NON-NLS-1$		dialog.setElements(openChoices);		if (dialog.open() == Window.OK) {			Object[] res= dialog.getResult();						result= new TypeInfo[res.length];			for (int i= 0; i < res.length; i++) {				Object[] array= (Object[]) res[i];				if (array.length > 0)					result[i]= (TypeInfo) array[0];			}		}		// restore selection		if (sel instanceof ITextSelection) {			ITextSelection textSelection= (ITextSelection) sel;			fEditor.selectAndReveal(textSelection.getOffset(), textSelection.getLength());		}		return result;	}