Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce UI thread for open(...) call #612

Merged
merged 1 commit into from
Apr 18, 2023
Merged
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
7 changes: 6 additions & 1 deletion org.eclipse.lsp4e/src/org/eclipse/lsp4e/LSPEclipseUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
import org.eclipse.mylyn.wikitext.parser.MarkupParser;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.RGBA;
import org.eclipse.swt.widgets.Display;
import org.eclipse.text.edits.MalformedTreeException;
import org.eclipse.text.edits.MultiTextEdit;
import org.eclipse.text.edits.ReplaceEdit;
Expand Down Expand Up @@ -865,7 +866,11 @@ public static void applyWorkspaceEdit(WorkspaceEdit wsEdit, String label) {
// Select the only start position of the range or the document start
Range range = changedURIs.get(uri);
Position start = range.getStart() != null ? range.getStart() : new Position(0, 0);
open(uri.toString(), new Range( start, start));
if (Display.getCurrent() != null) {
open(uri.toString(), new Range(start, start));
} else {
UI.getDisplay().asyncExec(() -> open(uri.toString(), new Range(start, start)));
}
});
}
} catch (CoreException e) {
Expand Down