private RefactoringChangeDescriptor createRefactoringDescriptor() { final ITypeBinding binding= fAnonymousInnerClassNode.resolveBinding(); final String[] labels= new String[] { BindingLabelProvider.getBindingLabel(binding, JavaElementLabels.ALL_FULLY_QUALIFIED), BindingLabelProvider.getBindingLabel(binding.getDeclaringMethod(), JavaElementLabels.ALL_FULLY_QUALIFIED)}; final Map<String, String> arguments= new HashMap<String, String>(); final String projectName= fCu.getJavaProject().getElementName(); final int flags= RefactoringDescriptor.STRUCTURAL_CHANGE | JavaRefactoringDescriptor.JAR_REFACTORING | JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT; final String description= RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_descriptor_description_short; final String header= Messages.format(RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_descriptor_description, labels); final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(projectName, this, header); comment.addSetting(Messages.format(RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_original_pattern, BindingLabelProvider.getBindingLabel(binding, JavaElementLabels.ALL_FULLY_QUALIFIED))); comment.addSetting(Messages.format(RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_class_name_pattern, BasicElementLabels.getJavaElementName(fClassName))); String visibility= JdtFlags.getVisibilityString(fVisibility); if (visibility.length() == 0) visibility= RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_default_visibility; comment.addSetting(Messages.format(RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_visibility_pattern, visibility)); if (fDeclareFinal && fDeclareStatic) comment.addSetting(RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_declare_final_static); else if (fDeclareFinal) comment.addSetting(RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_declare_final); else if (fDeclareStatic) comment.addSetting(RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_declare_static); arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT, JavaRefactoringDescriptorUtil.elementToHandle(projectName, fCu)); arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_NAME, fClassName); arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_SELECTION, new Integer(fSelectionStart).toString() + ' ' + new Integer(fSelectionLength).toString()); arguments.put(ATTRIBUTE_FINAL, Boolean.valueOf(fDeclareFinal).toString()); arguments.put(ATTRIBUTE_STATIC, Boolean.valueOf(fDeclareStatic).toString()); arguments.put(ATTRIBUTE_VISIBILITY, new Integer(fVisibility).toString()); ConvertAnonymousDescriptor descriptor= RefactoringSignatureDescriptorFactory.createConvertAnonymousDescriptor(projectName, description, comment.asString(), arguments, flags); return new RefactoringChangeDescriptor(descriptor); }
private RefactoringChangeDescriptor createRefactoringDescriptor() { final ITypeBinding binding = fAnonymousInnerClassNode.resolveBinding(); final String[] labels = new String[] { BindingLabelProvider.getBindingLabel(binding, JavaElementLabels.ALL_FULLY_QUALIFIED), BindingLabelProvider.getBindingLabel( binding.getDeclaringMethod(), JavaElementLabels.ALL_FULLY_QUALIFIED) }; final Map<String, String> arguments = new HashMap<String, String>(); final String projectName = fCu.getJavaProject().getElementName(); final int flags = RefactoringDescriptor.STRUCTURAL_CHANGE | JavaRefactoringDescriptor.JAR_REFACTORING | JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT; final String description = RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_descriptor_description_short; final String header = Messages.format( RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_descriptor_description, labels); final JDTRefactoringDescriptorComment comment = new JDTRefactoringDescriptorComment(projectName, this, header); comment.addSetting( Messages.format( RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_original_pattern, BindingLabelProvider.getBindingLabel(binding, JavaElementLabels.ALL_FULLY_QUALIFIED))); comment.addSetting( Messages.format( RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_class_name_pattern, BasicElementLabels.getJavaElementName(fClassName))); String visibility = JdtFlags.getVisibilityString(fVisibility); if (visibility.length() == 0) visibility = RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_default_visibility; comment.addSetting( Messages.format( RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_visibility_pattern, visibility)); if (fDeclareFinal && fDeclareStatic) comment.addSetting( RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_declare_final_static); else if (fDeclareFinal) comment.addSetting(RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_declare_final); else if (fDeclareStatic) comment.addSetting( RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_declare_static); arguments.put( JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT, JavaRefactoringDescriptorUtil.elementToHandle(projectName, fCu)); arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_NAME, fClassName); arguments.put( JavaRefactoringDescriptorUtil.ATTRIBUTE_SELECTION, new Integer(fSelectionStart).toString() + ' ' + new Integer(fSelectionLength).toString()); arguments.put(ATTRIBUTE_FINAL, Boolean.valueOf(fDeclareFinal).toString()); arguments.put(ATTRIBUTE_STATIC, Boolean.valueOf(fDeclareStatic).toString()); arguments.put(ATTRIBUTE_VISIBILITY, new Integer(fVisibility).toString()); ConvertAnonymousDescriptor descriptor = RefactoringSignatureDescriptorFactory.createConvertAnonymousDescriptor( projectName, description, comment.asString(), arguments, flags); return new RefactoringChangeDescriptor(descriptor); }
public static ConvertAnonymousDescriptor createConvertAnonymousDescriptor() { return new ConvertAnonymousDescriptor(); }
public static ConvertAnonymousDescriptor createConvertAnonymousDescriptor( String project, String description, String comment, Map arguments, int flags) { return new ConvertAnonymousDescriptor(project, description, comment, arguments, flags); }