Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.IMethodBinding


    if (binding.getKind() != IBinding.VARIABLE)
      return null;
    IVariableBinding varBinding = (IVariableBinding) binding;
    if (varBinding.isField())
      return null;
    IMethodBinding variableMethod = varBinding.getDeclaringMethod();
    //match declaration block
    ASTNode enclosingDeclarationBlock = ASTUtils.findAncestorOfType(name, ASTNode.METHOD_DECLARATION, ASTNode.INITIALIZER);
    if (variableMethod != null) {
      if (enclosingDeclarationBlock.getNodeType() != ASTNode.METHOD_DECLARATION)
        return null; // we are in initializer
      IMethodBinding enclosingMethod = ((MethodDeclaration)enclosingDeclarationBlock).resolveBinding();
      if (varBinding.getDeclaringMethod() != enclosingMethod)
        return null;
    } else {//variable is defined in initializer
      if (enclosingDeclarationBlock.getNodeType() != ASTNode.INITIALIZER)
        return null; // we are some method
View Full Code Here


    String[] paramTypes = new String[numParams];
    for (int i = 0; i < numParams; i++) {
      paramTypes[i] = "Object";
    }

    IMethodBinding methodBinding = QuickfixUtils.getMethodBinding(javaProject, constructor);
    if (methodBinding != null) {
      ClassInstanceCreation invocationNode = QuickfixUtils.getMockConstructorInvocation(constructor
          .getDeclaringType().getFullyQualifiedName(), paramTypes);
      Object proposal = QuickfixReflectionUtils.createChangeMethodSignatureProposal(label, targetCU,
          invocationNode, methodBinding, changeDesc, 5, getImage());
View Full Code Here

  public String getDisplayString() {
    String params = "";
    int numParams = constructor.getNumberOfParameters();

    IMethodBinding methodBinding = QuickfixUtils.getMethodBinding(javaProject, constructor);
    ITypeBinding[] typeParameters = methodBinding.getParameterTypes();

    for (int i = numParams - numAdditionalParams; i < numParams; i++) {
      if (params.length() > 0) {
        params += ", ";
      }
View Full Code Here

    String label = "Add <constructor-arg> to match " + getConstructorDisplay(constructor);
    proposals.add(new AddConstructorArgQuickFixProposal(offset, length, missingEndQuote, numAdditionalArgs,
        beanNode, label));

    IMethodBinding methodBinding = QuickfixUtils.getMethodBinding(javaProject, constructor);
    if (methodBinding != null) {
      label = "Change constructor " + getConstructorDisplay(constructor);
      proposals.add(new RemoveConstructorParamQuickFixProposal(offset, length, missingEndQuote,
          numAdditionalArgs, constructor, label, javaProject));
    }
View Full Code Here

      String[] paramTypes = new String[numParams];
      for (int i = 0; i < numParams; i++) {
        paramTypes[i] = "Object";
      }

      IMethodBinding methodBinding = QuickfixUtils.getMethodBinding(javaProject, constructor);
      if (methodBinding != null) {
        ClassInstanceCreation invocationNode = QuickfixUtils.getMockConstructorInvocation(constructor
            .getDeclaringType().getFullyQualifiedName(), paramTypes);
        Object proposal = QuickfixReflectionUtils.createChangeMethodSignatureProposal(label, targetCU,
            invocationNode, methodBinding, changeDesc, 5, getImage());
View Full Code Here

        break;
      }
    }
   
    ClassInstanceCreation invocationNode = QuickfixUtils.getMockConstructorInvocation(ACCOUNT_CLASS_NAME, new String[0]);
    IMethodBinding methodBinding = QuickfixUtils.getMethodBinding(javaProject, constructor);
    Object[] changeDesc = QuickfixReflectionUtils.createChangeDescriptionArray(1);
   
    changeDesc[0] = QuickfixReflectionUtils.createInsertDescription(targetTypeBinding, "obj");
    return QuickfixReflectionUtils.createChangeMethodSignatureProposal("", targetCU, invocationNode, methodBinding, changeDesc, 5, null);
  }
View Full Code Here

    if (listRewriter != null) {
      IJavaProject javaProject = compilationUnit.getJavaProject();
      CodeGenerationSettings settings = JavaPreferencesSettings.getCodeGenerationSettings(javaProject);
      MethodDeclaration methodDecl = createNewConstructor(typeDecl, ast);
      IMethodBinding constructorBinding = ASTNodes.getMethodBinding(methodDecl.getName());
      ITypeBinding typeBinding = ASTNodes.getTypeBinding(typeDecl.getName());
      ImportRewriteContext context = new ContextSensitiveImportRewriteContext(typeDecl, importRewrite);

      MethodDeclaration stub = StubUtility2.createConstructorStub(compilationUnit, astRewrite, importRewrite,
          context, typeBinding, constructorBinding, this.variableBindings, Modifier.PUBLIC, settings);
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.IMethodBinding

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.