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 69642 - Incorrect handling of 'DEL' key
Summary: Incorrect handling of 'DEL' key
Status: VERIFIED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Andrei Badea
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-30 16:46 UTC by Lukas Jungmann
Modified: 2005-12-14 12:08 UTC (History)
3 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 Lukas Jungmann 2005-11-30 16:46:25 UTC
[build 200511291900]

-start bundled derby
-view data from some table, eg. customer
-go to shown table, use keybord arrows to navigate within it => focus is on the
table
-press 'DEL'

=> iff shown table is read-only then nothing should happen, but currently first
letter of command in editor is deleted
Comment 1 Andrei Badea 2005-11-30 21:46:36 UTC
I can't think of anything in the SQL editor causing this. The SQL editor wraps
the editor component in a more complicated UI like this:

- JPanel
  - JSplitter
    - editor component (toolbar + JEditorPane)
    - JTable with results

But this shouldn't IMHO cause the key presses in the result table to be
processed by the editor. 

It happens in the Java editor too. Focus the toolbar (so that you can navigate
between the buttons with the arrow keys) and press Delete. Characters in the
editor are deleted.

Reassigning to editor.
Comment 2 Martin Roskanin 2005-12-05 12:37:18 UTC
reproduced, I will look at this
Comment 3 Martin Roskanin 2005-12-05 17:01:38 UTC
If the component doesn't provide the action in its ActionMap, then event is fall
to parent's ActionMap. Here: if toolbar button has the focus, button's ActionMap
(and InputMap) is asked for the "del" keystroke. JButton doesn't provide it,
thus the event fall into TopComponent where system action DelateAction is found.
We decided to fix it by not allowing the focus to remain in editor toolbar. The
same approach is used in the main toolbar. Table in Sql editor should solve the
problem itself. Reassigning back.

/cvs/editor/src/org/netbeans/modules/editor/NbEditorToolBar.java,v  <-- 
NbEditorToolBar.java
new revision: 1.21; previous revision: 1.20
Comment 4 Andrei Badea 2005-12-05 20:49:36 UTC
I think the fix in the toolbar doesn't solve the problem. If an action
implementing Presenter.Toolbar is added to the toolbar, that action must know
about the Del key. Try focusing the Connection combo box in the toolbar of the
SQL editor and pressing Del.

Can't the toolbar just add Del to its input map and wire it to a dummy empty
action? If not, then it should be documented that the action's Presenter.Toolbar
must handle the Del key itself. Reassigning back to the editor for evaluation.

Re. the fix in the SQL editor result area, I will fix that, reassign back to me.
Comment 5 Andrei Badea 2005-12-05 20:50:47 UTC
BTW are there any other keys that behave the same way as Del?
Comment 6 Miloslav Metelka 2005-12-06 12:44:37 UTC
Cut, copy, paste as well (CloneableEditor: 204-208).
Setting 5.0 TM.
Comment 7 Martin Roskanin 2005-12-06 13:41:44 UTC
fixed in [maintrunk] as for editor

del, cut, copy and paste action are replaced by NoOpAction in the toolbar's IM
and AM. Reassinging back for solving the table problem

/cvs/editor/src/org/netbeans/modules/editor/NbEditorToolBar.java,v  <-- 
NbEditorToolBar.java
new revision: 1.23; previous revision: 1.22


 
Comment 8 Andrei Badea 2005-12-08 15:27:10 UTC
This is caused by the parent of the CloneableEditor's ActionMap being the editor
pane's ActionMap, as described in issue 41223. The delete-next action is then
always returned when searching the CloneableEditor's Action map for delete, even
when the editor doesn't have the focus. The same applies to the cut, copy and
paste actions.

Since in the future we'll want to provide our own cut, copy, paste and delete
actions in the SQL editor result table, I think the fix of issue 41223 will have
to be reconsidered. I filed issue 70096 in this sense.

Until then I implemented a workaround which overrides the parent of the
CloneableEditor's ActionMap and delegates to it only when the editor pane has
the focus.

Checking in src/org/netbeans/modules/db/sql/loader/SQLEditorSupport.java;
/cvs/db/core/src/org/netbeans/modules/db/sql/loader/SQLEditorSupport.java,v  <--
 SQLEditorSupport.java
new revision: 1.12; previous revision: 1.11
done
Checking in CloneableEditorTest.java;
/cvs/openide/text/test/unit/src/org/openide/text/CloneableEditorTest.java,v  <--
 CloneableEditorTest.java
new revision: 1.3; previous revision: 1.2
done
Comment 9 Lukas Jungmann 2005-12-14 12:08:10 UTC
v.