本文整理汇总了Java中org.eclipse.jdt.core.dom.BreakStatement类的典型用法代码示例。如果您正苦于以下问题:Java BreakStatement类的具体用法?Java BreakStatement怎么用?Java BreakStatement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BreakStatement类属于org.eclipse.jdt.core.dom包,在下文中一共展示了BreakStatement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import org.eclipse.jdt.core.dom.BreakStatement; //导入依赖的package包/类
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;
}
}
示例2: visit
import org.eclipse.jdt.core.dom.BreakStatement; //导入依赖的package包/类
@Override
public boolean visit(BreakStatement node) {
SimpleName label= node.getLabel();
if (fDefiningLabel != null && isSameLabel(label) && ASTNodes.isParent(label, fDefiningLabel)) {
fResult.add(label);
}
return false;
}
示例3: endVisit
import org.eclipse.jdt.core.dom.BreakStatement; //导入依赖的package包/类
@Override
public void endVisit(BreakStatement node) {
if (skipNode(node)) {
return;
}
setFlowInfo(node, createBranch(node.getLabel()));
}
示例4: visit
import org.eclipse.jdt.core.dom.BreakStatement; //导入依赖的package包/类
@Override
public boolean visit(BreakStatement node) {
SimpleName label = node.getLabel();
if (fDefiningLabel != null
&& isSameLabel(label)
&& ASTNodes.isParent(label, fDefiningLabel)) {
fResult.add(label);
}
return false;
}
示例5: getBreakOrContinueNode
import org.eclipse.jdt.core.dom.BreakStatement; //导入依赖的package包/类
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;
}
示例6: getLabel
import org.eclipse.jdt.core.dom.BreakStatement; //导入依赖的package包/类
private SimpleName getLabel() {
if (fIsBreak){
BreakStatement bs= (BreakStatement) fSelected;
return bs.getLabel();
} else {
ContinueStatement cs= (ContinueStatement) fSelected;
return cs.getLabel();
}
}
示例7: findBreakOrContinueTarget
import org.eclipse.jdt.core.dom.BreakStatement; //导入依赖的package包/类
/**
* 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;
}
示例8: copyStatementExceptBreak
import org.eclipse.jdt.core.dom.BreakStatement; //导入依赖的package包/类
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);
}
示例9: visit
import org.eclipse.jdt.core.dom.BreakStatement; //导入依赖的package包/类
@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;
}
示例10: visit
import org.eclipse.jdt.core.dom.BreakStatement; //导入依赖的package包/类
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;
}
示例11: visit
import org.eclipse.jdt.core.dom.BreakStatement; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean visit(QBreak statement) {
Block block = blocks.peek();
BreakStatement breakSt = ast.newBreakStatement();
block.statements().add(breakSt);
return super.visit(statement);
}
示例12: visit
import org.eclipse.jdt.core.dom.BreakStatement; //导入依赖的package包/类
@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;
}
示例13: visit
import org.eclipse.jdt.core.dom.BreakStatement; //导入依赖的package包/类
@Override
public boolean visit(BreakStatement node) {
return false;
}
示例14: endVisit
import org.eclipse.jdt.core.dom.BreakStatement; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void endVisit(BreakStatement node) {
logger.warn("Method endVisitBreakStatement for " + node + " for " + node + " not implemented!");
super.endVisit(node);
}
示例15: visit
import org.eclipse.jdt.core.dom.BreakStatement; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public boolean visit(BreakStatement node) {
logger.warn("Method visitBreakStatement for " + node + " for " + node + " not implemented!");
return super.visit(node);
}