createdMethods= processResults(methods, type);
IJavaElement elementPosition= dialog.getElementPosition(); CodeGenerationSettings settings = JavaPreferencesSettings.getCodeGenerationSettings(); settings.createComments= dialog.getGenerateComment(); createdMethods= processResults(methods, type, elementPosition, settings);
	private void showUI(IType type, IField[] preselected) {		try {			FieldContentProvider provider = new FieldContentProvider(type);			Methods2FieldLabelProvider methodLabel = new Methods2FieldLabelProvider();			CheckedTreeSelectionDialog dialog = new CheckedTreeSelectionDialog(getShell(), methodLabel, provider);			dialog.setValidator(new ISelectionStatusValidator() {				public IStatus validate(Object[] selection) {					StatusInfo state = new StatusInfo();					if (selection != null && selection.length > 0) {						HashSet map = new HashSet(selection.length);						int count = 0;						for (int i = 0; i < selection.length; i++) {							Object key = selection[i];							if (selection[i] instanceof Methods2Field) {								count++;								try {									key = createSignatureKey(((Methods2Field) selection[i]).fMethod);								} catch (JavaModelException e) {									return new StatusInfo(StatusInfo.ERROR, e.toString());								}							}							if (!map.add(key)) { //$NON-NLS-1$								state = new StatusInfo(IStatus.ERROR, ActionMessages.getString("AddDelegateMethodsAction.duplicate_methods")); //$NON-NLS-1$								break;							} else {								String message;								if (count == 1) {									message = ActionMessages.getFormattedString("AddDelegateMethodsAction.selectioninfo.one", String.valueOf(count)); //$NON-NLS-1$								} else {									message = ActionMessages.getFormattedString("AddDelegateMethodsAction.selectioninfo.more", String.valueOf(count)); //$NON-NLS-1$								}								state = new StatusInfo(IStatus.INFO, message);							}						}					}					return state;				}			});			dialog.setSorter(new Methods2FieldSorter());			dialog.setInput(provider);			dialog.setContainerMode(true);			dialog.setMessage(ActionMessages.getString("AddDelegateMethodsAction.message")); //$NON-NLS-1$			dialog.setTitle(ActionMessages.getString("AddDelegateMethodsAction.title")); //$NON-NLS-1$			dialog.setExpandedElements(preselected);			int result = dialog.open();			if (result == Window.OK) {				Object[] o = dialog.getResult();				if (o == null)					return;				ArrayList methods = new ArrayList(o.length);				for (int i = 0; i < o.length; i++) {					if (o[i] instanceof Methods2Field)						methods.add(o[i]);				}				IEditorPart part = EditorUtility.openInEditor(type);				type = (IType) JavaModelUtil.toWorkingCopy(type);												IRewriteTarget target= (IRewriteTarget) part.getAdapter(IRewriteTarget.class);				IMethod[] createdMethods= null;				try {					if (target != null) {						target.beginCompoundChange();					}					createdMethods= processResults(methods, type);				} finally {					if (target != null) {						target.endCompoundChange();					}				}								if (createdMethods != null && createdMethods.length > 0) {					type.getCompilationUnit().reconcile();					EditorUtility.revealInEditor(part, createdMethods[0]);				}			}		} catch (CoreException e) {			ExceptionHandler.handle(e, DIALOG_TITLE, ActionMessages.getString("AddDelegateMethodsAction.error.actionfailed")); //$NON-NLS-1$		} catch (InvocationTargetException e) {			ExceptionHandler.handle(e, DIALOG_TITLE, ActionMessages.getString("AddDelegateMethodsAction.error.actionfailed")); //$NON-NLS-1$		}	}