本文整理匯總了Java中org.eclipse.jdt.core.compiler.IProblem.isError方法的典型用法代碼示例。如果您正苦於以下問題:Java IProblem.isError方法的具體用法?Java IProblem.isError怎麽用?Java IProblem.isError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jdt.core.compiler.IProblem
的用法示例。
在下文中一共展示了IProblem.isError方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: analyzeCompileErrors
import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
private static RefactoringStatus analyzeCompileErrors(
String newCuSource, CompilationUnit newCUNode, CompilationUnit oldCUNode) {
RefactoringStatus result = new RefactoringStatus();
IProblem[] newProblems =
RefactoringAnalyzeUtil.getIntroducedCompileProblems(newCUNode, oldCUNode);
for (int i = 0; i < newProblems.length; i++) {
IProblem problem = newProblems[i];
if (problem.isError())
result.addEntry(
new RefactoringStatusEntry(
(problem.isError() ? RefactoringStatus.ERROR : RefactoringStatus.WARNING),
problem.getMessage(),
new JavaStringStatusContext(newCuSource, SourceRangeFactory.create(problem))));
}
return result;
}
示例2: checkNewSource
import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
private void checkNewSource(SubProgressMonitor monitor, RefactoringStatus result)
throws CoreException {
String newCuSource = fChange.getPreviewContent(new NullProgressMonitor());
CompilationUnit newCUNode =
new RefactoringASTParser(ASTProvider.SHARED_AST_LEVEL)
.parse(newCuSource, fCu, true, true, monitor);
IProblem[] newProblems =
RefactoringAnalyzeUtil.getIntroducedCompileProblems(newCUNode, fCompilationUnitNode);
for (int i = 0; i < newProblems.length; i++) {
IProblem problem = newProblems[i];
if (problem.isError())
result.addEntry(
new RefactoringStatusEntry(
(problem.isError() ? RefactoringStatus.ERROR : RefactoringStatus.WARNING),
problem.getMessage(),
new JavaStringStatusContext(newCuSource, SourceRangeFactory.create(problem))));
}
}
示例3: checkSource
import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
private void checkSource(SubProgressMonitor monitor, RefactoringStatus result)
throws CoreException {
String newCuSource = fChange.getPreviewContent(new NullProgressMonitor());
CompilationUnit newCUNode =
new RefactoringASTParser(ASTProvider.SHARED_AST_LEVEL)
.parse(newCuSource, fCu, true, true, monitor);
IProblem[] newProblems =
RefactoringAnalyzeUtil.getIntroducedCompileProblems(newCUNode, fCuRewrite.getRoot());
for (int i = 0; i < newProblems.length; i++) {
IProblem problem = newProblems[i];
if (problem.isError())
result.addEntry(
new RefactoringStatusEntry(
(problem.isError() ? RefactoringStatus.ERROR : RefactoringStatus.WARNING),
problem.getMessage(),
new JavaStringStatusContext(newCuSource, SourceRangeFactory.create(problem))));
}
}
示例4: hasErrors
import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
/**
* Returns <code>true</code> if any of the problems fall within the
* {@link ASTNode}'s source range.
*/
public static boolean hasErrors(ASTNode node, IProblem[] problems) {
int startPosition = node.getStartPosition();
int endPosition = startPosition + node.getLength() - 1;
for (IProblem problem : problems) {
if (!problem.isError()) {
// Skip any problem that is not an error
continue;
}
if (problem.getSourceStart() >= startPosition
&& problem.getSourceEnd() <= endPosition) {
return true;
}
}
return false;
}
示例5: 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()]);
}
示例6: 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;
}
示例7: checkCompilationErrors
import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
private void checkCompilationErrors(String filename, CompilationUnit unit) {
for (IProblem problem : unit.getProblems()) {
if (problem.isError()) {
ErrorUtil.error(String.format(
"%s:%s: %s", filename, problem.getSourceLineNumber(), problem.getMessage()));
}
}
}
示例8: 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()]);
}
示例9: ProblemLocation
import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
public ProblemLocation(IProblem problem) {
fId = problem.getID();
fArguments = problem.getArguments();
fOffset = problem.getSourceStart();
fLength = problem.getSourceEnd() - fOffset + 1;
fIsError = problem.isError();
fMarkerType =
problem instanceof CategorizedProblem
? ((CategorizedProblem) problem).getMarkerType()
: IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER;
}
示例10: 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;
}
示例11: shouldReport
import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
/**
* Evaluates if a problem needs to be reported.
*
* @param problem the problem
* @param cu the AST containing the new source
* @return return <code>true</code> if the problem needs to be reported
*/
protected boolean shouldReport(IProblem problem, CompilationUnit cu) {
if (!problem.isError()) return false;
if (problem.getID() == IProblem.UndefinedType) // reported when trying to import
return false;
return true;
}