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.
Description: Name: akR10234 Date: 03/18/2004 Item 'Delete' in context menu should be disabled (as 'Cut' or 'Copy') if nothing selected in file editor. Now 'Delete' is always enabled and emulates pushing 'Delete' button on keyboard. So, if nothing is selected it deletes a letter on the left from the cursor. This is not a usual behavior. ====================================================================== A comment.
We currently plan to remove the "Delete" menu item from editor's popup completely as part of revisiting of the editor's popup menu. In practice the "Delete" item is never used as the user is unsure what gets deleted whether e.g. it wouldn't delete the whole file etc. Gabo can have more information regarding this.
Already fixed in the [maintrunk] Delete item has been removed from context menu
Even though the item has been removed from context menu, the behaviour still exists with respect to the 'Delete' item in the main menu. The standard behaviour exhibited by other applications like netscape editor etc as follows: - Delete menu item is disabled (whether in main menu or context menu) if there is no selection in the editor - Delete menuitem is associated with the 'Del' key - The key itself works whether there is any selection of not, by deleteing the char at cursor. In netbeans 'Delete' menuitem is enabled even when there is no selection in the editor. See also: http://www.netbeans.org/issues/show_bug.cgi?id=25763 Additional Comments From Miloslav Metelka 2002-07-19 01:04 PDT After personal meeting we've agreed that the change in semantics of the DeleteAction (will remove single char if there is no selection) is OK so the binding to deleteNextCharAction can be retained. The above is probably okay; perhaps what needs to happen is to disable the Delete menuitem/toolbar.
DefaultEditorKit.deleteNextCharAction instead of editor's "remove-selection" is putted into the ActionMap in CloneableEditor. Suggested solutions: First: put actions to ActionMap before kit creation and to pane action map not TC actionMap. Then we will be able to replace DefaultEditorKit.deleteNextCharAction with "remove-selection" during kit creation in editor module. Index: src/org/openide/text/CloneableEditor.java =================================================================== RCS file: /cvs/openide/src/org/openide/text/CloneableEditor.java,v retrieving revision 1.80 diff -r1.80 CloneableEditor.java 183a184,196 > // Init action map: cut,copy,delete,paste actions. > javax.swing.ActionMap am = getActionMap(); > //#43157 - editor actions need to be accessible from outside using the TopComponent.getLookup(ActionMap.class) call. > // used in main menu enabling/disabling logic. > javax.swing.ActionMap paneMap = pane.getActionMap(); > am.setParent(paneMap); > > paneMap.put(DefaultEditorKit.cutAction, getAction(DefaultEditorKit.cutAction)); > paneMap.put(DefaultEditorKit.copyAction, getAction(DefaultEditorKit.copyAction)); > paneMap.put("delete", getAction(DefaultEditorKit.deleteNextCharAction)); // NOI18N > paneMap.put(DefaultEditorKit.pasteAction, getAction(DefaultEditorKit.pasteAction)); > > 217,227d229 < < // Init action map: cut,copy,delete,paste actions. < javax.swing.ActionMap am = getActionMap(); < //#43157 - editor actions need to be accessible from outside using the TopComponent.getLookup(ActionMap.class) call. < // used in main menu enabling/disabling logic. < am.setParent(pane.getActionMap()); < < am.put(DefaultEditorKit.cutAction, getAction(DefaultEditorKit.cutAction)); < am.put(DefaultEditorKit.copyAction, getAction(DefaultEditorKit.copyAction)); < am.put("delete", getAction(DefaultEditorKit.deleteNextCharAction)); // NOI18N < am.put(DefaultEditorKit.pasteAction, getAction(DefaultEditorKit.pasteAction)); OR Second: check for remove-selection map yourself Index: src/org/openide/text/CloneableEditor.java =================================================================== RCS file: /cvs/openide/src/org/openide/text/CloneableEditor.java,v retrieving revision 1.80 diff -r1.80 CloneableEditor.java 226c226,230 < am.put("delete", getAction(DefaultEditorKit.deleteNextCharAction)); // NOI18N --- > Action deleteAction = getAction("remove-selection"); //NOI18N > if (deleteAction == null){ > deleteAction = getAction(DefaultEditorKit.deleteNextCharAction); > } > am.put("delete", deleteAction); // NOI18N
i went for solution number one because it's more generic and allows similar changes to be done in the future for other actions.
editor part wasn't implemented yet... taking back
fixed in [maintrunk] /cvs/editor/libsrc/org/netbeans/editor/BaseKit.java,v <-- BaseKit.java new revision: 1.122; previous revision: 1.121 /cvs/editor/src/org/netbeans/modules/editor/NbEditorUI.java,v <-- NbEditorUI.java new revision: 1.30; previous revision: 1.29
reopening, due to fix of issue #68879 We need to find a different solution
Still reproducible in main trunk. We could probably create a menu-bar equivalent of editor's 'Delete selection' action and use it in the Edit menu instead of hacking the 'Delete' action.
Minor issue. Mato will hardly fix it.
Resolving all issues with milestone "future" as LATER. If you feel strongly that it should be implemented please reopen and set the target milestone to "next".
NetBeans.org Migration: changing resolution from LATER to WONTFIX