Search in sources :

Example 6 with XMLOutputter

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

the class CommonEditActionsProvider method doCopy.

private boolean doCopy(DataContext dataContext) {
    try {
        Element root = new Element("designer");
        root.setAttribute("target", myDesigner.getPlatformTarget());
        List<RadComponent> components = RadComponent.getPureSelection(getArea(dataContext).getSelection());
        RadComponent rootComponent = myDesigner.getRootComponent();
        if (rootComponent instanceof IComponentCopyProvider) {
            IComponentCopyProvider copyProvider = (IComponentCopyProvider) rootComponent;
            copyProvider.copyTo(root, components);
        } else {
            for (RadComponent component : components) {
                component.copyTo(root);
            }
        }
        SerializedComponentData data = new SerializedComponentData(new XMLOutputter().outputString(root));
        CopyPasteManager.getInstance().setContents(new SimpleTransferable(data, DATA_FLAVOR));
        return true;
    } catch (Throwable e) {
        myDesigner.showError("Copy error", e);
        return false;
    }
}
Also used : XMLOutputter(org.jdom.output.XMLOutputter) SerializedComponentData(com.intellij.uiDesigner.SerializedComponentData) SimpleTransferable(com.intellij.designer.clipboard.SimpleTransferable) Element(org.jdom.Element) RadComponent(com.intellij.designer.model.RadComponent) IComponentCopyProvider(com.intellij.designer.model.IComponentCopyProvider)

Example 7 with XMLOutputter

use of org.jdom.output.XMLOutputter in project maven-plugins by apache.

the class MavenJDOMWriter method write.

// -- void updateSite(Site, String, Counter, Element)
/**
     * Method write
     *
     * @param project
     * @param stream
     * @param document
     * @deprecated
     */
public void write(Model project, Document document, OutputStream stream) throws java.io.IOException {
    updateModel(project, "project", new Counter(0), document.getRootElement());
    XMLOutputter outputter = new XMLOutputter();
    Format format = Format.getPrettyFormat();
    format.setIndent("    ").setLineSeparator(System.getProperty("line.separator"));
    outputter.setFormat(format);
    outputter.output(document, stream);
}
Also used : XMLOutputter(org.jdom.output.XMLOutputter) Format(org.jdom.output.Format)

Example 8 with XMLOutputter

use of org.jdom.output.XMLOutputter in project maven-plugins by apache.

the class MavenJDOMWriter method write.

// -- void write(Model, Document, OutputStreamWriter)
/**
     * Method write
     *
     * @param project
     * @param jdomFormat
     * @param writer
     * @param document
     */
public void write(Model project, Document document, Writer writer, Format jdomFormat) throws java.io.IOException {
    updateModel(project, "project", new Counter(0), document.getRootElement());
    XMLOutputter outputter = new XMLOutputter();
    outputter.setFormat(jdomFormat);
    outputter.output(document, writer);
}
Also used : XMLOutputter(org.jdom.output.XMLOutputter)

Example 9 with XMLOutputter

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

the class ArrangementSettingsSerializationTest method assertXmlOutputEquals.

private static void assertXmlOutputEquals(String expected, Element root) throws IOException {
    StringWriter writer = new StringWriter();
    Format format = Format.getPrettyFormat();
    format.setLineSeparator("\n");
    new XMLOutputter(format).output(root, writer);
    String actual = writer.toString();
    assertEquals(expected, actual);
}
Also used : XMLOutputter(org.jdom.output.XMLOutputter) Format(org.jdom.output.Format) StringWriter(java.io.StringWriter)

Example 10 with XMLOutputter

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

the class SerializableSchemeExporter method writeToStream.

private static void writeToStream(@NotNull OutputStream outputStream, @NotNull Element element) throws IOException {
    OutputStreamWriter writer = new OutputStreamWriter(outputStream);
    Format format = Format.getPrettyFormat();
    format.setLineSeparator("\n");
    new XMLOutputter(format).output(element, writer);
}
Also used : XMLOutputter(org.jdom.output.XMLOutputter) Format(org.jdom.output.Format) OutputStreamWriter(java.io.OutputStreamWriter)

Aggregations

XMLOutputter (org.jdom.output.XMLOutputter)48 Element (org.jdom.Element)27 Document (org.jdom.Document)16 Format (org.jdom.output.Format)16 IOException (java.io.IOException)15 StringWriter (java.io.StringWriter)13 SAXBuilder (org.jdom.input.SAXBuilder)6 Writer (java.io.Writer)5 ArrayList (java.util.ArrayList)5 StringReader (java.io.StringReader)4 List (java.util.List)3 TreeMap (java.util.TreeMap)3 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)3 JDOMException (org.jdom.JDOMException)3 ElementFilter (org.jdom.filter.ElementFilter)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 FileOutputStream (java.io.FileOutputStream)2 DateFormat (java.text.DateFormat)2 SimpleDateFormat (java.text.SimpleDateFormat)2