Java 类org.eclipse.jdt.core.refactoring.descriptors.IntroduceParameterDescriptor 实例源码

项目:Eclipse-Postfix-Code-Completion    文件:IntroduceParameterRefactoring.java   
private IntroduceParameterDescriptor getRefactoringDescriptor() {
    ChangeMethodSignatureDescriptor extended= (ChangeMethodSignatureDescriptor) fChangeSignatureProcessor.createDescriptor();
    RefactoringContribution contribution= RefactoringCore.getRefactoringContribution(IJavaRefactorings.CHANGE_METHOD_SIGNATURE);

    Map<String, String> argumentsMap= contribution.retrieveArgumentMap(extended);

    final Map<String, String> arguments= new HashMap<String, String>();
    arguments.put(ATTRIBUTE_ARGUMENT, fParameter.getNewName());
    arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_SELECTION, new Integer(fSelectionStart).toString() + " " + new Integer(fSelectionLength).toString()); //$NON-NLS-1$
    arguments.putAll(argumentsMap);
    String signature= fChangeSignatureProcessor.getMethodName();
    try {
        signature= fChangeSignatureProcessor.getOldMethodSignature();
    } catch (JavaModelException exception) {
        JavaPlugin.log(exception);
    }
    final String description= Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_descriptor_description_short, BasicElementLabels.getJavaElementName(fChangeSignatureProcessor.getMethod().getElementName()));
    final String header= Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_descriptor_description, new String[] { BasicElementLabels.getJavaElementName(fParameter.getNewName()), signature, BasicElementLabels.getJavaCodeString(ASTNodes.asString(fSelectedExpression))});
    final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(extended.getProject(), this, header);
    comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_original_pattern, JavaElementLabels.getTextLabel(fChangeSignatureProcessor.getMethod(),
            JavaElementLabels.ALL_FULLY_QUALIFIED)));
    comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_expression_pattern, BasicElementLabels.getJavaCodeString(ASTNodes.asString(fSelectedExpression))));
    comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_parameter_pattern, BasicElementLabels.getJavaElementName(getAddedParameterInfo().getNewName())));
    return RefactoringSignatureDescriptorFactory.createIntroduceParameterDescriptor(extended.getProject(), description, comment.asString(), arguments, extended.getFlags());
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:IntroduceParameterRefactoring.java   
private IntroduceParameterDescriptor getRefactoringDescriptor() {
    ChangeMethodSignatureDescriptor extended= (ChangeMethodSignatureDescriptor) fChangeSignatureProcessor.createDescriptor();
    RefactoringContribution contribution= RefactoringCore.getRefactoringContribution(IJavaRefactorings.CHANGE_METHOD_SIGNATURE);

    Map<String, String> argumentsMap= contribution.retrieveArgumentMap(extended);

    final Map<String, String> arguments= new HashMap<String, String>();
    arguments.put(ATTRIBUTE_ARGUMENT, fParameter.getNewName());
    arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_SELECTION, new Integer(fSelectionStart).toString() + " " + new Integer(fSelectionLength).toString()); //$NON-NLS-1$
    arguments.putAll(argumentsMap);
    String signature= fChangeSignatureProcessor.getMethodName();
    try {
        signature= fChangeSignatureProcessor.getOldMethodSignature();
    } catch (JavaModelException exception) {
        JavaPlugin.log(exception);
    }
    final String description= Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_descriptor_description_short, BasicElementLabels.getJavaElementName(fChangeSignatureProcessor.getMethod().getElementName()));
    final String header= Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_descriptor_description, new String[] { BasicElementLabels.getJavaElementName(fParameter.getNewName()), signature, BasicElementLabels.getJavaCodeString(ASTNodes.asString(fSelectedExpression))});
    final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(extended.getProject(), this, header);
    comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_original_pattern, JavaElementLabels.getTextLabel(fChangeSignatureProcessor.getMethod(),
            JavaElementLabels.ALL_FULLY_QUALIFIED)));
    comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_expression_pattern, BasicElementLabels.getJavaCodeString(ASTNodes.asString(fSelectedExpression))));
    comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_parameter_pattern, BasicElementLabels.getJavaElementName(getAddedParameterInfo().getNewName())));
    return RefactoringSignatureDescriptorFactory.createIntroduceParameterDescriptor(extended.getProject(), description, comment.asString(), arguments, extended.getFlags());
}
项目:che    文件:RefactoringSignatureDescriptorFactory.java   
public static IntroduceParameterDescriptor createIntroduceParameterDescriptor() {
  return new IntroduceParameterDescriptor();
}
项目:che    文件:RefactoringSignatureDescriptorFactory.java   
public static IntroduceParameterDescriptor createIntroduceParameterDescriptor(
    String project, String description, String comment, Map arguments, int flags) {
  return new IntroduceParameterDescriptor(project, description, comment, arguments, flags);
}