Search in sources :

Example 1 with WriteExternalException

use of com.intellij.openapi.util.WriteExternalException in project intellij-community by JetBrains.

the class MavenProjectsNavigator method getState.

@Override
public MavenProjectsNavigatorState getState() {
    ApplicationManager.getApplication().assertIsDispatchThread();
    if (myStructure != null) {
        try {
            myState.treeState = new Element("root");
            TreeState.createOn(myTree).writeExternal(myState.treeState);
        } catch (WriteExternalException e) {
            MavenLog.LOG.warn(e);
        }
    }
    return myState;
}
Also used : Element(org.jdom.Element) WriteExternalException(com.intellij.openapi.util.WriteExternalException)

Example 2 with WriteExternalException

use of com.intellij.openapi.util.WriteExternalException in project intellij-community by JetBrains.

the class WorkingContextManager method saveContext.

public void saveContext(Element toElement) {
    for (WorkingContextProvider provider : Extensions.getExtensions(WorkingContextProvider.EP_NAME, myProject)) {
        try {
            Element child = new Element(provider.getId());
            provider.saveContext(child);
            toElement.addContent(child);
        } catch (WriteExternalException e) {
            LOG.error(e);
        }
    }
}
Also used : Element(org.jdom.Element) WriteExternalException(com.intellij.openapi.util.WriteExternalException)

Example 3 with WriteExternalException

use of com.intellij.openapi.util.WriteExternalException in project intellij-community by JetBrains.

the class ClientPropertiesManager method writeExternal.

public void writeExternal(Element element) throws WriteExternalException {
    if (equals(getDefaultManager())) {
        throw new WriteExternalException();
    }
    for (Map.Entry<String, List<ClientProperty>> entry : myPropertyMap.entrySet()) {
        Element propertiesElement = new Element(ELEMENT_PROPERTIES);
        propertiesElement.setAttribute(ATTRIBUTE_CLASS, entry.getKey());
        for (ClientProperty prop : entry.getValue()) {
            Element propertyElement = new Element(ELEMENT_PROPERTY);
            propertyElement.setAttribute(ATTRIBUTE_NAME, prop.getName());
            propertyElement.setAttribute(ATTRIBUTE_CLASS, prop.getValueClass());
            propertiesElement.addContent(propertyElement);
        }
        element.addContent(propertiesElement);
    }
}
Also used : Element(org.jdom.Element) WriteExternalException(com.intellij.openapi.util.WriteExternalException)

Example 4 with WriteExternalException

use of com.intellij.openapi.util.WriteExternalException in project intellij-community by JetBrains.

the class AntWorkspaceConfiguration method getState.

public Element getState() {
    try {
        final Element e = new Element("state");
        writeExternal(e);
        return e;
    } catch (WriteExternalException e1) {
        LOG.error(e1);
        return null;
    }
}
Also used : Element(org.jdom.Element) WriteExternalException(com.intellij.openapi.util.WriteExternalException)

Example 5 with WriteExternalException

use of com.intellij.openapi.util.WriteExternalException in project intellij-community by JetBrains.

the class ProjectLevelVcsManagerImpl method writeDirectoryMappings.

void writeDirectoryMappings(@NotNull Element element) {
    if (myProject.isDefault()) {
        element.setAttribute(ATTRIBUTE_DEFAULT_PROJECT, Boolean.TRUE.toString());
    }
    for (VcsDirectoryMapping mapping : getDirectoryMappings()) {
        VcsRootSettings rootSettings = mapping.getRootSettings();
        if (rootSettings == null && StringUtil.isEmpty(mapping.getDirectory()) && StringUtil.isEmpty(mapping.getVcs())) {
            continue;
        }
        Element child = new Element(ELEMENT_MAPPING);
        child.setAttribute(ATTRIBUTE_DIRECTORY, mapping.getDirectory());
        child.setAttribute(ATTRIBUTE_VCS, mapping.getVcs());
        if (rootSettings != null) {
            Element rootSettingsElement = new Element(ELEMENT_ROOT_SETTINGS);
            rootSettingsElement.setAttribute(ATTRIBUTE_CLASS, rootSettings.getClass().getName());
            try {
                rootSettings.writeExternal(rootSettingsElement);
                child.addContent(rootSettingsElement);
            } catch (WriteExternalException e) {
            // don't add element
            }
        }
        element.addContent(child);
    }
}
Also used : Element(org.jdom.Element) WriteExternalException(com.intellij.openapi.util.WriteExternalException)

Aggregations

WriteExternalException (com.intellij.openapi.util.WriteExternalException)27 Element (org.jdom.Element)27 InvalidDataException (com.intellij.openapi.util.InvalidDataException)7 Nullable (org.jetbrains.annotations.Nullable)5 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)2 PsiElement (com.intellij.psi.PsiElement)2 NonNls (org.jetbrains.annotations.NonNls)2 NotNull (org.jetbrains.annotations.NotNull)2 ExecutionException (com.intellij.execution.ExecutionException)1 Executor (com.intellij.execution.Executor)1 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)1 ConfigurationContext (com.intellij.execution.actions.ConfigurationContext)1 ConfigurationFromContext (com.intellij.execution.actions.ConfigurationFromContext)1 ConfigurationFactory (com.intellij.execution.configurations.ConfigurationFactory)1 ConfigurationType (com.intellij.execution.configurations.ConfigurationType)1 LocatableConfiguration (com.intellij.execution.configurations.LocatableConfiguration)1 LocatableConfigurationBase (com.intellij.execution.configurations.LocatableConfigurationBase)1 RunProfileState (com.intellij.execution.configurations.RunProfileState)1 RuntimeConfigurationException (com.intellij.execution.configurations.RuntimeConfigurationException)1 ExecutionEnvironment (com.intellij.execution.runners.ExecutionEnvironment)1