Java 类org.eclipse.jdt.core.dom.LabeledStatement 实例源码

项目:eclipse.jdt.ls    文件:ExtractMethodAnalyzer.java   
private Statement getParentLoopBody(ASTNode node) {
    Statement stmt = null;
    ASTNode start = node;
    while (start != null && !(start instanceof ForStatement) && !(start instanceof DoStatement) && !(start instanceof WhileStatement) && !(start instanceof EnhancedForStatement) && !(start instanceof SwitchStatement)) {
        start = start.getParent();
    }
    if (start instanceof ForStatement) {
        stmt = ((ForStatement) start).getBody();
    } else if (start instanceof DoStatement) {
        stmt = ((DoStatement) start).getBody();
    } else if (start instanceof WhileStatement) {
        stmt = ((WhileStatement) start).getBody();
    } else if (start instanceof EnhancedForStatement) {
        stmt = ((EnhancedForStatement) start).getBody();
    }
    if (start != null && start.getParent() instanceof LabeledStatement) {
        LabeledStatement labeledStatement = (LabeledStatement) start.getParent();
        fEnclosingLoopLabel = labeledStatement.getLabel();
    }
    return stmt;
}
项目:che    文件:ExtractMethodAnalyzer.java   
private Statement getParentLoopBody(ASTNode node) {
  Statement stmt = null;
  ASTNode start = node;
  while (start != null
      && !(start instanceof ForStatement)
      && !(start instanceof DoStatement)
      && !(start instanceof WhileStatement)
      && !(start instanceof EnhancedForStatement)
      && !(start instanceof SwitchStatement)) {
    start = start.getParent();
  }
  if (start instanceof ForStatement) {
    stmt = ((ForStatement) start).getBody();
  } else if (start instanceof DoStatement) {
    stmt = ((DoStatement) start).getBody();
  } else if (start instanceof WhileStatement) {
    stmt = ((WhileStatement) start).getBody();
  } else if (start instanceof EnhancedForStatement) {
    stmt = ((EnhancedForStatement) start).getBody();
  }
  if (start != null && start.getParent() instanceof LabeledStatement) {
    LabeledStatement labeledStatement = (LabeledStatement) start.getParent();
    fEnclosingLoopLabel = labeledStatement.getLabel();
  }
  return stmt;
}
项目:Eclipse-Postfix-Code-Completion    文件:ExtractMethodAnalyzer.java   
private Statement getParentLoopBody(ASTNode node) {
    Statement stmt= null;
    ASTNode start= node;
    while (start != null
            && !(start instanceof ForStatement)
            && !(start instanceof DoStatement)
            && !(start instanceof WhileStatement)
            && !(start instanceof EnhancedForStatement)
            && !(start instanceof SwitchStatement)) {
        start= start.getParent();
    }
    if (start instanceof ForStatement) {
        stmt= ((ForStatement)start).getBody();
    } else if (start instanceof DoStatement) {
        stmt= ((DoStatement)start).getBody();
    } else if (start instanceof WhileStatement) {
        stmt= ((WhileStatement)start).getBody();
    } else if (start instanceof EnhancedForStatement) {
        stmt= ((EnhancedForStatement)start).getBody();
    }
    if (start != null && start.getParent() instanceof LabeledStatement) {
        LabeledStatement labeledStatement= (LabeledStatement)start.getParent();
        fEnclosingLoopLabel= labeledStatement.getLabel();
    }
    return stmt;
}
项目:Eclipse-Postfix-Code-Completion    文件:BreakContinueTargetFinder.java   
private boolean keepWalkingUp(ASTNode node) {
    if (node == null)
        return false;
    if (isAnyInstanceOf(STOPPERS, node))
        return false;
    if (fLabel != null && LabeledStatement.class.isInstance(node)){
        LabeledStatement ls= (LabeledStatement)node;
        return ! areEqualLabels(ls.getLabel(), fLabel);
    }
    if (fLabel == null) {
        if (isAnyInstanceOf(fIsBreak ? BREAKTARGETS : CONTINUETARGETS, node))
            return node.getParent() instanceof LabeledStatement; // for behavior consistency of break targets: see bug 339176
        if (node instanceof LabeledStatement)
            return false;
    }
    return true;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ExtractMethodAnalyzer.java   
private Statement getParentLoopBody(ASTNode node) {
    Statement stmt= null;
    ASTNode start= node;
    while (start != null
            && !(start instanceof ForStatement)
            && !(start instanceof DoStatement)
            && !(start instanceof WhileStatement)
            && !(start instanceof EnhancedForStatement)
            && !(start instanceof SwitchStatement)) {
        start= start.getParent();
    }
    if (start instanceof ForStatement) {
        stmt= ((ForStatement)start).getBody();
    } else if (start instanceof DoStatement) {
        stmt= ((DoStatement)start).getBody();
    } else if (start instanceof WhileStatement) {
        stmt= ((WhileStatement)start).getBody();
    } else if (start instanceof EnhancedForStatement) {
        stmt= ((EnhancedForStatement)start).getBody();
    }
    if (start != null && start.getParent() instanceof LabeledStatement) {
        LabeledStatement labeledStatement= (LabeledStatement)start.getParent();
        fEnclosingLoopLabel= labeledStatement.getLabel();
    }
    return stmt;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:BreakContinueTargetFinder.java   
private boolean keepWalkingUp(ASTNode node) {
    if (node == null)
        return false;
    if (isAnyInstanceOf(STOPPERS, node))
        return false;
    if (fLabel != null && LabeledStatement.class.isInstance(node)){
        LabeledStatement ls= (LabeledStatement)node;
        return ! areEqualLabels(ls.getLabel(), fLabel);
    }
    if (fLabel == null) {
        if (isAnyInstanceOf(fIsBreak ? BREAKTARGETS : CONTINUETARGETS, node))
            return node.getParent() instanceof LabeledStatement; // for behavior consistency of break targets: see bug 339176
        if (node instanceof LabeledStatement)
            return false;
    }
    return true;
}
项目:eclipse.jdt.ls    文件:LinkedNodeFinder.java   
@Override
public boolean visit(LabeledStatement node) {
    if (fDefiningLabel == null) {
        SimpleName label= node.getLabel();
        if (fLabel == label || isSameLabel(label) && ASTNodes.isParent(fLabel, node)) {
            fDefiningLabel= node;
            fResult.add(label);
        }
    }
    node.getBody().accept(this);
    return false;
}
项目:eclipse.jdt.ls    文件:FlowAnalyzer.java   
@Override
public void endVisit(LabeledStatement node) {
    if (skipNode(node)) {
        return;
    }
    FlowInfo info = assignFlowInfo(node, node.getBody());
    if (info != null) {
        info.removeLabel(node.getLabel());
    }
}
项目:che    文件:LinkedNodeFinder.java   
@Override
public boolean visit(LabeledStatement node) {
  if (fDefiningLabel == null) {
    SimpleName label = node.getLabel();
    if (fLabel == label || isSameLabel(label) && ASTNodes.isParent(fLabel, node)) {
      fDefiningLabel = node;
      fResult.add(label);
    }
  }
  node.getBody().accept(this);
  return false;
}
项目:che    文件:SourceProvider.java   
public boolean isDangligIf() {
  List<Statement> statements = fDeclaration.getBody().statements();
  if (statements.size() != 1) return false;

  ASTNode p = statements.get(0);

  while (true) {
    if (p instanceof IfStatement) {
      return ((IfStatement) p).getElseStatement() == null;
    } else {

      ChildPropertyDescriptor childD;
      if (p instanceof WhileStatement) {
        childD = WhileStatement.BODY_PROPERTY;
      } else if (p instanceof ForStatement) {
        childD = ForStatement.BODY_PROPERTY;
      } else if (p instanceof EnhancedForStatement) {
        childD = EnhancedForStatement.BODY_PROPERTY;
      } else if (p instanceof DoStatement) {
        childD = DoStatement.BODY_PROPERTY;
      } else if (p instanceof LabeledStatement) {
        childD = LabeledStatement.BODY_PROPERTY;
      } else {
        return false;
      }
      Statement body = (Statement) p.getStructuralProperty(childD);
      if (body instanceof Block) {
        return false;
      } else {
        p = body;
      }
    }
  }
}
项目:Eclipse-Postfix-Code-Completion    文件:SourceProvider.java   
public boolean isDangligIf() {
    List<Statement> statements= fDeclaration.getBody().statements();
    if (statements.size() != 1)
        return false;

    ASTNode p= statements.get(0);

    while (true) {
        if (p instanceof IfStatement) {
            return ((IfStatement) p).getElseStatement() == null;
        } else {

            ChildPropertyDescriptor childD;
            if (p instanceof WhileStatement) {
                childD= WhileStatement.BODY_PROPERTY;
            } else if (p instanceof ForStatement) {
                childD= ForStatement.BODY_PROPERTY;
            } else if (p instanceof EnhancedForStatement) {
                childD= EnhancedForStatement.BODY_PROPERTY;
            } else if (p instanceof DoStatement) {
                childD= DoStatement.BODY_PROPERTY;
            } else if (p instanceof LabeledStatement) {
                childD= LabeledStatement.BODY_PROPERTY;
            } else {
                return false;
            }
            Statement body= (Statement) p.getStructuralProperty(childD);
            if (body instanceof Block) {
                return false;
            } else {
                p= body;
            }
        }
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:FlowAnalyzer.java   
@Override
public void endVisit(LabeledStatement node) {
    if (skipNode(node))
        return;
    FlowInfo info= assignFlowInfo(node, node.getBody());
    if (info != null)
        info.removeLabel(node.getLabel());
}
项目:Eclipse-Postfix-Code-Completion    文件:LinkedNodeFinder.java   
@Override
public boolean visit(LabeledStatement node) {
    if (fDefiningLabel == null) {
        SimpleName label= node.getLabel();
        if (fLabel == label || isSameLabel(label) && ASTNodes.isParent(fLabel, node)) {
            fDefiningLabel= node;
            fResult.add(label);
        }
    }
    node.getBody().accept(this);
    return false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:SourceProvider.java   
public boolean isDangligIf() {
    List<Statement> statements= fDeclaration.getBody().statements();
    if (statements.size() != 1)
        return false;

    ASTNode p= statements.get(0);

    while (true) {
        if (p instanceof IfStatement) {
            return ((IfStatement) p).getElseStatement() == null;
        } else {

            ChildPropertyDescriptor childD;
            if (p instanceof WhileStatement) {
                childD= WhileStatement.BODY_PROPERTY;
            } else if (p instanceof ForStatement) {
                childD= ForStatement.BODY_PROPERTY;
            } else if (p instanceof EnhancedForStatement) {
                childD= EnhancedForStatement.BODY_PROPERTY;
            } else if (p instanceof DoStatement) {
                childD= DoStatement.BODY_PROPERTY;
            } else if (p instanceof LabeledStatement) {
                childD= LabeledStatement.BODY_PROPERTY;
            } else {
                return false;
            }
            Statement body= (Statement) p.getStructuralProperty(childD);
            if (body instanceof Block) {
                return false;
            } else {
                p= body;
            }
        }
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:FlowAnalyzer.java   
@Override
public void endVisit(LabeledStatement node) {
    if (skipNode(node))
        return;
    FlowInfo info= assignFlowInfo(node, node.getBody());
    if (info != null)
        info.removeLabel(node.getLabel());
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ASTFlattener.java   
@Override
public boolean visit(LabeledStatement node) {
    node.getLabel().accept(this);
    this.fBuffer.append(": ");//$NON-NLS-1$
    node.getBody().accept(this);
    return false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:LinkedNodeFinder.java   
@Override
public boolean visit(LabeledStatement node) {
    if (fDefiningLabel == null) {
        SimpleName label= node.getLabel();
        if (fLabel == label || isSameLabel(label) && ASTNodes.isParent(fLabel, node)) {
            fDefiningLabel= node;
            fResult.add(label);
        }
    }
    node.getBody().accept(this);
    return false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:NaiveASTFlattener.java   
public boolean visit(LabeledStatement node) {
    printIndent();
    node.getLabel().accept(this);
    this.buffer.append(": ");//$NON-NLS-1$
    node.getBody().accept(this);
    return false;
}
项目:jive    文件:StatementVisitor.java   
/**
 * Labeled statement.
 * 
 * identifier ':' statement
 */
@Override
public boolean visit(final LabeledStatement node)
{
  // visit children
  return true;
}
项目:j2d    文件:J2dVisitor.java   
@Override
public boolean visit(LabeledStatement node) {
    //System.out.println("Found: " + node.getClass());
    int oldIndent = indent;
    indent = 0;
    node.getLabel().accept(this);
    println(":");
    indent = oldIndent;
    node.getBody().accept(this);
    return false;
}
项目:bayou    文件:DOMLabeledStatement.java   
public DOMLabeledStatement(LabeledStatement statement) {
    this.statement = statement;
}
项目:eclipse.jdt.ls    文件:ImportReferencesCollector.java   
@Override
public boolean visit(LabeledStatement node) {
    doVisitNode(node.getBody());
    return false;
}
项目:code    文件:WorkspaceUtilities.java   
@Override
   public boolean visit(LabeledStatement node) {
    SimpleName sn = node.getLabel();
    addNewBinding(sn.resolveBinding(), node);
    return true;
}
项目:code    文件:WorkspaceUtilities.java   
@Override
   public boolean visit(LabeledStatement node) {
    SimpleName sn = node.getLabel();
    addNewBinding(sn.resolveBinding(), node);
    return true;
}
项目:code    文件:WorkspaceUtilities.java   
@Override
   public boolean visit(LabeledStatement node) {
    SimpleName sn = node.getLabel();
    addNewBinding(sn.resolveBinding(), node);
    return true;
}
项目:evosuite    文件:LoggingVisitor.java   
/** {@inheritDoc} */
@Override
public void endVisit(LabeledStatement node) {
    logger.warn("Method endVisitLabeledStatement for " + node + " for " + node + " not implemented!");
    super.endVisit(node);
}
项目:evosuite    文件:LoggingVisitor.java   
/** {@inheritDoc} */
@Override
public boolean visit(LabeledStatement node) {
    logger.warn("Method visitLabeledStatement for " + node + " not implemented!");
    return super.visit(node);
}
项目:Beagle    文件:NotRecursingAstVisitor.java   
@Override
public boolean visit(final LabeledStatement node) {
    return false;
}
项目:Beagle    文件:InstrumentableAstNodeLister.java   
@Override
public boolean visit(final LabeledStatement node) {
    // not instrumentable, may contain instrumentable nodes
    return true;
}
项目:Eclipse-Postfix-Code-Completion    文件:AstMatchingNodeFinder.java   
@Override
public boolean visit(LabeledStatement node) {
    if (node.subtreeMatch(fMatcher, fNodeToMatch))
        return matches(node);
    return super.visit(node);
}
项目:Eclipse-Postfix-Code-Completion    文件:ConstraintCollector.java   
@Override
public boolean visit(LabeledStatement node) {
    add(fCreator.create(node));
    return true;
}
项目:Eclipse-Postfix-Code-Completion    文件:GenericVisitor.java   
@Override
public void endVisit(LabeledStatement node) {
    endVisitNode(node);
}
项目:Eclipse-Postfix-Code-Completion    文件:GenericVisitor.java   
@Override
public boolean visit(LabeledStatement node) {
    return visitNode(node);
}
项目:ImportSmaliVarNames    文件:RenameVariablesVisitor.java   
@Override
public boolean visit(SimpleName node) {
    // We have to be inside a method
    if (curMethod == null)
        return false;
    // Only replace variables
    IBinding binding = node.resolveBinding();
    if (binding == null) {
        if ((node.getParent() instanceof LabeledStatement)
                && ((LabeledStatement) node.getParent()).getLabel().equals(node))
            return false;
        if ((node.getParent() instanceof BreakStatement)
                && ((BreakStatement) node.getParent()).getLabel().equals(node))
            return false;
        if (node.getParent() instanceof QualifiedName)
            return false;
        // This may happen
        System.err.println("Detected SimpleName without binding: " + node + "; Parent:" + node.getParent()
                + "\nThis may happen if there are compile errors");
        // return false;
    } else if (binding.getKind() != IBinding.VARIABLE)
        return false;
    // Check if we need to add a "this"
    // Do this if current node is a field and we may replace a variable with
    // its name
    AST ast = node.getAST();
    IVariableBinding vBinding = (IVariableBinding) binding;
    // Check for field acceses
    if (vBinding != null && vBinding.isField()) {
        // Add this if necessary
        if (renaming.containsValue(node.toString()) && !(node.getParent() instanceof FieldAccess)
                && !(node.getParent() instanceof QualifiedName)) {
            FieldAccess fa = ast.newFieldAccess();
            fa.setExpression(ast.newThisExpression());
            fa.setName(ast.newSimpleName(node.toString()));
            astRewrite.replace(node, fa, null);
        }
        return false;
    }
    String newName = renaming.get(node.toString());
    if (newName == null || newName == "")
        return false;
    astRewrite.replace(node, ast.newSimpleName(newName), null);
    return false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:AstMatchingNodeFinder.java   
@Override
public boolean visit(LabeledStatement node) {
    if (node.subtreeMatch(fMatcher, fNodeToMatch))
        return matches(node);
    return super.visit(node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ConstraintCollector.java   
@Override
public boolean visit(LabeledStatement node) {
    add(fCreator.create(node));
    return true;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:HierarchicalASTVisitor.java   
@Override
public boolean visit(LabeledStatement node) {
    return visit((Statement)node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:HierarchicalASTVisitor.java   
@Override
public void endVisit(LabeledStatement node) {
    endVisit((Statement)node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:GenericVisitor.java   
@Override
public boolean visit(LabeledStatement node) {
    return visitNode(node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:GenericVisitor.java   
@Override
public void endVisit(LabeledStatement node) {
    endVisitNode(node);
}