Java Code Examples for org.jdom.Element#setName()

The following examples show how to use org.jdom.Element#setName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultilanguageDuplocatorSettings.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public Element getState() {
  synchronized (mySettingsMap) {
    Element state = new Element("state");
    if (mySettingsMap.isEmpty()) {
      return state;
    }

    SkipDefaultValuesSerializationFilters filter = new SkipDefaultValuesSerializationFilters();
    for (String name : mySettingsMap.keySet()) {
      Element child = XmlSerializer.serializeIfNotDefault(mySettingsMap.get(name), filter);
      if (child != null) {
        child.setName("object");
        child.setAttribute("language", name);
        state.addContent(child);
      }
    }
    return state;
  }
}
 
Example 2
Source File: BlazeCommandRunConfiguration.java    From intellij with Apache License 2.0 5 votes vote down vote up
private static Element getBlazeSettingsCopy(Element element) {
  Element blazeSettings = element.getChild(BLAZE_SETTINGS_TAG);
  if (blazeSettings != null) {
    return blazeSettings.clone();
  }
  // migrate an old-style run configuration
  blazeSettings = element.clone();
  blazeSettings.setName(BLAZE_SETTINGS_TAG);
  for (String common : COMMON_SETTINGS) {
    blazeSettings.removeChildren(common);
    blazeSettings.removeAttribute(common);
  }
  return blazeSettings;
}
 
Example 3
Source File: TreeState.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void writeExternal(Element element, List<? extends List<PathElement>> list, String name) throws WriteExternalException {
  Element root = new Element(name);
  for (List<PathElement> path : list) {
    Element e = XmlSerializer.serialize(path.toArray());
    e.setName(PATH_TAG);
    root.addContent(e);
  }
  element.addContent(root);
}
 
Example 4
Source File: StorageData.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void prepareElement(@Nonnull Element state) {
  if (state.getParent() != null) {
    LOG.warn("State element must not have parent " + JDOMUtil.writeElement(state));
    state.detach();
  }
  state.setName(COMPONENT);
}
 
Example 5
Source File: IoFileBasedStorage.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void setDefaultState(@Nonnull Element element) {
  element.setName(myRootElementName);
  super.setDefaultState(element);
}
 
Example 6
Source File: VfsFileBasedStorage.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void setDefaultState(@Nonnull Element element) {
  element.setName(myRootElementName);
  super.setDefaultState(element);
}