use of com.intellij.lang.findUsages.EmptyFindUsagesProvider in project intellij-community by JetBrains.
the class FindUsagesInFileAction method isEnabled.
private static boolean isEnabled(DataContext dataContext) {
Project project = CommonDataKeys.PROJECT.getData(dataContext);
if (project == null || EditorGutter.KEY.getData(dataContext) != null || Boolean.TRUE.equals(dataContext.getData(CommonDataKeys.EDITOR_VIRTUAL_SPACE))) {
return false;
}
Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
if (editor == null) {
UsageTarget[] target = UsageView.USAGE_TARGETS_KEY.getData(dataContext);
return target != null && target.length > 0;
} else {
PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
if (file == null) {
return false;
}
Language language = PsiUtilBase.getLanguageInEditor(editor, project);
if (language == null) {
language = file.getLanguage();
}
return !(LanguageFindUsages.INSTANCE.forLanguage(language) instanceof EmptyFindUsagesProvider);
}
}
Aggregations