EditorDocument doc = (EditorDocument) ed.document(); doc.copySelections(_tempFile, ed);
    public void doIt() {        BiosimEditor ed = (BiosimEditor) Globals.curEditor();        try {            Clipboard clipboard = ed.getJComponent().getToolkit()                    .getSystemClipboard();            Vector copies = ed.getSelectionManager().selections();            if (copies.size() > 0) {                if (_selection == null) {                    _tempFile = File.createTempFile("biosimEditor", ".tmp");                    _tempFile.deleteOnExit();                    _selection = new FileSelection(_tempFile);                }                EditorDocument doc = (EditorDocument) ed.document();                doc.copySelections(_tempFile, ed);                clipboard.setContents(_selection, this);            }        } catch (Exception e) {            e.printStackTrace();            JOptionPane.showMessageDialog(ed.findFrame(), "Copy failed.\n"                    + e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);        }    }