Programmatically bring up code completion menu.

I'd like to bring up the default code completion menu (also called transformation menu?) for a reference editor cell when a user clicks a button (a JComponent editor cell).

I was able to clear the cell, and move focus to the cell, but can't figure out how to bring up the code completion menu.

This is what I have inside the JComponent:

component provider: (node, editorContext)->JComponent { 
JButton btn = new JButton("Edit");
btn.setPreferredSize(new Dimension(40, 20));
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent p0) {
editorContext.getRepository().getModelAccess().executeCommand({ => node.someRef = null; });
editorContext.getRepository().getModelAccess().executeCommand({ =>
EditorCell cell = editorContext.getEditorComponent().findCellWithId(node, "cellId").getNextSibling();
editorContext.selectWRTFocusPolicy(cell);
});

}
});
btn;
}

 

 

Please sign in to leave a comment.