@Override public Change createChange(IProgressMonitor monitor) throws CoreException { try { monitor.beginTask(RefactoringCoreMessages.JavaDeleteProcessor_creating_change, 1); final Map<String, String> arguments= new HashMap<String, String>(); final String description= fElements.length == 1 ? RefactoringCoreMessages.JavaDeleteProcessor_description_singular : RefactoringCoreMessages.JavaDeleteProcessor_description_plural; final IProject resource= getSingleProject(); final String project= resource != null ? resource.getName() : null; final String source= project != null ? Messages.format(RefactoringCoreMessages.JavaDeleteProcessor_project_pattern, BasicElementLabels.getJavaElementName(project)) : RefactoringCoreMessages.JavaDeleteProcessor_workspace; final String header= fElements.length == 1 ? Messages.format(RefactoringCoreMessages.JavaDeleteProcessor_header_singular, source) : Messages.format( RefactoringCoreMessages.JavaDeleteProcessor_header_plural, new String[] { String.valueOf(fElements.length), source }); int flags= JavaRefactoringDescriptor.JAR_MIGRATION | JavaRefactoringDescriptor.JAR_REFACTORING | RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE; final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(project, this, header); if (fDeleteSubPackages) comment.addSetting(RefactoringCoreMessages.JavaDeleteProcessor_delete_subpackages); if (fAccessorsDeleted) comment.addSetting(RefactoringCoreMessages.JavaDeleteProcessor_delete_accessors); final DeleteDescriptor descriptor= RefactoringSignatureDescriptorFactory.createDeleteDescriptor(project, description, comment.asString(), arguments, flags); arguments.put(ATTRIBUTE_DELETE_SUBPACKAGES, Boolean.valueOf(fDeleteSubPackages).toString()); arguments.put(ATTRIBUTE_SUGGEST_ACCESSORS, Boolean.valueOf(fSuggestGetterSetterDeletion).toString()); arguments.put(ATTRIBUTE_RESOURCES, new Integer(fResources.length).toString()); for (int offset= 0; offset < fResources.length; offset++) arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_ELEMENT + (offset + 1), JavaRefactoringDescriptorUtil.resourceToHandle(project, fResources[offset])); arguments.put(ATTRIBUTE_ELEMENTS, new Integer(fJavaElements.length).toString()); for (int offset= 0; offset < fJavaElements.length; offset++) arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_ELEMENT + (offset + fResources.length + 1), JavaRefactoringDescriptorUtil.elementToHandle(project, fJavaElements[offset])); return new DynamicValidationRefactoringChange(descriptor, RefactoringCoreMessages.DeleteRefactoring_7, new Change[] { fDeleteChange}); } finally { monitor.done(); } }
public static DeleteDescriptor createDeleteDescriptor() { return new DeleteDescriptor(); }
public static DeleteDescriptor createDeleteDescriptor( String project, String description, String comment, Map arguments, int flags) { return new DeleteDescriptor(project, description, comment, arguments, flags); }