当前位置: 首页>>代码示例>>Java>>正文


Java JDOMUtil.getChildren方法代码示例

本文整理汇总了Java中com.intellij.openapi.util.JDOMUtil.getChildren方法的典型用法代码示例。如果您正苦于以下问题:Java JDOMUtil.getChildren方法的具体用法?Java JDOMUtil.getChildren怎么用?Java JDOMUtil.getChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.util.JDOMUtil的用法示例。


在下文中一共展示了JDOMUtil.getChildren方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadModules

import com.intellij.openapi.util.JDOMUtil; //导入方法依赖的package包/类
private void loadModules(Element root, final @Nullable JpsSdkType<?> projectSdkType) {
  Runnable timingLog = TimingLog.startActivity("loading modules");
  Element componentRoot = JDomSerializationUtil.findComponent(root, "ProjectModuleManager");
  if (componentRoot == null) return;

  final Set<File> foundFiles = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
  final List<File> moduleFiles = new ArrayList<File>();
  for (Element moduleElement : JDOMUtil.getChildren(componentRoot.getChild("modules"), "module")) {
    final String path = moduleElement.getAttributeValue("filepath");
    final File file = new File(path);
    if (foundFiles.add(file) && file.exists()) {
      moduleFiles.add(file);
    }
    else {
      LOG.info("Module '" + FileUtil.getNameWithoutExtension(file) + "' is skipped: " + file.getAbsolutePath() + " doesn't exist");
    }
  }

  List<JpsModule> modules = loadModules(moduleFiles, projectSdkType, myPathVariables);
  for (JpsModule module : modules) {
    myProject.addModule(module);
  }
  timingLog.run();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:JpsProjectLoader.java

示例2: loadExtension

import com.intellij.openapi.util.JDOMUtil; //导入方法依赖的package包/类
@Override
public void loadExtension(@NotNull JpsProject project, @NotNull Element componentTag) {
  String projectEncoding = null;
  Map<String, String> urlToEncoding = new HashMap<String, String>();
  for (Element fileTag : JDOMUtil.getChildren(componentTag, "file")) {
    String url = fileTag.getAttributeValue("url");
    String encoding = fileTag.getAttributeValue("charset");
    if (url.equals("PROJECT")) {
      projectEncoding = encoding;
    }
    else {
      urlToEncoding.put(url, encoding);
    }
  }
  JpsEncodingConfigurationService.getInstance().setEncodingConfiguration(project, projectEncoding, urlToEncoding);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JpsEncodingModelSerializerExtension.java

示例3: findModuleFiles

import com.intellij.openapi.util.JDOMUtil; //导入方法依赖的package包/类
private File[] findModuleFiles(final Element root) {
  final Element modulesManager = JDomSerializationUtil.findComponent(root, ModuleManagerImpl.COMPONENT_NAME);
  if (modulesManager == null) return new File[0];

  final Element modules = modulesManager.getChild(ModuleManagerImpl.ELEMENT_MODULES);
  if (modules == null) return new File[0];

  final ExpandMacroToPathMap macros = createExpandMacroMap();

  List<File> files = new ArrayList<File>();
  for (Element module : JDOMUtil.getChildren(modules, ModuleManagerImpl.ELEMENT_MODULE)) {
    String filePath = module.getAttributeValue(ModuleManagerImpl.ATTRIBUTE_FILEPATH);
    filePath = macros.substitute(filePath, true);
    files.add(new File(FileUtil.toSystemDependentName(filePath)));
  }
  return files.toArray(new File[files.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ConversionContextImpl.java

示例4: getClassRoots

import com.intellij.openapi.util.JDOMUtil; //导入方法依赖的package包/类
@NotNull
public List<File> getClassRoots(Element libraryElement, @Nullable ModuleSettingsImpl moduleSettings) {
  List<File> files = new ArrayList<File>();
  //todo[nik] support jar directories
  final Element classesChild = libraryElement.getChild("CLASSES");
  if (classesChild != null) {
    final List<Element> roots = JDOMUtil.getChildren(classesChild, "root");
    final ExpandMacroToPathMap pathMap = createExpandMacroMap(moduleSettings);
    for (Element root : roots) {
      final String url = root.getAttributeValue("url");
      final String path = VfsUtilCore.urlToPath(url);
      files.add(new File(PathUtil.getLocalPath(pathMap.substitute(path, true))));
    }
  }
  return files;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ConversionContextImpl.java

示例5: findComponent

import com.intellij.openapi.util.JDOMUtil; //导入方法依赖的package包/类
@Nullable
public static Element findComponent(@Nullable Element root, @NonNls String componentName) {
  for (Element element : JDOMUtil.getChildren(root, COMPONENT_ELEMENT)) {
    if (componentName.equals(element.getAttributeValue(NAME_ATTRIBUTE))) {
      return element;
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JDomSerializationUtil.java

示例6: readExcludes

import com.intellij.openapi.util.JDOMUtil; //导入方法依赖的package包/类
public static void readExcludes(Element excludeFromCompileTag, JpsCompilerExcludes excludes) {
  if (excludeFromCompileTag != null) {
    for (Element fileTag : JDOMUtil.getChildren(excludeFromCompileTag, "file")) {
      excludes.addExcludedFile(fileTag.getAttributeValue("url"));
    }
    for (Element directoryTag : JDOMUtil.getChildren(excludeFromCompileTag, "directory")) {
      boolean recursively = Boolean.parseBoolean(directoryTag.getAttributeValue("includeSubdirectories"));
      excludes.addExcludedDirectory(directoryTag.getAttributeValue("url"), recursively);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:JpsJavaCompilerConfigurationSerializer.java

示例7: loadExtension

import com.intellij.openapi.util.JDOMUtil; //导入方法依赖的package包/类
@Override
public void loadExtension(@NotNull JpsProject project, @NotNull Element componentTag) {
  for (Element buildFileTag : JDOMUtil.getChildren(componentTag, "buildFile")) {
    String commandLine = getValueAttribute(buildFileTag, "antCommandLine");
    String url = buildFileTag.getAttributeValue("url");
    if (!StringUtil.isEmpty(commandLine)) {
      JpsAntConfiguration configuration = project.getContainer().getChild(JpsAntConfigurationImpl.ROLE);
      if (configuration != null) {
        configuration.getOptions(url).setAntCommandLineParameters(commandLine);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:JpsAntModelSerializerExtension.java

示例8: loadPackagingElement

import com.intellij.openapi.util.JDOMUtil; //导入方法依赖的package包/类
@Nullable
private static JpsPackagingElement loadPackagingElement(Element element) {
  JpsPackagingElement packagingElement = createPackagingElement(element);
  if (packagingElement instanceof JpsCompositePackagingElement) {
    for (Element childElement : JDOMUtil.getChildren(element, ELEMENT_TAG)) {
      JpsPackagingElement child = loadPackagingElement(childElement);
      if (child != null) {
        ((JpsCompositePackagingElement)packagingElement).addChild(child);
      }
    }
  }
  return packagingElement;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:JpsArtifactSerializer.java

示例9: getSettingsElement

import com.intellij.openapi.util.JDOMUtil; //导入方法依赖的package包/类
@Nullable
public static Element getSettingsElement(@Nullable Element element, String name) {
  for (Element child : JDOMUtil.getChildren(element, "setting")) {
    if (child.getAttributeValue("name").equals(name)) {
      return child;
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JDomConvertingUtil.java

示例10: loadSdk

import com.intellij.openapi.util.JDOMUtil; //导入方法依赖的package包/类
private static JpsLibrary loadSdk(Element sdkElement) {
  String name = getAttributeValue(sdkElement, NAME_TAG);
  String typeId = getAttributeValue(sdkElement, TYPE_TAG);
  LOG.debug("Loading " + typeId + " SDK '" + name + "'");
  JpsSdkPropertiesSerializer<?> serializer = getSdkPropertiesSerializer(typeId);
  final JpsLibrary library = createSdk(name, serializer, sdkElement);
  final Element roots = sdkElement.getChild(ROOTS_TAG);
  for (Element rootTypeElement : JDOMUtil.getChildren(roots)) {
    JpsLibraryRootTypeSerializer rootTypeSerializer = getRootTypeSerializer(rootTypeElement.getName());
    if (rootTypeSerializer != null) {
      for (Element rootElement : JDOMUtil.getChildren(rootTypeElement)) {
        loadRoots(rootElement, library, rootTypeSerializer.getType());
      }
    }
    else {
      LOG.info("root type serializer not found for " + rootTypeElement.getName());
    }
  }
  if (LOG.isDebugEnabled()) {
    List<File> files = library.getFiles(JpsOrderRootType.COMPILED);
    LOG.debug(name + " SDK classpath (" + files.size() + " roots):");
    for (File file : files) {
      LOG.debug(" " + file.getAbsolutePath());
    }
  }
  return library;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:JpsSdkTableSerializer.java

示例11: loadRoots

import com.intellij.openapi.util.JDOMUtil; //导入方法依赖的package包/类
private static void loadRoots(Element rootElement, JpsLibrary library, JpsOrderRootType rootType) {
  final String type = rootElement.getAttributeValue(TYPE_ATTRIBUTE);
  if (type.equals(COMPOSITE_TYPE)) {
    for (Element element : JDOMUtil.getChildren(rootElement)) {
      loadRoots(element, library, rootType);
    }
  }
  else if (type.equals(SIMPLE_TYPE)) {
    library.addRoot(rootElement.getAttributeValue(URL_ATTRIBUTE), rootType);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:JpsSdkTableSerializer.java

示例12: addFacetTypes

import com.intellij.openapi.util.JDOMUtil; //导入方法依赖的package包/类
private static void addFacetTypes(@NotNull String facetTypeId, @Nullable Element parent, @NotNull ArrayList<Element> elements) {
  for (Element child : JDOMUtil.getChildren(parent, JpsFacetSerializer.FACET_TAG)) {
    if (facetTypeId.equals(child.getAttributeValue(JpsFacetSerializer.TYPE_ATTRIBUTE))) {
      elements.add(child);
    } else {
      addFacetTypes(facetTypeId, child, elements);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ModuleSettingsImpl.java

示例13: addExcludedFolder

import com.intellij.openapi.util.JDOMUtil; //导入方法依赖的package包/类
private void addExcludedFolder(File directory, Element contentRoot) {
  for (Element excludedFolder : JDOMUtil.getChildren(contentRoot, ExcludeFolderImpl.ELEMENT_NAME)) {
    final File excludedDir = getFile(excludedFolder.getAttributeValue(ExcludeFolderImpl.URL_ATTRIBUTE));
    if (FileUtil.isAncestor(excludedDir, directory, false)) {
      return;
    }
  }
  String path = ConversionContextImpl.collapsePath(FileUtil.toSystemIndependentName(directory.getAbsolutePath()), this);
  contentRoot.addContent(new Element(ExcludeFolderImpl.ELEMENT_NAME).setAttribute(ExcludeFolderImpl.URL_ATTRIBUTE, VfsUtil.pathToUrl(path)));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ModuleSettingsImpl.java

示例14: loadAdditionalRoots

import com.intellij.openapi.util.JDOMUtil; //导入方法依赖的package包/类
private static void loadAdditionalRoots(Element rootModelComponent, final String rootsTagName, final JpsUrlList result) {
  final Element roots = rootModelComponent.getChild(rootsTagName);
  for (Element root : JDOMUtil.getChildren(roots, ROOT_TAG)) {
    result.addUrl(root.getAttributeValue(URL_ATTRIBUTE));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:JpsJavaModelSerializerExtension.java

示例15: loadExtension

import com.intellij.openapi.util.JDOMUtil; //导入方法依赖的package包/类
@Override
public void loadExtension(@NotNull JpsProject project, @NotNull Element componentTag) {
  JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getOrCreateCompilerConfiguration(project);
  Element addNotNullTag = componentTag.getChild(ADD_NOTNULL_ASSERTIONS);
  if (addNotNullTag != null) {
    configuration.setAddNotNullAssertions(Boolean.parseBoolean(addNotNullTag.getAttributeValue(ENABLED, "true")));
  }

  readExcludes(componentTag.getChild(EXCLUDE_FROM_COMPILE), configuration.getCompilerExcludes());

  Element resourcePatternsTag = componentTag.getChild(WILDCARD_RESOURCE_PATTERNS);
  for (Element entry : JDOMUtil.getChildren(resourcePatternsTag, ENTRY)) {
    String pattern = entry.getAttributeValue(NAME);
    if (!StringUtil.isEmpty(pattern)) {
      configuration.addResourcePattern(pattern);
    }
  }

  Element annotationProcessingTag = componentTag.getChild(ANNOTATION_PROCESSING);
  if (annotationProcessingTag != null) {
    List<Element> profiles = JDOMUtil.getChildren(annotationProcessingTag, "profile");
    for (Element profileTag : profiles) {
      boolean isDefault = Boolean.parseBoolean(profileTag.getAttributeValue("default"));
      if (isDefault) {
        AnnotationProcessorProfileSerializer.readExternal(configuration.getDefaultAnnotationProcessingProfile(), profileTag);
      }
      else {
        AnnotationProcessorProfileSerializer.readExternal(configuration.addAnnotationProcessingProfile(), profileTag);
      }
    }
  }

  Element targetLevelTag = componentTag.getChild(BYTECODE_TARGET_LEVEL);
  if (targetLevelTag != null) {
    configuration.setProjectByteCodeTargetLevel(targetLevelTag.getAttributeValue(TARGET_ATTRIBUTE));
    for (Element moduleTag : JDOMUtil.getChildren(targetLevelTag, MODULE)) {
      String moduleName = moduleTag.getAttributeValue(NAME);
      String level = moduleTag.getAttributeValue(TARGET_ATTRIBUTE);
      if (moduleName != null && level != null) {
        configuration.setModuleByteCodeTargetLevel(moduleName, level);
      }
    }
  }
  String compilerId = JDOMExternalizerUtil.readField(componentTag, "DEFAULT_COMPILER");
  if (compilerId != null) {
    configuration.setJavaCompilerId(compilerId);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:49,代码来源:JpsJavaCompilerConfigurationSerializer.java


注:本文中的com.intellij.openapi.util.JDOMUtil.getChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。