本文整理汇总了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);
}
示例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);
}
}
}
示例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;
}