本文整理汇总了Java中org.eclipse.jdt.ui.text.java.IProblemLocation.isError方法的典型用法代码示例。如果您正苦于以下问题:Java IProblemLocation.isError方法的具体用法?Java IProblemLocation.isError怎么用?Java IProblemLocation.isError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.ui.text.java.IProblemLocation
的用法示例。
在下文中一共展示了IProblemLocation.isError方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: noErrorsAtLocation
import org.eclipse.jdt.ui.text.java.IProblemLocation; //导入方法依赖的package包/类
static boolean noErrorsAtLocation(IProblemLocation[] locations) {
if (locations != null) {
for (int i = 0; i < locations.length; i++) {
IProblemLocation location = locations[i];
if (location.isError()) {
if (IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER.equals(location.getMarkerType())
&& JavaCore.getOptionForConfigurableSeverity(location.getProblemId()) != null) {
// continue (only drop out for severe (non-optional) errors)
} else {
return false;
}
}
}
}
return true;
}
示例2: addSuppressWarningsProposals
import org.eclipse.jdt.ui.text.java.IProblemLocation; //导入方法依赖的package包/类
public static void addSuppressWarningsProposals(
IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) {
if (problem.isError()
&& !JavaCore.ENABLED.equals(
context
.getCompilationUnit()
.getJavaProject()
.getOption(JavaCore.COMPILER_PB_SUPPRESS_OPTIONAL_ERRORS, true))) {
return;
}
if (JavaCore.DISABLED.equals(
context
.getCompilationUnit()
.getJavaProject()
.getOption(JavaCore.COMPILER_PB_SUPPRESS_WARNINGS, true))) {
return;
}
String warningToken = CorrectionEngine.getWarningToken(problem.getProblemId());
if (warningToken == null) {
return;
}
for (Iterator<ICommandAccess> iter = proposals.iterator(); iter.hasNext(); ) {
Object element = iter.next();
if (element instanceof SuppressWarningsProposal
&& warningToken.equals(((SuppressWarningsProposal) element).getWarningToken())) {
return; // only one at a time
}
}
ASTNode node = problem.getCoveringNode(context.getASTRoot());
if (node == null) {
return;
}
ASTNode target = node;
int relevance = IProposalRelevance.ADD_SUPPRESSWARNINGS;
do {
relevance =
addSuppressWarningsProposalIfPossible(
context.getCompilationUnit(), target, warningToken, relevance, proposals);
if (relevance == 0) return;
target = target.getParent();
} while (target != null);
ASTNode importStatement = ASTNodes.getParent(node, ImportDeclaration.class);
if (importStatement != null && !context.getASTRoot().types().isEmpty()) {
target = (ASTNode) context.getASTRoot().types().get(0);
if (target != null) {
addSuppressWarningsProposalIfPossible(
context.getCompilationUnit(),
target,
warningToken,
IProposalRelevance.ADD_SUPPRESSWARNINGS,
proposals);
}
}
}