@NotNull private static DataContext createEditorContext(@NotNull Editor editor) { Object e = editor; Object hostEditor = editor instanceof EditorWindow ? ((EditorWindow) editor).getDelegate() : editor; Map<String, Object> map = ContainerUtil.newHashMap( Pair.create(CommonDataKeys.HOST_EDITOR.getName(), hostEditor), Pair.createNonNull(CommonDataKeys.EDITOR.getName(), e)); DataContext parent = DataManager.getInstance().getDataContext(editor.getContentComponent()); return SimpleDataContext.getSimpleContext(map, parent); }