本文整理汇总了Java中org.eclipse.jdt.internal.ui.text.correction.proposals.ChangeMethodSignatureProposal类的典型用法代码示例。如果您正苦于以下问题:Java ChangeMethodSignatureProposal类的具体用法?Java ChangeMethodSignatureProposal怎么用?Java ChangeMethodSignatureProposal使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ChangeMethodSignatureProposal类属于org.eclipse.jdt.internal.ui.text.correction.proposals包,在下文中一共展示了ChangeMethodSignatureProposal类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addUnnecessaryThrownExceptionProposal
import org.eclipse.jdt.internal.ui.text.correction.proposals.ChangeMethodSignatureProposal; //导入依赖的package包/类
public static void addUnnecessaryThrownExceptionProposal(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) {
ASTNode selectedNode= problem.getCoveringNode(context.getASTRoot());
selectedNode= ASTNodes.getNormalizedNode(selectedNode);
if (selectedNode == null || selectedNode.getLocationInParent() != MethodDeclaration.THROWN_EXCEPTION_TYPES_PROPERTY) {
return;
}
MethodDeclaration decl= (MethodDeclaration) selectedNode.getParent();
IMethodBinding binding= decl.resolveBinding();
if (binding != null) {
List<Type> thrownExceptions= decl.thrownExceptionTypes();
int index= thrownExceptions.indexOf(selectedNode);
if (index == -1) {
return;
}
ChangeDescription[] desc= new ChangeDescription[thrownExceptions.size()];
desc[index]= new RemoveDescription();
ICompilationUnit cu= context.getCompilationUnit();
String label= CorrectionMessages.LocalCorrectionsSubProcessor_unnecessarythrow_description;
Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION);
proposals.add(new ChangeMethodSignatureProposal(label, cu, selectedNode, binding, null, desc, IProposalRelevance.UNNECESSARY_THROW, image));
}
JavadocTagsSubProcessor.getUnusedAndUndocumentedParameterOrExceptionProposals(context, problem, proposals);
}
示例2: addUnnecessaryThrownExceptionProposal
import org.eclipse.jdt.internal.ui.text.correction.proposals.ChangeMethodSignatureProposal; //导入依赖的package包/类
public static void addUnnecessaryThrownExceptionProposal(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) {
ASTNode selectedNode= problem.getCoveringNode(context.getASTRoot());
if (selectedNode == null || !(selectedNode.getParent() instanceof MethodDeclaration)) {
return;
}
MethodDeclaration decl= (MethodDeclaration) selectedNode.getParent();
IMethodBinding binding= decl.resolveBinding();
if (binding != null) {
List<Name> thrownExceptions= decl.thrownExceptions();
int index= thrownExceptions.indexOf(selectedNode);
if (index == -1) {
return;
}
ChangeDescription[] desc= new ChangeDescription[thrownExceptions.size()];
desc[index]= new RemoveDescription();
ICompilationUnit cu= context.getCompilationUnit();
String label= CorrectionMessages.LocalCorrectionsSubProcessor_unnecessarythrow_description;
Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION);
proposals.add(new ChangeMethodSignatureProposal(label, cu, selectedNode, binding, null, desc, 5, image));
}
JavadocTagsSubProcessor.getUnusedAndUndocumentedParameterOrExceptionProposals(context, problem, proposals);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:26,代码来源:LocalCorrectionsSubProcessor.java
示例3: addUnnecessaryThrownExceptionProposal
import org.eclipse.jdt.internal.ui.text.correction.proposals.ChangeMethodSignatureProposal; //导入依赖的package包/类
public static void addUnnecessaryThrownExceptionProposal(
IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) {
ASTNode selectedNode = problem.getCoveringNode(context.getASTRoot());
selectedNode = ASTNodes.getNormalizedNode(selectedNode);
if (selectedNode == null
|| selectedNode.getLocationInParent()
!= MethodDeclaration.THROWN_EXCEPTION_TYPES_PROPERTY) {
return;
}
MethodDeclaration decl = (MethodDeclaration) selectedNode.getParent();
IMethodBinding binding = decl.resolveBinding();
if (binding != null) {
List<Type> thrownExceptions = decl.thrownExceptionTypes();
int index = thrownExceptions.indexOf(selectedNode);
if (index == -1) {
return;
}
ChangeDescription[] desc = new ChangeDescription[thrownExceptions.size()];
desc[index] = new RemoveDescription();
ICompilationUnit cu = context.getCompilationUnit();
String label = CorrectionMessages.LocalCorrectionsSubProcessor_unnecessarythrow_description;
Image image = JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION);
proposals.add(
new ChangeMethodSignatureProposal(
label,
cu,
selectedNode,
binding,
null,
desc,
IProposalRelevance.UNNECESSARY_THROW,
image));
}
JavadocTagsSubProcessor.getUnusedAndUndocumentedParameterOrExceptionProposals(
context, problem, proposals);
}