This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 199699 - undo problems in properties editor; exceptions and erratic behavior
Summary: undo problems in properties editor; exceptions and erratic behavior
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Property Editors (show other bugs)
Version: 7.0
Hardware: All All
: P2 normal (vote)
Assignee: Miloslav Metelka
URL:
Keywords: REGRESSION
Depends on: 199568
Blocks: 179047
  Show dependency tree
 
Reported: 2011-06-26 02:39 UTC by err
Modified: 2011-12-02 16:43 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
bug fix (2.38 KB, patch)
2011-11-30 18:32 UTC, err
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description err 2011-06-26 02:39:57 UTC
This is probably a jVi only problem (but not necessarily).

PropertiesEditorSupport does
        UndoRedoStampFlagManager extends UndoRedo.Manager
and returns one for createUndoRedoManager.

jVi's use of the UndoableEdits BEGIN/END_COMMIT_GROUP end up becoming edits in an UndoRedoStampFlagManager (rather than being used for control). There's a bug with that which happens since these edits are singletons which hold state depending on how they are used. They are intended to be innocuous as edits.

These edits always return true for isSignificant(), but that's not enough to make them reusable, the fix is to also have these control edits always return true for canUndo/canRedo in CloneableEditorSupport$UndoGroupManager$CommitGroupEdit.

I've added this fix to the patch for bug Bug 199568.

=== example exception
javax.swing.undo.CannotUndoException
	at javax.swing.undo.AbstractUndoableEdit.undo
           (AbstractUndoableEdit.java:93)
	at javax.swing.undo.UndoManager.undoTo(UndoManager.java:320)
	at javax.swing.undo.UndoManager.undo(UndoManager.java:398)
	at org.openide.awt.UndoRedo$Manager.undo(UndoRedo.java:184)
	at org.netbeans.modules.properties
           .PropertiesEditorSupport$UndoRedoStampFlagManager
           .undo(PropertiesEditorSupport.java:1351)
[catch] at org.openide.actions.UndoAction.performAction(UndoAction.java:185)
Comment 1 err 2011-07-17 15:14:14 UTC
Fixed by commit for Bug 199568 "Integrated as ergonomics#971cca9637b5"
Comment 2 err 2011-11-30 16:46:00 UTC
Reopening. The fix for Bug 21237 has reintroduced this issue.

I'll post a patch later today.

The exception hasn't changed much

javax.swing.undo.CannotUndoException
        at javax.swing.undo.AbstractUndoableEdit.undo
                (AbstractUndoableEdit.java:93)
        at javax.swing.undo.CompoundEdit.undo(CompoundEdit.java:42)
        at javax.swing.undo.UndoManager.undoTo(UndoManager.java:320)
        at javax.swing.undo.UndoManager.undo(UndoManager.java:398)
        at org.openide.awt.UndoRedo$Manager.undo(UndoRedo.java:161)
        at org.netbeans.modules.properties
                .PropertiesEditorSupport$UndoRedoStampFlagManager
                .undo(PropertiesEditorSupport.java:1532)
        at org.netbeans.core.multiview
                .MultiViewPeer$DelegateUndoRedo.undo(MultiViewPeer.java:813)
[catch] at org.openide.actions.UndoAction.performAction(UndoAction.java:185)
Comment 3 err 2011-11-30 18:32:48 UTC
Created attachment 113672 [details]
bug fix

Mila,

The attached patch fixes the *_COMMIT_GROUP special edits. I also used it for the SAVEPOINT special edit but it might not be appropriate for that. If savepoint depends on canRedo() and canUndo() flipping around, then the fix is not correct for it.

I can rework the patch, if you'd like.
Comment 4 Miloslav Metelka 2011-12-01 13:49:00 UTC
Thanks for the patch, Ernie. It's fine for SAVEPOINT too it's just a marker value.http://hg.netbeans.org/jet-main/rev/e01de0f11813
Comment 5 Miloslav Metelka 2011-12-01 15:38:13 UTC
Integrated into release71:
e01de0f11813 transplanted to 3503f47f7613
Comment 6 Quality Engineering 2011-12-02 07:56:03 UTC
Integrated into 'releases'
Changeset: http://hg.netbeans.org/releases/rev/3503f47f7613
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #199699 - undo problems in properties editor; exceptions and erratic behavior.
(transplanted from e01de0f118132500d4a5511a0f1f13f584d00d83)
Comment 7 Quality Engineering 2011-12-02 16:43:27 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/e01de0f11813
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #199699 - undo problems in properties editor; exceptions and erratic behavior.