DataContext (@NotNull Editor editor) { Editor hostEditor = editor instanceof EditorWindow ? ((EditorWindow)editor).getDelegate() : editor; DataContext parent = DataManager.getInstance().getDataContext(editor.getContentComponent()); return SimpleDataContext.builder() .setParent(parent) .add(CommonDataKeys.HOST_EDITOR, hostEditor) .add(CommonDataKeys.EDITOR, editor) .build(); }