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

项目:che    文件:PromoteTempToFieldRefactoring.java   
private ConvertLocalVariableDescriptor getRefactoringDescriptor() {
  final Map<String, String> arguments = new HashMap<String, String>();
  String project = null;
  IJavaProject javaProject = fCu.getJavaProject();
  if (javaProject != null) project = javaProject.getElementName();
  final IVariableBinding binding = fTempDeclarationNode.resolveBinding();
  final String description =
      Messages.format(
          RefactoringCoreMessages.PromoteTempToFieldRefactoring_descriptor_description_short,
          BasicElementLabels.getJavaElementName(binding.getName()));
  final String header =
      Messages.format(
          RefactoringCoreMessages.PromoteTempToFieldRefactoring_descriptor_description,
          new String[] {
            BindingLabelProvider.getBindingLabel(binding, JavaElementLabels.ALL_FULLY_QUALIFIED),
            BindingLabelProvider.getBindingLabel(
                binding.getDeclaringMethod(), JavaElementLabels.ALL_FULLY_QUALIFIED)
          });
  final JDTRefactoringDescriptorComment comment =
      new JDTRefactoringDescriptorComment(project, this, header);
  comment.addSetting(
      Messages.format(
          RefactoringCoreMessages.PromoteTempToFieldRefactoring_original_pattern,
          BindingLabelProvider.getBindingLabel(binding, JavaElementLabels.ALL_FULLY_QUALIFIED)));
  comment.addSetting(
      Messages.format(
          RefactoringCoreMessages.PromoteTempToFieldRefactoring_field_pattern,
          BasicElementLabels.getJavaElementName(fFieldName)));
  switch (fInitializeIn) {
    case INITIALIZE_IN_CONSTRUCTOR:
      comment.addSetting(
          RefactoringCoreMessages.PromoteTempToFieldRefactoring_initialize_constructor);
      break;
    case INITIALIZE_IN_FIELD:
      comment.addSetting(
          RefactoringCoreMessages.PromoteTempToFieldRefactoring_initialize_declaration);
      break;
    case INITIALIZE_IN_METHOD:
      comment.addSetting(RefactoringCoreMessages.PromoteTempToFieldRefactoring_initialize_method);
      break;
  }
  String visibility = JdtFlags.getVisibilityString(fVisibility);
  if ("".equals(visibility)) // $NON-NLS-1$
  visibility = RefactoringCoreMessages.PromoteTempToFieldRefactoring_default_visibility;
  comment.addSetting(
      Messages.format(
          RefactoringCoreMessages.PromoteTempToFieldRefactoring_visibility_pattern, visibility));
  if (fDeclareFinal && fDeclareStatic)
    comment.addSetting(
        RefactoringCoreMessages.PromoteTempToFieldRefactoring_declare_final_static);
  else if (fDeclareFinal)
    comment.addSetting(RefactoringCoreMessages.PromoteTempToFieldRefactoring_declare_final);
  else if (fDeclareStatic)
    comment.addSetting(RefactoringCoreMessages.PromoteTempToFieldRefactoring_declare_static);
  final ConvertLocalVariableDescriptor descriptor =
      RefactoringSignatureDescriptorFactory.createConvertLocalVariableDescriptor(
          project,
          description,
          comment.asString(),
          arguments,
          RefactoringDescriptor.STRUCTURAL_CHANGE);
  arguments.put(
      JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT,
      JavaRefactoringDescriptorUtil.elementToHandle(project, fCu));
  arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_NAME, fFieldName);
  arguments.put(
      JavaRefactoringDescriptorUtil.ATTRIBUTE_SELECTION,
      new Integer(fSelectionStart).toString()
          + " "
          + new Integer(fSelectionLength).toString()); // $NON-NLS-1$
  arguments.put(ATTRIBUTE_STATIC, Boolean.valueOf(fDeclareStatic).toString());
  arguments.put(ATTRIBUTE_FINAL, Boolean.valueOf(fDeclareFinal).toString());
  arguments.put(ATTRIBUTE_VISIBILITY, new Integer(fVisibility).toString());
  arguments.put(ATTRIBUTE_INITIALIZE, new Integer(fInitializeIn).toString());
  return descriptor;
}
项目:che    文件:RefactoringSignatureDescriptorFactory.java   
public static ConvertLocalVariableDescriptor createConvertLocalVariableDescriptor() {
  return new ConvertLocalVariableDescriptor();
}
项目:che    文件:RefactoringSignatureDescriptorFactory.java   
public static ConvertLocalVariableDescriptor createConvertLocalVariableDescriptor(
    String project, String description, String comment, Map arguments, int flags) {
  return new ConvertLocalVariableDescriptor(project, description, comment, arguments, flags);
}
项目:Eclipse-Postfix-Code-Completion    文件:PromoteTempToFieldRefactoring.java   
private ConvertLocalVariableDescriptor getRefactoringDescriptor() {
    final Map<String, String> arguments= new HashMap<String, String>();
    String project= null;
    IJavaProject javaProject= fCu.getJavaProject();
    if (javaProject != null)
        project= javaProject.getElementName();
    final IVariableBinding binding= fTempDeclarationNode.resolveBinding();
    final String description= Messages.format(RefactoringCoreMessages.PromoteTempToFieldRefactoring_descriptor_description_short, BasicElementLabels.getJavaElementName(binding.getName()));
    final String header= Messages.format(RefactoringCoreMessages.PromoteTempToFieldRefactoring_descriptor_description, new String[] { BindingLabelProvider.getBindingLabel(binding, JavaElementLabels.ALL_FULLY_QUALIFIED), BindingLabelProvider.getBindingLabel(binding.getDeclaringMethod(), JavaElementLabels.ALL_FULLY_QUALIFIED)});
    final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(project, this, header);
    comment.addSetting(Messages.format(RefactoringCoreMessages.PromoteTempToFieldRefactoring_original_pattern, BindingLabelProvider.getBindingLabel(binding, JavaElementLabels.ALL_FULLY_QUALIFIED)));
    comment.addSetting(Messages.format(RefactoringCoreMessages.PromoteTempToFieldRefactoring_field_pattern, BasicElementLabels.getJavaElementName(fFieldName)));
    switch (fInitializeIn) {
        case INITIALIZE_IN_CONSTRUCTOR:
            comment.addSetting(RefactoringCoreMessages.PromoteTempToFieldRefactoring_initialize_constructor);
            break;
        case INITIALIZE_IN_FIELD:
            comment.addSetting(RefactoringCoreMessages.PromoteTempToFieldRefactoring_initialize_declaration);
            break;
        case INITIALIZE_IN_METHOD:
            comment.addSetting(RefactoringCoreMessages.PromoteTempToFieldRefactoring_initialize_method);
            break;
    }
    String visibility= JdtFlags.getVisibilityString(fVisibility);
    if ("".equals(visibility)) //$NON-NLS-1$
        visibility= RefactoringCoreMessages.PromoteTempToFieldRefactoring_default_visibility;
    comment.addSetting(Messages.format(RefactoringCoreMessages.PromoteTempToFieldRefactoring_visibility_pattern, visibility));
    if (fDeclareFinal && fDeclareStatic)
        comment.addSetting(RefactoringCoreMessages.PromoteTempToFieldRefactoring_declare_final_static);
    else if (fDeclareFinal)
        comment.addSetting(RefactoringCoreMessages.PromoteTempToFieldRefactoring_declare_final);
    else if (fDeclareStatic)
        comment.addSetting(RefactoringCoreMessages.PromoteTempToFieldRefactoring_declare_static);
    final ConvertLocalVariableDescriptor descriptor= RefactoringSignatureDescriptorFactory.createConvertLocalVariableDescriptor(project, description, comment.asString(), arguments, RefactoringDescriptor.STRUCTURAL_CHANGE);
    arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT, JavaRefactoringDescriptorUtil.elementToHandle(project, fCu));
    arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_NAME, fFieldName);
    arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_SELECTION, new Integer(fSelectionStart).toString() + " " + new Integer(fSelectionLength).toString()); //$NON-NLS-1$
    arguments.put(ATTRIBUTE_STATIC, Boolean.valueOf(fDeclareStatic).toString());
    arguments.put(ATTRIBUTE_FINAL, Boolean.valueOf(fDeclareFinal).toString());
    arguments.put(ATTRIBUTE_VISIBILITY, new Integer(fVisibility).toString());
    arguments.put(ATTRIBUTE_INITIALIZE, new Integer(fInitializeIn).toString());
    return descriptor;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:PromoteTempToFieldRefactoring.java   
private ConvertLocalVariableDescriptor getRefactoringDescriptor() {
    final Map<String, String> arguments= new HashMap<String, String>();
    String project= null;
    IJavaProject javaProject= fCu.getJavaProject();
    if (javaProject != null)
        project= javaProject.getElementName();
    final IVariableBinding binding= fTempDeclarationNode.resolveBinding();
    final String description= Messages.format(RefactoringCoreMessages.PromoteTempToFieldRefactoring_descriptor_description_short, BasicElementLabels.getJavaElementName(binding.getName()));
    final String header= Messages.format(RefactoringCoreMessages.PromoteTempToFieldRefactoring_descriptor_description, new String[] { BindingLabelProvider.getBindingLabel(binding, JavaElementLabels.ALL_FULLY_QUALIFIED), BindingLabelProvider.getBindingLabel(binding.getDeclaringMethod(), JavaElementLabels.ALL_FULLY_QUALIFIED)});
    final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(project, this, header);
    comment.addSetting(Messages.format(RefactoringCoreMessages.PromoteTempToFieldRefactoring_original_pattern, BindingLabelProvider.getBindingLabel(binding, JavaElementLabels.ALL_FULLY_QUALIFIED)));
    comment.addSetting(Messages.format(RefactoringCoreMessages.PromoteTempToFieldRefactoring_field_pattern, BasicElementLabels.getJavaElementName(fFieldName)));
    switch (fInitializeIn) {
        case INITIALIZE_IN_CONSTRUCTOR:
            comment.addSetting(RefactoringCoreMessages.PromoteTempToFieldRefactoring_initialize_constructor);
            break;
        case INITIALIZE_IN_FIELD:
            comment.addSetting(RefactoringCoreMessages.PromoteTempToFieldRefactoring_initialize_declaration);
            break;
        case INITIALIZE_IN_METHOD:
            comment.addSetting(RefactoringCoreMessages.PromoteTempToFieldRefactoring_initialize_method);
            break;
    }
    String visibility= JdtFlags.getVisibilityString(fVisibility);
    if ("".equals(visibility)) //$NON-NLS-1$
        visibility= RefactoringCoreMessages.PromoteTempToFieldRefactoring_default_visibility;
    comment.addSetting(Messages.format(RefactoringCoreMessages.PromoteTempToFieldRefactoring_visibility_pattern, visibility));
    if (fDeclareFinal && fDeclareStatic)
        comment.addSetting(RefactoringCoreMessages.PromoteTempToFieldRefactoring_declare_final_static);
    else if (fDeclareFinal)
        comment.addSetting(RefactoringCoreMessages.PromoteTempToFieldRefactoring_declare_final);
    else if (fDeclareStatic)
        comment.addSetting(RefactoringCoreMessages.PromoteTempToFieldRefactoring_declare_static);
    final ConvertLocalVariableDescriptor descriptor= RefactoringSignatureDescriptorFactory.createConvertLocalVariableDescriptor(project, description, comment.asString(), arguments, RefactoringDescriptor.STRUCTURAL_CHANGE);
    arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT, JavaRefactoringDescriptorUtil.elementToHandle(project, fCu));
    arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_NAME, fFieldName);
    arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_SELECTION, new Integer(fSelectionStart).toString() + " " + new Integer(fSelectionLength).toString()); //$NON-NLS-1$
    arguments.put(ATTRIBUTE_STATIC, Boolean.valueOf(fDeclareStatic).toString());
    arguments.put(ATTRIBUTE_FINAL, Boolean.valueOf(fDeclareFinal).toString());
    arguments.put(ATTRIBUTE_VISIBILITY, new Integer(fVisibility).toString());
    arguments.put(ATTRIBUTE_INITIALIZE, new Integer(fInitializeIn).toString());
    return descriptor;
}