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

The following examples show how to use org.jdom.Element#removeChildren() . 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: BlazeAndroidBinaryRunConfigurationState.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public void writeExternal(Element element) throws WriteExternalException {
  commonState.writeExternal(element);

  // Group profiler settings under its own section. Previously written profiler info
  // are replaced manually because ProfilerState#writeExternal does not handle the removal
  // process; unlike i.e, implementers of RunConfigurationState.
  Element profilersElement = new Element(PROFILERS_ELEMENT_NAME);
  element.removeChildren(PROFILERS_ELEMENT_NAME);
  element.addContent(profilersElement);
  profilerState.writeExternal(profilersElement);

  element.setAttribute(DEEP_LINK, deepLink);
  element.setAttribute(ACTIVITY_CLASS, activityClass);
  element.setAttribute(MODE, mode);
  element.setAttribute(LAUNCH_METHOD_ATTR, launchMethod.name());
  element.setAttribute(USE_SPLIT_APKS_IF_POSSIBLE, Boolean.toString(useSplitApksIfPossible));
  element.setAttribute(WORK_PROFILE_ATTR, Boolean.toString(useWorkProfileIfPresent));
  element.setAttribute(SHOW_LOGCAT_AUTOMATICALLY, Boolean.toString(showLogcatAutomatically));
  element.setAttribute(AM_START_OPTIONS, amStartOptions);

  if (userId != null) {
    element.setAttribute(USER_ID_ATTR, Integer.toString(userId));
  } else {
    element.removeAttribute(USER_ID_ATTR);
  }
}
 
Example 2
Source File: BlazeAndroidRunConfigurationCommonState.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public void writeExternal(Element element) throws WriteExternalException {
  blazeFlags.writeExternal(element);
  exeFlags.writeExternal(element);
  debuggerSettings.writeExternal(element);

  element.removeChildren(DEPLOY_TARGET_STATES_TAG);
  Element deployTargetStatesElement = new Element(DEPLOY_TARGET_STATES_TAG);
  deployTargetManager.writeExternal(deployTargetStatesElement);
  element.addContent(deployTargetStatesElement);
}
 
Example 3
Source File: EnvironmentVariablesState.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public void writeExternal(Element element) throws WriteExternalException {
  element.removeChildren(ELEMENT_TAG);
  Element child = new Element(ELEMENT_TAG);
  data.writeExternal(child);
  element.addContent(child);
}
 
Example 4
Source File: RunConfigurationFlagsState.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public void writeExternal(Element element) {
  element.removeChildren(tag);
  for (String flag : flags) {
    Element child = new Element(tag);
    child.setText(flag);
    element.addContent(child);
  }
}
 
Example 5
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;
}