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

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

java 1次浏览

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

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

示例1: getNodeTypeTranslation

点赞 3

import com.intellij.lang.properties.PropertiesFileType; //导入依赖的package包/类
public static String getNodeTypeTranslation(Project project, String namespace, String nodeTypeName) {
    Collection<VirtualFile> virtualFiles = CndProjectFilesUtil.findFilesInSourcesOnly(project, PropertiesFileType.INSTANCE);

    String key = convertNodeTypeIdentifierToPropertyName(namespace, nodeTypeName);
    PsiManager psiManager = PsiManager.getInstance(project);
    for (VirtualFile virtualFile : virtualFiles) {
        PropertiesFile propertiesFile = (PropertiesFile) psiManager.findFile(virtualFile);
        if (propertiesFile != null) {
            IProperty property = propertiesFile.findPropertyByKey(key);
            if (property != null) {
                return property.getValue();
            }
        }
    }
    return null;
}
 

开发者ID:Tolc,
项目名称:IntelliJ_Jahia_plugin,
代码行数:17,
代码来源:CndTranslationUtil.java

示例2: createPropertiesFile

点赞 2

import com.intellij.lang.properties.PropertiesFileType; //导入依赖的package包/类
@NotNull
public static PropertiesFile createPropertiesFile(@NotNull Project project, Properties properties, String fileName) {
  ByteArrayOutputStream stream = new ByteArrayOutputStream();
  try {
    properties.store(stream, "");
  }
  catch (IOException e) {
    throw new RuntimeException(e);
  }
  @NonNls String filename = fileName + "." + PropertiesFileType.INSTANCE.getDefaultExtension();
  return (PropertiesFile)PsiFileFactory.getInstance(project)
    .createFileFromText(filename, PropertiesFileType.INSTANCE, stream.toString());
}
 

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

示例3: handleElementRename

点赞 2

import com.intellij.lang.properties.PropertiesFileType; //导入依赖的package包/类
public PsiElement handleElementRename(final String newElementName) {
  return handleFileRename(newElementName, PropertiesFileType.DOT_DEFAULT_EXTENSION, false);
}
 

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

示例4: createFileTypes

点赞 2

import com.intellij.lang.properties.PropertiesFileType; //导入依赖的package包/类
@Override
public void createFileTypes(@NotNull FileTypeConsumer consumer) {
  ExactFileNameMatcher matcher = new ExactFileNameMatcher(GroovyExtensionProvider.ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE,
                                                          !SystemInfo.isFileSystemCaseSensitive);
  consumer.consume(PropertiesFileType.INSTANCE, matcher);
}
 

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

示例5: defineCustomElementsFromResources

点赞 2

import com.intellij.lang.properties.PropertiesFileType; //导入依赖的package包/类
private void defineCustomElementsFromResources(AntDomTypeDef typedef, final String uri, AntDomProject antProject, ClassLoader loader) {
  final XmlElement xmlElement = antProject.getXmlElement();
  final Project project = xmlElement != null? xmlElement.getProject() : null;
  if (project == null) {
    return;
  }
  XmlFile xmlFile = null;
  PropertiesFile propFile = null;

  final String resource = typedef.getResource().getStringValue();
  if (resource != null) {
    if (loader == null) {
      loader = getClassLoader(typedef, antProject);
    }
    final InputStream stream = loader.getResourceAsStream(resource);
    if (stream != null) {
      try {
        if (isXmlFormat(typedef, resource)) {
          xmlFile = (XmlFile)loadContentAsFile(project, stream, XmlFileType.INSTANCE);
        }
        else {
          propFile = (PropertiesFile)loadContentAsFile(project, stream, PropertiesFileType.INSTANCE);
        }
      }
      catch (IOException e) {
        LOG.info(e);
      }
    }
    else {
      myTypeDefErrors.put(typedef, "Resource \"" + resource + "\" not found in the classpath");
    }
  }
  else {
    final PsiFileSystemItem file = typedef.getFile().getValue();
    if (file instanceof PsiFile) {
      if (isXmlFormat(typedef, file.getName())) {
        xmlFile = file instanceof XmlFile ? (XmlFile)file : (XmlFile)loadContentAsFile((PsiFile)file, XmlFileType.INSTANCE);
      }
      else { // assume properties format
        propFile = file instanceof PropertiesFile ? (PropertiesFile)file : (PropertiesFile)loadContentAsFile((PsiFile)file, PropertiesFileType.INSTANCE);
      }
    }
  }

  if (propFile != null) {
    if (loader == null) { // if not initialized yet
      loader = getClassLoader(typedef, antProject);
    }
    for (final IProperty property : propFile.getProperties()) {
      addCustomDefinition(typedef, property.getUnescapedKey(), uri, ClassProvider.create(property.getValue(), loader));
    }
  }

  if (xmlFile != null) {
    if (loader == null) { // if not initialized yet
      loader = getClassLoader(typedef, antProject);
    }
    loadDefinitionsFromAntlib(xmlFile, uri, loader, typedef, antProject);
  }
}
 

开发者ID:consulo,
项目名称:consulo-apache-ant,
代码行数:61,
代码来源:CustomAntElementsRegistry.java


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