Getting the editor for a root node from the list of opened editors

1. Consider i have a node(root node - concept instance can be root)

2. I got the opened editors in current project using the code below.

FileEditorManager fileEditorManager = FileEditorManager.getInstance(ideaProject);
sequence<MPSFileNodeEditor> editors = fileEditorManager.getAllEditors().asSequence.ofType<MPSFileNodeEditor>;

 

3. Is there a way to get the editor corresponding to my root node from the list of available editors?

0
3 comments

Okay. Currently am doing it like 


FileEditorManager fileEditorManager = FileEditorManager.getInstance(ideaProject);
sequence<MPSFileNodeEditor> editors = fileEditorManager.getAllEditors().asSequence.ofType<MPSFileNodeEditor>;
sequence<Editor> seq = editors.select({~it => it.getNodeEditor(); });
Editor editor = seq.findFirst({~it => it.getEditorContext().getEditorComponent().getEditedNode() :eq: myNode; });

 

0

Hello,

Can this help you?

EditorComponentUtil.findComponentForNode(snode, FileEditorManager.getInstance(project));

 

Regards,

Sérgio Ribeiro
Porto - Portugal

 

1

Thank you Sérgio. The solution you gave is working fine.
I have a very basic doubt. I understand the meaning of Editor, Editor_Cell, and EditorCell_Collection.
Can you explain the exact meaning of "EditorContext" and "EditorComponent"?

0

Please sign in to leave a comment.