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

项目:che    文件:RefactoringSignatureDescriptorFactory.java   
public static MoveMethodDescriptor createMoveMethodDescriptor() {
  return new MoveMethodDescriptor();
}
项目:che    文件:RefactoringSignatureDescriptorFactory.java   
public static MoveMethodDescriptor createMoveMethodDescriptor(
    String project, String description, String comment, Map arguments, int flags) {
  return new MoveMethodDescriptor(project, description, comment, arguments, flags);
}
项目:Eclipse-Postfix-Code-Completion    文件:MoveInstanceMethodProcessor.java   
@Override
public final Change createChange(final IProgressMonitor monitor) throws CoreException, OperationCanceledException {
    Assert.isNotNull(monitor);
    try {
        monitor.beginTask("", 6); //$NON-NLS-1$
        monitor.setTaskName(RefactoringCoreMessages.MoveInstanceMethodProcessor_creating);
        final TextChange[] changes= fChangeManager.getAllChanges();
        if (changes.length == 1)
            return changes[0];
        final List<TextChange> list= new ArrayList<TextChange>(changes.length);
        list.addAll(Arrays.asList(changes));
        final Map<String, String> arguments= new HashMap<String, String>();
        String project= null;
        final IJavaProject javaProject= fMethod.getJavaProject();
        if (javaProject != null)
            project= javaProject.getElementName();
        int flags= JavaRefactoringDescriptor.JAR_REFACTORING | JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT | RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE;
        final IType declaring= fMethod.getDeclaringType();
        try {
            if (declaring.isAnonymous() || declaring.isLocal())
                flags|= JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
        } catch (JavaModelException exception) {
            JavaPlugin.log(exception);
        }
        final String description= Messages.format(RefactoringCoreMessages.MoveInstanceMethodProcessor_descriptor_description_short, BasicElementLabels.getJavaElementName(fMethod.getElementName()));
        final String header= Messages.format(RefactoringCoreMessages.MoveInstanceMethodProcessor_descriptor_description, new String[] { JavaElementLabels.getElementLabel(fMethod, JavaElementLabels.ALL_FULLY_QUALIFIED), BindingLabelProvider.getBindingLabel(fTarget, JavaElementLabels.ALL_FULLY_QUALIFIED) });
        final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(project, this, header);
        comment.addSetting(Messages.format(RefactoringCoreMessages.MoveInstanceMethodProcessor_moved_element_pattern, RefactoringCoreMessages.JavaRefactoringDescriptor_not_available));
        comment.addSetting(Messages.format(RefactoringCoreMessages.MoveInstanceMethodProcessor_target_element_pattern, BindingLabelProvider.getBindingLabel(fTarget, JavaElementLabels.ALL_FULLY_QUALIFIED)));
        comment.addSetting(Messages.format(RefactoringCoreMessages.MoveInstanceMethodProcessor_method_name_pattern, BasicElementLabels.getJavaElementName(getMethodName())));
        if (needsTargetNode())
            comment.addSetting(Messages.format(RefactoringCoreMessages.MoveInstanceMethodProcessor_parameter_name_pattern, BasicElementLabels.getJavaElementName(getTargetName())));
        final MoveMethodDescriptor descriptor= RefactoringSignatureDescriptorFactory.createMoveMethodDescriptor(project, description, comment.asString(), arguments, flags);
        arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT, JavaRefactoringDescriptorUtil.elementToHandle(project, fMethod));
        arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_NAME, fMethodName);
        arguments.put(ATTRIBUTE_TARGET_NAME, fTargetName);
        arguments.put(ATTRIBUTE_DEPRECATE, Boolean.valueOf(fDelegateDeprecation).toString());
        arguments.put(ATTRIBUTE_REMOVE, Boolean.valueOf(fRemove).toString());
        arguments.put(ATTRIBUTE_INLINE, Boolean.valueOf(fInline).toString());
        arguments.put(ATTRIBUTE_USE_GETTER, Boolean.valueOf(fUseGetters).toString());
        arguments.put(ATTRIBUTE_USE_SETTER, Boolean.valueOf(fUseSetters).toString());
        arguments.put(ATTRIBUTE_TARGET_INDEX, new Integer(getTargetIndex()).toString());
        return new DynamicValidationRefactoringChange(descriptor, RefactoringCoreMessages.MoveInstanceMethodRefactoring_name, list.toArray(new Change[list.size()]));
    } finally {
        monitor.done();
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:MoveInstanceMethodProcessor.java   
@Override
public final Change createChange(final IProgressMonitor monitor) throws CoreException, OperationCanceledException {
    Assert.isNotNull(monitor);
    try {
        monitor.beginTask("", 6); //$NON-NLS-1$
        monitor.setTaskName(RefactoringCoreMessages.MoveInstanceMethodProcessor_creating);
        final TextChange[] changes= fChangeManager.getAllChanges();
        if (changes.length == 1)
            return changes[0];
        final List<TextChange> list= new ArrayList<TextChange>(changes.length);
        list.addAll(Arrays.asList(changes));
        final Map<String, String> arguments= new HashMap<String, String>();
        String project= null;
        final IJavaProject javaProject= fMethod.getJavaProject();
        if (javaProject != null)
            project= javaProject.getElementName();
        int flags= JavaRefactoringDescriptor.JAR_REFACTORING | JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT | RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE;
        final IType declaring= fMethod.getDeclaringType();
        try {
            if (declaring.isAnonymous() || declaring.isLocal())
                flags|= JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
        } catch (JavaModelException exception) {
            JavaPlugin.log(exception);
        }
        final String description= Messages.format(RefactoringCoreMessages.MoveInstanceMethodProcessor_descriptor_description_short, BasicElementLabels.getJavaElementName(fMethod.getElementName()));
        final String header= Messages.format(RefactoringCoreMessages.MoveInstanceMethodProcessor_descriptor_description, new String[] { JavaElementLabels.getElementLabel(fMethod, JavaElementLabels.ALL_FULLY_QUALIFIED), BindingLabelProvider.getBindingLabel(fTarget, JavaElementLabels.ALL_FULLY_QUALIFIED) });
        final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(project, this, header);
        comment.addSetting(Messages.format(RefactoringCoreMessages.MoveInstanceMethodProcessor_moved_element_pattern, RefactoringCoreMessages.JavaRefactoringDescriptor_not_available));
        comment.addSetting(Messages.format(RefactoringCoreMessages.MoveInstanceMethodProcessor_target_element_pattern, BindingLabelProvider.getBindingLabel(fTarget, JavaElementLabels.ALL_FULLY_QUALIFIED)));
        comment.addSetting(Messages.format(RefactoringCoreMessages.MoveInstanceMethodProcessor_method_name_pattern, BasicElementLabels.getJavaElementName(getMethodName())));
        if (needsTargetNode())
            comment.addSetting(Messages.format(RefactoringCoreMessages.MoveInstanceMethodProcessor_parameter_name_pattern, BasicElementLabels.getJavaElementName(getTargetName())));
        final MoveMethodDescriptor descriptor= RefactoringSignatureDescriptorFactory.createMoveMethodDescriptor(project, description, comment.asString(), arguments, flags);
        arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT, JavaRefactoringDescriptorUtil.elementToHandle(project, fMethod));
        arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_NAME, fMethodName);
        arguments.put(ATTRIBUTE_TARGET_NAME, fTargetName);
        arguments.put(ATTRIBUTE_DEPRECATE, Boolean.valueOf(fDelegateDeprecation).toString());
        arguments.put(ATTRIBUTE_REMOVE, Boolean.valueOf(fRemove).toString());
        arguments.put(ATTRIBUTE_INLINE, Boolean.valueOf(fInline).toString());
        arguments.put(ATTRIBUTE_USE_GETTER, Boolean.valueOf(fUseGetters).toString());
        arguments.put(ATTRIBUTE_USE_SETTER, Boolean.valueOf(fUseSetters).toString());
        arguments.put(ATTRIBUTE_TARGET_INDEX, new Integer(getTargetIndex()).toString());
        return new DynamicValidationRefactoringChange(descriptor, RefactoringCoreMessages.MoveInstanceMethodRefactoring_name, list.toArray(new Change[list.size()]));
    } finally {
        monitor.done();
    }
}