Java 类com.intellij.lang.findUsages.EmptyFindUsagesProvider 实例源码

项目:intellij-ce-playground    文件:FindUsagesInFileAction.java   
private static boolean isEnabled(DataContext dataContext) {
  Project project = CommonDataKeys.PROJECT.getData(dataContext);
  if (project == null) {
    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);
  }
}
项目:tools-idea    文件:FindUsagesInFileAction.java   
private static boolean isEnabled(DataContext dataContext) {
  Project project = PlatformDataKeys.PROJECT.getData(dataContext);
  if (project == null) {
    return false;
  }

  Editor editor = PlatformDataKeys.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);
  }
}
项目:consulo    文件:FindUsagesInFileAction.java   
private static boolean isEnabled(DataContext dataContext) {
  Project project = dataContext.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    return false;
  }

  Editor editor = dataContext.getData(PlatformDataKeys.EDITOR);
  if (editor == null) {
    UsageTarget[] target = dataContext.getData(UsageView.USAGE_TARGETS_KEY);
    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);
  }
}