/* (non-Javadoc) * Method declared on SelectionDispatchAction. */ public void run(ITextSelection selection) { IModelElement input = SelectionConverter.getInput(fEditor); if (!ActionUtil.isProcessable(getShell(), input)) return; try { IModelElement[] elements = resolveModelElements(); if (elements == null) return; List candidates = new ArrayList(elements.length); for (int i = 0; i < elements.length; i++) { IModelElement[] resolvedElements = CallHierarchyUI.getCandidates(elements[i]); if (resolvedElements != null) candidates.addAll(Arrays.asList(resolvedElements)); } if (candidates.isEmpty()) { IModelElement enclosingMethod = getEnclosingMethod(input, selection); if (enclosingMethod != null) { candidates.add(enclosingMethod); } } run((IModelElement[]) candidates.toArray(new IModelElement[candidates.size()])); } catch (InvocationTargetException e) { ExceptionHandler.handle( e, getShell(), getErrorDialogTitle(), ActionMessages.SelectionConverter_codeResolve_failed); } catch (InterruptedException e) { // cancelled } }
/* (non-Javadoc) * @see org.eclipse.jface.action.Action#run() */ public void run() { Shell shell = getShell(); if (!doCreateProjectFirstOnEmptyWorkspace(shell)) { return; } try { INewWizard wizard = createWizard(); wizard.init(PlatformUI.getWorkbench(), getSelection()); WizardDialog dialog = new WizardDialog(shell, wizard); if (shell != null) { PixelConverter converter = new PixelConverter(shell); dialog.setMinimumPageSize( converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20)); } dialog.create(); int res = dialog.open(); if (res == Window.OK && wizard instanceof NewElementWizard) { fCreatedElement = ((NewElementWizard) wizard).getCreatedElement(); } notifyResult(res == Window.OK); } catch (CoreException e) { String title = NewWizardMessages.AbstractOpenWizardAction_createerror_title; String message = NewWizardMessages.AbstractOpenWizardAction_createerror_message; ExceptionHandler.handle(e, shell, title, message); } }