[kepler-dev] text area undo/redo

Christopher Brooks cxh at eecs.berkeley.edu
Fri Mar 28 12:50:04 PDT 2008

Hi Ben,
[I've cc'd Ian Brown from HSBC on this because HSBC is now a CHESS
sponsor and thus funding some work in this area.]

These changes sound reasonable to me for the ptII devel trunk.

There is a similar bug that came out of discussions with Ian:
"Editing Python Scripts is difficult"

There is this larger question though:  We could spend effort on trying
to make a good editor out of TextEditor, or we could solve this
problem in other ways.
I see several possibilities:
1) Enhance TextEditor et al.
     - This is not much effort, but developing a full editor is real work.
     Edward and I did this with Tycho using Tcl/Tk.  The problem is
     that people want more and more features (syntax highlighting,
     syntax checking, jump from stack trace)
2) Find something better and add it to the ptII tree
     - More work, but we end up with something that is probably so so.

3) Provide an interface to an arbitrary editor (Netbeans, Eclipse, Emacs)
     - The interface to Emacs sort of works
     - I'm not sure if this is possible for Netbeans and Eclipse
4) Interface to something like Netbeans or Eclipse
     - This is lots of work, and ties us to one program.  However, it
     seems like an eventual goal.

Anyway, enhancing TextEditor seems reasonable.

There are also issues concerning modal dialogs.  Personally, I really
don't like the modal dialog we use for editing parameters.  It makes
it impossible to compare parameters between two actors.  However, 
because of various reasons surrounding parameter evaluation, we have
modal dialogs.  It sounds like we are talking about leaving the Python
code open as a non-modal window?  My concern here is that this might
cause other problems.  I'm not sure about this though.

Anyway, I say go for checking the changes in.  These changes will
probably not appear in the ptII rel-7-0-beta-2 branch.  I'm only
folding bug fixes into the rel-7-0-beta-2 branch.  This is a rather
nice enhancment, not a bug in current functionality.  That said, we
could start a ptII branch for these and other enhancements that would
be used as for the Kepler 1.0 release.


    After looking at this again, I realized it could be made even more  
    generic by creating the UndoableEditListener implementation as a  
    regular class (not inner).  That way the ptolemy.actor.gui.TextEditor  
    can make use of the same code.  The PythonScript actor seems to makes  
    use of the TextEditor when you "Configure Actor" (from the context  
    menu).  It would be nice to provide the undo feature there, too.
    We could also do something similar with the RExpression actor (but  
    instead use the text editor when "Open Actor" is invoked).  Using the  
    editor for R would address a few concerns we've heard about the  
    current editing window being too small and also demanding window focus  
    until the text changes were "committed".
    See http://bugzilla.ecoinformatics.org/show_bug.cgi?id=3186 and http://bugz
    On Mar 27, 2008, at 11:02 AM, Chad Berkley wrote:
    > Sounds like a great change to me.  Christopher, any objections?
    > chad
    > ben leinfelder wrote:
    >> Hi all,
    >> There's been a request to add an "undo" feature when editing  
    >> scripts  in the RExpression actor.  See http://bugzilla.ecoinformatics.o
    >> Locally, I have implemented an UndoableEditListener for the  
    >> JTextArea  that is used in ptolemy.gui.Query along with some  
    >> supporting inner  classes to facilitate the undoing and redoing of  
    >> text edits.  This  change would cascade to all actors when editing  
    >> their parameters.   While it seems like a useful feature to  
    >> provide, it is in a ptII class  and therefore should probably be  
    >> reviewed by the larger community.
    >> I've used the standard Ctrl+Z and Ctrl+Y shortcut mappings for  
    >> undo  and redo respectively.  And yes, "Ctrl" translates to "open  
    >> apple/ command" key on the Mac.
    >> Does anyone object to including this change?
    >> Thanks,
    >> -ben
    >> _______________________________________________
    >> Kepler-dev mailing list
    >> Kepler-dev at ecoinformatics.org
    >> http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/kepler-dev
    Kepler-dev mailing list
    Kepler-dev at ecoinformatics.org

More information about the Kepler-dev mailing list