本文整理匯總了Java中org.eclipse.jdt.core.compiler.IProblem.isWarning方法的典型用法代碼示例。如果您正苦於以下問題:Java IProblem.isWarning方法的具體用法?Java IProblem.isWarning怎麽用?Java IProblem.isWarning使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jdt.core.compiler.IProblem
的用法示例。
在下文中一共展示了IProblem.isWarning方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getProblems
import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
public static IProblem[] getProblems(ASTNode node, int scope, int severity) {
ASTNode root= node.getRoot();
if (!(root instanceof CompilationUnit)) {
return EMPTY_PROBLEMS;
}
IProblem[] problems= ((CompilationUnit)root).getProblems();
if (root == node) {
return problems;
}
final int iterations= computeIterations(scope);
List<IProblem> result= new ArrayList<>(5);
for (int i= 0; i < problems.length; i++) {
IProblem problem= problems[i];
boolean consider= false;
if ((severity & PROBLEMS) == PROBLEMS) {
consider= true;
} else if ((severity & WARNING) != 0) {
consider= problem.isWarning();
} else if ((severity & ERROR) != 0) {
consider= problem.isError();
} else if ((severity & INFO) != 0) {
consider= problem.isInfo();
}
if (consider) {
ASTNode temp= node;
int count= iterations;
do {
int nodeOffset= temp.getStartPosition();
int problemOffset= problem.getSourceStart();
if (nodeOffset <= problemOffset && problemOffset < nodeOffset + temp.getLength()) {
result.add(problem);
count= 0;
} else {
count--;
}
} while ((temp= temp.getParent()) != null && count > 0);
}
}
return result.toArray(new IProblem[result.size()]);
}
示例2: convertSeverity
import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
private static DiagnosticSeverity convertSeverity(IProblem problem) {
if(problem.isError()) {
return DiagnosticSeverity.Error;
}
if(problem.isWarning()) {
return DiagnosticSeverity.Warning;
}
return DiagnosticSeverity.Information;
}
示例3: getProblems
import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
public static IProblem[] getProblems(ASTNode node, int scope, int severity) {
ASTNode root = node.getRoot();
if (!(root instanceof CompilationUnit)) return EMPTY_PROBLEMS;
IProblem[] problems = ((CompilationUnit) root).getProblems();
if (root == node) return problems;
final int iterations = computeIterations(scope);
List<IProblem> result = new ArrayList<IProblem>(5);
for (int i = 0; i < problems.length; i++) {
IProblem problem = problems[i];
boolean consider = false;
if ((severity & PROBLEMS) == PROBLEMS) consider = true;
else if ((severity & WARNING) != 0) consider = problem.isWarning();
else if ((severity & ERROR) != 0) consider = problem.isError();
if (consider) {
ASTNode temp = node;
int count = iterations;
do {
int nodeOffset = temp.getStartPosition();
int problemOffset = problem.getSourceStart();
if (nodeOffset <= problemOffset && problemOffset < nodeOffset + temp.getLength()) {
result.add(problem);
count = 0;
} else {
count--;
}
} while ((temp = temp.getParent()) != null && count > 0);
}
}
return result.toArray(new IProblem[result.size()]);
}
示例4: GetProblemType
import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
private FileParseMessagesResponse.Problem.ProblemType GetProblemType(IProblem problem)
{
if (problem.isError())
return FileParseMessagesResponse.Problem.ProblemType.Error;
if (problem.isWarning())
return FileParseMessagesResponse.Problem.ProblemType.Warning;
return FileParseMessagesResponse.Problem.ProblemType.Message;
}