当前位置: 首页>>代码示例>>Java>>正文


Java BreakStatement类代码示例

本文整理汇总了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;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:BreakContinueTargetFinder.java

示例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;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:9,代码来源:LinkedNodeFinder.java

示例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()));
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:8,代码来源:FlowAnalyzer.java

示例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;
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:LinkedNodeFinder.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:BreakContinueTargetFinder.java

示例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();
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:BreakContinueTargetFinder.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:41,代码来源:JavaElementHyperlinkDetector.java

示例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);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:16,代码来源:AdvancedQuickAssistProcessor.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:11,代码来源:ASTFlattener.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:11,代码来源:NaiveASTFlattener.java

示例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);
}
 
开发者ID:asupdev,项目名称:asup,代码行数:12,代码来源:JDTStatementWriter.java

示例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;
}
 
开发者ID:mrmonday,项目名称:j2d,代码行数:16,代码来源:J2dVisitor.java

示例13: visit

import org.eclipse.jdt.core.dom.BreakStatement; //导入依赖的package包/类
@Override
public boolean visit(BreakStatement node) {
	return false;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:5,代码来源:ImportReferencesCollector.java

示例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);
}
 
开发者ID:EvoSuite,项目名称:evosuite,代码行数:7,代码来源:LoggingVisitor.java

示例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);
}
 
开发者ID:EvoSuite,项目名称:evosuite,代码行数:7,代码来源:LoggingVisitor.java


注:本文中的org.eclipse.jdt.core.dom.BreakStatement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。