Publish shared FXML diagnostics and integrate IntelliJ Problems
Navigate authoritative FXML locations, withdraw stale results and preserve host Undo/Redo. Include editor ownership in native problem identity so equal diagnostics from separate owners survive independent cleanup. Qualify both hosts automatically.
This commit is contained in:
@@ -22,6 +22,7 @@ public final class IntellijHost implements AutoCloseable {
|
||||
Project project, HostServices.Runtimes runtimes, HostServices.Diagnostics diagnostics) {
|
||||
var docs = scope.own(new IntellijDocuments(project));
|
||||
var builds = new ProcessBuilds();
|
||||
var problems = scope.own(new IntellijDiagnostics(project, diagnostics));
|
||||
services =
|
||||
new HostServices(
|
||||
docs,
|
||||
@@ -62,6 +63,33 @@ public final class IntellijHost implements AutoCloseable {
|
||||
}));
|
||||
}
|
||||
|
||||
public CompletionStage<Void> openSource(HostServices.Location location) {
|
||||
var result = new CompletableFuture<Void>();
|
||||
ApplicationManager.getApplication()
|
||||
.invokeLater(
|
||||
() ->
|
||||
WriteIntentReadAction.run(
|
||||
() -> {
|
||||
try {
|
||||
if (project.isDisposed())
|
||||
throw new IllegalStateException("Project disposed");
|
||||
var file =
|
||||
LocalFileSystem.getInstance()
|
||||
.refreshAndFindFileByNioFile(
|
||||
Path.of(location.document()));
|
||||
if (file == null)
|
||||
throw new IllegalArgumentException(
|
||||
"Navigation file unavailable");
|
||||
new OpenFileDescriptor(project, file, location.offset())
|
||||
.navigate(true);
|
||||
result.complete(null);
|
||||
} catch (Throwable e) {
|
||||
result.completeExceptionally(e);
|
||||
}
|
||||
}));
|
||||
return result;
|
||||
}
|
||||
|
||||
public CompletionStage<Void> open(HostServices.Location location) {
|
||||
var result = new CompletableFuture<Void>();
|
||||
ApplicationManager.getApplication()
|
||||
@@ -107,7 +135,7 @@ public final class IntellijHost implements AutoCloseable {
|
||||
return result;
|
||||
}
|
||||
},
|
||||
diagnostics,
|
||||
problems,
|
||||
scope);
|
||||
Disposer.register(project, this::close);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user