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


Java IProblemLocation.isError方法代码示例

本文整理汇总了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;
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:QuickAssistProcessor.java

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


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