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 100751 - Undo doesn't work in code customizer.
Summary: Undo doesn't work in code customizer.
Status: NEW
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All Windows Vista
: P4 blocker (vote)
Assignee: issues@guibuilder
URL:
Keywords:
: 101363 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-04-12 10:20 UTC by novakm
Modified: 2010-08-25 11:27 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description novakm 2007-04-12 10:20:43 UTC
If you make any change to the code using code customizer, you cannot undo your
action, the shortcut doesn't work.

NetBeans IDE Dev (Build 200704111800)
1.5.0_12; Java HotSpot(TM) Client VM 1.5.0_12-b02
Windows Vista version 6.0 running on x86
en_GB (nb); Cp1252
Comment 1 Tomas Pavek 2007-07-13 14:05:01 UTC
*** Issue 101363 has been marked as a duplicate of this issue. ***
Comment 2 Tomas Pavek 2007-07-13 14:46:23 UTC
The undo action is applied on the selected TopComponent under the dialog (i.e. the form editor), not in the editor
component itself.

Asking editor guys for evaluation - can I do something to make the embedded editor handle undo/redo "locally", or is it
a problem in editor?
Comment 3 Vitezslav Stejskal 2007-07-25 12:27:30 UTC
IMO undo/redo extend CallbackSystemAction and are registered globally from core. The editor attaches performers for each
standard editor component. You will probably have to do the same for your code customizers. This might help:
http://bits.netbeans.org/download/6.0/nightly/latest/javadoc/org-openide-util/org/openide/util/actions/CallbackSystemAction.html#setActionPerformer(org.openide.util.actions.ActionPerformer)
Comment 4 Tomas Pavek 2007-07-26 16:27:36 UTC
Well, the undo/redo actions are not CallbackSystemAction. The problem is the editor registers its own actions in the
editor pane's keymap that call the global undo/redo actions that look for undo manager in active TopComponent. I've
hacked this by removing these actions from the keymap and registering the basic ones from editor's ActionFactory which
work with undo manager attached to the document.

Hopefully editor will support better way of creating editor components embedded in dialogs one day. The number of hacks
everyone interested must discover and implement would deserve it.

I'm marking this issue as fixed - undo/redo works (for now).


/cvs/form/src/org/netbeans/modules/form/FormEditor.java
new revision: 1.106; previous revision: 1.105
/cvs/form/src/org/netbeans/modules/form/CustomCodeView.java
new revision: 1.4; previous revision: 1.3
/cvs/form/src/org/netbeans/modules/form/FormUtils.java
new revision: 1.131; previous revision: 1.130
/cvs/form/src/org/netbeans/modules/form/CodeCustomizer.java
new revision: 1.3; previous revision: 1.2
/cvs/form/src/org/netbeans/modules/form/editors/CustomCodeEditor.java
new revision: 1.27; previous revision: 1.26
Comment 5 novakm 2007-07-27 12:35:32 UTC
REOPENING as two exceptions are 100% reproducible in Build 200707270000:
1) java.lang.AssertionError: Start offset must be before the end offset. startOffset = 38, endOffset = 1
	at org.netbeans.spi.editor.highlighting.support.OffsetsBag.addHighlightImpl(OffsetsBag.java:452)
	at org.netbeans.spi.editor.highlighting.support.OffsetsBag.addAllHighlightsImpl(OffsetsBag.java:553)
        ...
  is thrown every time you perform undo action more times than you actually did any modifications.

2) java.lang.NullPointerException
	at org.netbeans.modules.java.editor.rename.InstantRenamePerformer.invokeInstantRename(InstantRenamePerformer.java:149)
	at org.netbeans.modules.java.editor.rename.InstantRenameAction.actionPerformed(InstantRenameAction.java:37)
        ...
  is thrown every time you perform redo action.

Comment 6 Tomas Pavek 2007-07-27 13:08:19 UTC
I'm not getting any exceptions, please provide exact steps to reproduce.
Comment 7 novakm 2007-07-30 11:13:48 UTC
AssertionError:
1) Create a new form
2) Add a new button
3) Invoke "Customize Code" on that button
4) Select "Custom Property" in the second combobox
5) Modify somehow the text... for example "jButston1"
6) Press CTRL+Z three times (after the second press there is everything from that line deleted and after the third time
the UndeclaredThrowableException - AssertionError is thrown)

NPE:
Execute steps 1) to 4) from above
5) Put your caret into the text and press CTRL+R - NPE every time

-----
Product Version: NetBeans IDE Dev (Build 200707270000)
Java: 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b05
System: Windows Vista version 6.0 running on x86
Comment 8 Tomas Pavek 2007-07-30 13:56:56 UTC
I can reproduce now. Seems the undo/redo needs a little bit more work in the code customizer.
Comment 9 Tomas Pavek 2010-08-25 11:27:30 UTC
Undo works only for latest changes in the document typed by the user, but not for the "model" changes done by activating custom code areas using the combo boxes. It is a bug, but haven't seen another report about it for long time.