Edit form controls and render localized application previews in the IntelliJ designer
This commit is contained in:
@@ -60,6 +60,26 @@ public final class WorkflowProbe implements StartupActivity.DumbAware {
|
||||
return null;
|
||||
}
|
||||
|
||||
static DesignerPane openDesigner(Project project, VirtualFile file) throws Exception {
|
||||
var editor =
|
||||
edt(
|
||||
() -> {
|
||||
var manager = FileEditorManager.getInstance(project);
|
||||
var all = manager.openFile(file, true);
|
||||
manager.setSelectedEditor(file, "neitzel-fx-designer");
|
||||
return java.util.Arrays.stream(all)
|
||||
.filter(e -> e.getName().equals("Neitzel Designer"))
|
||||
.findFirst()
|
||||
.orElseThrow();
|
||||
});
|
||||
await(() -> edt(() -> bridge(editor.getComponent()) != null));
|
||||
var panel = edt(() -> bridge(editor.getComponent()));
|
||||
await(() -> fx(() -> panel.getScene() != null));
|
||||
var pane = fx(() -> (DesignerPane) panel.getScene().getRoot());
|
||||
await(() -> fx(() -> pane.kit().editor().getFxomDocument() != null));
|
||||
return pane;
|
||||
}
|
||||
|
||||
static void await(Callable<Boolean> condition) throws Exception {
|
||||
long until = System.nanoTime() + TimeUnit.SECONDS.toNanos(120);
|
||||
while (System.nanoTime() < until) {
|
||||
|
||||
Reference in New Issue
Block a user