當前位置: 首頁>>代碼示例>>Java>>正文


Java IProblem.isError方法代碼示例

本文整理匯總了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;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:17,代碼來源:RenameAnalyzeUtil.java

示例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))));
  }
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:19,代碼來源:ExtractTempRefactoring.java

示例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))));
  }
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:20,代碼來源:ExtractConstantRefactoring.java

示例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;
}
 
開發者ID:gwt-plugins,項目名稱:gwt-eclipse-plugin,代碼行數:22,代碼來源:JavaASTUtils.java

示例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()]);
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:41,代碼來源:ASTNodes.java

示例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;
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:10,代碼來源:DiagnosticsHandler.java

示例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()));
    }
  }
}
 
開發者ID:Sellegit,項目名稱:j2objc,代碼行數:9,代碼來源:JdtParser.java

示例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()]);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:31,代碼來源:ASTNodes.java

示例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;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:12,代碼來源:ProblemLocation.java

示例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;
}
 
開發者ID:Microsoft,項目名稱:vsminecraft,代碼行數:9,代碼來源:JavaParser.java

示例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;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:14,代碼來源:ChangeSignatureProcessor.java


注:本文中的org.eclipse.jdt.core.compiler.IProblem.isError方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。