Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void testExternalFile(@TempDir Path tempDir) throws CoreException, IOExce

MockLanguageServer.INSTANCE.setDocumentSymbols(symbolCow);

final var editor = (ITextEditor) TestUtils.openExternalFileInEditor(testFile.toFile());
final var editor = (ITextEditor) TestUtils.openExternalFileInEditor(testFile);

final var outlinePage = (CNFOutlinePage) new EditorToOutlineAdapterFactory().getAdapter(editor, IContentOutlinePage.class);
final var shell = new Shell(editor.getEditorSite().getWorkbenchWindow().getShell());
Expand Down Expand Up @@ -90,7 +90,7 @@ public void testExternalFileOpenedOnFileStore(@TempDir Path tempDir) throws Core

MockLanguageServer.INSTANCE.setDocumentSymbols(symbolCow);

final var editor = (ITextEditor) TestUtils.openExternalFileOnFileStore(testFile.toFile());
final var editor = (ITextEditor) TestUtils.openExternalFileOnFileStore(testFile);

final var outlinePage = (CNFOutlinePage) new EditorToOutlineAdapterFactory().getAdapter(editor, IContentOutlinePage.class);
final var shell = new Shell(editor.getEditorSite().getWorkbenchWindow().getShell());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void testDocumentURIAbsolutePathForExternalFile(@TempDir Path tempDir) th
var tempFile = Files.writeString(tempDir.resolve("externalTest.lspt"), "external file content for testing absolute paths");

// Open the external file in an editor
var editor = (ITextEditor) TestUtils.openExternalFileInEditor(tempFile.toFile());
var editor = (ITextEditor) TestUtils.openExternalFileInEditor(tempFile);
var document = LSPEclipseUtils.getDocument(editor);

// Create OutlineViewerInput and verify documentURI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
Expand Down Expand Up @@ -101,20 +100,20 @@ public static List<IEditorReference> splitActiveEditor() {
return List.of(page.getEditorReferences());
}

public static IEditorPart openExternalFileInEditor(File file) throws PartInitException {
public static IEditorPart openExternalFileInEditor(Path file) throws PartInitException {
IWorkbenchWindow workbenchWindow = UI.getActiveWindow();
IWorkbenchPage page = workbenchWindow.getActivePage();
IEditorPart part = IDE.openEditor(page, file.toURI(), "org.eclipse.ui.genericeditor.GenericEditor", false);
IEditorPart part = IDE.openEditor(page, file.toUri(), "org.eclipse.ui.genericeditor.GenericEditor", false);
if (part != null) {
part.setFocus();
}
return part;
}

public static IEditorPart openExternalFileOnFileStore(File file) throws PartInitException {
public static IEditorPart openExternalFileOnFileStore(Path file) throws PartInitException {
IWorkbenchWindow workbenchWindow = UI.getActiveWindow();
IWorkbenchPage page = workbenchWindow.getActivePage();
IFileStore fileStore = EFS.getLocalFileSystem().getStore(file.toURI());
IFileStore fileStore = EFS.getLocalFileSystem().getStore(file.toUri());
IEditorPart part = IDE.openEditorOnFileStore(page, fileStore);
if (part != null) {
part.setFocus();
Expand Down