Search in sources :

Example 6 with FileEditorState

use of com.intellij.openapi.fileEditor.FileEditorState in project intellij-community by JetBrains.

the class HistoryEntry method writeExternal.

/**
   * @return element that was added to the {@code element}.
   * Returned element has tag {@link #TAG}. Never null.
   */
public Element writeExternal(Element element, Project project) {
    Element e = new Element(TAG);
    element.addContent(e);
    e.setAttribute(FILE_ATTR, myFilePointer.getUrl());
    for (final Map.Entry<FileEditorProvider, FileEditorState> entry : myProvider2State.entrySet()) {
        FileEditorProvider provider = entry.getKey();
        Element providerElement = new Element(PROVIDER_ELEMENT);
        if (provider.equals(mySelectedProvider)) {
            providerElement.setAttribute(SELECTED_ATTR_VALUE, Boolean.TRUE.toString());
        }
        providerElement.setAttribute(EDITOR_TYPE_ID_ATTR, provider.getEditorTypeId());
        Element stateElement = new Element(STATE_ELEMENT);
        providerElement.addContent(stateElement);
        provider.writeState(entry.getValue(), project, stateElement);
        e.addContent(providerElement);
    }
    return e;
}
Also used : FileEditorProvider(com.intellij.openapi.fileEditor.FileEditorProvider) Element(org.jdom.Element) HashMap(com.intellij.util.containers.HashMap) Map(java.util.Map) FileEditorState(com.intellij.openapi.fileEditor.FileEditorState)

Aggregations

FileEditorState (com.intellij.openapi.fileEditor.FileEditorState)6 FileEditorProvider (com.intellij.openapi.fileEditor.FileEditorProvider)5 NotNull (org.jetbrains.annotations.NotNull)4 VirtualFilePointer (com.intellij.openapi.vfs.pointers.VirtualFilePointer)3 Disposable (com.intellij.openapi.Disposable)2 Element (org.jdom.Element)2 InvalidDataException (com.intellij.openapi.util.InvalidDataException)1 Pair (com.intellij.openapi.util.Pair)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 LightFilePointer (com.intellij.openapi.vfs.impl.LightFilePointer)1 HashMap (com.intellij.util.containers.HashMap)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1