Package org.eclipse.jdt.core

Examples of org.eclipse.jdt.core.IMethod


    block.accept(new ASTVisitor() {

      @SuppressWarnings("unchecked")
      @Override
      public boolean visit(MethodInvocation node) {
          IMethod invokedMethod = (IMethod) node.resolveMethodBinding().getJavaElement();
         
          try {
            if (invokedMethod.getElementName().equals(fromMethod.getElementName())
              && invokedMethod.getSignature().equals(fromMethod.getSignature())){

              Block newBlock = parseCode(code);
             
              ASTNode target = node.getParent();
             
View Full Code Here


  public MethodDeclaration getMethodDeclaration(IMethod method) {
    TypeDeclaration typeDeclaration = getTypeDeclaration(method.getDeclaringType());
    MethodDeclaration[] methods = typeDeclaration.getMethods();
    for (MethodDeclaration methodDeclaration : methods) {
      try {
        IMethod m = (IMethod) methodDeclaration.resolveBinding().getJavaElement();
        if (m.equals(method)) {
          return methodDeclaration;
        }
      } catch (Exception e) {
      }
    }
View Full Code Here

  }

  private MethodDeclaration getMethodDeclaration(TypeDeclaration typeDeclaration, String methodName, String[] signature) {
    try {
      IType type = javaProject.findType(typeDeclaration.resolveBinding().getQualifiedName());
      IMethod method = type.getMethod(methodName, signature);

      return compilationUnitCache.getMethodDeclaration(method);
    } catch (JavaModelException e) {
    }
   
View Full Code Here

    }
  }

  public void changeInvocationsToConstructor(String fromClass, final String fromMethodName, String[] fromSignature, final String toClass) {
    MethodDeclaration fromMethodDeclaration = compilationUnitCache.getMethodDeclaration(fromClass, fromMethodName, fromSignature);
    final IMethod fromMethod = (IMethod) fromMethodDeclaration.resolveBinding().getJavaElement();

    BlockModifier blockModifier = new ConvertMethodInvocationToConstructor(fromMethod, toClass);
    modifyBlocks(fromMethod, blockModifier);
  }
View Full Code Here

        try {
          if (!(match instanceof MethodReferenceMatch)) {
            continue;
          }

          IMethod javaElement = (IMethod) ((PlatformObject) (match.getElement())).getAdapter(IJavaElement.class);
          Block block = compilationUnitCache.getMethodDeclaration(javaElement).getBody();
          blockModifier.modify(block);
        } catch (Exception e) {
          e.printStackTrace();
        }
View Full Code Here

    return compilationUnitCache.getSignatures(type, methodName);
  }

  public void changeInvocationsTo(String fromClass, String fromMethodName, String[] fromSignature, String code) {
    MethodDeclaration fromMethodDeclaration = compilationUnitCache.getMethodDeclaration(fromClass, fromMethodName, fromSignature);
    final IMethod fromMethod = (IMethod) fromMethodDeclaration.resolveBinding().getJavaElement();

    BlockModifier blockModifier = new ConvertMethodInvocationToCode(fromMethod, code);
    modifyBlocks(fromMethod, blockModifier);
  }
View Full Code Here

          dependency.setDependsOn(dependsOn);
         
          dependency.addMethodCall(methodCall);
          results.add(dependency);
        } else {
          IMethod method = (IMethod) node.resolveMethodBinding().getJavaElement();
          if (! method.isBinary()) {
            MethodDeclaration calleeMethodDeclaration = compilationUnitCache.getMethodDeclaration(method);
         
            if (calleeMethodDeclaration != null) {
              List<Dependency> references = findReferencesTo(bean, interfacesToFind, calleeMethodDeclaration, currentDepth + 1);
             
View Full Code Here

      methodsByName.put(methods[i].getElementName(), methods[i]);
    }
  }

  private IMethod getMethod(final String name) {
    final IMethod m = (IMethod) methodsByName.get(name);
    assertNotNull(m);
    return m;
  }
View Full Code Here

    return m;
  }

  private void assertSignature(final String methodName, final String signature)
      throws Exception {
    final IMethod method = getMethod(methodName);
    assertEquals(signature, SignatureResolver.getParameters(method));
  }
View Full Code Here

  private void addToIndex(final IMethod method) throws JavaModelException {
    final String paramCountKey = createParamCountKey(method);
    if (ambiguous.contains(paramCountKey)) {
      indexParamSignature.put(createParamSignatureKey(method), method);
    } else {
      final IMethod existing = indexParamCount.get(paramCountKey);
      if (existing == null) {
        indexParamCount.put(paramCountKey, method);
      } else {
        ambiguous.add(paramCountKey);
        indexParamSignature.put(createParamSignatureKey(existing), existing);
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.IMethod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.