use of org.eclipse.che.ide.ext.java.shared.dto.refactoring.RefactoringStatus in project che by eclipse.
the class MoveRefactoringSessionTest method testSetMoveDestination.
@Test
public void testSetMoveDestination() 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);
RefactoringStatus status = manager.setRefactoringDestination(destination);
assertThat(status).isNotNull();
assertThat(status.getSeverity()).isEqualTo(RefactoringStatus.OK);
}
use of org.eclipse.che.ide.ext.java.shared.dto.refactoring.RefactoringStatus in project che by eclipse.
the class MoveRefactoringSessionTest method testApplyMove.
@Test
public void testApplyMove() 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);
RefactoringStatus status = manager.applyRefactoring(sessionId);
assertThat(status).isNotNull();
assertThat(status.getSeverity()).isEqualTo(RefactoringStatus.OK);
IType movedType = fProject.findType("p1.A");
assertThat(movedType).isNotNull();
assertThat(movedType.exists()).isTrue();
}
Aggregations