fmorbini / scxmlgui

A graphical user interface for editing SCXML finite state machines.
Other
104 stars 37 forks source link

apostrophes showing as ' in an Executable content tab of an element editor window #73

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.create an edge with script that contain apostrophes (')
2.save to disk as scxml file and then open that file
3.open the edge editor and go to the Executable content tab...

What is the expected output? What do you see instead?
I want to see apostrophes ('), but I see the ' escape code instead

What version of the product are you using? On what operating system?
the latest I believe - I did "svn checkout 
http://scxmlgui.googlecode.com/svn/trunk/ scxmlgui-read-only" yesterday and 
build it. also happened when I downloaded the jar from this site..

Please provide any additional information below.
I was able to fix it by changing the code for the initDocument method inside 
com.mxgraph.examples.swing.editor.scxml.UndoJTextPane to be:

    protected void initDocument(String init) {
        if (init!=null) {
            //String initString[] =init.split("\n");
            try {/*
                for (int i = 0; i < initString.length; i ++) {
                    doc.insertString(doc.getLength(), strToInsert + newline,null);
                }*/
            doc.insertString(0,init.replaceAll("&#039;", "'"),null);
            } catch (BadLocationException ble) {
                System.err.println("Couldn't insert initial text.");
            }
        }
    }
but there's probably a more elegant solution....
Thank's!

Original issue reported on code.google.com by os...@google.com on 28 Jan 2014 at 8:18

GoogleCodeExporter commented 9 years ago

Original comment by fmorbini on 29 Jan 2014 at 6:43