Package org.eclipse.jdt.core.dom

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


  }
  /**
   * Example: MyLabel: { int x = 5; }
   */
  public boolean visit(LabeledStatement node) {
    SimpleName label = node.getLabel();
    if(label == null)
      throw new CrystalRuntimeException("labeled statement had no label");
    ControlFlowNode body = controlFlowNode.newControlFlowNode(node.getBody());
    if(body == null)
      throw new CrystalRuntimeException("labeled statement had no body");
View Full Code Here


  }
  /**
   * Example: (2 in 1)  java.lang.System.out.println("Hello");
   */
  public boolean visit(QualifiedName node) {
    SimpleName name = node.getName();
    Name qualifier = node.getQualifier();
    IBinding nameBinding = name.resolveBinding();
    // If this is a Field access, then add children to CFG
    if(nameBinding.getKind() == IBinding.VARIABLE) {
      IVariableBinding variableBinding = (IVariableBinding) nameBinding;
      if(variableBinding.isField()) {
        ControlFlowNode nameCFN = controlFlowNode.newControlFlowNode(name);
View Full Code Here

   
    // If the next node is a labeled node, get the label
    String nextCFNLabel = null;
    if(cfnType == ASTNode.LABELED_STATEMENT) {
      LabeledStatement ls = (LabeledStatement) nextCFN.astNode;
      SimpleName sn = ls.getLabel();
      nextCFNLabel = sn.getIdentifier();
    }
   
    // if no label, then break on first loop or switch
    if(label == null &&
        (cfnType == ASTNode.SWITCH_STATEMENT
View Full Code Here

   
    // If the next node is a labeled node, get the label
    String nextCFNLabel = null;
    if(cfnType == ASTNode.LABELED_STATEMENT) {
      LabeledStatement ls = (LabeledStatement) nextCFN.astNode;
      SimpleName sn = ls.getLabel();
      nextCFNLabel = sn.getIdentifier();
    }
   
    // if no label, then continue on first loop
    if(label == null &&
        (cfnType == ASTNode.DO_STATEMENT
View Full Code Here

              eclipseVariableQuery);
        }
      }
    }
    if(targetNode instanceof SimpleName) {
      SimpleName target = (SimpleName) targetNode;
      IBinding binding = target.resolveBinding();
      if(binding instanceof IVariableBinding) {
        IVariableBinding vb = (IVariableBinding) binding;
        if(vb.isField()) {
          // implicit field access on this
          return new StoreFieldInstructionImpl(
View Full Code Here

    // "add" should be into variable
    if (!(possibleExpression instanceof SimpleName)) {
      return false;
    }
    // variable should be same as "columnsList"
    SimpleName possibleName = (SimpleName) possibleExpression;
    if (!columnsList.getIdentifier().equals(possibleName.getIdentifier())) {
      return false;
    }
    // there should be no re-assignment of "columnsList"
    ExecutionFlowDescription flowDescription = JavaInfoUtils.getState(this).getFlowDescription();
    ASTNode columnsAssignment = ExecutionFlowUtils.getLastAssignment(flowDescription, columnsList);
View Full Code Here

        }
      }

      @Override
      void create(ColumnConfigInfo column, ColumnConfigInfo nextColumn) throws Exception {
        SimpleName columnsList = ensureColumnsList();
        ColumnConfigAssociation association = new ColumnConfigAssociation(columnsList);
        AssociationObject associationObject = new AssociationObject(association, true);
        if (nextColumn == null) {
          Statement columnsListUsageStatement = AstNodeUtils.getEnclosingStatement(columnsList);
          StatementTarget target = new StatementTarget(columnsListUsageStatement, true);
          JavaInfoUtils.addTarget(column, associationObject, GridInfo.this, target);
        } else {
          JavaInfoUtils.add(column, associationObject, GridInfo.this, nextColumn);
        }
      }

      @Override
      void move(ColumnConfigInfo column, ColumnConfigInfo nextColumn) throws Exception {
        SimpleName columnsList = ensureColumnsList();
        ColumnConfigAssociation association = new ColumnConfigAssociation(columnsList);
        AssociationObject associationObject = new AssociationObject(association, true);
        if (nextColumn == null) {
          Statement columnsListUsageStatement = AstNodeUtils.getEnclosingStatement(columnsList);
          StatementTarget target = new StatementTarget(columnsListUsageStatement, true);
View Full Code Here

            @Override
            public boolean visit(TypeDeclaration typeDecl) {
                ITypeBinding typeBinding = typeDecl.resolveBinding();
                if (typeBinding != null) {
                    if (typeBinding.getBinaryName().equals(className)) {
                        SimpleName nameNode = typeDecl.getName();
                        markerAttributes.put(IMarker.CHAR_START, nameNode.getStartPosition());
                        markerAttributes.put(IMarker.CHAR_END, nameNode.getStartPosition() + nameNode.getLength());

                        return false;
                    }
                }
                return true;
View Full Code Here

              while (bodyDeclarations.hasNext()) {
                Object bodyDeclaration = bodyDeclarations.next();
                if (bodyDeclaration instanceof MethodDeclaration) {
                  MethodDeclaration methodDeclaration = (MethodDeclaration) bodyDeclaration;
                  if (methodDeclaration.isConstructor()) {
                    SimpleName methodName = methodDeclaration.getName();
                    if (methodName.getIdentifier().equals(oldTypeName)) {
                      rewriter.replace(methodName, ast.newSimpleName(newTypeName), null);
                    }
                  }
                }
              }
View Full Code Here

    private MethodDeclaration createRunMethodDeclaration(ASTRewrite rewrite, ClassInstanceCreation classLoaderCreation) {
        AST ast = rewrite.getAST();

        MethodDeclaration methodDeclaration = ast.newMethodDeclaration();
        SimpleName methodName = ast.newSimpleName("run");
        Type returnType = (Type) rewrite.createCopyTarget(classLoaderCreation.getType());
        Block methodBody = createRunMethodBody(rewrite, classLoaderCreation);
        List<Modifier> modifiers = checkedList(methodDeclaration.modifiers());

        modifiers.add(ast.newModifier(PUBLIC_KEYWORD));
View Full Code Here

TOP

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

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.