/* (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 } }