Search in sources :

Example 6 with RefactoringPreview

use of org.eclipse.che.ide.ext.java.shared.dto.refactoring.RefactoringPreview 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

RefactoringPreview (org.eclipse.che.ide.ext.java.shared.dto.refactoring.RefactoringPreview)6 ICompilationUnit (org.eclipse.jdt.core.ICompilationUnit)3 IType (org.eclipse.jdt.core.IType)3 Test (org.junit.Test)3 TreeItem (com.google.gwt.user.client.ui.TreeItem)2 ChangePreview (org.eclipse.che.ide.ext.java.shared.dto.refactoring.ChangePreview)2 MoveSettings (org.eclipse.che.ide.ext.java.shared.dto.refactoring.MoveSettings)2 RefactoringChange (org.eclipse.che.ide.ext.java.shared.dto.refactoring.RefactoringChange)2 ReorgDestination (org.eclipse.che.ide.ext.java.shared.dto.refactoring.ReorgDestination)2 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 CheckBox (com.google.gwt.user.client.ui.CheckBox)1 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)1 Label (com.google.gwt.user.client.ui.Label)1 Tree (com.google.gwt.user.client.ui.Tree)1 SelectionChangeEvent (com.google.gwt.view.client.SelectionChangeEvent)1 SingleSelectionModel (com.google.gwt.view.client.SingleSelectionModel)1 ArrayList (java.util.ArrayList)1 RefactoringStatus (org.eclipse.che.ide.ext.java.shared.dto.refactoring.RefactoringStatus)1 RenameRefactoringSession (org.eclipse.che.ide.ext.java.shared.dto.refactoring.RenameRefactoringSession)1