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


Java ChangeMethodSignatureProposal類代碼示例

本文整理匯總了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);
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:27,代碼來源:LocalCorrectionsSubProcessor.java

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


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