Search in sources :

Example 96 with Element

use of org.jdom.Element 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 97 with Element

use of org.jdom.Element in project intellij-community by JetBrains.

the class XDebuggerBreakpointsContextProvider method saveContext.

@Override
public void saveContext(Element toElement) throws WriteExternalException {
    XBreakpointManagerImpl.BreakpointManagerState state = myBreakpointManager.getState();
    Element serialize = XmlSerializer.serialize(state, new SerializationFilter() {

        @Override
        public boolean accepts(@NotNull Accessor accessor, @NotNull Object bean) {
            return accessor.read(bean) != null;
        }
    });
    toElement.addContent(serialize.removeContent());
}
Also used : SerializationFilter(com.intellij.util.xmlb.SerializationFilter) Element(org.jdom.Element) Accessor(com.intellij.util.xmlb.Accessor) XBreakpointManagerImpl(com.intellij.xdebugger.impl.breakpoints.XBreakpointManagerImpl)

Example 98 with Element

use of org.jdom.Element in project intellij-community by JetBrains.

the class XDebuggerWatchesProvider method saveContext.

@Override
public void saveContext(Element toElement) throws WriteExternalException {
    XDebuggerWatchesManager.WatchesManagerState state = myWatchesManager.getState();
    Element serialize = XmlSerializer.serialize(state, new SerializationFilter() {

        @Override
        public boolean accepts(@NotNull Accessor accessor, @NotNull Object bean) {
            return accessor.read(bean) != null;
        }
    });
    toElement.addContent(serialize.removeContent());
}
Also used : XDebuggerWatchesManager(com.intellij.xdebugger.impl.XDebuggerWatchesManager) SerializationFilter(com.intellij.util.xmlb.SerializationFilter) Element(org.jdom.Element) Accessor(com.intellij.util.xmlb.Accessor)

Example 99 with Element

use of org.jdom.Element in project intellij-community by JetBrains.

the class TaskManagerImpl method loadState.

public void loadState(Config config) {
    XmlSerializerUtil.copyBean(config, myConfig);
    myRepositories.clear();
    Element element = config.servers;
    List<TaskRepository> repositories = loadRepositories(element);
    myRepositories.addAll(repositories);
    myTasks.clear();
    for (LocalTaskImpl task : config.tasks) {
        if (task.getRepository() == null) {
            // restore repository from url
            String url = task.getIssueUrl();
            if (url != null) {
                for (TaskRepository repository : repositories) {
                    if (repository.getUrl() != null && url.startsWith(repository.getUrl())) {
                        task.setRepository(repository);
                    }
                }
            }
        }
        addTask(task);
    }
}
Also used : Element(org.jdom.Element)

Example 100 with Element

use of org.jdom.Element in project intellij-community by JetBrains.

the class JiraLegacyApi method processRSS.

private List<Task> processRSS(@NotNull GetMethod method) throws Exception {
    // Basic authorization should be enough
    int code = myRepository.getHttpClient().executeMethod(method);
    if (code != HttpStatus.SC_OK) {
        throw new Exception(TaskBundle.message("failure.http.error", code, method.getStatusText()));
    }
    Element root = new SAXBuilder(false).build(method.getResponseBodyAsStream()).getRootElement();
    Element channel = root.getChild("channel");
    if (channel != null) {
        List<Element> children = channel.getChildren("item");
        LOG.debug("Total issues in JIRA RSS feed: " + children.size());
        return ContainerUtil.map(children, element -> new JiraSoapTask(element, myRepository));
    } else {
        LOG.warn("JIRA channel not found");
    }
    return ContainerUtil.emptyList();
}
Also used : SAXBuilder(org.jdom.input.SAXBuilder) Element(org.jdom.Element)

Aggregations

Element (org.jdom.Element)1236 NotNull (org.jetbrains.annotations.NotNull)103 Nullable (org.jetbrains.annotations.Nullable)98 IOException (java.io.IOException)81 ArrayList (java.util.ArrayList)76 List (java.util.List)70 VirtualFile (com.intellij.openapi.vfs.VirtualFile)67 Document (org.jdom.Document)67 File (java.io.File)64 JDOMException (org.jdom.JDOMException)53 PsiElement (com.intellij.psi.PsiElement)44 SAXBuilder (org.jdom.input.SAXBuilder)40 Attribute (org.jdom.Attribute)32 Iterator (java.util.Iterator)31 InvalidDataException (com.intellij.openapi.util.InvalidDataException)30 WriteExternalException (com.intellij.openapi.util.WriteExternalException)30 THashMap (gnu.trove.THashMap)30 XMLOutputter (org.jdom.output.XMLOutputter)27 JpsElement (org.jetbrains.jps.model.JpsElement)24 NonNls (org.jetbrains.annotations.NonNls)22