Package org.eclipse.jdt.core

Examples of org.eclipse.jdt.core.IMethod


  {
    Vector<String> ret = new Vector<String>();

    IType thisType = compilationUnit.getAllTypes()[0];

    IMethod methods[] = thisType.getMethods();

    for (int i = 0; i < methods.length; i++)
    {
      if (methods[i].getElementName().startsWith("get") && !methods[i].getElementName().startsWith("getId") && !methods[i].getElementName().contains("UID") && isRelationship(methods[i]))
      {
View Full Code Here


    IField fields[] = thisType.getFields();

    for (int i = 0; i < fields.length; i++)
    {
      IMethod method = thisType.getMethod(makeGet(fields[i].getElementName()), null);

      if (!fields[i].getElementName().contains("UID") && !isRelationship(method))
        ret.add(fields[i].getElementName());
    }
View Full Code Here

     
        sourceCompilationUnit.save(null, true);

        // Inserimento delle annotazioni relative al generatore
       
        IMethod method=null;
        IJavaElement types[] = type.getChildren();
       
        for (IJavaElement element : types)
        {
          if (element instanceof IMethod && element.getElementName().contains(Utils.makeGet(directRelationshipName)))
View Full Code Here

      int overridden = 0;
      try {
        IMethod[] myMethods = iType.getMethods();
        List<IMethod> counted = new ArrayList<IMethod>();
        for (int m = 0; m < myMethods.length; m++) {
          IMethod myMethod = myMethods[m];
          // don't consider methods excluded by preferences
          if (getPrefs().countMethod(myMethod.getElementName())) {
            overridden = countMethods(supers, overridden, counted,
                myMethod);
          }
        }
      } catch (JavaModelException e) {
View Full Code Here

      for (int s = 0; s < supers.length; s++) {
        IMethod[] inheritedMethods = supers[s].getMethods();
        for (int sm = 0; sm < inheritedMethods.length; sm++) {
          if (counted.contains(myMethod))
            continue;
          IMethod inherited = inheritedMethods[sm];
          int inheritedFlags = inherited.getFlags();
          // don't have to consider static methods
          if ((inheritedFlags & Flags.AccStatic) != 0)
            continue;
          // don't have to consider private methods
          if ((inheritedFlags & Flags.AccPrivate) != 0)
            continue;
          // don't count abstract methods unless preferences dictate
          // it
          if ((!getPrefs().countAbstract())
              && ((inheritedFlags & Flags.AccAbstract) != 0))
            continue;
          // methods must have same signature and return type
          if (!inherited.isSimilar(myMethod))
            continue;
          // don't count methods invoking super unless preferences
          // override
          if ((getPrefs().countSuper())
              || (!containsSuperCall(myMethod))) {
View Full Code Here

     * <code>null</code> if the type doesn't contain a corresponding method.
     */
    public static IMethod find(IMethodBinding method, IType type) throws JavaModelException {
        IMethod[] candidates= type.getMethods();
        for (int i= 0; i < candidates.length; i++) {
            IMethod candidate= candidates[i];
            if (candidate.getElementName().equals(method.getName()) && sameParameters(method, candidate)) {
                return candidate;
            }
        }
        return null;
    }
View Full Code Here

        }
        return null;
    }

    public static IMethod findIncludingSupertypes(IMethodBinding method, IType type, IProgressMonitor pm) throws JavaModelException {
        IMethod inThisType= find(method, type);
        if (inThisType != null)
            return inThisType;
        IType[] superTypes= getAllSuperTypes(type, pm);
        for (int i= 0; i < superTypes.length; i++) {
            IMethod m= find(method, superTypes[i]);
            if (m != null)
                return m;
        }
        return null;
    }
View Full Code Here

    } else
    if(decl.getParent() instanceof MethodDeclaration){
      // the case of a parameter -- add the actuals and recurse
      //showMessage(decl.toString() + " is a parameter of " + parent.getClass());
      MethodDeclaration methodDecl = (MethodDeclaration) decl.getParent();
      IMethod method = new MethodFinder((IFile) resource).convertMethodDecl2IMethod(methodDecl);
      if(method == null) {
        JavaPlugin.logErrorMessage("Internal error: No method found for " + methodDecl);
        return;
      }

      HistoryDefinitionLocation paramDL = new HistoryDefinitionLocation(
          decl.toString(),
          resource,
          cu.getLineNumber(decl.getStartPosition()),
          decl, parent, HistoryDefinitionLocation.FORMAL_PARAMETER);
      if(!registerExpansion(paramDL)) {
        // recursion detected here
        return;
      }

      Expression onlyCall = (Expression) (stack.isEmpty() ? null : stack.getLast());
      log("Looking for calls from " + onlyCall);
      Collection/*<ExpressionUnitPair>*/ c = CallerFinder.getActualsForFormal(method, name, onlyCall, monitor, null);
      if(c.isEmpty()){
        logError(
            "No suitable actual arguments for formal argument " +
            name + " of " + method.getElementName() + " at " +
            resource.getName() + " found");
      } else
      for (Iterator iter = c.iterator(); iter.hasNext();) {
        Utils.ExpressionUnitPair eup = (Utils.ExpressionUnitPair) iter.next();
        Expression     e        = eup.getExpression();
View Full Code Here

  @Override
  public void shouldCorrectlyBuildMultiplePaths() {
    WorkspaceStorage ws2 = new WorkspaceStorage(new Path(".b"), null);
    LocalDate date2 = date.minusDays(2);
    IMethod method2 = (IMethod) JavaCore
        .create("=Proj2/src2<com.example2{My.java[My~getDefault");
    Duration duration2 = duration.minus(100);

    ICategory[] categories = {Category.WORKSPACE, Category.JAVA_TYPE_ROOT};
    List<TreePath> expected = asList(
        newPath(ws, method.getTypeRoot(), duration),
        newPath(ws2, method2.getTypeRoot(), duration2));

    IJavaData data2 = mock(IJavaData.class);
    given(data2.get(IJavaData.DATE)).willReturn(date2);
    given(data2.get(IJavaData.DURATION)).willReturn(duration2);
    given(data2.get(IJavaData.JAVA_ELEMENT)).willReturn(method2);
View Full Code Here

    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())){

              ASTNode varDeclarationStmt = node.getParent().getParent();
              if (varDeclarationStmt instanceof VariableDeclarationStatement) {
                VariableDeclarationStatement vds = (VariableDeclarationStatement) varDeclarationStmt;
               
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.