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.
Summary: | Undo doesn't work in code customizer. | ||
---|---|---|---|
Product: | guibuilder | Reporter: | novakm <novakm> |
Component: | Code | Assignee: | issues@guibuilder <issues> |
Status: | NEW --- | ||
Severity: | blocker | CC: | issues, vstejskal |
Priority: | P4 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | Windows Vista | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
novakm
2007-04-12 10:20:43 UTC
*** Issue 101363 has been marked as a duplicate of this issue. *** 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? 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) 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 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. I'm not getting any exceptions, please provide exact steps to reproduce. 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 I can reproduce now. Seems the undo/redo needs a little bit more work in the code customizer. 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. |