in src/java/org/jetbrains/plugins/clojure/repl/actions/ClojureConsoleActionBase.java [79:126]
public void update(AnActionEvent e) {
final Presentation presentation = e.getPresentation();
final Editor editor = e.getData(DataKeys.EDITOR);
if (editor == null) {
presentation.setEnabled(false);
return;
}
final Project project = editor.getProject();
if (project == null) {
presentation.setEnabled(false);
return;
}
final Document document = editor.getDocument();
final PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document);
if (psiFile == null || !(psiFile instanceof ClojureFile)) {
presentation.setEnabled(false);
return;
}
final VirtualFile virtualFile = psiFile.getVirtualFile();
if (virtualFile == null || virtualFile instanceof LightVirtualFile) {
presentation.setEnabled(false);
return;
}
final String filePath = virtualFile.getPath();
if (filePath == null) {
presentation.setEnabled(false);
return;
}
final ClojureConsoleProcessHandler handler = findRunningClojureConsole(project);
if (handler == null) {
presentation.setEnabled(false);
return;
}
final LanguageConsoleImpl console = handler.getLanguageConsole();
if (!(console instanceof ClojureConsole)) {
presentation.setEnabled(false);
return;
}
presentation.setEnabled(true);
}