Skip to content
Merged
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 @@ -40,13 +40,10 @@
import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.texteditor.ITextEditor;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

public class FormatHandlerReadOnlyTest extends AbstractTestWithProject {

@Test
@DisabledOnOs(value = OS.LINUX, architectures = "aarch64", disabledReason = "Test fails consistently on Ubuntu 24.04 (ARM)")
public void testFormatOnReadOnlyFileAndMakeWritable() throws Exception {
// Mock formatting to prepend "//" at the start of each line
var edits = List.of( //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public void testIntroUrlLink() throws Exception {

waitForAndAssertCondition(5_000, () -> LSPEclipseUtils.getTextViewer(editorPart) != null);
ITextViewer viewer = LSPEclipseUtils.getTextViewer(editorPart);
assertEquals(UI.getActivePart(), editorPart);
assertEquals(editorPart, UI.getActivePart());

@Nullable IRegion hoverRegion = hover.getHoverRegion(viewer, 0);
String hoverContent = hover.getHoverInfoFuture(viewer, hoverRegion).get(2, TimeUnit.SECONDS);
Expand Down Expand Up @@ -220,7 +220,7 @@ public void testIntroUrlLink() throws Exception {
@Override
public void completed(ProgressEvent event) {
browser.removeProgressListener(this);
assertEquals(UI.getActivePart(), editorPart);
assertEquals(editorPart, UI.getActivePart());
browser.execute("document.getElementsByTagName('a')[0].click()");
completed.set(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,7 @@ public static IEditorPart openEditor(IFile file) throws PartInitException {
IWorkbenchPage page = workbenchWindow.getActivePage();
final var input = new FileEditorInput(file);

IEditorPart part = page.openEditor(input, "org.eclipse.ui.genericeditor.GenericEditor", false);
if (part != null) {
part.setFocus();
}
IEditorPart part = page.openEditor(input, "org.eclipse.ui.genericeditor.GenericEditor", true);
return part;
}

Expand All @@ -103,10 +100,7 @@ public static List<IEditorReference> splitActiveEditor() {
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);
if (part != null) {
part.setFocus();
}
IEditorPart part = IDE.openEditor(page, file.toUri(), "org.eclipse.ui.genericeditor.GenericEditor", true);
return part;
}

Expand All @@ -115,8 +109,8 @@ public static IEditorPart openExternalFileOnFileStore(Path file) throws PartInit
IWorkbenchPage page = workbenchWindow.getActivePage();
IFileStore fileStore = EFS.getLocalFileSystem().getStore(file.toUri());
IEditorPart part = IDE.openEditorOnFileStore(page, fileStore);
if (part != null) {
part.setFocus();
if (page != null && part != null) {
page.activate(part);
}
return part;
}
Expand Down
Loading