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:
+28
-12
@@ -75,6 +75,24 @@ public final class DesignerApplication extends Application {
|
||||
}
|
||||
}
|
||||
|
||||
private CompletableFuture<Void> navigate(
|
||||
de.neitzel.fxdesigner.host.HostServices.Location location, boolean source) {
|
||||
var result = new CompletableFuture<Void>();
|
||||
javafx.application.Platform.runLater(
|
||||
() -> {
|
||||
try {
|
||||
Path file = Path.of(location.document()).toRealPath();
|
||||
open(new Stage(), file);
|
||||
if (source)
|
||||
((DesignerPane) editors.get(file).getScene().getRoot()).showSource(location.offset());
|
||||
result.complete(null);
|
||||
} catch (Exception e) {
|
||||
result.completeExceptionally(e);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
private void open(Stage stage, Path file) throws Exception {
|
||||
Path identity = file.toRealPath();
|
||||
var existing = editors.get(identity);
|
||||
@@ -88,18 +106,16 @@ public final class DesignerApplication extends Application {
|
||||
host =
|
||||
new StandaloneHost(
|
||||
launch.runtimes(),
|
||||
location -> {
|
||||
var future = new CompletableFuture<Void>();
|
||||
javafx.application.Platform.runLater(
|
||||
() -> {
|
||||
try {
|
||||
open(new Stage(), Path.of(location.document()));
|
||||
future.complete(null);
|
||||
} catch (Exception e) {
|
||||
future.completeExceptionally(e);
|
||||
}
|
||||
});
|
||||
return future;
|
||||
new de.neitzel.fxdesigner.host.HostServices.Navigation() {
|
||||
public java.util.concurrent.CompletionStage<Void> open(
|
||||
de.neitzel.fxdesigner.host.HostServices.Location location) {
|
||||
return navigate(location, false);
|
||||
}
|
||||
|
||||
public java.util.concurrent.CompletionStage<Void> openSource(
|
||||
de.neitzel.fxdesigner.host.HostServices.Location location) {
|
||||
return navigate(location, true);
|
||||
}
|
||||
},
|
||||
d -> System.err.println(d.message()));
|
||||
var pane = new DesignerPane(host.services(), launch, file);
|
||||
|
||||
Reference in New Issue
Block a user