private List<String> initParameterNames() { if (fMethod != null) { try { return new ArrayList<>(Arrays.asList(fMethod.getParameterNames())); } catch (JavaModelException e) { } } return Collections.emptyList(); }
private List<String> initParameterNames() { if (fMethod != null) { try { return new ArrayList<>(Arrays.asList(fMethod.getParameterNames())); } catch (JavaModelException e) { JavaPlugin.log(e); } } return Collections.emptyList(); }
private static String[] getParameterNamesOfAllConstructors(IType type) throws JavaModelException { IMethod[] constructors= JavaElementUtil.getAllConstructors(type); Set<String> result= new HashSet<>(); for (int i= 0; i < constructors.length; i++) { result.addAll(Arrays.asList(constructors[i].getParameterNames())); } return result.toArray(new String[result.size()]); }
private static String[] getParameterNamesOfAllConstructors(IType type) throws JavaModelException { IMethod[] constructors= JavaElementUtil.getAllConstructors(type); Set<String> result= new HashSet<>(); for (int i= 0; i < constructors.length; i++) { result.addAll(Arrays.asList(constructors[i].getParameterNames())); } return result.toArray(new String[result.size()]); }
private static String[] getParameterNamesOfAllConstructors(IType type) throws JavaModelException { IMethod[] constructors= JavaElementUtil.getAllConstructors(type); Set result= new HashSet(); for (int i= 0; i < constructors.length; i++) { result.addAll(Arrays.asList(constructors[i].getParameterNames())); } return (String[]) result.toArray(new String[result.size()]); }
private List<String> initParameterNames() { if (fMethod != null) { try { return new ArrayList<>(Arrays.asList(fMethod.getParameterNames())); } catch (JavaModelException e) { JavaPlugin.log(e); } } return Collections.emptyList(); }
private void copyInvocationParameters(MethodInvocation invocation, AST ast) throws JavaModelException { String[] names= fTargetMethod.getParameterNames(); for (int i= 0; i < names.length; i++) invocation.arguments().add(ast.newSimpleName(names[i])); }
private void copyInvocationParameters(MethodInvocation invocation, AST ast) throws JavaModelException { String[] names= fTargetMethod.getParameterNames(); for (int i= 0; i < names.length; i++) invocation.arguments().add(ast.newSimpleName(names[i])); }
private void copyInvocationParameters(MethodInvocation invocation, AST ast) throws JavaModelException { String[] names= fTargetMethod.getParameterNames(); for (int i= 0; i < names.length; i++) invocation.arguments().add(ast.newSimpleName(names[i])); }
/** Constructor. * @param operation the operation. * @throws JavaModelException if the parameters cannot be retreived. */ JdtFormalParameterList(IMethod operation) throws JavaModelException { this.nb = operation.getNumberOfParameters(); this.names = operation.getParameterNames(); this.types = new String[this.nb]; final ILocalVariable[] unresolvedParameters = operation.getParameters(); for (int i = 0; i < this.nb; ++i) { this.types[i] = resolve(operation, unresolvedParameters[i].getTypeSignature()); } }
public void documentChanged(DocumentEvent event) { try { fRefactoring.setBody(event.getDocument().get(), fRefactoring.getMethod().getParameterNames()); } catch (JavaModelException ex) { // TODO Auto-generated catch block JavaPlugin.log(ex); } } });
@Override public void documentChanged(DocumentEvent event) { try { fRefactoring.setBody(event.getDocument().get(), fRefactoring.getMethod().getParameterNames()); } catch (JavaModelException ex) { // TODO Auto-generated catch block JavaPlugin.log(ex); } } });
public static String createMethodSignature(IMethod method){ try { return Signature.toString(method.getSignature(), method.getElementName(), method.getParameterNames(), false, ! method.isConstructor()); } catch(JavaModelException e) { return method.getElementName(); //fallback } }
@Override public void documentChanged(DocumentEvent event) { try { fRefactoring.setBody(event.getDocument().get(), fRefactoring.getMethod().getParameterNames()); } catch (JavaModelException ex) { // TODO Auto-generated catch block JavaPlugin.log(ex); } } });
private RefactoringStatus checkParameterNamesInRippleMethods() throws JavaModelException { RefactoringStatus result= new RefactoringStatus(); Set newParameterNames= getNewParameterNamesList(); for (int i= 0; i < fRippleMethods.length; i++) { String[] paramNames= fRippleMethods[i].getParameterNames(); for (int j= 0; j < paramNames.length; j++) { if (newParameterNames.contains(paramNames[j])){ String[] args= new String[]{JavaElementUtil.createMethodSignature(fRippleMethods[i]), paramNames[j]}; String msg= Messages.format(RefactoringCoreMessages.ChangeSignatureRefactoring_already_has, args); RefactoringStatusContext context= JavaStatusContext.create(fRippleMethods[i].getCompilationUnit(), fRippleMethods[i].getNameRange()); result.addError(msg, context); } } } return result; }
public static String createMethodSignature(IMethod method){ try { return BasicElementLabels.getJavaElementName(Signature.toString(method.getSignature(), method.getElementName(), method.getParameterNames(), false, ! method.isConstructor())); } catch(JavaModelException e) { return BasicElementLabels.getJavaElementName(method.getElementName()); //fallback } }
public static String createMethodSignature(IMethod method){ try { return BasicElementLabels.getJavaElementName(Signature.toString(method.getSignature(), method.getElementName(), method.getParameterNames(), false, ! method.isConstructor())); } catch(JavaModelException e) { return BasicElementLabels.getJavaElementName(method.getElementName()); //fallback } }
public static String createMethodSignature(IMethod method){ try { return BasicElementLabels.getJavaElementName(Signature.toString(method.getSignature(), method.getElementName(), method.getParameterNames(), false, ! method.isConstructor())); } catch(JavaModelException e) { return BasicElementLabels.getJavaElementName(method.getElementName()); //fallback } }
private RefactoringStatus checkParameterNamesInRippleMethods() throws JavaModelException { RefactoringStatus result= new RefactoringStatus(); Set<String> newParameterNames= getNewParameterNamesList(); for (int i= 0; i < fRippleMethods.length; i++) { String[] paramNames= fRippleMethods[i].getParameterNames(); for (int j= 0; j < paramNames.length; j++) { if (newParameterNames.contains(paramNames[j])){ String[] args= new String[]{ JavaElementUtil.createMethodSignature(fRippleMethods[i]), BasicElementLabels.getJavaElementName(paramNames[j])}; String msg= Messages.format(RefactoringCoreMessages.ChangeSignatureRefactoring_already_has, args); RefactoringStatusContext context= JavaStatusContext.create(fRippleMethods[i].getCompilationUnit(), fRippleMethods[i].getNameRange()); result.addError(msg, context); } } } return result; }
public void run() { String methodName = null; try { methodName = Signature.toString(getMethod().getSignature(), getMethod().getElementName(), getMethod().getParameterNames(), false, false); } catch (JavaModelException e) { methodName = getMethod().getElementName(); } new MessageDialog(JDIDebugUIPlugin.getActiveWorkbenchShell(), ActionMessages.StepIntoSelectionHandler_1, null, MessageFormat.format(ActionMessages.StepIntoSelectionHandler_Execution_did_not_enter____0____before_the_current_method_returned__1, new String[]{methodName}), MessageDialog.INFORMATION, new String[] {ActionMessages.StepIntoSelectionHandler_2}, 0).open(); } };