mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
isEnabledForFile() removed
This commit is contained in:
@@ -87,22 +87,13 @@ public abstract class CodeInsightAction extends AnAction {
|
||||
}
|
||||
|
||||
final PsiFile file = PsiUtilBase.getPsiFileInEditor(editor, project);
|
||||
if (file == null || !isValidForFile(project, editor, file)) {
|
||||
presentation.setEnabled(false);
|
||||
}
|
||||
else {
|
||||
presentation.setEnabled(isEnabledForFile(project, editor, file));
|
||||
}
|
||||
presentation.setEnabled(file != null && isValidForFile(project, editor, file));
|
||||
}
|
||||
|
||||
protected boolean isValidForFile(Project project, Editor editor, final PsiFile file) {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean isEnabledForFile(Project project, Editor editor, final PsiFile file) {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected abstract CodeInsightActionHandler getHandler();
|
||||
|
||||
protected String getCommandName() {
|
||||
|
||||
+2
-2
@@ -45,10 +45,10 @@ public class ShowErrorDescriptionAction extends BaseCodeInsightAction implements
|
||||
}
|
||||
|
||||
protected boolean isValidForFile(Project project, Editor editor, PsiFile file) {
|
||||
return DaemonCodeAnalyzer.getInstance(project).isHighlightingAvailable(file);
|
||||
return DaemonCodeAnalyzer.getInstance(project).isHighlightingAvailable(file) && isEnabledForFile(project, editor, file);
|
||||
}
|
||||
|
||||
protected boolean isEnabledForFile(Project project, Editor editor, PsiFile file) {
|
||||
private static boolean isEnabledForFile(Project project, Editor editor, PsiFile file) {
|
||||
DaemonCodeAnalyzer codeAnalyzer = DaemonCodeAnalyzer.getInstance(project);
|
||||
HighlightInfo info =
|
||||
((DaemonCodeAnalyzerImpl)codeAnalyzer).findHighlightByOffset(editor.getDocument(), editor.getCaretModel().getOffset(), false);
|
||||
|
||||
Reference in New Issue
Block a user