• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java PropertiesLanguage类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中com.intellij.lang.properties.PropertiesLanguage的典型用法代码示例。如果您正苦于以下问题:Java PropertiesLanguage类的具体用法?Java PropertiesLanguage怎么用?Java PropertiesLanguage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

PropertiesLanguage类属于com.intellij.lang.properties包,在下文中一共展示了PropertiesLanguage类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: resolveToCustomSystemProperty

点赞 2

import com.intellij.lang.properties.PropertiesLanguage; //导入依赖的package包/类
@Nullable
private PsiElement resolveToCustomSystemProperty(@NotNull String propertyName, @Nullable String propertyValue) {
  if (propertyValue == null) return null;

  PsiFile propFile = PsiFileFactory.getInstance(myProject).createFileFromText("SystemProperties.properties", PropertiesLanguage.INSTANCE,
                                                                              propertyName + '=' + propertyValue);

  return ((PropertiesFile)propFile).getProperties().get(0).getPsiElement();
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:10,
代码来源:MavenPropertyPsiReference.java

示例2: prepareTemplate

点赞 2

import com.intellij.lang.properties.PropertiesLanguage; //导入依赖的package包/类
protected void prepareTemplate(@NotNull Template template,
                               @NotNull final PsiElement element,
                               String relativePath,
                               @NotNull final PsiFile fileToInsertComment) {
  final List<String> allFiles = Util.collectFilePaths(element, new Function<PsiFile, String>() {
    public String fun(@NotNull final PsiFile psiFile) {
      PsiFile file = psiFile.getViewProvider().getPsi(PropertiesLanguage.INSTANCE);
      if (!(file instanceof PropertiesFile)) {
        return null;
      }
      final VelocityPropertiesProvider propertiesProvider = new VelocityPropertiesProvider((PropertiesFile)file);
      List<PsiFile> macroLibs = collectReferencedLibFiles(ModuleUtil.findModuleForPsiElement(element), propertiesProvider);

      for (PsiFile macroLib : macroLibs) {
        if (!(macroLib instanceof VtlFile) ||
            ((VtlFile)macroLib).getNumberOfMacros(((VtlReferenceExpression)element).getReferenceName()) <= 0) {
          continue;
        }
        VirtualFile vFile = macroLib.getViewProvider().getVirtualFile();
        String res = Util.computeFilePath(propertiesProvider, vFile.getPath(), vFile.getName(), fileToInsertComment);
        if(res != null) return res;
      }
      return null;
    }
  });

  template.addTextSegment("#* @velocityproperties path=");
  final Expression pathExpression = new StringCollectionExpression(allFiles);
  template.addVariable("PATH", pathExpression, pathExpression, true);
  final String fileRef = relativePath != null ? " file=\"" + relativePath + "\"" : "";
  template.addTextSegment(fileRef + " *#\n");
  template.addEndVariable();
}
 

开发者ID:consulo,
项目名称:consulo-apache-velocity,
代码行数:34,
代码来源:DefineVelocityPropertiesRefIntention.java

示例3: computeFilePaths

点赞 2

import com.intellij.lang.properties.PropertiesLanguage; //导入依赖的package包/类
private static List<String> computeFilePaths(final PsiElement element, final PsiFile fileToInsertComment) {
  final VtlFileReferenceSet refSet = findVtlFileReferenceSet(element);
  if (refSet == null) {
    return Collections.emptyList();
  }
  final PsiFile[] referencedFiles =
      findReferencedFiles(ModuleUtil.findModuleForPsiElement(element), refSet.getLastReference().getCanonicalText());

  if (referencedFiles.length == 0) {
    return Collections.emptyList();
  }

  return collectFilePaths(element, new Function<PsiFile, String>() {
    public String fun(@NotNull final PsiFile psiFile) {
      PsiFile file = psiFile.getViewProvider().getPsi(PropertiesLanguage.INSTANCE);
      if (file instanceof PropertiesFile) {
        PropertiesFile propFile = (PropertiesFile)file;
        VelocityPropertiesProvider velocityProperties = new VelocityPropertiesProvider(propFile);
        for (PsiFile referencedFile : referencedFiles) {
          String referencedFilePath = referencedFile.getViewProvider().getVirtualFile().getPath();
          String filePath = computeFilePath(velocityProperties, referencedFilePath, refSet.getPathString(), fileToInsertComment);
          if (filePath != null) return filePath;
        }
      }
      return null;
    }
  });
}
 

开发者ID:consulo,
项目名称:consulo-apache-velocity,
代码行数:29,
代码来源:DefineVelocityPropertiesRefForFilesIntention.java

示例4: PropertiesCompletionContributor

点赞 2

import com.intellij.lang.properties.PropertiesLanguage; //导入依赖的package包/类
public PropertiesCompletionContributor() {
  extend(CompletionType.BASIC,
      PlatformPatterns.psiElement().withLanguage(PropertiesLanguage.INSTANCE),
      new PropertiesCompletionProvider());
}
 

开发者ID:1tontech,
项目名称:intellij-spring-assistant,
代码行数:6,
代码来源:PropertiesCompletionContributor.java

示例5: getLanguage

点赞 2

import com.intellij.lang.properties.PropertiesLanguage; //导入依赖的package包/类
@NotNull
public Language getLanguage() {
  return PropertiesLanguage.INSTANCE;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:5,
代码来源:PropertiesStubElementImpl.java

示例6: PropertiesCodeStyleSettings

点赞 2

import com.intellij.lang.properties.PropertiesLanguage; //导入依赖的package包/类
public PropertiesCodeStyleSettings(CodeStyleSettings container) {
  super(PropertiesLanguage.INSTANCE.getID(), container);
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:4,
代码来源:PropertiesCodeStyleSettings.java

示例7: getConfigurableDisplayName

点赞 2

import com.intellij.lang.properties.PropertiesLanguage; //导入依赖的package包/类
@Nullable
@Override
public String getConfigurableDisplayName() {
  return PropertiesLanguage.INSTANCE.getDisplayName();
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:6,
代码来源:PropertiesCodeStyleSettingsProvider.java

示例8: PropertiesElementType

点赞 2

import com.intellij.lang.properties.PropertiesLanguage; //导入依赖的package包/类
public PropertiesElementType(@NonNls String debugName) {
  super(debugName, PropertiesLanguage.INSTANCE);
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:4,
代码来源:PropertiesElementType.java

示例9: guessSeparator

点赞 2

import com.intellij.lang.properties.PropertiesLanguage; //导入依赖的package包/类
private static String guessSeparator(final Project project, final VirtualFile file) {
  Collection<PropertiesFile> files;
  if (file instanceof ResourceBundleAsVirtualFile) {
    files = ((ResourceBundleAsVirtualFile)file).getResourceBundle().getPropertiesFiles(project);
  }
  else {
    PsiManager psiManager = PsiManager.getInstance(project);
    final FileViewProvider provider = psiManager.findViewProvider(file);
    files = new SmartList<PropertiesFile>();
    if (provider != null) {
      ContainerUtil.addIfNotNull((PropertiesFile)provider.getPsi(PropertiesLanguage.INSTANCE), files);
    }
  }
  final TIntLongHashMap charCounts = new TIntLongHashMap();
  for (PropertiesFile propertiesFile : files) {
    if (propertiesFile == null) continue;
    List<IProperty> properties = propertiesFile.getProperties();
    for (IProperty property : properties) {
      String key = property.getUnescapedKey();
      if (key == null) continue;
      for (int i =0; i<key.length(); i++) {
        char c = key.charAt(i);
        if (!Character.isLetterOrDigit(c)) {
          charCounts.put(c, charCounts.get(c) + 1);
        }
      }
    }
  }

  final char[] mostProbableChar = new char[]{'.'};
  charCounts.forEachKey(new TIntProcedure() {
    long count = -1;
    public boolean execute(int ch) {
      long charCount = charCounts.get(ch);
      if (charCount > count) {
        count = charCount;
        mostProbableChar[0] = (char)ch;
      }
      return true;
    }
  });
  if (mostProbableChar[0] == 0) {
    mostProbableChar[0] = '.';
  }
  return Character.toString(mostProbableChar[0]);
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:47,
代码来源:PropertiesSeparatorManager.java

示例10: PropertiesFileImpl

点赞 2

import com.intellij.lang.properties.PropertiesLanguage; //导入依赖的package包/类
public PropertiesFileImpl(FileViewProvider viewProvider) {
  super(viewProvider, PropertiesLanguage.INSTANCE);
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:4,
代码来源:PropertiesFileImpl.java

示例11: PlayJavaConfFileType

点赞 2

import com.intellij.lang.properties.PropertiesLanguage; //导入依赖的package包/类
private PlayJavaConfFileType()
{
	super(PropertiesLanguage.INSTANCE);
}
 

开发者ID:consulo,
项目名称:consulo-play,
代码行数:5,
代码来源:PlayJavaConfFileType.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)