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 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);
 }
  @Override
  public void writeExternal(Element element) throws WriteExternalException {
    super.writeExternal(element);
    JavaRunConfigurationExtensionManager.getInstance().writeExternal(this, element);
    writeModule(element);
    DefaultJDOMExternalizer.writeExternal(this, element);
    DefaultJDOMExternalizer.writeExternal(getPersistantData(), element);
    EnvironmentVariablesComponent.writeExternal(element, getPersistantData().getEnvs());

    Element propertiesElement = element.getChild("properties");

    if (propertiesElement == null) {
      propertiesElement = new Element("properties");
      element.addContent(propertiesElement);
    }

    Map<String, String> properties = getPersistantData().TEST_PROPERTIES;
    for (Map.Entry<String, String> entry : properties.entrySet()) {
      Element property = new Element("property");
      property.setAttribute("name", entry.getKey());
      property.setAttribute("value", entry.getValue());
      propertiesElement.addContent(property);
    }

    Element listenersElement = element.getChild("listeners");
    if (listenersElement == null) {
      listenersElement = new Element("listeners");
      element.addContent(listenersElement);
    }

    List<String> listeners = getPersistantData().TEST_LISTENERS;
    for (String listener : listeners) {
      Element listenerElement = new Element("listener");
      listenerElement.setAttribute("class", listener);
      listenersElement.addContent(listenerElement);
    }
    final Set<String> patterns = getPersistantData().getPatterns();
    if (!patterns.isEmpty()) {
      final Element patternsElement = new Element(PATTERNS_EL_NAME);
      for (String o : patterns) {
        final Element patternElement = new Element(PATTERN_EL_NAME);
        patternElement.setAttribute(TEST_CLASS_ATT_NAME, o);
        patternsElement.addContent(patternElement);
      }
      element.addContent(patternsElement);
    }
  }
Пример #3
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);
 }
 @Override
 public Element getState() {
   Element element = new Element("state");
   try {
     DefaultJDOMExternalizer.writeExternal(this, element);
   } catch (WriteExternalException e) {
     LOG.info(e);
   }
   return element;
 }
  @Override
  public void writeExternal(Element element) throws WriteExternalException {
    final CodeStyleSettings parentSettings = new CodeStyleSettings();
    DefaultJDOMExternalizer.writeExternal(
        this, element, new DifferenceFilter<CodeStyleSettings>(this, parentSettings));
    List<CustomCodeStyleSettings> customSettings =
        new ArrayList<CustomCodeStyleSettings>(getCustomSettingsValues());

    Collections.sort(
        customSettings,
        new Comparator<CustomCodeStyleSettings>() {
          @Override
          public int compare(final CustomCodeStyleSettings o1, final CustomCodeStyleSettings o2) {
            return o1.getTagName().compareTo(o2.getTagName());
          }
        });

    for (final CustomCodeStyleSettings settings : customSettings) {
      final CustomCodeStyleSettings parentCustomSettings =
          parentSettings.getCustomSettings(settings.getClass());
      if (parentCustomSettings == null) {
        throw new WriteExternalException("Custom settings are null for " + settings.getClass());
      }
      settings.writeExternal(element, parentCustomSettings);
    }

    final FileType[] fileTypes =
        myAdditionalIndentOptions
            .keySet()
            .toArray(new FileType[myAdditionalIndentOptions.keySet().size()]);
    Arrays.sort(
        fileTypes,
        new Comparator<FileType>() {
          @Override
          public int compare(final FileType o1, final FileType o2) {
            return o1.getDefaultExtension().compareTo(o2.getDefaultExtension());
          }
        });

    for (FileType fileType : fileTypes) {
      final IndentOptions indentOptions = myAdditionalIndentOptions.get(fileType);
      Element additionalIndentOptions = new Element(ADDITIONAL_INDENT_OPTIONS);
      indentOptions.serialize(additionalIndentOptions, getDefaultIndentOptions(fileType));
      additionalIndentOptions.setAttribute(FILETYPE, fileType.getDefaultExtension());
      if (!additionalIndentOptions.getChildren().isEmpty()) {
        element.addContent(additionalIndentOptions);
      }
    }

    myCommonSettingsManager.writeExternal(element);
  }
Пример #7
0
 private static void writeExternal(
     @NotNull Element element, @NotNull ShelvedChangeList shelvedChangeList)
     throws WriteExternalException {
   DefaultJDOMExternalizer.writeExternal(shelvedChangeList, element);
   element.setAttribute(NAME_ATTRIBUTE, shelvedChangeList.getName());
   element.setAttribute(ATTRIBUTE_DATE, Long.toString(shelvedChangeList.DATE.getTime()));
   element.setAttribute(
       ATTRIBUTE_RECYCLED_CHANGELIST, Boolean.toString(shelvedChangeList.isRecycled()));
   for (ShelvedBinaryFile file : shelvedChangeList.getBinaryFiles()) {
     Element child = new Element(ELEMENT_BINARY);
     file.writeExternal(child);
     element.addContent(child);
   }
 }
  @Override
  public Element getState() {
    final Element component = new Element("component");

    if (hasDefaultValues()) {
      return component;
    }

    try {
      DefaultJDOMExternalizer.writeExternal(this, component);
    } catch (WriteExternalException e) {
      LOG.error(e);
    }
    return component;
  }
 @SuppressWarnings({"HardCodedStringLiteral"})
 public void writeExternal(Element element) throws WriteExternalException {
   DefaultJDOMExternalizer.writeExternal(this, element);
   if (ADD_PATHS != null) {
     for (String aADD_PATHS : ADD_PATHS) {
       Element elem = new Element("addpath");
       elem.setAttribute("path", aADD_PATHS);
       element.addContent(elem);
     }
   }
   if (myConfigurationDirectory != null) {
     Element configurationDirectory = new Element("configuration");
     configurationDirectory.setText(myConfigurationDirectory);
     configurationDirectory.setAttribute(
         "useDefault", myIsUseDefaultConfiguration ? "true" : "false");
     element.addContent(configurationDirectory);
   }
   if (myIsKeepLocks) {
     element.addContent(new Element("keepLocks"));
   }
   if (myRemoteStatus) {
     element.addContent(new Element("remoteStatus"));
   }
   if (myUpgradeMode != null) {
     element.addContent(new Element("upgradeMode").setText(myUpgradeMode));
   }
   element.addContent(
       new Element("myIsUseDefaultProxy").setText(myIsUseDefaultProxy ? "true" : "false"));
   if (mySupportOptions != null) {
     element.addContent(new Element("supportedVersion").setText("" + mySupportOptions.myVersion));
   }
   element.setAttribute("maxAnnotateRevisions", "" + myMaxAnnotateRevisions);
   element.setAttribute("myUseAcceleration", "" + myUseAcceleration);
   element.setAttribute("myAutoUpdateAfterCommit", "" + myAutoUpdateAfterCommit);
   element.setAttribute(CLEANUP_ON_START_RUN, "" + myCleanupRun);
   element.setAttribute("SSL_PROTOCOLS", SSL_PROTOCOLS.name());
   if (TREE_CONFLICT_MERGE_THEIRS_NEW_INTO_OLD_PLACE != null) {
     element.setAttribute(
         "TREE_CONFLICT_MERGE_THEIRS_NEW_INTO_OLD_PLACE",
         "" + TREE_CONFLICT_MERGE_THEIRS_NEW_INTO_OLD_PLACE);
   }
 }
  @Override
  public void writeExternal(Element element) throws WriteExternalException {
    super.writeExternal(element);
    DefaultJDOMExternalizer.writeExternal(this, element);

    Element e = new Element("XsltFile");
    if (myXsltFile != null) {
      e.setAttribute("url", myXsltFile.getUrl());
      element.addContent(e);
    }
    e = new Element("XmlFile");
    if (myXmlInputFile != null) {
      e.setAttribute("url", myXmlInputFile.getUrl());
      element.addContent(e);
    }
    e = new Element("OutputFile");
    if (myOutputFile != null) {
      e.setAttribute("path", myOutputFile);
      e.setAttribute("openOutputFile", Boolean.toString(myOpenOutputFile));
      e.setAttribute("openInBrowser", Boolean.toString(myOpenInBrowser));
      element.addContent(e);
    }
  }
 @Override
 public void writeExternal(Element element) throws WriteExternalException {
   for (String s : myGroupPath) {
     Element path = new Element(PATH);
     path.setAttribute(VALUE, s);
     element.addContent(path);
   }
   if (myComponent instanceof String) {
     element.setAttribute(VALUE, (String) myComponent);
     element.setAttribute(IS_ACTION, Boolean.TRUE.toString());
   } else if (myComponent instanceof Separator) {
     element.setAttribute(SEPARATOR, Boolean.TRUE.toString());
   } else if (myComponent instanceof Group) {
     final String groupId =
         ((Group) myComponent).getId() != null && ((Group) myComponent).getId().length() != 0
             ? ((Group) myComponent).getId()
             : ((Group) myComponent).getName();
     element.setAttribute(VALUE, groupId != null ? groupId : "");
     element.setAttribute(IS_GROUP, Boolean.TRUE.toString());
   }
   element.setAttribute(ACTION_TYPE, Integer.toString(myActionType));
   element.setAttribute(POSITION, Integer.toString(myAbsolutePosition));
   DefaultJDOMExternalizer.writeExternal(this, element);
 }
Пример #12
0
 @Override
 public void writeExternal(Element element) throws WriteExternalException {
   super.writeExternal(element);
   DefaultJDOMExternalizer.writeExternal(this, element);
 }
 public void writeExternal(Element element) throws WriteExternalException {
   DefaultJDOMExternalizer.writeExternal(this, element);
 }
 private void writeExternal(Element element) throws WriteExternalException {
   DefaultJDOMExternalizer.writeExternal(
       this,
       element,
       new DifferenceFilter<CodeStyleSettingsManager>(this, new CodeStyleSettingsManager()));
 }
Пример #15
0
 public void writeExternal(Element element) throws WriteExternalException {
   DefaultJDOMExternalizer.writeExternal(this, element);
   if (myUserObject instanceof String) {
     element.setAttribute(USER_OBJECT, (String) myUserObject);
   }
 }