com.intellij.openapi.util.JDOMExternalizerUtil Java Examples

The following examples show how to use com.intellij.openapi.util.JDOMExternalizerUtil. 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: WeaveConfiguration.java    From mule-intellij-plugins with Apache License 2.0 6 votes vote down vote up
@Override
public void readExternal(Element element) throws InvalidDataException
{
    super.readExternal(element);
    this.weaveHome = JDOMExternalizerUtil.readField(element, WEAVE_HOME_FIELD);
    this.weaveFile = JDOMExternalizerUtil.readField(element, WEAVE_FILE);
    this.weaveOutput = JDOMExternalizerUtil.readField(element, WEAVE_OUTPUT);
    final List<Element> children = element.getChildren(WEAVE_INPUT);
    this.weaveInputs = new ArrayList<>();
    for (Element child : children)
    {
        final WeaveInput weaveInput = new WeaveInput();
        weaveInput.readExternal(child);
        weaveInputs.add(weaveInput);
    }
    getConfigurationModule().readExternal(element);
}
 
Example #2
Source File: RoboVmRunConfiguration.java    From robovm-idea with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void readExternal(Element element) throws InvalidDataException {
    super.readExternal(element);

    readModule(element);
    moduleName = JDOMExternalizerUtil.readField(element, "moduleName");
    String targetTypeStr = JDOMExternalizerUtil.readField(element, "targetType");
    targetType = targetTypeStr.length() == 0? null: TargetType.valueOf(targetTypeStr);
    String deviceArchStr = JDOMExternalizerUtil.readField(element, "deviceArch");
    deviceArch = deviceArchStr.length() == 0? null: Arch.valueOf(deviceArchStr);
    signingIdentity = JDOMExternalizerUtil.readField(element, "signingIdentity");
    provisioningProfile = JDOMExternalizerUtil.readField(element, "provisioningProfile");
    String simArchStr = JDOMExternalizerUtil.readField(element, "simArch");
    simArch = simArchStr.length() == 0? null: Arch.valueOf(simArchStr);
    simulatorName = JDOMExternalizerUtil.readField(element, "simulatorName");
    arguments = JDOMExternalizerUtil.readField(element, "arguments");
    if(arguments == null) arguments = "";
    workingDir = JDOMExternalizerUtil.readField(element, "workingDir");
    if(workingDir == null) workingDir = "";
}
 
Example #3
Source File: RoboVmRunConfiguration.java    From robovm-idea with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void writeExternal(Element element) throws WriteExternalException {
    super.writeExternal(element);

    setModuleName(moduleName);
    writeModule(element);
    JDOMExternalizerUtil.writeField(element, "moduleName", moduleName);
    JDOMExternalizerUtil.writeField(element, "targetType", targetType == null? null: targetType.toString());
    JDOMExternalizerUtil.writeField(element, "deviceArch", deviceArch == null? null: deviceArch.toString());
    JDOMExternalizerUtil.writeField(element, "signingIdentity", signingIdentity);
    JDOMExternalizerUtil.writeField(element, "provisioningProfile", provisioningProfile);
    JDOMExternalizerUtil.writeField(element, "simArch", simArch == null? null: simArch.toString());
    JDOMExternalizerUtil.writeField(element, "simulatorName", simulatorName);
    JDOMExternalizerUtil.writeField(element, "arguments", arguments == null? "": arguments);
    JDOMExternalizerUtil.writeField(element, "workingDir", workingDir == null? "": workingDir);
}
 
Example #4
Source File: BashRunConfiguration.java    From BashSupport with Apache License 2.0 6 votes vote down vote up
@Override
public void writeExternal(Element element) throws WriteExternalException {
    super.writeExternal(element);

    // common config
    JDOMExternalizerUtil.writeField(element, "INTERPRETER_OPTIONS", interpreterOptions);
    JDOMExternalizerUtil.writeField(element, "INTERPRETER_PATH", interpreterPath);
    JDOMExternalizerUtil.writeField(element, "PROJECT_INTERPRETER", Boolean.toString(useProjectInterpreter));
    JDOMExternalizerUtil.writeField(element, "WORKING_DIRECTORY", workingDirectory);
    JDOMExternalizerUtil.writeField(element, "PARENT_ENVS", Boolean.toString(isPassParentEnvs()));

    // run config
    JDOMExternalizerUtil.writeField(element, "SCRIPT_NAME", scriptName);
    JDOMExternalizerUtil.writeField(element, "PARAMETERS", getProgramParameters());

    //JavaRunConfigurationExtensionManager.getInstance().writeExternal(this, element);
    DefaultJDOMExternalizer.writeExternal(this, element);
    writeModule(element);
    EnvironmentVariablesComponent.writeExternal(element, getEnvs());

    PathMacroManager.getInstance(getProject()).collapsePathsRecursively(element);
}
 
Example #5
Source File: MuleConfiguration.java    From mule-intellij-plugins with Apache License 2.0 5 votes vote down vote up
@Override
public void writeExternal(Element element) throws WriteExternalException
{
    super.writeExternal(element);
    // Stores the values of this class into the parent
    JDOMExternalizerUtil.writeField(element, VM_ARGS_FIELD, this.getVmArgs());
    JDOMExternalizerUtil.writeField(element, MULE_HOME_FIELD, this.getMuleHome());
    JDOMExternalizerUtil.writeField(element, CLEAR_DATA_FIELD, this.getClearData());

    getConfigurationModule().writeExternal(element);
}
 
Example #6
Source File: TextAttributesKey.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void writeExternal(Element element) throws WriteExternalException {
  JDOMExternalizerUtil.writeField(element, "myExternalName", myExternalName);

  if (myDefaultAttributes != NULL_ATTRIBUTES) {
    Element option = JDOMExternalizerUtil.writeOption(element, "myDefaultAttributes");
    myDefaultAttributes.writeExternal(option);
  }
}
 
Example #7
Source File: TextAttributesKey.java    From consulo with Apache License 2.0 5 votes vote down vote up
public TextAttributesKey(@Nonnull Element element) {
  this(JDOMExternalizerUtil.readField(element, "myExternalName"));
  Element myDefaultAttributesElement = JDOMExternalizerUtil.getOption(element, "myDefaultAttributes");
  if (myDefaultAttributesElement != null) {
    myDefaultAttributes = new TextAttributes(myDefaultAttributesElement);
  }
}
 
Example #8
Source File: AttributesFlyweight.java    From consulo with Apache License 2.0 5 votes vote down vote up
void writeExternal(@Nonnull Element element) {
  writeColor(element, "FOREGROUND", getForeground());
  writeColor(element, "BACKGROUND", getBackground());
  int fontType = getFontType();
  if (fontType != 0) {
    JDOMExternalizerUtil.writeField(element, "FONT_TYPE", String.valueOf(fontType));
  }
  writeColor(element, "EFFECT_COLOR", getEffectColor());
  writeColor(element, "ERROR_STRIPE_COLOR", getErrorStripeColor());
  int effectType = fromEffectType(getEffectType());
  if (effectType != 0) {
    JDOMExternalizerUtil.writeField(element, "EFFECT_TYPE", String.valueOf(effectType));
  }
  // todo additionalEffects are not serialized yet, we have no user-controlled additional effects
}
 
Example #9
Source File: AttributesFlyweight.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static AttributesFlyweight create(@Nonnull Element element) throws InvalidDataException {
  Color FOREGROUND = DefaultJDOMExternalizer.toColor(JDOMExternalizerUtil.readField(element, "FOREGROUND"));
  Color BACKGROUND = DefaultJDOMExternalizer.toColor(JDOMExternalizerUtil.readField(element, "BACKGROUND"));
  Color EFFECT_COLOR = DefaultJDOMExternalizer.toColor(JDOMExternalizerUtil.readField(element, "EFFECT_COLOR"));
  Color ERROR_STRIPE_COLOR = DefaultJDOMExternalizer.toColor(JDOMExternalizerUtil.readField(element, "ERROR_STRIPE_COLOR"));
  int fontType = DefaultJDOMExternalizer.toInt(JDOMExternalizerUtil.readField(element, "FONT_TYPE", "0"));
  if (fontType < 0 || fontType > 3) {
    fontType = 0;
  }
  int FONT_TYPE = fontType;
  int EFFECT_TYPE = DefaultJDOMExternalizer.toInt(JDOMExternalizerUtil.readField(element, "EFFECT_TYPE", "0"));
  // todo additionalEffects are not serialized yet, we have no user-controlled additional effects
  return create(FOREGROUND, BACKGROUND, FONT_TYPE, EFFECT_COLOR, toEffectType(EFFECT_TYPE), Collections.emptyMap(), ERROR_STRIPE_COLOR);
}
 
Example #10
Source File: ProjectFilesViewPane.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public void readExternal(@NotNull Element element) throws InvalidDataException {
  super.readExternal(element);
  final String showExcludedOption = JDOMExternalizerUtil.readField(element, SHOW_EXCLUDED_FILES_OPTION);
  myShowExcludedFiles = showExcludedOption == null || Boolean.parseBoolean(showExcludedOption);

  final String showOnlyLoadedOption = JDOMExternalizerUtil.readField(element, SHOW_ONLY_LOADED_FILES_OPTION);
  myShowOnlyLoadedFiles = showOnlyLoadedOption == null || Boolean.parseBoolean(showOnlyLoadedOption);
}
 
Example #11
Source File: BashRunConfiguration.java    From BashSupport with Apache License 2.0 5 votes vote down vote up
@Override
public void readExternal(Element element) throws InvalidDataException {
    PathMacroManager.getInstance(getProject()).expandPaths(element);
    super.readExternal(element);

    DefaultJDOMExternalizer.readExternal(this, element);
    readModule(element);
    EnvironmentVariablesComponent.readExternal(element, getEnvs());

    // common config
    interpreterOptions = JDOMExternalizerUtil.readField(element, "INTERPRETER_OPTIONS");
    interpreterPath = JDOMExternalizerUtil.readField(element, "INTERPRETER_PATH");
    workingDirectory = JDOMExternalizerUtil.readField(element, "WORKING_DIRECTORY");

    // 1.7.0 to 1.7.2 broke the run configs by defaulting to useProjectInterpreter, using field USE_PROJECT_INTERPRETER
    // we try to workaround for config saved by these versions by using another field and a smart fallback
    String useProjectInterpreterValue = JDOMExternalizerUtil.readField(element, "PROJECT_INTERPRETER");
    String oldUseProjectInterpreterValue = JDOMExternalizerUtil.readField(element, "USE_PROJECT_INTERPRETER");
    if (useProjectInterpreterValue != null) {
        useProjectInterpreter = Boolean.parseBoolean(useProjectInterpreterValue);
    } else if (StringUtils.isEmpty(interpreterPath) && oldUseProjectInterpreterValue != null) {
        // only use old "use project interpreter" setting when there's no interpreter in the run config and a configured project interpreter
        Project project = getProject();
        if (!BashProjectSettings.storedSettings(project).getProjectInterpreter().isEmpty()) {
            useProjectInterpreter = Boolean.parseBoolean(oldUseProjectInterpreterValue);
        }
    }

    String parentEnvValue = JDOMExternalizerUtil.readField(element, "PARENT_ENVS");
    if (parentEnvValue != null) {
        setPassParentEnvs(Boolean.parseBoolean(parentEnvValue));
    }

    // run config
    scriptName = JDOMExternalizerUtil.readField(element, "SCRIPT_NAME");
    setProgramParameters(JDOMExternalizerUtil.readField(element, "PARAMETERS"));
}
 
Example #12
Source File: WeaveConfiguration.java    From mule-intellij-plugins with Apache License 2.0 5 votes vote down vote up
@Override
public void writeExternal(Element element) throws WriteExternalException
{
    super.writeExternal(element);
    // Stores the values of this class into the parent
    JDOMExternalizerUtil.writeField(element, WEAVE_HOME_FIELD, this.getWeaveHome());
    JDOMExternalizerUtil.writeField(element, WEAVE_FILE, this.getWeaveFile());
    JDOMExternalizerUtil.writeField(element, WEAVE_OUTPUT, this.getWeaveOutput());
    JDOMExternalizerUtil.addChildren(element, WEAVE_INPUT, weaveInputs);
    getConfigurationModule().writeExternal(element);
}
 
Example #13
Source File: MuleRemoteConfiguration.java    From mule-intellij-plugins with Apache License 2.0 5 votes vote down vote up
@Override
public void writeExternal(Element element) throws WriteExternalException {
    super.writeExternal(element);
    // Stores the values of this class into the parent
    JDOMExternalizerUtil.writeField(element, HOST_PROP_NAME, this.host);
    JDOMExternalizerUtil.writeField(element, PORT_PROP_NAME, String.valueOf(this.port));
    JDOMExternalizerUtil.writeField(element, JVM_PORT_PROP_NAME, String.valueOf(this.jvmPort));
    JDOMExternalizerUtil.writeField(element, ISCUSTOMMAP_PROP_NAME, String.valueOf(isCustomAppsMap));

    if (modulesToAppsMap != null) {
        for (String moduleName : modulesToAppsMap.keySet()) {
            JDOMExternalizerUtil.writeField(element, MODULE_NAME_PREFIX + moduleName, modulesToAppsMap.get(moduleName));
        }
    }
}
 
Example #14
Source File: MuleConfiguration.java    From mule-intellij-plugins with Apache License 2.0 5 votes vote down vote up
@Override
public void readExternal(Element element) throws InvalidDataException
{
    super.readExternal(element);
    this.vmArgs = JDOMExternalizerUtil.readField(element, VM_ARGS_FIELD);
    this.muleHome = JDOMExternalizerUtil.readField(element, MULE_HOME_FIELD);
    this.clearData = JDOMExternalizerUtil.readField(element, CLEAR_DATA_FIELD);

    getConfigurationModule().readExternal(element);
}
 
Example #15
Source File: ProjectFilesViewPane.java    From intellij-pants-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public void writeExternal(Element element) throws WriteExternalException {
  super.writeExternal(element);
  JDOMExternalizerUtil.writeField(element, SHOW_EXCLUDED_FILES_OPTION, String.valueOf(myShowExcludedFiles));
  JDOMExternalizerUtil.writeField(element, SHOW_ONLY_LOADED_FILES_OPTION, String.valueOf(myShowOnlyLoadedFiles));
}
 
Example #16
Source File: HaskellTestRunConfiguration.java    From intellij-haskforce with Apache License 2.0 4 votes vote down vote up
@Override
public void readExternal(Element element) throws InvalidDataException {
    PathMacroManager.getInstance(getProject()).expandPaths(element);
    super.readExternal(element);
    programArguments = JDOMExternalizerUtil.readField(element, PROGRAM_ARGUMENTS);
}
 
Example #17
Source File: HaskellTestRunConfiguration.java    From intellij-haskforce with Apache License 2.0 4 votes vote down vote up
@Override
public void writeExternal(Element element) throws WriteExternalException {
    super.writeExternal(element);
    JDOMExternalizerUtil.writeField(element, PROGRAM_ARGUMENTS, programArguments);
    PathMacroManager.getInstance(getProject()).collapsePathsRecursively(element);
}
 
Example #18
Source File: HaskellApplicationRunConfiguration.java    From intellij-haskforce with Apache License 2.0 4 votes vote down vote up
@Override
public void readExternal(Element element) throws InvalidDataException {
    PathMacroManager.getInstance(getProject()).expandPaths(element);
    super.readExternal(element);
    programArguments = JDOMExternalizerUtil.readField(element, PROGRAM_ARGUMENTS);
}
 
Example #19
Source File: HaskellApplicationRunConfiguration.java    From intellij-haskforce with Apache License 2.0 4 votes vote down vote up
@Override
public void writeExternal(Element element) throws WriteExternalException {
    super.writeExternal(element);
    JDOMExternalizerUtil.writeField(element, PROGRAM_ARGUMENTS, programArguments);
    PathMacroManager.getInstance(getProject()).collapsePathsRecursively(element);
}
 
Example #20
Source File: HighlightSeverity.java    From consulo with Apache License 2.0 4 votes vote down vote up
public HighlightSeverity(@Nonnull Element element) {
  this(JDOMExternalizerUtil.readField(element, "myName"), Integer.valueOf(JDOMExternalizerUtil.readField(element, "myVal")));
}
 
Example #21
Source File: AttributesFlyweight.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static void writeColor(Element element, String fieldName, Color color) {
  if (color != null) {
    String string = Integer.toString(color.getRGB() & 0xFFFFFF, 16);
    JDOMExternalizerUtil.writeField(element, fieldName, string);
  }
}