Package org.eclipse.jdt.core.dom

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


      org.eclipse.jdt.core.dom.Type constructorChosenType = jdtHelper
          .getChosenType(ast, contructorUmlTypeName,
              constructorUmlQualifiedTypeName,
              sourceDirectoryPackageName);

      SingleVariableDeclaration variableDeclaration = ast
          .newSingleVariableDeclaration();
      variableDeclaration.setType(constructorChosenType);
      variableDeclaration.setName(ast.newSimpleName(constructorProperty
          .getName()));

      md.parameters().add(variableDeclaration);
    }
  }
View Full Code Here


      return;
    }
   
    NakedObjectActionParameter nakedObjectActionParameter =
      (NakedObjectActionParameter) selections[1];
    SingleVariableDeclaration searchDeclaration = (SingleVariableDeclaration)nakedObjectActionParameter.getDeclaration();

    CompilationUnit parsedCompilationUnit = getEditorTracker().getParsedCompilationUnit();
    if (parsedCompilationUnit == null) {
      return;
    }

    SingleVariableDeclaration newDeclaration =
      AstUtils.findDeclaration(
        parsedCompilationUnit, searchDeclaration );
    if (newDeclaration == null) {
      return;
    }
View Full Code Here

  }


 
    public boolean isStringType() {
      SingleVariableDeclaration declaration = getDeclaration();
      Type type = declaration.getType();
      ITypeBinding typeBinding = type.resolveBinding();
      if (typeBinding == null) {
        // java.lang.String should always resolve.
        return false;
      }
View Full Code Here

    entry.addLabels(retriever.getAllLabels());
   
    //first, create fresh variables for all the parameters
    Iterator itr = method.parameters().iterator();
    while (itr.hasNext()) {
      SingleVariableDeclaration param = (SingleVariableDeclaration) itr.next();
      Variable paramVar = getAnalysisContext().getSourceVariable(param.resolveBinding());
     
      ObjectLabel fresh = new DefaultObjectLabel(param.getType().resolveBinding(), false);
      entry.addPointsTo(paramVar, fresh);
      entry.addLabel(fresh);
    }

    //once we have all starting variables, figure out who might point to who
    itr = method.parameters().iterator();
    while (itr.hasNext()) {
      SingleVariableDeclaration param = (SingleVariableDeclaration) itr.next();
      Variable paramVar = getAnalysisContext().getSourceVariable(param.resolveBinding());
      entry.addPointsToAnySubtype(paramVar, param.getType().resolveBinding());
    }
   
    return entry;
  }
View Full Code Here

    entry.addLabels(retriever.getAllLabels());
   
    //create fresh variables for all the parameters
    Iterator itr = method.parameters().iterator();
    while (itr.hasNext()) {
      SingleVariableDeclaration param = (SingleVariableDeclaration) itr.next();
      Variable paramVar = getAnalysisContext().getSourceVariable(param.resolveBinding());
     
      ObjectLabel fresh = new DefaultObjectLabel(param.getType().resolveBinding(), false);
      entry.addPointsTo(paramVar, fresh);
      entry.addLabel(fresh);
    }   
    return entry;
  }
View Full Code Here

    }

    public MatchResult compare() {
      //map argument variables
      for(Object param: cfg.getCodeFragment().parameters()){
        SingleVariableDeclaration var = (SingleVariableDeclaration) param;
        SimpleName name = var.getName();
        Variable result = EvaluationUtils.tryGetVariable(name);
        if (result == null)
          throw new RuntimeException("Not a proper variable!!: '" + var + "'");
        variablesMap.put(name.toString(), result);
      }
View Full Code Here

    MethodDeclaration md = ast.newMethodDeclaration();
    md.modifiers().add(ast.newModifier(ModifierKeyword.PUBLIC_KEYWORD));
    md.setName(ast.newSimpleName("bar"));

    SingleVariableDeclaration var = ast.newSingleVariableDeclaration();
    var.setType(ast.newSimpleType(ast.newSimpleName("String")));
    var.setName(ast.newSimpleName("a"));
    md.parameters().add(var);
    td.bodyDeclarations().add(md);

    Block block = ast.newBlock();
    md.setBody(block);
View Full Code Here

*/
@Test
public class SingleVariableDeclarationWrapperTest {

  public void from_ast() {
    SingleVariableDeclaration declaration = SingleVariableDeclarationFake.SOURCE_FILE_THAT;
    ParameterInfo res = SingleVariableDeclarationWrapper.wrapperOf(declaration)
        .toParameterInfo();
    assertThat(res, isEqualTo(ParameterInfoFake.SOURCE_FILE_THAT));
  }
View Full Code Here

      this.buffer.append(" ");//$NON-NLS-1$
    }
    node.getName().accept(this);
    this.buffer.append("(");//$NON-NLS-1$
    for (Iterator it = node.parameters().iterator(); it.hasNext(); ) {
      SingleVariableDeclaration v = (SingleVariableDeclaration) it.next();
      v.accept(this);
      if (it.hasNext()) {
        this.buffer.append(",");//$NON-NLS-1$
      }
    }
    this.buffer.append(")");//$NON-NLS-1$
View Full Code Here

      int size = parameters.size();
      this.parameterTypes = new String[size];
      Iterator iterator = parameters.iterator();
      // convert the AST types to signatures
      for (int i = 0; i < size; i++) {
        SingleVariableDeclaration parameter = (SingleVariableDeclaration) iterator.next();
        String typeSig = Util.getSignature(parameter.getType());
        int extraDimensions = parameter.getExtraDimensions();
        if (methodDeclaration.isVarargs() && i == size-1)
          extraDimensions++;
        this.parameterTypes[i] = Signature.createArraySignature(typeSig, extraDimensions);
      }
    }
View Full Code Here

TOP

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

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.