How to get editor from BasicDomElementComponent?

Hallo,

I have created my custom dom file editor and i want to show popup menu, where i would have also Undo and Redo JMenuItems. I want in this items to perform Undo - firstly get UndoManager, where i need project instance argument and then call undo on the manager, where i need my editor instance. Is there some easy way to get my editor instance from my dom components, or do i have to pass editor instance to all my dom components? I want to have different JMenuItems in different dom components, that is why i need active editor in all components. Thanks.

2 comments
Comment actions Permalink

((EditorFieldTextControl) domElementComponent.getDomControl()).getEditorTextField()?

Note that you don't need to implement the undo and redo actions manually. Instead, create a DefaultActionGroup, add the standard undo and redo actions to it (ActionManager.getInstance.getAction(IdeActions.ACTION_UNDO)) and use ActionManager.createActionPopupMenu() to show the context menu.

0
Comment actions Permalink

Thanks.

I tried this way, but when I create JPopupMenu from ActionManager.createActionPopupMenu ().getComponent () and add new JMenuItems with swing actions attached to them, than they are not added at all. Is there a way to do this? I have many swing actions atached to swing components and i dont want to unnecessarily implement also intellij AnAction class.

0

Please sign in to leave a comment.