ui/src/main/java/ucar/nc2/ui/op/NcmlEditor.java
void doTransform(String text) {
        try {
            final StringReader reader = new StringReader(text);
            final NetcdfDataset ncd = NcMLReader.readNcML(reader, null);
            final StringWriter sw = new StringWriter(10000);
            ncd.writeNcML(sw, null);
            editor.setText(sw.toString());
            editor.setCaretPosition(0);
            JOptionPane.showMessageDialog(this, "File successfully transformed");
        }
        catch (IOException ioe) {
            JOptionPane.showMessageDialog(this, "ERROR: " + ioe.getMessage());
            ioe.printStackTrace();
        }
    }
void doTransform(String text) {
        try {
            final StringReader reader = new StringReader(text);
            final NetcdfDataset ncd = NcMLReader.readNcML(reader, null);
            final StringWriter sw = new StringWriter(10000);
            ncd.writeNcML(sw, null);
            editor.setText(sw.toString());
            editor.setCaretPosition(0);
            JOptionPane.showMessageDialog(this, "File successfully transformed");
        }
        catch (IOException ioe) {
            JOptionPane.showMessageDialog(this, "ERROR: " + ioe.getMessage());
            ioe.printStackTrace();
        }
    }
void doTransform ( String text ) { try { final StringReader reader = new StringReader ( text ) ; final NetcdfDataset ncd = NcMLReader . readNcML ( reader , null ) ; final StringWriter sw = new StringWriter ( 10000 ) ; ncd . writeNcML ( sw , null ) ; editor . setText ( sw . toString ( ) ) ; editor . setCaretPosition ( 0 ) ; JOptionPane . showMessageDialog ( this , "File successfully transformed" ) ; } catch ( IOException ioe ) { JOptionPane . showMessageDialog ( this , "ERROR: " + ioe . getMessage ( ) ) ; ioe . printStackTrace ( ) ; } }
Read text from textArea through NcMLReader
then write it back out via resulting dataset
Read text from textArea through NcMLReader then write it back out via resulting dataset