boolean (DataContext dataContext) { Editor editor = CommonDataKeys.EDITOR.getData(dataContext); if (editor != null && editor.getSelectionModel().hasSelection()) { return false; } final Project project = CommonDataKeys.PROJECT.getData(dataContext); final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext); return project != null && view != null && view.getDirectories().length != 0; }