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

项目:che    文件:RefactoringSignatureDescriptorFactory.java   
public static UseSupertypeDescriptor createUseSupertypeDescriptor() {
  return new UseSupertypeDescriptor();
}
项目:che    文件:RefactoringSignatureDescriptorFactory.java   
public static UseSupertypeDescriptor createUseSupertypeDescriptor(
    String project, String description, String comment, Map arguments, int flags) {
  return new UseSupertypeDescriptor(project, description, comment, arguments, flags);
}
项目:Eclipse-Postfix-Code-Completion    文件:UseSuperTypeProcessor.java   
@Override
public final Change createChange(final IProgressMonitor monitor) throws CoreException, OperationCanceledException {
    Assert.isNotNull(monitor);
    try {
        fChanges= 0;
        monitor.beginTask("", 1); //$NON-NLS-1$
        monitor.setTaskName(RefactoringCoreMessages.ExtractInterfaceProcessor_creating);
        final TextEditBasedChange[] changes= fChangeManager.getAllChanges();
        if (changes != null && changes.length != 0) {
            fChanges= changes.length;
            IJavaProject project= null;
            if (!fSubType.isBinary())
                project= fSubType.getJavaProject();
            int flags= JavaRefactoringDescriptor.JAR_MIGRATION | JavaRefactoringDescriptor.JAR_REFACTORING | RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE;
            try {
                if (fSubType.isLocal() || fSubType.isAnonymous())
                    flags|= JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
            } catch (JavaModelException exception) {
                JavaPlugin.log(exception);
            }
            final String name= project != null ? project.getElementName() : null;
            final String description= Messages.format(RefactoringCoreMessages.UseSuperTypeProcessor_descriptor_description_short, BasicElementLabels.getJavaElementName(fSuperType.getElementName()));
            final String header= Messages.format(RefactoringCoreMessages.UseSuperTypeProcessor_descriptor_description, new String[] { JavaElementLabels.getElementLabel(fSuperType, JavaElementLabels.ALL_FULLY_QUALIFIED), JavaElementLabels.getElementLabel(fSubType, JavaElementLabels.ALL_FULLY_QUALIFIED) });
            final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(name, this, header);
            comment.addSetting(Messages.format(RefactoringCoreMessages.UseSuperTypeProcessor_refactored_element_pattern, JavaElementLabels.getElementLabel(fSuperType, JavaElementLabels.ALL_FULLY_QUALIFIED)));
            addSuperTypeSettings(comment, false);
            final UseSupertypeDescriptor descriptor= RefactoringSignatureDescriptorFactory.createUseSupertypeDescriptor();
            descriptor.setProject(name);
            descriptor.setDescription(description);
            descriptor.setComment(comment.asString());
            descriptor.setFlags(flags);
            descriptor.setSubtype(getSubType());
            descriptor.setSupertype(getSuperType());
            descriptor.setReplaceInstanceof(fInstanceOf);
            return new DynamicValidationRefactoringChange(descriptor, RefactoringCoreMessages.UseSupertypeWherePossibleRefactoring_name, fChangeManager.getAllChanges());
        }
        monitor.worked(1);
    } finally {
        monitor.done();
    }
    return null;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:UseSuperTypeProcessor.java   
@Override
public final Change createChange(final IProgressMonitor monitor) throws CoreException, OperationCanceledException {
    Assert.isNotNull(monitor);
    try {
        fChanges= 0;
        monitor.beginTask("", 1); //$NON-NLS-1$
        monitor.setTaskName(RefactoringCoreMessages.ExtractInterfaceProcessor_creating);
        final TextEditBasedChange[] changes= fChangeManager.getAllChanges();
        if (changes != null && changes.length != 0) {
            fChanges= changes.length;
            IJavaProject project= null;
            if (!fSubType.isBinary())
                project= fSubType.getJavaProject();
            int flags= JavaRefactoringDescriptor.JAR_MIGRATION | JavaRefactoringDescriptor.JAR_REFACTORING | RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE;
            try {
                if (fSubType.isLocal() || fSubType.isAnonymous())
                    flags|= JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
            } catch (JavaModelException exception) {
                JavaPlugin.log(exception);
            }
            final String name= project != null ? project.getElementName() : null;
            final String description= Messages.format(RefactoringCoreMessages.UseSuperTypeProcessor_descriptor_description_short, BasicElementLabels.getJavaElementName(fSuperType.getElementName()));
            final String header= Messages.format(RefactoringCoreMessages.UseSuperTypeProcessor_descriptor_description, new String[] { JavaElementLabels.getElementLabel(fSuperType, JavaElementLabels.ALL_FULLY_QUALIFIED), JavaElementLabels.getElementLabel(fSubType, JavaElementLabels.ALL_FULLY_QUALIFIED) });
            final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(name, this, header);
            comment.addSetting(Messages.format(RefactoringCoreMessages.UseSuperTypeProcessor_refactored_element_pattern, JavaElementLabels.getElementLabel(fSuperType, JavaElementLabels.ALL_FULLY_QUALIFIED)));
            addSuperTypeSettings(comment, false);
            final UseSupertypeDescriptor descriptor= RefactoringSignatureDescriptorFactory.createUseSupertypeDescriptor();
            descriptor.setProject(name);
            descriptor.setDescription(description);
            descriptor.setComment(comment.asString());
            descriptor.setFlags(flags);
            descriptor.setSubtype(getSubType());
            descriptor.setSupertype(getSuperType());
            descriptor.setReplaceInstanceof(fInstanceOf);
            return new DynamicValidationRefactoringChange(descriptor, RefactoringCoreMessages.UseSupertypeWherePossibleRefactoring_name, fChangeManager.getAllChanges());
        }
        monitor.worked(1);
    } finally {
        monitor.done();
    }
    return null;
}