Beispiel #1
0
 public static void writeFilters(Element parentNode, @NonNls String tagName, ClassFilter[] filters)
     throws WriteExternalException {
   for (ClassFilter filter : filters) {
     Element element = new Element(tagName);
     parentNode.addContent(element);
     DefaultJDOMExternalizer.writeExternal(filter, element);
   }
 }
 public void writeExternal(Element element) throws WriteExternalException {
   for (final String name : myName2FavoritesRoots.keySet()) {
     Element list = new Element(ELEMENT_FAVORITES_LIST);
     list.setAttribute(ATTRIBUTE_NAME, name);
     writeRoots(list, myName2FavoritesRoots.get(name));
     element.addContent(list);
   }
   DefaultJDOMExternalizer.writeExternal(this, element);
 }
 public void readExternal(Element element) throws InvalidDataException {
   myName2FavoritesRoots.clear();
   for (Object list : element.getChildren(ELEMENT_FAVORITES_LIST)) {
     final String name = ((Element) list).getAttributeValue(ATTRIBUTE_NAME);
     List<TreeItem<Pair<AbstractUrl, String>>> roots = readRoots((Element) list, myProject);
     myName2FavoritesRoots.put(name, roots);
   }
   DefaultJDOMExternalizer.readExternal(this, element);
 }
  public void writeExternal(final Element element) throws WriteExternalException {
    super.writeExternal(element);
    JavaRunConfigurationExtensionManager.getInstance().writeExternal(this, element);
    writeModule(element);
    DefaultJDOMExternalizer.writeExternal(this, element);
    final Data persistentData = getPersistentData();
    DefaultJDOMExternalizer.writeExternal(persistentData, element);
    EnvironmentVariablesComponent.writeExternal(element, persistentData.getEnvs());
    final String dirName = persistentData.getDirName();
    if (!dirName.isEmpty()) {
      final Element dirNameElement = new Element("dir");
      dirNameElement.setAttribute("value", FileUtil.toSystemIndependentName(dirName));
      element.addContent(dirNameElement);
    }

    final String categoryName = persistentData.getCategory();
    if (!categoryName.isEmpty()) {
      final Element categoryNameElement = new Element("category");
      categoryNameElement.setAttribute("value", categoryName);
      element.addContent(categoryNameElement);
    }

    final Element patternsElement = new Element(PATTERNS_EL_NAME);
    for (String o : persistentData.getPatterns()) {
      final Element patternElement = new Element(PATTERN_EL_NAME);
      patternElement.setAttribute(TEST_CLASS_ATT_NAME, o);
      patternsElement.addContent(patternElement);
    }
    final String forkMode = getForkMode();
    if (!forkMode.equals("none")) {
      final Element forkModeElement = new Element("fork_mode");
      forkModeElement.setAttribute("value", forkMode);
      element.addContent(forkModeElement);
    }
    element.addContent(patternsElement);
    PathMacroManager.getInstance(getProject()).collapsePathsRecursively(element);
  }
  public void readExternal(final Element element) throws InvalidDataException {
    PathMacroManager.getInstance(getProject()).expandPaths(element);
    super.readExternal(element);
    JavaRunConfigurationExtensionManager.getInstance().readExternal(this, element);
    readModule(element);
    DefaultJDOMExternalizer.readExternal(this, element);
    DefaultJDOMExternalizer.readExternal(getPersistentData(), element);
    EnvironmentVariablesComponent.readExternal(element, getPersistentData().getEnvs());
    final Element patternsElement = element.getChild(PATTERNS_EL_NAME);
    if (patternsElement != null) {
      final Set<String> tests = new LinkedHashSet<String>();
      for (Object o : patternsElement.getChildren(PATTERN_EL_NAME)) {
        Element patternElement = (Element) o;
        tests.add(patternElement.getAttributeValue(TEST_CLASS_ATT_NAME));
      }
      myData.setPatterns(tests);
    }
    final Element forkModeElement = element.getChild("fork_mode");
    if (forkModeElement != null) {
      final String mode = forkModeElement.getAttributeValue("value");
      if (mode != null) {
        setForkMode(mode);
      }
    }
    final Element dirNameElement = element.getChild("dir");
    if (dirNameElement != null) {
      final String dirName = dirNameElement.getAttributeValue("value");
      getPersistentData().setDirName(FileUtil.toSystemDependentName(dirName));
    }

    final Element categoryNameElement = element.getChild("category");
    if (categoryNameElement != null) {
      final String categoryName = categoryNameElement.getAttributeValue("value");
      getPersistentData().setCategoryName(categoryName);
    }
  }
Beispiel #6
0
 public static ClassFilter create(Element element) throws InvalidDataException {
   ClassFilter filter = new ClassFilter();
   DefaultJDOMExternalizer.readExternal(filter, element);
   return filter;
 }