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

项目:Eclipse-Postfix-Code-Completion    文件:BreakContinueTargetFinder.java   
public String initialize(CompilationUnit root, ASTNode node) {
    ASTNode controlNode= getBreakOrContinueNode(node);
    if (controlNode != null) {
        fASTRoot= root;

        try {
            if (root.getTypeRoot() == null || root.getTypeRoot().getBuffer() == null)
                return SearchMessages.BreakContinueTargetFinder_cannot_highlight;
        } catch (JavaModelException e) {
            return SearchMessages.BreakContinueTargetFinder_cannot_highlight;
        }
        fSelected= controlNode;
        fIsBreak= fSelected instanceof BreakStatement;
        fLabel= getLabel();
        fDescription= Messages.format(SearchMessages.BreakContinueTargetFinder_occurrence_description, BasicElementLabels.getJavaElementName(ASTNodes.asString(fSelected)));
        return null;
    } else {
        return SearchMessages.BreakContinueTargetFinder_no_break_or_continue_selected;
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:BreakContinueTargetFinder.java   
public String initialize(CompilationUnit root, ASTNode node) {
    ASTNode controlNode= getBreakOrContinueNode(node);
    if (controlNode != null) {
        fASTRoot= root;

        try {
            if (root.getTypeRoot() == null || root.getTypeRoot().getBuffer() == null)
                return SearchMessages.BreakContinueTargetFinder_cannot_highlight;
        } catch (JavaModelException e) {
            return SearchMessages.BreakContinueTargetFinder_cannot_highlight;
        }
        fSelected= controlNode;
        fIsBreak= fSelected instanceof BreakStatement;
        fLabel= getLabel();
        fDescription= Messages.format(SearchMessages.BreakContinueTargetFinder_occurrence_description, BasicElementLabels.getJavaElementName(ASTNodes.asString(fSelected)));
        return null;
    } else {
        return SearchMessages.BreakContinueTargetFinder_no_break_or_continue_selected;
    }
}
项目:eclipse.jdt.ls    文件:LinkedNodeFinder.java   
@Override
public boolean visit(BreakStatement node) {
    SimpleName label= node.getLabel();
    if (fDefiningLabel != null && isSameLabel(label) && ASTNodes.isParent(label, fDefiningLabel)) {
        fResult.add(label);
    }
    return false;
}
项目:eclipse.jdt.ls    文件:FlowAnalyzer.java   
@Override
public void endVisit(BreakStatement node) {
    if (skipNode(node)) {
        return;
    }
    setFlowInfo(node, createBranch(node.getLabel()));
}
项目:che    文件:LinkedNodeFinder.java   
@Override
public boolean visit(BreakStatement node) {
  SimpleName label = node.getLabel();
  if (fDefiningLabel != null
      && isSameLabel(label)
      && ASTNodes.isParent(label, fDefiningLabel)) {
    fResult.add(label);
  }
  return false;
}
项目:Eclipse-Postfix-Code-Completion    文件:LinkedNodeFinder.java   
@Override
public boolean visit(BreakStatement node) {
    SimpleName label= node.getLabel();
    if (fDefiningLabel != null && isSameLabel(label) && ASTNodes.isParent(label, fDefiningLabel)) {
        fResult.add(label);
    }
    return false;
}
项目:Eclipse-Postfix-Code-Completion    文件:BreakContinueTargetFinder.java   
private ASTNode getBreakOrContinueNode(ASTNode selectedNode) {
    if (selectedNode instanceof BreakStatement)
        return selectedNode;
    if (selectedNode instanceof ContinueStatement)
        return selectedNode;
    if (selectedNode instanceof SimpleName && selectedNode.getParent() instanceof BreakStatement)
        return selectedNode.getParent();
    if (selectedNode instanceof SimpleName && selectedNode.getParent() instanceof ContinueStatement)
        return selectedNode.getParent();
    return null;
}
项目:Eclipse-Postfix-Code-Completion    文件:BreakContinueTargetFinder.java   
private SimpleName getLabel() {
    if (fIsBreak){
        BreakStatement bs= (BreakStatement) fSelected;
        return bs.getLabel();
    } else {
        ContinueStatement cs= (ContinueStatement) fSelected;
        return cs.getLabel();
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaElementHyperlinkDetector.java   
/**
 * Finds the target for break or continue node.
 * 
 * @param input the editor input
 * @param region the region
 * @return the break or continue target location or <code>null</code> if none
 * @since 3.7
 */
public static OccurrenceLocation findBreakOrContinueTarget(ITypeRoot input, IRegion region) {
    CompilationUnit astRoot= SharedASTProvider.getAST(input, SharedASTProvider.WAIT_NO, null);
    if (astRoot == null)
        return null;

    ASTNode node= NodeFinder.perform(astRoot, region.getOffset(), region.getLength());
    ASTNode breakOrContinueNode= null;
    boolean labelSelected= false;
    if (node instanceof SimpleName) {
        SimpleName simpleName= (SimpleName) node;
        StructuralPropertyDescriptor location= simpleName.getLocationInParent();
        if (location == ContinueStatement.LABEL_PROPERTY || location == BreakStatement.LABEL_PROPERTY) {
            breakOrContinueNode= simpleName.getParent();
            labelSelected= true;
        }
    } else if (node instanceof ContinueStatement || node instanceof BreakStatement)
        breakOrContinueNode= node;

    if (breakOrContinueNode == null)
        return null;

    BreakContinueTargetFinder finder= new BreakContinueTargetFinder();
    if (finder.initialize(astRoot, breakOrContinueNode) == null) {
        OccurrenceLocation[] locations= finder.getOccurrences();
        if (locations != null) {
            if (breakOrContinueNode instanceof BreakStatement && !labelSelected)
                return locations[locations.length - 1]; // points to the end of target statement
            return locations[0]; // points to the beginning of target statement
        }
    }
    return null;
}
项目:Eclipse-Postfix-Code-Completion    文件:AdvancedQuickAssistProcessor.java   
private static Statement copyStatementExceptBreak(AST ast, ASTRewrite rewrite, Statement source) {
    if (source instanceof Block) {
        Block block= (Block) source;
        Block newBlock= ast.newBlock();
        for (Iterator<Statement> iter= block.statements().iterator(); iter.hasNext();) {
            Statement statement= iter.next();
            if (statement instanceof BreakStatement) {
                continue;
            }
            newBlock.statements().add(copyStatementExceptBreak(ast, rewrite, statement));
        }
        return newBlock;
    }
    return (Statement) rewrite.createMoveTarget(source);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ASTFlattener.java   
@Override
public boolean visit(BreakStatement node) {
    this.fBuffer.append("break");//$NON-NLS-1$
    if (node.getLabel() != null) {
        this.fBuffer.append(" ");//$NON-NLS-1$
        node.getLabel().accept(this);
    }
    this.fBuffer.append(";");//$NON-NLS-1$
    return false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:LinkedNodeFinder.java   
@Override
public boolean visit(BreakStatement node) {
    SimpleName label= node.getLabel();
    if (fDefiningLabel != null && isSameLabel(label) && ASTNodes.isParent(label, fDefiningLabel)) {
        fResult.add(label);
    }
    return false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:BreakContinueTargetFinder.java   
private ASTNode getBreakOrContinueNode(ASTNode selectedNode) {
    if (selectedNode instanceof BreakStatement)
        return selectedNode;
    if (selectedNode instanceof ContinueStatement)
        return selectedNode;
    if (selectedNode instanceof SimpleName && selectedNode.getParent() instanceof BreakStatement)
        return selectedNode.getParent();
    if (selectedNode instanceof SimpleName && selectedNode.getParent() instanceof ContinueStatement)
        return selectedNode.getParent();
    return null;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:BreakContinueTargetFinder.java   
private SimpleName getLabel() {
    if (fIsBreak){
        BreakStatement bs= (BreakStatement) fSelected;
        return bs.getLabel();
    } else {
        ContinueStatement cs= (ContinueStatement) fSelected;
        return cs.getLabel();
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaElementHyperlinkDetector.java   
/**
 * Finds the target for break or continue node.
 * 
 * @param input the editor input
 * @param region the region
 * @return the break or continue target location or <code>null</code> if none
 * @since 3.7
 */
public static OccurrenceLocation findBreakOrContinueTarget(ITypeRoot input, IRegion region) {
    CompilationUnit astRoot= SharedASTProvider.getAST(input, SharedASTProvider.WAIT_NO, null);
    if (astRoot == null)
        return null;

    ASTNode node= NodeFinder.perform(astRoot, region.getOffset(), region.getLength());
    ASTNode breakOrContinueNode= null;
    boolean labelSelected= false;
    if (node instanceof SimpleName) {
        SimpleName simpleName= (SimpleName) node;
        StructuralPropertyDescriptor location= simpleName.getLocationInParent();
        if (location == ContinueStatement.LABEL_PROPERTY || location == BreakStatement.LABEL_PROPERTY) {
            breakOrContinueNode= simpleName.getParent();
            labelSelected= true;
        }
    } else if (node instanceof ContinueStatement || node instanceof BreakStatement)
        breakOrContinueNode= node;

    if (breakOrContinueNode == null)
        return null;

    BreakContinueTargetFinder finder= new BreakContinueTargetFinder();
    if (finder.initialize(astRoot, breakOrContinueNode) == null) {
        OccurrenceLocation[] locations= finder.getOccurrences();
        if (locations != null) {
            if (breakOrContinueNode instanceof BreakStatement && !labelSelected)
                return locations[locations.length - 1]; // points to the end of target statement
            return locations[0]; // points to the beginning of target statement
        }
    }
    return null;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:AdvancedQuickAssistProcessor.java   
private static Statement copyStatementExceptBreak(AST ast, ASTRewrite rewrite, Statement source) {
    if (source instanceof Block) {
        Block block= (Block) source;
        Block newBlock= ast.newBlock();
        for (Iterator<Statement> iter= block.statements().iterator(); iter.hasNext();) {
            Statement statement= iter.next();
            if (statement instanceof BreakStatement) {
                continue;
            }
            newBlock.statements().add(copyStatementExceptBreak(ast, rewrite, statement));
        }
        return newBlock;
    }
    return (Statement) rewrite.createMoveTarget(source);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:NaiveASTFlattener.java   
public boolean visit(BreakStatement node) {
    printIndent();
    this.buffer.append("break");//$NON-NLS-1$
    if (node.getLabel() != null) {
        this.buffer.append(" ");//$NON-NLS-1$
        node.getLabel().accept(this);
    }
    this.buffer.append(";\n");//$NON-NLS-1$
    return false;
}
项目:asup    文件:JDTStatementWriter.java   
@SuppressWarnings("unchecked")
@Override
public boolean visit(QBreak statement) {

    Block block = blocks.peek();

    BreakStatement breakSt = ast.newBreakStatement();
    block.statements().add(breakSt);

    return super.visit(statement);
}
项目:j2d    文件:J2dVisitor.java   
@Override
public boolean visit(BreakStatement node) {
    //System.out.println("Found: " + node.getClass());
    if (node.getLabel() == null) {
        println("break;");
        //if (node.getParent() instanceof SwitchCase) {
        //  indent--;
        //}
    } else {
        print("break ");
        node.getLabel().accept(this);
        println(";");
    }
    return false;
}
项目:eclipse.jdt.ls    文件:ImportReferencesCollector.java   
@Override
public boolean visit(BreakStatement node) {
    return false;
}
项目:evosuite    文件:LoggingVisitor.java   
/** {@inheritDoc} */
@Override
public void endVisit(BreakStatement node) {
    logger.warn("Method endVisitBreakStatement for " + node + " for " + node + " not implemented!");
    super.endVisit(node);
}
项目:evosuite    文件:LoggingVisitor.java   
/** {@inheritDoc} */
@Override
public boolean visit(BreakStatement node) {
    logger.warn("Method visitBreakStatement for " + node + " for " + node + " not implemented!");
    return super.visit(node);
}
项目:Convert-For-Each-Loop-to-Lambda-Expression-Eclipse-Plugin    文件:EnhancedForStatementVisitor.java   
@Override
public boolean visit(BreakStatement node) {
    this.encounteredBreakStatement = true;
    return super.visit(node);
}
项目:Beagle    文件:NotRecursingAstVisitor.java   
@Override
public boolean visit(final BreakStatement node) {
    return false;
}
项目:Beagle    文件:InstrumentableAstNodeLister.java   
@Override
public boolean visit(final BreakStatement node) {
    return this.visitInstrumentable(node);
}
项目:Eclipse-Postfix-Code-Completion    文件:FlowAnalyzer.java   
@Override
public void endVisit(BreakStatement node) {
    if (skipNode(node))
        return;
    setFlowInfo(node, createBranch(node.getLabel()));
}
项目:Eclipse-Postfix-Code-Completion    文件:AstMatchingNodeFinder.java   
@Override
public boolean visit(BreakStatement node) {
    if (node.subtreeMatch(fMatcher, fNodeToMatch))
        return matches(node);
    return super.visit(node);
}
项目:Eclipse-Postfix-Code-Completion    文件:ConstraintCollector.java   
@Override
public boolean visit(BreakStatement node) {
    add(fCreator.create(node));
    return true;
}
项目:Eclipse-Postfix-Code-Completion    文件:GenericVisitor.java   
@Override
public void endVisit(BreakStatement node) {
    endVisitNode(node);
}
项目:Eclipse-Postfix-Code-Completion    文件:GenericVisitor.java   
@Override
public boolean visit(BreakStatement 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    文件:FlowAnalyzer.java   
@Override
public void endVisit(BreakStatement node) {
    if (skipNode(node))
        return;
    setFlowInfo(node, createBranch(node.getLabel()));
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:AstMatchingNodeFinder.java   
@Override
public boolean visit(BreakStatement node) {
    if (node.subtreeMatch(fMatcher, fNodeToMatch))
        return matches(node);
    return super.visit(node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ConstraintCollector.java   
@Override
public boolean visit(BreakStatement node) {
    add(fCreator.create(node));
    return true;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:HierarchicalASTVisitor.java   
@Override
public boolean visit(BreakStatement node) {
    return visit((Statement)node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:HierarchicalASTVisitor.java   
@Override
public void endVisit(BreakStatement node) {
    endVisit((Statement)node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:GenericVisitor.java   
@Override
public boolean visit(BreakStatement node) {
    return visitNode(node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:GenericVisitor.java   
@Override
public void endVisit(BreakStatement node) {
    endVisitNode(node);
}
项目:eclipse-i18ntools    文件:ASTNodeFinder.java   
@Override
public boolean visit(final BreakStatement node) {
    return this.internalVisit(node);
}
项目:repositoryminer    文件:MethodVisitor.java   
@Override
public boolean visit(BreakStatement node) {
    statements.add(new AbstractStatement(NodeType.BREAK, null));
    return true;
}