use of org.eclipse.ltk.core.refactoring.PerformChangeOperation in project che by eclipse.
the class RefactoringSession method apply.
/**
* @return instance of {@link org.eclipse.che.ide.ext.java.shared.dto.refactoring.RefactoringStatus}.
* That describes status of the refactoring operation.
*/
public RefactoringResult apply() {
PerformChangeOperation operation = new PerformChangeOperation(change);
FinishResult result = internalPerformFinish(operation);
if (result.isException()) {
return DtoConverter.toRefactoringResultDto(RefactoringStatus.createErrorStatus("Refactoring failed with Exception."));
}
CompositeChange operationChange = (CompositeChange) operation.getUndoChange();
Change[] changes = operationChange.getChildren();
RefactoringStatus validationStatus = operation.getValidationStatus();
if (validationStatus != null) {
List<ChangeInfo> changesInfo = new ArrayList<>();
prepareChangesInfo(changes, changesInfo);
RefactoringResult status = DtoConverter.toRefactoringResultDto(validationStatus);
status.setChanges(changesInfo);
return status;
}
return DtoConverter.toRefactoringResultDto(new RefactoringStatus());
}
Aggregations