use of org.eclipse.ltk.core.refactoring.CompositeChange in project webtools.sourceediting by eclipse.
the class JSPRenameParticipant method createChange.
/**
* @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#createChange(
* org.eclipse.core.runtime.IProgressMonitor)
*/
public Change createChange(IProgressMonitor pm) throws CoreException {
// $NON-NLS-1$
this.getTextChange("");
// create one multi change to contain all new created changes
CompositeChange multiChange = new CompositeChange(JSPUIMessages.JSP_changes);
// for each element get the changes for it and add it to the multi change
Iterator iter = fElementAndArgumentPairs.values().iterator();
while (iter.hasNext()) {
ElementAndArgumentsPair elemArgsPair = (ElementAndArgumentsPair) iter.next();
Change[] changes = createChangesFor(elemArgsPair.fElement, elemArgsPair.fArgs.getNewName(), pm);
/* add all new text changes to the local list of text changes so that
* future iterations through the while loop will be aware of already
* existing changes
*/
for (int i = 0; i < changes.length; ++i) {
if (changes[i] instanceof TextChange) {
fLocalTextChanges.put(((TextChange) changes[i]).getModifiedElement(), changes[i]);
}
}
if (changes.length > 0) {
multiChange.addAll(changes);
}
}
// unless there are actually new changes return null
Change result = null;
if (multiChange.getChildren().length > 0) {
result = multiChange;
}
return result;
}
use of org.eclipse.ltk.core.refactoring.CompositeChange in project webtools.sourceediting by eclipse.
the class JSPMethodRenameParticipant method createChange.
/*
* (non-Javadoc)
*
* @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#createChange(org.eclipse.core.runtime.IProgressMonitor)
*/
public Change createChange(IProgressMonitor pm) throws CoreException {
Change[] changes = JSPMethodRenameChange.createChangesFor(this.fMethod, getArguments().getNewName());
CompositeChange multiChange = null;
if (changes.length > 0) {
multiChange = new CompositeChange(JsUIMessages.JSP_changes, changes);
}
return multiChange;
}
use of org.eclipse.ltk.core.refactoring.CompositeChange in project webtools.sourceediting by eclipse.
the class JSPTypeRenameParticipant method createChange.
/**
* @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#createChange(org.eclipse.core.runtime.IProgressMonitor)
*/
public Change createChange(IProgressMonitor pm) throws CoreException {
Change[] changes = JSPTypeRenameChange.createChangesFor(fType, getArguments().getNewName());
CompositeChange multiChange = null;
if (changes.length > 0) {
multiChange = new CompositeChange(JsUIMessages.JSP_changes, changes);
}
return multiChange;
}
use of org.eclipse.ltk.core.refactoring.CompositeChange in project webtools.sourceediting by eclipse.
the class JSPPackageRenameParticipant method createChange.
/**
* @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#createChange(org.eclipse.core.runtime.IProgressMonitor)
*/
public Change createChange(IProgressMonitor pm) throws CoreException {
Change[] changes = JSPPackageRenameChange.createChangesFor(this.fPkg, getArguments().getNewName());
CompositeChange multiChange = null;
if (changes.length > 0) {
multiChange = new CompositeChange(JsUIMessages.JSP_changes, changes);
}
return multiChange;
}
use of org.eclipse.ltk.core.refactoring.CompositeChange in project webtools.sourceediting by eclipse.
the class RenameComponentProcessor method postCreateChange.
public Change postCreateChange(Change[] participantChanges, IProgressMonitor pm) throws CoreException, OperationCanceledException {
Assert.isNotNull(pm);
try {
String changeName = RefactoringMessages.getString("RenameComponentProcessor.Component_Refactoring_updates");
TextChange[] changes = changeManager.getAllChanges();
// };
if (changes.length > 0) {
// Arrays.sort(changes, c);
CompositeChange compositeChange = new CompositeChange("!" + changeName, changes);
compositeChange.markAsSynthetic();
return compositeChange;
} else {
return null;
}
} finally {
pm.done();
}
}
Aggregations