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


Java IProblemLocation.getOffset方法代码示例

本文整理汇总了Java中org.eclipse.jdt.ui.text.java.IProblemLocation.getOffset方法的典型用法代码示例。如果您正苦于以下问题:Java IProblemLocation.getOffset方法的具体用法?Java IProblemLocation.getOffset怎么用?Java IProblemLocation.getOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.ui.text.java.IProblemLocation的用法示例。


在下文中一共展示了IProblemLocation.getOffset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addSuperfluousSemicolonProposal

import org.eclipse.jdt.ui.text.java.IProblemLocation; //导入方法依赖的package包/类
public static void addSuperfluousSemicolonProposal(
    IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) {
  String label = CorrectionMessages.LocalCorrectionsSubProcessor_removesemicolon_description;
  ReplaceCorrectionProposal proposal =
      new ReplaceCorrectionProposal(
          label,
          context.getCompilationUnit(),
          problem.getOffset(),
          problem.getLength(),
          "",
          IProposalRelevance.REMOVE_SEMICOLON); // $NON-NLS-1$
  proposals.add(proposal);
}
 
开发者ID:eclipse,项目名称:che,代码行数:14,代码来源:LocalCorrectionsSubProcessor.java

示例2: getAmbiguosTypeReferenceProposals

import org.eclipse.jdt.ui.text.java.IProblemLocation; //导入方法依赖的package包/类
public static void getAmbiguosTypeReferenceProposals(
    IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals)
    throws CoreException {
  final ICompilationUnit cu = context.getCompilationUnit();
  int offset = problem.getOffset();
  int len = problem.getLength();

  IJavaElement[] elements = cu.codeSelect(offset, len);
  for (int i = 0; i < elements.length; i++) {
    IJavaElement curr = elements[i];
    if (curr instanceof IType && !TypeFilter.isFiltered((IType) curr)) {
      String qualifiedTypeName = ((IType) curr).getFullyQualifiedName('.');

      CompilationUnit root = context.getASTRoot();

      String label =
          Messages.format(
              CorrectionMessages.UnresolvedElementsSubProcessor_importexplicit_description,
              BasicElementLabels.getJavaElementName(qualifiedTypeName));
      Image image = JavaPluginImages.get(JavaPluginImages.IMG_OBJS_IMPDECL);
      ASTRewriteCorrectionProposal proposal =
          new ASTRewriteCorrectionProposal(
              label,
              cu,
              ASTRewrite.create(root.getAST()),
              IProposalRelevance.IMPORT_EXPLICIT,
              image);

      ImportRewrite imports = proposal.createImportRewrite(root);
      imports.addImport(qualifiedTypeName);

      proposals.add(proposal);
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:36,代码来源:UnresolvedElementsSubProcessor.java

示例3: contains

import org.eclipse.jdt.ui.text.java.IProblemLocation; //导入方法依赖的package包/类
private static boolean contains(ArrayList<IProblemLocation> problems, IProblemLocation problem) {
  for (int i = 0; i < problems.size(); i++) {
    IProblemLocation existing = problems.get(i);
    if (existing.getProblemId() == problem.getProblemId()
        && existing.getOffset() == problem.getOffset()
        && existing.getLength() == problem.getLength()) {
      return true;
    }
  }

  return false;
}
 
开发者ID:eclipse,项目名称:che,代码行数:13,代码来源:AbstractMultiFix.java


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