public void write(XMLWriter writer, Context params) {
try {
// Init context
MutableContext context = new DefaultMutableContext();
context.put(ToolWindowManager.class, manager);
// Start document
writer.startDocument();
// Write header
AttributesImpl mydoggyAttributes = new AttributesImpl();
mydoggyAttributes.addAttribute(null, "version", null, null, "1.4.2");
mydoggyAttributes.addAttribute(null, "contentManagerEnabled", null, null,
String.valueOf(manager.getContentManager().isEnabled()));
writer.startElement("mydoggy", mydoggyAttributes);
// Write ToolWindows
writer.startElement("toolWindows");
for (ToolWindow toolWindow : manager.getToolWindows()) {
context.put(ToolWindow.class, toolWindow);
getElementWriter(ToolWindow.class).write(writer, context);
}
writer.endElement("toolWindows");
// Write ToolWindowManagerDescriptor
context.put(ToolWindowManagerDescriptor.class, manager.getToolWindowManagerDescriptor());
getElementWriter(ToolWindowManagerDescriptor.class).write(writer, context);
// Write ContentManagerUI
context.put(ContentManager.class, manager.getContentManager());
context.put(ContentManagerUI.class, manager.getContentManager().getContentManagerUI());
ContentManager contentManager = manager.getContentManager();
writer.startElement("contentManagerUI");
getElementWriter(contentManager.getContentManagerUI().getClass()).write(writer, context);
writer.endElement("contentManagerUI");