I got a question related to my emails on opening the inspector:
I am struggling to select(focus on) the new added node inside the inspector. I read your article about opening the inspector, but I could not find one on this behavior.
editorContext.select(newNode)
ornewNode.select[in: editorContext]
did not work.
Both of the mentioned methods would work, but the problem is that the editorContext
above is probably associated with
the main editor, not the inspector. To obtain the editor context of the inspector, you can use the following code:
InspectorTool inspectorTool = mpsProject.getComponent(InspectorTool.class);
EditorComponent inspector = inspectorTool.getInspector();
EditorContext inspectorContext = inspector.getEditorContext();
And then you can use inspectorContext
in a node.select[...]
expression. You would probably also want to focus on the
inspector. To do that, you can call inspectorTool.activate()
.
The only remaining problem is where to get the mpsProject
and I have covered this previously.