DelayUndoManager should synchronize with Undo/Redo Actions

This forum is used by users to request and discuss new product features. Please do not use this forum for technical support including bug reports.

Moderator: JIDE Support

Forum rules
Product suggestions only. Please do not use this forum for technical support including bug reports.

DelayUndoManager should synchronize with Undo/Redo Actions

Postby drampulla » Wed Feb 06, 2008 7:24 am

It would be nice if the DelayUndoManager provided some standard undo and redo Actions (in much the same way that Cut/Copy/Paste are provided in the DefaultEditorKit). I would expect these actions to update the NAME, LONG_DESCRIPTION, SHORT_DESCRIPTION, and the enabled status of the Action. This way the menu/toolbars always appear updated correctly.

I tried to implement this myself, but found that if I check canUndo or getUndoPresentationName before the DelayUndoManager's timer goes off, the DelayUndoManager will prematurely commit the edits (which defeats the purpose of using the DelayUndoManager in the first place). My only other option is to re-write your DelayUndoManager myself to coordinate the actions better. I don't like re-writing things other people already wrote :)

I believe if you provided these actions (and a way to easily customize the other attributes of the action like menumonic, accelerator, and icon), your DelayUndoManager would be much easier to use and provide menus/toolbars that work great.
drampulla
 
Posts: 25
Joined: Mon Apr 30, 2007 6:32 am

Postby JIDE Support » Wed Feb 06, 2008 10:11 am

We have to commit the pending UndoableEdit whenever you do something including a query such as canUndo. Maybe you can try to override commitCache. Call super first then update the name etc. However I wonder how you get the name and description? Each undo includes several UndoableEdits. How do you come up with a name for all of them?
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Postby drampulla » Wed Feb 06, 2008 12:28 pm

Overriding commitCache has a problem of StackOverflow because I'm calling getUndoPresentationName or canUndo in it.

Code: Select all
    public class MyUndoManager extends DelayUndoManager {

        @Override
        public synchronized void commitCache() {
            super.commitCache();
            super.getUndoPresentationName();
        }       
    }


As for the name for all the edits, I was assuming that you guys were providing something meaningful in the getUndoPresentationName method.
drampulla
 
Posts: 25
Joined: Mon Apr 30, 2007 6:32 am

Postby JIDE Support » Wed Feb 06, 2008 3:05 pm

The default presentation name is something like "Undo addition" or "Undo deletion". CompoundEdit will just use the last presentation name as its presentation name. This reminds me maybe DelayUndoManager should only group the undoable edit if they have the same presentation name.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am


Return to Product Suggestions

Who is online

Users browsing this forum: No registered users and 8 guests

cron