use of org.eclipse.jdt.internal.corext.refactoring.changes.DynamicValidationRefactoringChange in project che by eclipse.
the class RenameTypeParameterProcessor method createChange.
@Override
public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
Assert.isNotNull(monitor);
try {
Change change = fChange;
if (change != null) {
String project = null;
IJavaProject javaProject = fTypeParameter.getJavaProject();
if (javaProject != null)
project = javaProject.getElementName();
String description = Messages.format(RefactoringCoreMessages.RenameTypeParameterProcessor_descriptor_description_short, BasicElementLabels.getJavaElementName(fTypeParameter.getElementName()));
String header = Messages.format(RefactoringCoreMessages.RenameTypeParameterProcessor_descriptor_description, new String[] { BasicElementLabels.getJavaElementName(fTypeParameter.getElementName()), JavaElementLabels.getElementLabel(fTypeParameter.getDeclaringMember(), JavaElementLabels.ALL_FULLY_QUALIFIED), BasicElementLabels.getJavaElementName(getNewElementName()) });
String comment = new JDTRefactoringDescriptorComment(project, this, header).asString();
RenameJavaElementDescriptor descriptor = RefactoringSignatureDescriptorFactory.createRenameJavaElementDescriptor(IJavaRefactorings.RENAME_TYPE_PARAMETER);
descriptor.setProject(project);
descriptor.setDescription(description);
descriptor.setComment(comment);
descriptor.setFlags(RefactoringDescriptor.NONE);
descriptor.setJavaElement(fTypeParameter);
descriptor.setNewName(getNewElementName());
descriptor.setUpdateReferences(fUpdateReferences);
change = new DynamicValidationRefactoringChange(descriptor, RefactoringCoreMessages.RenameTypeParameterProcessor_change_name, new Change[] { change });
}
return change;
} finally {
fChange = null;
monitor.done();
}
}
use of org.eclipse.jdt.internal.corext.refactoring.changes.DynamicValidationRefactoringChange in project che by eclipse.
the class ReplaceInvocationsRefactoring method createChange.
@Override
public Change createChange(IProgressMonitor pm) throws CoreException {
// TODO: update for fSelectionStart == -1
final Map<String, String> arguments = new HashMap<String, String>();
String project = null;
IJavaProject javaProject = fSelectionTypeRoot.getJavaProject();
if (javaProject != null)
project = javaProject.getElementName();
final IMethodBinding binding = fSourceProvider.getDeclaration().resolveBinding();
int flags = RefactoringDescriptor.STRUCTURAL_CHANGE | JavaRefactoringDescriptor.JAR_REFACTORING | JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
if (!Modifier.isPrivate(binding.getModifiers()))
flags |= RefactoringDescriptor.MULTI_CHANGE;
final String description = Messages.format(RefactoringCoreMessages.ReplaceInvocationsRefactoring_descriptor_description_short, BasicElementLabels.getJavaElementName(binding.getName()));
final String header = Messages.format(RefactoringCoreMessages.ReplaceInvocationsRefactoring_descriptor_description, new String[] { BindingLabelProvider.getBindingLabel(binding, JavaElementLabels.ALL_FULLY_QUALIFIED), BindingLabelProvider.getBindingLabel(binding.getDeclaringClass(), JavaElementLabels.ALL_FULLY_QUALIFIED) });
final JDTRefactoringDescriptorComment comment = new JDTRefactoringDescriptorComment(project, this, header);
comment.addSetting(Messages.format(RefactoringCoreMessages.ReplaceInvocationsRefactoring_original_pattern, BindingLabelProvider.getBindingLabel(binding, JavaElementLabels.ALL_FULLY_QUALIFIED)));
if (!fTargetProvider.isSingle())
comment.addSetting(RefactoringCoreMessages.ReplaceInvocationsRefactoring_replace_references);
//REVIEW Unregistered ID!
final JavaRefactoringDescriptor descriptor = new JavaRefactoringDescriptor(ID_REPLACE_INVOCATIONS, project, description, comment.asString(), arguments, flags) {
};
arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT, JavaRefactoringDescriptorUtil.elementToHandle(project, fSelectionTypeRoot));
//$NON-NLS-1$
arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_SELECTION, new Integer(fSelectionStart).toString() + " " + new Integer(fSelectionLength).toString());
arguments.put(ATTRIBUTE_MODE, new Integer(fTargetProvider.isSingle() ? 0 : 1).toString());
return new DynamicValidationRefactoringChange(descriptor, RefactoringCoreMessages.ReplaceInvocationsRefactoring_change_name, fChangeManager.getAllChanges());
}
Aggregations