本文整理汇总了Java中com.intellij.openapi.util.JDOMExternalizable类的典型用法代码示例。如果您正苦于以下问题:Java JDOMExternalizable类的具体用法?Java JDOMExternalizable怎么用?Java JDOMExternalizable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JDOMExternalizable类属于com.intellij.openapi.util包,在下文中一共展示了JDOMExternalizable类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: write
import com.intellij.openapi.util.JDOMExternalizable; //导入依赖的package包/类
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;
}
示例2: deserializeState
import com.intellij.openapi.util.JDOMExternalizable; //导入依赖的package包/类
@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;
}
}
示例3: serializeState
import com.intellij.openapi.util.JDOMExternalizable; //导入依赖的package包/类
@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());
}
}
示例4: deserializeState
import com.intellij.openapi.util.JDOMExternalizable; //导入依赖的package包/类
@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;
}
}
示例5: registerProperty
import com.intellij.openapi.util.JDOMExternalizable; //导入依赖的package包/类
/**
* @deprecated
*/
public <T extends JDOMExternalizable> void registerProperty(ListProperty<T> property, @NonNls String itemTagName, Factory<T> factory) {
registerProperty(property, itemTagName, Externalizer.FactoryBased.create(factory));
}
示例6: create
import com.intellij.openapi.util.JDOMExternalizable; //导入依赖的package包/类
public static <T extends JDOMExternalizable> FactoryBased<T> create(Factory<T> factory) {
return new FactoryBased<T>(factory);
}
示例7: readExternal
import com.intellij.openapi.util.JDOMExternalizable; //导入依赖的package包/类
public void readExternal(Element element) throws InvalidDataException {
((JDOMExternalizable)editorOptions).readExternal(element);
((JDOMExternalizable)externalEditorOptions).readExternal(element);
}
示例8: writeExternal
import com.intellij.openapi.util.JDOMExternalizable; //导入依赖的package包/类
public void writeExternal(Element element) throws WriteExternalException {
((JDOMExternalizable)editorOptions).writeExternal(element);
((JDOMExternalizable)externalEditorOptions).writeExternal(element);
}
示例9: readExternal
import com.intellij.openapi.util.JDOMExternalizable; //导入依赖的package包/类
public void readExternal(Element element) throws InvalidDataException {
((JDOMExternalizable)gridOptions).readExternal(element);
((JDOMExternalizable)transparencyChessboardOptions).readExternal(element);
((JDOMExternalizable)zoomOptions).readExternal(element);
}
示例10: writeExternal
import com.intellij.openapi.util.JDOMExternalizable; //导入依赖的package包/类
public void writeExternal(Element element) throws WriteExternalException {
((JDOMExternalizable)gridOptions).writeExternal(element);
((JDOMExternalizable)transparencyChessboardOptions).writeExternal(element);
((JDOMExternalizable)zoomOptions).writeExternal(element);
}
示例11: bindList
import com.intellij.openapi.util.JDOMExternalizable; //导入依赖的package包/类
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;
}
示例12: JDOMExternalizableWrapper
import com.intellij.openapi.util.JDOMExternalizable; //导入依赖的package包/类
public JDOMExternalizableWrapper(JDOMExternalizable jdomExternalizable) {
myJDOMExternalizable = jdomExternalizable;
}