[menu contributions] openEditor & cursor position


I'm trying to add a menu contribution, say for instance to give the subclasses of a class in "Context Actions". When i click on a subclass, i want it to be opened in the editor. How can i have the cursor positioned at the name of the class which is opened and not where it last was when the class was opened?

So far, i've created a <code>default transformation menu for concept X</code> and in the <code>execute</code> part i have:

final EditorPanelManager editorPanelManager = editorContext.getEditorPanelManager();
if (editorPanelManager != null) {

I understood i could use <code>EditorComponent#selectNode</code> but what i don't know is how to get a "pointer" to the component... <code>openEditor</code> returns void... 





what's the formatting we could use to put code in a post?

Comment actions Permalink

Untested, but give it a try:

execute (editorContext, node, model, pattern)->void { 
Project project = ProjectHelper.getProject(editorContext.getRepository());
node<INamedConcept> root = new node<YourRootThatImplementsINamedConcept>();
model.add root(root);
Editor editor = NavigationSupport.getInstance().openNode(project, root, true, true);
EditorContext editorContext = editor.getEditorContext();
root.select[in: editorContext, cell: {name}];

To answer your second question: I usualy paste in my code or write it manually, select it and then select "Code" as formatting by means of the little Pilcrow-Button to the top left:

Comment actions Permalink

Thank you Robert, i had something working by adapting your suggestion. 

As for formatting, the hover-text for Pilcrow-Button says "paragraph styles" so i didn't even click on it, not expecting that it would hide code formatting :) (one might want to have also inline code...) 


Please sign in to leave a comment.