Search in sources :

Example 1 with UndoTextFileChange

use of org.eclipse.ltk.core.refactoring.UndoTextFileChange in project che by eclipse.

the class RefactoringSession method prepareChangesInfo.

/**
     * Prepare the information about changes which were applied.
     *
     * @param changes array of the applied changes
     * @param changesInfo prepared list of {@link ChangeInfo}
     */
public void prepareChangesInfo(Change[] changes, List<ChangeInfo> changesInfo) {
    for (Change ch : changes) {
        if (ch instanceof DynamicValidationStateChange) {
            prepareChangesInfo(((DynamicValidationStateChange) ch).getChildren(), changesInfo);
        } else {
            ChangeInfo changeInfo = DtoFactory.newDto(ChangeInfo.class);
            String refactoringName = ch.getName();
            if (ch instanceof UndoTextFileChange) {
                changeInfo.setName(ChangeInfo.ChangeName.UPDATE);
                changeInfo.setPath(((CompilationUnit) ch.getModifiedElement()).getPath().toString());
            }
            if (refactoringName.startsWith("Rename")) {
                if (ch instanceof RenameCompilationUnitChange) {
                    prepareRenameCompilationUnitChange(changeInfo, ch);
                } else if (ch instanceof RenamePackageChange) {
                    prepareRenamePackageChange(changesInfo, changeInfo, ch);
                }
            }
            if (refactoringName.startsWith("Move")) {
                prepareMoveChange(changeInfo, ch);
            }
            changesInfo.add(changeInfo);
        }
    }
}
Also used : CompilationUnit(org.eclipse.jdt.internal.core.CompilationUnit) ChangeInfo(org.eclipse.che.ide.ext.java.shared.dto.refactoring.ChangeInfo) RenamePackageChange(org.eclipse.jdt.internal.corext.refactoring.changes.RenamePackageChange) CompositeChange(org.eclipse.ltk.core.refactoring.CompositeChange) MoveCompilationUnitChange(org.eclipse.jdt.internal.corext.refactoring.changes.MoveCompilationUnitChange) UndoTextFileChange(org.eclipse.ltk.core.refactoring.UndoTextFileChange) Change(org.eclipse.ltk.core.refactoring.Change) DynamicValidationStateChange(org.eclipse.jdt.internal.corext.refactoring.changes.DynamicValidationStateChange) RenameCompilationUnitChange(org.eclipse.jdt.internal.corext.refactoring.changes.RenameCompilationUnitChange) RenamePackageChange(org.eclipse.jdt.internal.corext.refactoring.changes.RenamePackageChange) UndoTextFileChange(org.eclipse.ltk.core.refactoring.UndoTextFileChange) DynamicValidationStateChange(org.eclipse.jdt.internal.corext.refactoring.changes.DynamicValidationStateChange) RenameCompilationUnitChange(org.eclipse.jdt.internal.corext.refactoring.changes.RenameCompilationUnitChange)

Aggregations

ChangeInfo (org.eclipse.che.ide.ext.java.shared.dto.refactoring.ChangeInfo)1 CompilationUnit (org.eclipse.jdt.internal.core.CompilationUnit)1 DynamicValidationStateChange (org.eclipse.jdt.internal.corext.refactoring.changes.DynamicValidationStateChange)1 MoveCompilationUnitChange (org.eclipse.jdt.internal.corext.refactoring.changes.MoveCompilationUnitChange)1 RenameCompilationUnitChange (org.eclipse.jdt.internal.corext.refactoring.changes.RenameCompilationUnitChange)1 RenamePackageChange (org.eclipse.jdt.internal.corext.refactoring.changes.RenamePackageChange)1 Change (org.eclipse.ltk.core.refactoring.Change)1 CompositeChange (org.eclipse.ltk.core.refactoring.CompositeChange)1 UndoTextFileChange (org.eclipse.ltk.core.refactoring.UndoTextFileChange)1