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

项目: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);
  }
}
项目:intellij-ce-playground    文件:DeleteTypeDescriptionLocation.java   
@Override
public String getElementDescription(@NotNull final PsiElement element, @NotNull final ElementDescriptionLocation location) {
  if (location instanceof DeleteTypeDescriptionLocation) {
    final boolean plural = ((DeleteTypeDescriptionLocation)location).isPlural();
    final int count = plural ? 2 : 1;
    if (element instanceof PsiFileSystemItem && PsiUtilBase.isSymLink((PsiFileSystemItem)element)) {
      return IdeBundle.message("prompt.delete.symlink", count);
    }
    if (element instanceof PsiFile) {
      return IdeBundle.message("prompt.delete.file", count);
    }
    if (element instanceof PsiDirectory) {
      return IdeBundle.message("prompt.delete.directory", count);
    }
    if (!plural) {
      return LanguageFindUsages.INSTANCE.forLanguage(element.getLanguage()).getType(element);
    }
    return "elements";
  }
  return null;
}
项目: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);
  }
}
项目:tools-idea    文件:DeleteTypeDescriptionLocation.java   
@Override
public String getElementDescription(@NotNull final PsiElement element, @NotNull final ElementDescriptionLocation location) {
  if (location instanceof DeleteTypeDescriptionLocation) {
    final boolean plural = ((DeleteTypeDescriptionLocation)location).isPlural();
    final int count = plural ? 2 : 1;
    if (element instanceof PsiFileSystemItem && PsiUtilBase.isSymLink((PsiFileSystemItem)element)) {
      return IdeBundle.message("prompt.delete.symlink", count);
    }
    if (element instanceof PsiFile) {
      return IdeBundle.message("prompt.delete.file", count);
    }
    if (element instanceof PsiDirectory) {
      return IdeBundle.message("prompt.delete.directory", count);
    }
    if (!plural) {
      return LanguageFindUsages.INSTANCE.forLanguage(element.getLanguage()).getType(element);
    }
    return "elements";
  }
  return null;
}
项目: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);
  }
}
项目:consulo    文件:DeleteTypeDescriptionLocation.java   
@Override
public String getElementDescription(@Nonnull final PsiElement element, @Nonnull final ElementDescriptionLocation location) {
  if (location instanceof DeleteTypeDescriptionLocation) {
    final boolean plural = ((DeleteTypeDescriptionLocation)location).isPlural();
    final int count = plural ? 2 : 1;
    if (element instanceof PsiFileSystemItem && PsiUtilBase.isSymLink((PsiFileSystemItem)element)) {
      return IdeBundle.message("prompt.delete.symlink", count);
    }
    if (element instanceof PsiFile) {
      return IdeBundle.message("prompt.delete.file", count);
    }
    if (element instanceof PsiDirectory) {
      return IdeBundle.message("prompt.delete.directory", count);
    }
    if (!plural) {
      return LanguageFindUsages.INSTANCE.forLanguage(element.getLanguage()).getType(element);
    }
    return "elements";
  }
  return null;
}
项目:intellij-ce-playground    文件:VariableArrayTypeFix.java   
private static String formatType(@NotNull PsiVariable variable) {
  FindUsagesProvider provider = LanguageFindUsages.INSTANCE.forLanguage(variable.getLanguage());
  final String type = provider.getType(variable);
  if (StringUtil.isNotEmpty(type)) {
    return type;
  }

  return TypePresentationService.getService().getTypePresentableName(variable.getClass());
}
项目:intellij-ce-playground    文件:AddAnnotationPsiFix.java   
public static String calcText(PsiModifierListOwner modifierListOwner, @NotNull String annotation) {
  final String shortName = annotation.substring(annotation.lastIndexOf('.') + 1);
  if (modifierListOwner instanceof PsiNamedElement) {
    final String name = ((PsiNamedElement)modifierListOwner).getName();
    if (name != null) {
      FindUsagesProvider provider = LanguageFindUsages.INSTANCE.forLanguage(modifierListOwner.getLanguage());
      return CodeInsightBundle
        .message("inspection.i18n.quickfix.annotate.element.as", provider.getType(modifierListOwner), name, shortName);
    }
  }
  return CodeInsightBundle.message("inspection.i18n.quickfix.annotate.as", shortName);
}
项目:intellij-ce-playground    文件:UsageViewTypeLocation.java   
@Override
public String getElementDescription(@NotNull final PsiElement psiElement, @NotNull final ElementDescriptionLocation location) {
  if (!(location instanceof UsageViewTypeLocation)) return null;

  if (psiElement instanceof PsiMetaOwner) {
    final PsiMetaData metaData = ((PsiMetaOwner)psiElement).getMetaData();
    if (metaData instanceof PsiPresentableMetaData) {
      return ((PsiPresentableMetaData)metaData).getTypeName();
    }
  }

  if (psiElement instanceof PsiFile) {
    return LangBundle.message("terms.file");
  }
  if (psiElement instanceof PsiDirectory) {
    return LangBundle.message("terms.directory");
  }

  final Language lang = psiElement.getLanguage();
  FindUsagesProvider provider = LanguageFindUsages.INSTANCE.forLanguage(lang);
  final String type = provider.getType(psiElement);
  if (StringUtil.isNotEmpty(type)) {
    return type;
  }

  return TypePresentationService.getService().getTypePresentableName(psiElement.getClass());
}
项目:intellij-ce-playground    文件:IdTableBuilding.java   
@Nullable
public static FileTypeIdIndexer getFileTypeIndexer(FileType fileType) {
  final FileTypeIdIndexer idIndexer = ourIdIndexers.get(fileType);

  if (idIndexer != null) {
    return idIndexer;
  }

  final FileTypeIdIndexer extIndexer = IdIndexers.INSTANCE.forFileType(fileType);
  if (extIndexer != null) {
    return extIndexer;
  }

  final WordsScanner customWordsScanner = CacheBuilderRegistry.getInstance().getCacheBuilder(fileType);
  if (customWordsScanner != null) {
    return new WordsScannerFileTypeIdIndexerAdapter(customWordsScanner);
  }

  if (fileType instanceof LanguageFileType) {
    final Language lang = ((LanguageFileType)fileType).getLanguage();
    final FindUsagesProvider findUsagesProvider = LanguageFindUsages.INSTANCE.forLanguage(lang);
    WordsScanner scanner = findUsagesProvider == null ? null : findUsagesProvider.getWordsScanner();
    if (scanner == null) {
      scanner = new SimpleWordsScanner();
    }
    return new WordsScannerFileTypeIdIndexerAdapter(scanner);
  }

  if (fileType instanceof CustomSyntaxTableFileType) {
    return new WordsScannerFileTypeIdIndexerAdapter(createCustomFileTypeScanner(((CustomSyntaxTableFileType)fileType).getSyntaxTable()));
  }

  return null;
}
项目:intellij-ce-playground    文件:DefaultFindUsagesHandlerFactory.java   
@Override
public boolean canFindUsages(@NotNull final PsiElement element) {
  if (element instanceof PsiFileSystemItem) {
    if (((PsiFileSystemItem)element).getVirtualFile() == null) return false;
  }
  else if (!LanguageFindUsages.INSTANCE.forLanguage(element.getLanguage()).canFindUsagesFor(element)) {
    return false;
  }
  return element.isValid();
}
项目:intellij-ce-playground    文件:XmlCoreEnvironment.java   
public ApplicationEnvironment(CoreApplicationEnvironment appEnvironment) {
  appEnvironment.registerFileType(HtmlFileType.INSTANCE, "html;htm;sht;shtm;shtml");
  appEnvironment.registerFileType(XHtmlFileType.INSTANCE, "xhtml");
  appEnvironment.registerFileType(DTDFileType.INSTANCE, "dtd;ent;mod;elt");

  appEnvironment.registerFileType(XmlFileType.INSTANCE, "xml;xsd;tld;xsl;jnlp;wsdl;jhm;ant;xul;xslt;rng;fxml");

  SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(XMLLanguage.INSTANCE, new XmlSyntaxHighlighterFactory());
  SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(DTDLanguage.INSTANCE, new DtdSyntaxHighlighterFactory());
  SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(HTMLLanguage.INSTANCE, new HtmlSyntaxHighlighterFactory());
  SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(XHTMLLanguage.INSTANCE, new XhtmlSyntaxHighlighterFactory());

  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, XMLLanguage.INSTANCE, new XMLParserDefinition());
  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, DTDLanguage.INSTANCE, new DTDParserDefinition());
  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, HTMLLanguage.INSTANCE, new HTMLParserDefinition());
  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, XHTMLLanguage.INSTANCE, new XHTMLParserDefinition());

  appEnvironment.addExplicitExtension(IdIndexers.INSTANCE, XmlFileType.INSTANCE, new XmlIdIndexer());
  appEnvironment.addExplicitExtension(IdIndexers.INSTANCE, DTDFileType.INSTANCE, new XmlIdIndexer());
  appEnvironment.addExplicitExtension(TodoIndexers.INSTANCE, XmlFileType.INSTANCE, new XmlTodoIndexer());
  appEnvironment.addExplicitExtension(TodoIndexers.INSTANCE, DTDFileType.INSTANCE, new XmlTodoIndexer());
  appEnvironment.addExplicitExtension(TodoIndexers.INSTANCE, XHtmlFileType.INSTANCE, new XHtmlTodoIndexer());

  appEnvironment.addExtension(MetaDataContributor.EP_NAME, new XmlApplicationComponent());
  appEnvironment.addExtension(FileBasedIndexExtension.EXTENSION_POINT_NAME, new XmlNamespaceIndex());
  appEnvironment.addExtension(FileBasedIndexExtension.EXTENSION_POINT_NAME, new SchemaTypeInheritanceIndex());
  appEnvironment.addExtension(FileBasedIndexExtension.EXTENSION_POINT_NAME, new XmlTagNamesIndex());
  appEnvironment.addExtension(StandardResourceProvider.EP_NAME, new InternalResourceProvider());

  appEnvironment.registerApplicationComponent(PathMacros.class, new PathMacrosImpl());
  appEnvironment.registerApplicationService(ExternalResourceManager.class, new ExternalResourceManagerExImpl());
  appEnvironment.registerApplicationService(XmlFoldingSettings.class, new XmlFoldingSettings());
  Language[] myLanguages = new Language[]{XMLLanguage.INSTANCE, HTMLLanguage.INSTANCE, XHTMLLanguage.INSTANCE, DTDLanguage.INSTANCE};
  for (Language myLanguage : myLanguages) {
    appEnvironment.addExplicitExtension(LanguageFolding.INSTANCE, myLanguage, new XmlFoldingBuilder());
    appEnvironment.addExplicitExtension(LanguageFindUsages.INSTANCE, myLanguage, new XmlFindUsagesProvider());
    appEnvironment.addExplicitExtension(LanguageASTFactory.INSTANCE, myLanguage, new XmlASTFactory());
  }
}
项目:intellij-ce-playground    文件:PropertiesCoreEnvironment.java   
public ApplicationEnvironment(CoreApplicationEnvironment appEnvironment) {
  appEnvironment.registerFileType(PropertiesFileType.INSTANCE, "properties");
  appEnvironment.addExplicitExtension(SyntaxHighlighterFactory.LANGUAGE_FACTORY, PropertiesLanguage.INSTANCE,
                                      new PropertiesSyntaxHighlighterFactory());
  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesParserDefinition());
  appEnvironment.addExtension(FileBasedIndexExtension.EXTENSION_POINT_NAME, new XmlPropertiesIndex());
  appEnvironment.addExtension(StubIndexExtension.EP_NAME, new PropertyKeyIndex());

  appEnvironment.registerApplicationService(PropertiesQuickFixFactory.class, new EmptyPropertiesQuickFixFactory());
  appEnvironment.registerApplicationService(PropertiesRefactoringSettings.class, new PropertiesRefactoringSettings());
  appEnvironment.addExplicitExtension(LanguageAnnotators.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesAnnotator());
  appEnvironment.addExplicitExtension(LanguageFindUsages.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesFindUsagesProvider());

  appEnvironment.addExplicitExtension(LanguageASTFactory.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesASTFactory());
  appEnvironment.addExplicitExtension(LanguageFolding.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesFoldingBuilder());
  appEnvironment.addExplicitExtension(ElementManipulators.INSTANCE, PropertyImpl.class, new PropertyManipulator());
  appEnvironment.addExplicitExtension(ElementManipulators.INSTANCE, PropertyKeyImpl.class, new PropertyKeyManipulator());
  appEnvironment.addExplicitExtension(ElementManipulators.INSTANCE, PropertyValueImpl.class, new PropertyValueManipulator());

  final StubElementTypeHolderEP stubElementTypeHolderBean = new StubElementTypeHolderEP();
  stubElementTypeHolderBean.holderClass = PropertiesElementTypes.class.getName();
  appEnvironment.addExtension(StubElementTypeHolderEP.EP_NAME, stubElementTypeHolderBean);

  appEnvironment.addExplicitExtension(LanguageCommenters.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesCommenter());
  appEnvironment.addExplicitExtension(IdIndexers.INSTANCE, PropertiesFileType.INSTANCE, new PropertiesIdIndexer());
  appEnvironment.addExplicitExtension(TodoIndexers.INSTANCE, PropertiesFileType.INSTANCE, new PropertiesTodoIndexer());

  appEnvironment.addExtension(IconProvider.EXTENSION_POINT_NAME, new XmlPropertiesIconProvider());
}
项目:tools-idea    文件:VariableArrayTypeFix.java   
private static String formatType(@NotNull PsiVariable variable) {
  FindUsagesProvider provider = LanguageFindUsages.INSTANCE.forLanguage(variable.getLanguage());
  final String type = provider.getType(variable);
  if (StringUtil.isNotEmpty(type)) {
    return type;
  }

  return TypePresentationService.getService().getTypePresentableName(variable.getClass());
}
项目:tools-idea    文件:AddAnnotationPsiFix.java   
public static String calcText(PsiModifierListOwner modifierListOwner, @NotNull String annotation) {
  final String shortName = annotation.substring(annotation.lastIndexOf('.') + 1);
  if (modifierListOwner instanceof PsiNamedElement) {
    final String name = ((PsiNamedElement)modifierListOwner).getName();
    if (name != null) {
      FindUsagesProvider provider = LanguageFindUsages.INSTANCE.forLanguage(modifierListOwner.getLanguage());
      return CodeInsightBundle
        .message("inspection.i18n.quickfix.annotate.element.as", provider.getType(modifierListOwner), name, shortName);
    }
  }
  return CodeInsightBundle.message("inspection.i18n.quickfix.annotate.as", shortName);
}
项目:tools-idea    文件:IdTableBuilding.java   
@Nullable
public static FileTypeIdIndexer getFileTypeIndexer(FileType fileType) {
  final FileTypeIdIndexer idIndexer = ourIdIndexers.get(fileType);

  if (idIndexer != null) {
    return idIndexer;
  }

  final FileTypeIdIndexer extIndexer = IdIndexers.INSTANCE.forFileType(fileType);
  if (extIndexer != null) {
    return extIndexer;
  }

  final WordsScanner customWordsScanner = CacheBuilderRegistry.getInstance().getCacheBuilder(fileType);
  if (customWordsScanner != null) {
    return new WordsScannerFileTypeIdIndexerAdapter(customWordsScanner);
  }

  if (fileType instanceof LanguageFileType) {
    final Language lang = ((LanguageFileType)fileType).getLanguage();
    final FindUsagesProvider findUsagesProvider = LanguageFindUsages.INSTANCE.forLanguage(lang);
    WordsScanner scanner = findUsagesProvider == null ? null : findUsagesProvider.getWordsScanner();
    if (scanner == null) {
      scanner = new SimpleWordsScanner();
    }
    return new WordsScannerFileTypeIdIndexerAdapter(scanner);
  }

  if (fileType instanceof CustomSyntaxTableFileType) {
    return new WordsScannerFileTypeIdIndexerAdapter(createWordScanner((CustomSyntaxTableFileType)fileType));
  }

  return null;
}
项目:tools-idea    文件:UsageViewTypeLocation.java   
@Override
public String getElementDescription(@NotNull final PsiElement psiElement, @NotNull final ElementDescriptionLocation location) {
  if (!(location instanceof UsageViewTypeLocation)) return null;

  if (psiElement instanceof PsiMetaOwner) {
    final PsiMetaData metaData = ((PsiMetaOwner)psiElement).getMetaData();
    if (metaData instanceof PsiPresentableMetaData) {
      return ((PsiPresentableMetaData)metaData).getTypeName();
    }
  }

  if (psiElement instanceof PsiFile) {
    return LangBundle.message("terms.file");
  }
  if (psiElement instanceof PsiDirectory) {
    return LangBundle.message("terms.directory");
  }

  final Language lang = psiElement.getLanguage();
  FindUsagesProvider provider = LanguageFindUsages.INSTANCE.forLanguage(lang);
  final String type = provider.getType(psiElement);
  if (StringUtil.isNotEmpty(type)) {
    return type;
  }

  return TypePresentationService.getService().getTypePresentableName(psiElement.getClass());
}
项目:tools-idea    文件:DefaultFindUsagesHandlerFactory.java   
@Override
public boolean canFindUsages(@NotNull final PsiElement element) {
  if (element instanceof PsiFileSystemItem) {
    if (((PsiFileSystemItem)element).getVirtualFile() == null) return false;
  }
  else if (!LanguageFindUsages.INSTANCE.forLanguage(element.getLanguage()).canFindUsagesFor(element)) {
    return false;
  }
  return element.isValid();
}
项目:consulo-csharp    文件:CSharpBaseGroupingRule.java   
@NotNull
@Override
public String getText(@Nullable UsageView usageView)
{
    T element = myPointer.getElement();
    if(element == null)
    {
        return "INVALID";
    }
    return LanguageFindUsages.INSTANCE.forKey(CSharpLanguage.INSTANCE).get(0).getNodeText(element, false);
}
项目:consulo    文件:IdTableBuilding.java   
@javax.annotation.Nullable
public static IdIndexer getFileTypeIndexer(FileType fileType) {
  final IdIndexer idIndexer = ourIdIndexers.get(fileType);

  if (idIndexer != null) {
    return idIndexer;
  }

  final IdIndexer extIndexer = IdIndexers.INSTANCE.forFileType(fileType);
  if (extIndexer != null) {
    return extIndexer;
  }

  final WordsScanner customWordsScanner = CacheBuilderRegistry.getInstance().getCacheBuilder(fileType);
  if (customWordsScanner != null) {
    return new WordsScannerFileTypeIdIndexerAdapter(customWordsScanner);
  }

  if (fileType instanceof LanguageFileType) {
    final Language lang = ((LanguageFileType)fileType).getLanguage();
    final FindUsagesProvider findUsagesProvider = LanguageFindUsages.INSTANCE.forLanguage(lang);
    WordsScanner scanner = findUsagesProvider == null ? null : findUsagesProvider.getWordsScanner();
    if (scanner == null) {
      scanner = new SimpleWordsScanner();
    }
    return new WordsScannerFileTypeIdIndexerAdapter(scanner);
  }

  if (fileType instanceof CustomSyntaxTableFileType) {
    return new WordsScannerFileTypeIdIndexerAdapter(createWordScanner((CustomSyntaxTableFileType)fileType));
  }

  return null;
}
项目:consulo    文件:UsageViewTypeLocation.java   
@Override
public String getElementDescription(@Nonnull final PsiElement psiElement, @Nonnull final ElementDescriptionLocation location) {
  if (!(location instanceof UsageViewTypeLocation)) return null;

  if (psiElement instanceof PsiMetaOwner) {
    final PsiMetaData metaData = ((PsiMetaOwner)psiElement).getMetaData();
    if (metaData instanceof PsiPresentableMetaData) {
      return ((PsiPresentableMetaData)metaData).getTypeName();
    }
  }

  if (psiElement instanceof PsiFile) {
    return LangBundle.message("terms.file");
  }
  if (psiElement instanceof PsiDirectory) {
    return LangBundle.message("terms.directory");
  }

  final Language lang = psiElement.getLanguage();
  FindUsagesProvider provider = LanguageFindUsages.INSTANCE.forLanguage(lang);
  final String type = provider.getType(psiElement);
  if (StringUtil.isNotEmpty(type)) {
    return type;
  }

  return TypePresentationService.getInstance().getTypePresentableName(psiElement.getClass());
}
项目:consulo    文件:DefaultFindUsagesHandlerFactory.java   
@Override
public boolean canFindUsages(@Nonnull final PsiElement element) {
  if (element instanceof PsiFileSystemItem) {
    if (((PsiFileSystemItem)element).getVirtualFile() == null) return false;
  }
  else if (!LanguageFindUsages.INSTANCE.forLanguage(element.getLanguage()).canFindUsagesFor(element)) {
    return false;
  }
  return element.isValid();
}
项目:consulo-java    文件:HighlightUtil.java   
@NotNull
static String buildProblemWithStaticDescription(@NotNull PsiElement refElement)
{
    String type = LanguageFindUsages.INSTANCE.forLanguage(JavaLanguage.INSTANCE).getType(refElement);
    String name = HighlightMessageUtil.getSymbolName(refElement, PsiSubstitutor.EMPTY);
    return JavaErrorMessages.message("non.static.symbol.referenced.from.static.context", type, name);
}
项目:consulo-java    文件:VariableArrayTypeFix.java   
private static String formatType(@NotNull PsiVariable variable)
{
    FindUsagesProvider provider = LanguageFindUsages.INSTANCE.forLanguage(variable.getLanguage());
    final String type = provider.getType(variable);
    if(StringUtil.isNotEmpty(type))
    {
        return type;
    }

    return TypePresentationService.getInstance().getTypePresentableName(variable.getClass());
}
项目:consulo-java    文件:AddAnnotationPsiFix.java   
public static String calcText(PsiModifierListOwner modifierListOwner, @NotNull String annotation)
{
    final String shortName = annotation.substring(annotation.lastIndexOf('.') + 1);
    if(modifierListOwner instanceof PsiNamedElement)
    {
        final String name = ((PsiNamedElement) modifierListOwner).getName();
        if(name != null)
        {
            FindUsagesProvider provider = LanguageFindUsages.INSTANCE.forLanguage(modifierListOwner.getLanguage());
            return CodeInsightBundle.message("inspection.i18n.quickfix.annotate.element.as", provider.getType(modifierListOwner), name, shortName);
        }
    }
    return CodeInsightBundle.message("inspection.i18n.quickfix.annotate.as", shortName);
}
项目:intellij-ce-playground    文件:HighlightUtil.java   
@NotNull
static String buildProblemWithStaticDescription(@NotNull PsiElement refElement) {
  String type = LanguageFindUsages.INSTANCE.forLanguage(JavaLanguage.INSTANCE).getType(refElement);
  String name = HighlightMessageUtil.getSymbolName(refElement, PsiSubstitutor.EMPTY);
  return JavaErrorMessages.message("non.static.symbol.referenced.from.static.context", type, name);
}
项目:intellij-ce-playground    文件:FindUsagesManager.java   
public static String getHelpID(PsiElement element) {
  return LanguageFindUsages.INSTANCE.forLanguage(element.getLanguage()).getHelpId(element);
}
项目:intellij-ce-playground    文件:XsltLanguage.java   
@Nullable
public WordsScanner getWordsScanner() {
    return LanguageFindUsages.INSTANCE.forLanguage(XMLLanguage.INSTANCE).getWordsScanner();
}
项目:intellij-ce-playground    文件:RenameVariableFix.java   
@NotNull
public String getText() {
    final String type = LanguageFindUsages.INSTANCE.forLanguage(myElement.getLanguage()).getType(myElement);
    return "Rename " + myPlace + " " + StringUtil.capitalize(type);
}
项目:tools-idea    文件:HighlightUtil.java   
@NotNull
static String buildProblemWithStaticDescription(@NotNull PsiElement refElement) {
  String type = LanguageFindUsages.INSTANCE.forLanguage(JavaLanguage.INSTANCE).getType(refElement);
  String name = HighlightMessageUtil.getSymbolName(refElement, PsiSubstitutor.EMPTY);
  return JavaErrorMessages.message("non.static.symbol.referenced.from.static.context", type, name);
}
项目:tools-idea    文件:FindUsagesManager.java   
public static String getHelpID(PsiElement element) {
  return LanguageFindUsages.INSTANCE.forLanguage(element.getLanguage()).getHelpId(element);
}
项目:tools-idea    文件:XsltLanguage.java   
@Nullable
public WordsScanner getWordsScanner() {
    return LanguageFindUsages.INSTANCE.forLanguage(XMLLanguage.INSTANCE).getWordsScanner();
}
项目:tools-idea    文件:RenameVariableFix.java   
@NotNull
public String getText() {
    final String type = LanguageFindUsages.INSTANCE.forLanguage(myElement.getLanguage()).getType(myElement);
    return "Rename " + myPlace + " " + StringUtil.capitalize(type);
}
项目:intellij-haxe    文件:HaxeFindUsagesHandlerFactory.java   
static FindUsagesProvider getHaxeProvider() {
  if (null == haxeProvider) {
    haxeProvider = LanguageFindUsages.INSTANCE.forLanguage(HaxeLanguage.INSTANCE); // Find and use the provider specified in plugin.xml.
  }
  return haxeProvider;
}
项目:consulo    文件:FindUsagesManager.java   
public static String getHelpID(PsiElement element) {
  return LanguageFindUsages.INSTANCE.forLanguage(element.getLanguage()).getHelpId(element);
}
项目:consulo-xslt    文件:XsltLanguage.java   
@Nullable
public WordsScanner getWordsScanner() {
    return LanguageFindUsages.INSTANCE.forLanguage(XMLLanguage.INSTANCE).getWordsScanner();
}
项目:consulo-xslt    文件:RenameVariableFix.java   
@NotNull
public String getText() {
    final String type = LanguageFindUsages.INSTANCE.forLanguage(myElement.getLanguage()).getType(myElement);
    return "Rename " + myPlace + " " + StringUtil.capitalize(type);
}