Search in sources :

Example 11 with RenameFile

use of org.eclipse.lsp4j.RenameFile in project eclipse.jdt.ls by eclipse.

the class ReorgQuickFixTest method assertRenameFileOperation.

private void assertRenameFileOperation(Either<Command, CodeAction> codeAction, String newUri) {
    WorkspaceEdit edit = getWorkspaceEdit(codeAction);
    List<Either<TextDocumentEdit, ResourceOperation>> documentChanges = edit.getDocumentChanges();
    assertNotNull(documentChanges);
    assertEquals(1, documentChanges.size());
    ResourceOperation resourceOperation = documentChanges.get(0).getRight();
    assertNotNull(resourceOperation);
    assertTrue(resourceOperation instanceof RenameFile);
    assertEquals(newUri, ((RenameFile) resourceOperation).getNewUri());
}
Also used : Either(org.eclipse.lsp4j.jsonrpc.messages.Either) WorkspaceEdit(org.eclipse.lsp4j.WorkspaceEdit) RenameFile(org.eclipse.lsp4j.RenameFile) ResourceOperation(org.eclipse.lsp4j.ResourceOperation)

Aggregations

RenameFile (org.eclipse.lsp4j.RenameFile)11 ICompilationUnit (org.eclipse.jdt.core.ICompilationUnit)9 IPackageFragment (org.eclipse.jdt.core.IPackageFragment)8 AbstractProjectsManagerBasedTest (org.eclipse.jdt.ls.core.internal.managers.AbstractProjectsManagerBasedTest)7 Test (org.junit.Test)7 WorkspaceEdit (org.eclipse.lsp4j.WorkspaceEdit)6 Either (org.eclipse.lsp4j.jsonrpc.messages.Either)6 TextDocumentEdit (org.eclipse.lsp4j.TextDocumentEdit)5 TextEdit (org.eclipse.lsp4j.TextEdit)5 ResourceOperation (org.eclipse.lsp4j.ResourceOperation)4 ArrayList (java.util.ArrayList)3 IPath (org.eclipse.core.runtime.IPath)3 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)3 Position (org.eclipse.lsp4j.Position)3 LinkedList (java.util.LinkedList)2 RenameCompilationUnitChange (org.eclipse.jdt.ls.core.internal.corext.refactoring.changes.RenameCompilationUnitChange)2 RefactorWorkspaceEdit (org.eclipse.jdt.ls.core.internal.handlers.GetRefactorEditHandler.RefactorWorkspaceEdit)2 MoveParams (org.eclipse.jdt.ls.core.internal.handlers.MoveHandler.MoveParams)2 CreateFile (org.eclipse.lsp4j.CreateFile)2 Path (org.eclipse.core.runtime.Path)1