Search in sources :

Example 6 with ReorgDestination

use of org.eclipse.che.ide.ext.java.shared.dto.refactoring.ReorgDestination in project che by eclipse.

the class MoveRefactoringSessionTest method testGetMoveChanges.

@Test
public void testGetMoveChanges() throws Exception {
    IType type = fProject.findType("p.A");
    ICompilationUnit unit = type.getCompilationUnit();
    String sessionId = manager.createMoveRefactoringSession(new IJavaElement[] { unit });
    ReorgDestination destination = new DtoServerImpls.ReorgDestinationImpl();
    destination.setSessionId(sessionId);
    destination.setProjectPath(RefactoringTestSetup.getProject().getPath().toOSString());
    destination.setDestination(p1.getPath().toOSString());
    destination.setType(ReorgDestination.DestinationType.PACKAGE);
    manager.setRefactoringDestination(destination);
    MoveSettings settings = new DtoServerImpls.MoveSettingsImpl();
    settings.setUpdateReferences(true);
    settings.setSessionId(sessionId);
    manager.setMoveSettings(settings);
    manager.createChange(sessionId);
    RefactoringPreview change = manager.getRefactoringPreview(sessionId);
    assertThat(change).isNotNull();
    assertThat(change.getText()).isEqualTo("Move");
    assertThat(change.getChildrens()).isNotNull().hasSize(2);
}
Also used : ICompilationUnit(org.eclipse.jdt.core.ICompilationUnit) ReorgDestination(org.eclipse.che.ide.ext.java.shared.dto.refactoring.ReorgDestination) MoveSettings(org.eclipse.che.ide.ext.java.shared.dto.refactoring.MoveSettings) RefactoringPreview(org.eclipse.che.ide.ext.java.shared.dto.refactoring.RefactoringPreview) IType(org.eclipse.jdt.core.IType) Test(org.junit.Test)

Aggregations

ReorgDestination (org.eclipse.che.ide.ext.java.shared.dto.refactoring.ReorgDestination)6 ICompilationUnit (org.eclipse.jdt.core.ICompilationUnit)5 IType (org.eclipse.jdt.core.IType)5 Test (org.junit.Test)5 MoveSettings (org.eclipse.che.ide.ext.java.shared.dto.refactoring.MoveSettings)4 RefactoringStatus (org.eclipse.che.ide.ext.java.shared.dto.refactoring.RefactoringStatus)3 RefactoringPreview (org.eclipse.che.ide.ext.java.shared.dto.refactoring.RefactoringPreview)2 OperationException (org.eclipse.che.api.promises.client.OperationException)1 ChangeCreationResult (org.eclipse.che.ide.ext.java.shared.dto.refactoring.ChangeCreationResult)1 ChangePreview (org.eclipse.che.ide.ext.java.shared.dto.refactoring.ChangePreview)1 RefactoringChange (org.eclipse.che.ide.ext.java.shared.dto.refactoring.RefactoringChange)1