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

项目:Eclipse-Postfix-Code-Completion    文件:IntroduceIndirectionRefactoring.java   
@Override
public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
    final Map<String, String> arguments= new HashMap<String, String>();
    String project= null;
    IJavaProject javaProject= fTargetMethod.getJavaProject();
    if (javaProject != null)
        project= javaProject.getElementName();
    int flags= JavaRefactoringDescriptor.JAR_MIGRATION | JavaRefactoringDescriptor.JAR_REFACTORING | RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE;
    final IType declaring= fTargetMethod.getDeclaringType();
    try {
        if (declaring.isLocal() || declaring.isAnonymous())
            flags|= JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
    } catch (JavaModelException exception) {
        JavaPlugin.log(exception);
    }
    final String description= Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_descriptor_description_short, BasicElementLabels.getJavaElementName(fTargetMethod.getElementName()));
    final String header= Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_descriptor_description, new String[] { JavaElementLabels.getTextLabel(fTargetMethod, JavaElementLabels.ALL_FULLY_QUALIFIED), JavaElementLabels.getTextLabel(declaring, JavaElementLabels.ALL_FULLY_QUALIFIED)});
    final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(project, this, header);
    comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_original_pattern, JavaElementLabels.getTextLabel(fTargetMethod, JavaElementLabels.ALL_FULLY_QUALIFIED)));
    comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_method_pattern, BasicElementLabels.getJavaElementName(fIntermediaryMethodName)));
    comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_declaring_pattern, JavaElementLabels.getTextLabel(fIntermediaryType, JavaElementLabels.ALL_FULLY_QUALIFIED)));
    if (fUpdateReferences)
        comment.addSetting(RefactoringCoreMessages.JavaRefactoringDescriptor_update_references);
    final IntroduceIndirectionDescriptor descriptor= RefactoringSignatureDescriptorFactory.createIntroduceIndirectionDescriptor(project, description, comment.asString(), arguments, flags);
    arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT, JavaRefactoringDescriptorUtil.elementToHandle(project, fTargetMethod));
    arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_NAME, fIntermediaryMethodName);
    arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_ELEMENT + 1, JavaRefactoringDescriptorUtil.elementToHandle(project, fIntermediaryType));
    arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_REFERENCES, Boolean.valueOf(fUpdateReferences).toString());
    return new DynamicValidationRefactoringChange(descriptor, RefactoringCoreMessages.IntroduceIndirectionRefactoring_introduce_indirection, fTextChangeManager.getAllChanges());
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:IntroduceIndirectionRefactoring.java   
@Override
public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
    final Map<String, String> arguments= new HashMap<String, String>();
    String project= null;
    IJavaProject javaProject= fTargetMethod.getJavaProject();
    if (javaProject != null)
        project= javaProject.getElementName();
    int flags= JavaRefactoringDescriptor.JAR_MIGRATION | JavaRefactoringDescriptor.JAR_REFACTORING | RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE;
    final IType declaring= fTargetMethod.getDeclaringType();
    try {
        if (declaring.isLocal() || declaring.isAnonymous())
            flags|= JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
    } catch (JavaModelException exception) {
        JavaPlugin.log(exception);
    }
    final String description= Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_descriptor_description_short, BasicElementLabels.getJavaElementName(fTargetMethod.getElementName()));
    final String header= Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_descriptor_description, new String[] { JavaElementLabels.getTextLabel(fTargetMethod, JavaElementLabels.ALL_FULLY_QUALIFIED), JavaElementLabels.getTextLabel(declaring, JavaElementLabels.ALL_FULLY_QUALIFIED)});
    final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(project, this, header);
    comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_original_pattern, JavaElementLabels.getTextLabel(fTargetMethod, JavaElementLabels.ALL_FULLY_QUALIFIED)));
    comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_method_pattern, BasicElementLabels.getJavaElementName(fIntermediaryMethodName)));
    comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_declaring_pattern, JavaElementLabels.getTextLabel(fIntermediaryClass, JavaElementLabels.ALL_FULLY_QUALIFIED)));
    if (fUpdateReferences)
        comment.addSetting(RefactoringCoreMessages.JavaRefactoringDescriptor_update_references);
    final IntroduceIndirectionDescriptor descriptor= RefactoringSignatureDescriptorFactory.createIntroduceIndirectionDescriptor(project, description, comment.asString(), arguments, flags);
    arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT, JavaRefactoringDescriptorUtil.elementToHandle(project, fTargetMethod));
    arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_NAME, fIntermediaryMethodName);
    arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_ELEMENT + 1, JavaRefactoringDescriptorUtil.elementToHandle(project, fIntermediaryClass));
    arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_REFERENCES, Boolean.valueOf(fUpdateReferences).toString());
    return new DynamicValidationRefactoringChange(descriptor, RefactoringCoreMessages.IntroduceIndirectionRefactoring_introduce_indirection, fTextChangeManager.getAllChanges());
}
项目:che    文件:IntroduceIndirectionRefactoring.java   
@Override
public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
  final Map<String, String> arguments = new HashMap<String, String>();
  String project = null;
  IJavaProject javaProject = fTargetMethod.getJavaProject();
  if (javaProject != null) project = javaProject.getElementName();
  int flags =
      JavaRefactoringDescriptor.JAR_MIGRATION
          | JavaRefactoringDescriptor.JAR_REFACTORING
          | RefactoringDescriptor.STRUCTURAL_CHANGE
          | RefactoringDescriptor.MULTI_CHANGE;
  final IType declaring = fTargetMethod.getDeclaringType();
  try {
    if (declaring.isLocal() || declaring.isAnonymous())
      flags |= JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
  } catch (JavaModelException exception) {
    JavaPlugin.log(exception);
  }
  final String description =
      Messages.format(
          RefactoringCoreMessages.IntroduceIndirectionRefactoring_descriptor_description_short,
          BasicElementLabels.getJavaElementName(fTargetMethod.getElementName()));
  final String header =
      Messages.format(
          RefactoringCoreMessages.IntroduceIndirectionRefactoring_descriptor_description,
          new String[] {
            JavaElementLabels.getTextLabel(fTargetMethod, JavaElementLabels.ALL_FULLY_QUALIFIED),
            JavaElementLabels.getTextLabel(declaring, JavaElementLabels.ALL_FULLY_QUALIFIED)
          });
  final JDTRefactoringDescriptorComment comment =
      new JDTRefactoringDescriptorComment(project, this, header);
  comment.addSetting(
      Messages.format(
          RefactoringCoreMessages.IntroduceIndirectionRefactoring_original_pattern,
          JavaElementLabels.getTextLabel(fTargetMethod, JavaElementLabels.ALL_FULLY_QUALIFIED)));
  comment.addSetting(
      Messages.format(
          RefactoringCoreMessages.IntroduceIndirectionRefactoring_method_pattern,
          BasicElementLabels.getJavaElementName(fIntermediaryMethodName)));
  comment.addSetting(
      Messages.format(
          RefactoringCoreMessages.IntroduceIndirectionRefactoring_declaring_pattern,
          JavaElementLabels.getTextLabel(
              fIntermediaryType, JavaElementLabels.ALL_FULLY_QUALIFIED)));
  if (fUpdateReferences)
    comment.addSetting(RefactoringCoreMessages.JavaRefactoringDescriptor_update_references);
  final IntroduceIndirectionDescriptor descriptor =
      RefactoringSignatureDescriptorFactory.createIntroduceIndirectionDescriptor(
          project, description, comment.asString(), arguments, flags);
  arguments.put(
      JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT,
      JavaRefactoringDescriptorUtil.elementToHandle(project, fTargetMethod));
  arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_NAME, fIntermediaryMethodName);
  arguments.put(
      JavaRefactoringDescriptorUtil.ATTRIBUTE_ELEMENT + 1,
      JavaRefactoringDescriptorUtil.elementToHandle(project, fIntermediaryType));
  arguments.put(
      JavaRefactoringDescriptorUtil.ATTRIBUTE_REFERENCES,
      Boolean.valueOf(fUpdateReferences).toString());
  return new DynamicValidationRefactoringChange(
      descriptor,
      RefactoringCoreMessages.IntroduceIndirectionRefactoring_introduce_indirection,
      fTextChangeManager.getAllChanges());
}
项目:che    文件:RefactoringSignatureDescriptorFactory.java   
public static IntroduceIndirectionDescriptor createIntroduceIndirectionDescriptor() {
  return new IntroduceIndirectionDescriptor();
}
项目:che    文件:RefactoringSignatureDescriptorFactory.java   
public static IntroduceIndirectionDescriptor createIntroduceIndirectionDescriptor(
    String project, String description, String comment, Map arguments, int flags) {
  return new IntroduceIndirectionDescriptor(project, description, comment, arguments, flags);
}