Java 类com.intellij.openapi.util.JDOMExternalizable 实例源码

项目:tools-idea    文件:ProjectRootUtil.java   
static Element write(ProjectRoot projectRoot) throws WriteExternalException {
  Element element = new Element(ELEMENT_ROOT);
  if (projectRoot instanceof SimpleProjectRoot) {
    element.setAttribute(ATTRIBUTE_TYPE, SIMPLE_ROOT);
    ((JDOMExternalizable)projectRoot).writeExternal(element);
  }
  else if (projectRoot instanceof CompositeProjectRoot) {
    element.setAttribute(ATTRIBUTE_TYPE, COMPOSITE_ROOT);
    ((CompositeProjectRoot)projectRoot).writeExternal(element);
  }
  else {
    throw new IllegalArgumentException("Wrong root: " + projectRoot);
  }

  return element;
}
项目:intellij-ce-playground    文件:DefaultStateSerializer.java   
@SuppressWarnings({"unchecked"})
@Nullable
public static <T> T deserializeState(@Nullable Element stateElement, Class <T> stateClass, @Nullable T mergeInto) {
  if (stateElement == null) {
    return mergeInto;
  }
  else if (stateClass == Element.class) {
    return (T)stateElement;
  }
  else if (JDOMExternalizable.class.isAssignableFrom(stateClass)) {
    if (mergeInto != null) {
      String elementText = JDOMUtil.writeElement(stateElement, "\n");
      LOG.error("State is " + stateClass.getName() + ", merge into is " + mergeInto.toString() + ", state element text is " + elementText);
    }

    T t = ReflectionUtil.newInstance(stateClass);
    try {
      ((JDOMExternalizable)t).readExternal(stateElement);
      return t;
    }
    catch (InvalidDataException e) {
      throw new RuntimeException(e);
    }
  }
  else if (mergeInto == null) {
    return XmlSerializer.deserialize(stateElement, stateClass);
  }
  else {
    XmlSerializer.deserializeInto(mergeInto, stateElement);
    return mergeInto;
  }
}
项目:consulo    文件:DefaultStateSerializer.java   
@Nullable
static Element serializeState(@Nonnull Object state, @Nullable final Storage storage) throws WriteExternalException {
  if (state instanceof Element) {
    return (Element)state;
  }
  else if (state instanceof JDOMExternalizable) {
    Element element = new Element("temp_element");
    ((JDOMExternalizable)state).writeExternal(element);
    return element;
  }
  else {
    return XmlSerializer.serializeIfNotDefault(state, new SkipDefaultValuesSerializationFilters());
  }
}
项目:consulo    文件:DefaultStateSerializer.java   
@SuppressWarnings({"unchecked"})
@Nullable
public static <T> T deserializeState(@Nullable Element stateElement, Class <T> stateClass, @Nullable T mergeInto) throws StateStorageException {
  if (stateElement == null) return mergeInto;

  if (stateClass.equals(Element.class)) {
    //assert mergeInto == null;
    return (T)stateElement;
  }
  else if (JDOMExternalizable.class.isAssignableFrom(stateClass)) {
    if (mergeInto != null) {
      String elementText = JDOMUtil.writeElement(stateElement, "\n");
      LOG.error("State is " + stateClass.getName() + ", merge into is " + mergeInto.toString() + ", state element text is " + elementText);
    }
    final T t = ReflectionUtil.newInstance(stateClass);
    try {
      ((JDOMExternalizable)t).readExternal(stateElement);
      return t;
    }
    catch (InvalidDataException e) {
      throw new StateStorageException(e);
    }
  }
  else if (mergeInto == null) {
    return XmlSerializer.deserialize(stateElement, stateClass);
  }
  else {
    XmlSerializer.deserializeInto(mergeInto, stateElement);
    return mergeInto;
  }
}
项目:intellij-ce-playground    文件:ExternalizablePropertyContainer.java   
/**
 * @deprecated
 */
public <T extends JDOMExternalizable> void  registerProperty(ListProperty<T> property, @NonNls String itemTagName, Factory<T> factory) {
  registerProperty(property, itemTagName, Externalizer.FactoryBased.create(factory));
}
项目:intellij-ce-playground    文件:Externalizer.java   
public static <T extends JDOMExternalizable> FactoryBased<T> create(Factory<T> factory) {
  return new FactoryBased<T>(factory);
}
项目:intellij-ce-playground    文件:OptionsImpl.java   
public void readExternal(Element element) throws InvalidDataException {
    ((JDOMExternalizable)editorOptions).readExternal(element);
    ((JDOMExternalizable)externalEditorOptions).readExternal(element);
}
项目:intellij-ce-playground    文件:OptionsImpl.java   
public void writeExternal(Element element) throws WriteExternalException {
    ((JDOMExternalizable)editorOptions).writeExternal(element);
    ((JDOMExternalizable)externalEditorOptions).writeExternal(element);
}
项目:intellij-ce-playground    文件:EditorOptionsImpl.java   
public void readExternal(Element element) throws InvalidDataException {
    ((JDOMExternalizable)gridOptions).readExternal(element);
    ((JDOMExternalizable)transparencyChessboardOptions).readExternal(element);
    ((JDOMExternalizable)zoomOptions).readExternal(element);
}
项目:intellij-ce-playground    文件:EditorOptionsImpl.java   
public void writeExternal(Element element) throws WriteExternalException {
    ((JDOMExternalizable)gridOptions).writeExternal(element);
    ((JDOMExternalizable)transparencyChessboardOptions).writeExternal(element);
    ((JDOMExternalizable)zoomOptions).writeExternal(element);
}
项目:intellij-ce-playground    文件:UIPropertyBinding.java   
public <T extends JDOMExternalizable> TableListBinding<T> bindList(JTable table, ColumnInfo[] columns, ListProperty<T> property) {
  final TableListBinding<T> binding = new TableListBinding<T>(table, columns, property);
  myBindings.add(binding);
  return binding;
}
项目:tools-idea    文件:Externalizer.java   
public static <T extends JDOMExternalizable> FactoryBased<T> create(Factory<T> factory) {
  return new FactoryBased<T>(factory);
}
项目:tools-idea    文件:OptionsImpl.java   
public void readExternal(Element element) throws InvalidDataException {
    ((JDOMExternalizable)editorOptions).readExternal(element);
    ((JDOMExternalizable)externalEditorOptions).readExternal(element);
}
项目:tools-idea    文件:OptionsImpl.java   
public void writeExternal(Element element) throws WriteExternalException {
    ((JDOMExternalizable)editorOptions).writeExternal(element);
    ((JDOMExternalizable)externalEditorOptions).writeExternal(element);
}
项目:tools-idea    文件:EditorOptionsImpl.java   
public void readExternal(Element element) throws InvalidDataException {
    ((JDOMExternalizable)gridOptions).readExternal(element);
    ((JDOMExternalizable)transparencyChessboardOptions).readExternal(element);
    ((JDOMExternalizable)zoomOptions).readExternal(element);
}
项目:tools-idea    文件:EditorOptionsImpl.java   
public void writeExternal(Element element) throws WriteExternalException {
    ((JDOMExternalizable)gridOptions).writeExternal(element);
    ((JDOMExternalizable)transparencyChessboardOptions).writeExternal(element);
    ((JDOMExternalizable)zoomOptions).writeExternal(element);
}
项目:tools-idea    文件:UIPropertyBinding.java   
public <T extends JDOMExternalizable> TableListBinding<T> bindList(JTable table, ColumnInfo[] columns, ListProperty<T> property) {
  final TableListBinding<T> binding = new TableListBinding<T>(table, columns, property);
  myBindings.add(binding);
  return binding;
}
项目:consulo-apache-ant    文件:UIPropertyBinding.java   
public <T extends JDOMExternalizable> TableListBinding<T> bindList(JTable table, ColumnInfo[] columns, ListProperty<T> property) {
  final TableListBinding<T> binding = new TableListBinding<T>(table, columns, property);
  myBindings.add(binding);
  return binding;
}
项目:consulo    文件:ExternalizablePropertyContainer.java   
/**
 * @deprecated
 */
public <T extends JDOMExternalizable> void  registerProperty(ListProperty<T> property, @NonNls String itemTagName, Factory<T> factory) {
  registerProperty(property, itemTagName, Externalizer.FactoryBased.create(factory));
}
项目:consulo    文件:Externalizer.java   
public static <T extends JDOMExternalizable> FactoryBased<T> create(Factory<T> factory) {
  return new FactoryBased<T>(factory);
}
项目:consulo    文件:JDOMExternalizableWrapper.java   
public JDOMExternalizableWrapper(JDOMExternalizable jdomExternalizable) {
  myJDOMExternalizable = jdomExternalizable;
}