Java 类com.intellij.lang.properties.psi.impl.PropertyValueImpl 实例源码

项目:tools-idea    文件:PropertiesReferenceContributor.java   
public void registerReferenceProviders(final PsiReferenceRegistrar registrar) {
  registrar.registerReferenceProvider(literalExpression(), new PropertiesReferenceProvider(true));
  registrar.registerReferenceProvider(literalExpression().withParent(
    psiNameValuePair().withName(AnnotationUtil.PROPERTY_KEY_RESOURCE_BUNDLE_PARAMETER)),
                                      new ResourceBundleReferenceProvider());

  registrar.registerReferenceProvider(PsiJavaPatterns.psiElement(PropertyValueImpl.class), new PsiReferenceProvider() {
    @NotNull
    @Override
    public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
      String text = element.getText();
      String[] words = text.split("\\s");
      if (words.length != 1) return PsiReference.EMPTY_ARRAY;
      return CLASS_REFERENCE_PROVIDER.getReferencesByString(words[0], element, 0);
    }
  });
}
项目:consulo-java    文件:PropertiesReferenceContributor.java   
public void registerReferenceProviders(final PsiReferenceRegistrar registrar) {
  registrar.registerReferenceProvider(literalExpression(), new PropertiesReferenceProvider(true));
  registrar.registerReferenceProvider(literalExpression().withParent(
    psiNameValuePair().withName(AnnotationUtil.PROPERTY_KEY_RESOURCE_BUNDLE_PARAMETER)),
                                      new ResourceBundleReferenceProvider());

  registrar.registerReferenceProvider(PsiJavaPatterns.psiElement(PropertyValueImpl.class), new PsiReferenceProvider() {
    @NotNull
    @Override
    public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
      String text = element.getText();
      String[] words = text.split("\\s");
      if (words.length != 1) return PsiReference.EMPTY_ARRAY;
      return CLASS_REFERENCE_PROVIDER.getReferencesByString(words[0], element, 0);
    }
  });
}
项目:intellij-ce-playground    文件:PropertiesSpellcheckingStrategy.java   
@NotNull
@Override
public Tokenizer getTokenizer(PsiElement element) {
  if (element instanceof PropertyValueImpl) {
    return myPropertyValueTokenizer;
  }
  if (element instanceof PropertyKeyImpl) {
    return myPropertyTokenizer;
  }
  return super.getTokenizer(element);
}
项目: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());
}
项目:intellij-ce-playground    文件:PropertyValueManipulator.java   
@Override
public PropertyValueImpl handleContentChange(@NotNull PropertyValueImpl element, @NotNull TextRange range, String newContent)
  throws IncorrectOperationException {
  final String oldText = element.getText();
  String newText = oldText.substring(0, range.getStartOffset()) + newContent + oldText.substring(range.getEndOffset());
  return (PropertyValueImpl)element.replaceWithText(newText);
}
项目:tools-idea    文件:PropertiesSpellcheckingStrategy.java   
@NotNull
@Override
public Tokenizer getTokenizer(PsiElement element) {
  if (element instanceof PropertyValueImpl) {
    return myPropertyValueTokenizer;
  }
  if (element instanceof PropertyImpl) {
    return myPropertyTokenizer;
  }
  return super.getTokenizer(element);
}
项目:tools-idea    文件:PropertyValueManipulator.java   
@Override
public PropertyValueImpl handleContentChange(PropertyValueImpl element, TextRange range, String newContent)
  throws IncorrectOperationException {
  final String oldText = element.getText();
  String newText = oldText.substring(0, range.getStartOffset()) + newContent + oldText.substring(range.getEndOffset());
  return (PropertyValueImpl)element.replaceWithText(newText);
}