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: | Keystroke Shortcut for Generators Needed | ||
---|---|---|---|
Product: | ruby | Reporter: | William Leonard <bleonard> |
Component: | Code | Assignee: | issues@ruby <issues> |
Status: | NEW --- | ||
Severity: | blocker | CC: | gsporar, olangr |
Priority: | P3 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: |
Description
William Leonard
2007-05-21 00:57:44 UTC
Reassigning this issue to newly created 'ruby' component. Might be nice to also have one for Migrate Database Hi Ondrej, is it too late to get another keybinding or two? Especially for "Generate" (which opens the Rails Code Generator and is used to generate all kinds of artifacts - source files, application skeletons, etc.). Gregg, do you really want one for migrating the database, or perhaps one for running the most recent rake target over again?
>Gregg, do you really want one for migrating the database, or perhaps one for running the most recent rake target over
again?
Well, ideally both. :-)
But I guess if I had to choose, the rake target one would be more heavily used.
Done. From the commit message: 104379 Keystroke Shortcut for Generators Needed Add Ctrl-Insert (Command-I, not insert on the mac) I also discovered a potential conflict in method names: AbstractAction defines getName() to return a -localized- name of the action, whereas EditorAction.getName() wants an -internal- name of the action (which is used as a bundle key), so to make it possible for an action to implement both (which the GenerateAction now does) rename EditorAction's getName to getActionName. (GenerateAction is only bound to Ctrl-Insert/Cmd-I from Ruby editor files, not as a global shortcut action since it needs to be different on Mac from others. Also, this is the same keybinding used for code generation in other languages so it's better to make it editor specific.) IDE:------------------------------------------------- IDE: [10/21/07 9:58 AM] Committing started cvs server: scheduling file `org.netbeans.api.gsf.EditorAction' for addition cvs server: use 'cvs commit' to add this file permanently IDE: [10/21/07 9:58 AM] Committing finished Checking in editing/src/org/netbeans/modules/ruby/ReflowParagraphAction.java; /cvs/ruby/editing/src/org/netbeans/modules/ruby/ReflowParagraphAction.java,v <-- ReflowParagraphAction.java new revision: 1.11; previous revision: 1.10 done Checking in editing/src/org/netbeans/modules/ruby/DefaultKeyBindings.xml; /cvs/ruby/editing/src/org/netbeans/modules/ruby/DefaultKeyBindings.xml,v <-- DefaultKeyBindings.xml new revision: 1.12; previous revision: 1.11 done Checking in editing/src/org/netbeans/modules/ruby/DefaultKeyBindings-Mac.xml; /cvs/ruby/editing/src/org/netbeans/modules/ruby/DefaultKeyBindings-Mac.xml,v <-- DefaultKeyBindings-Mac.xml new revision: 1.6; previous revision: 1.5 done Checking in railsprojects/src/org/netbeans/modules/ruby/railsprojects/GenerateAction.java; /cvs/ruby/railsprojects/src/org/netbeans/modules/ruby/railsprojects/GenerateAction.java,v <-- GenerateAction.java new revision: 1.7; previous revision: 1.6 done Checking in railsprojects/src/org/netbeans/modules/ruby/railsprojects/Bundle.properties; /cvs/ruby/railsprojects/src/org/netbeans/modules/ruby/railsprojects/Bundle.properties,v <-- Bundle.properties new revision: 1.14; previous revision: 1.13 done IDE: [10/21/07 9:58 AM] Diffing finished Checking in gsf/src/org/netbeans/modules/gsf/GsfEditorKitFactory.java; /cvs/ruby/gsf/src/org/netbeans/modules/gsf/GsfEditorKitFactory.java,v <-- GsfEditorKitFactory.java new revision: 1.9; previous revision: 1.8 done RCS file: /cvs/ruby/railsprojects/src/META-INF/services/org.netbeans.api.gsf.EditorAction,v done Checking in railsprojects/src/META-INF/services/org.netbeans.api.gsf.EditorAction; /cvs/ruby/railsprojects/src/META-INF/services/org.netbeans.api.gsf.EditorAction,v <-- org.netbeans.api.gsf.EditorAction initial revision: 1.1 done Checking in gsf/api/src/org/netbeans/api/gsf/EditorAction.java; /cvs/ruby/gsf/api/src/org/netbeans/api/gsf/EditorAction.java,v <-- EditorAction.java new revision: 1.3; previous revision: 1.2 done Checking in rspec/src/org/netbeans/modules/ruby/rspec/RunFocusedSpec.java; /cvs/ruby/rspec/src/org/netbeans/modules/ruby/rspec/RunFocusedSpec.java,v <-- RunFocusedSpec.java new revision: 1.6; previous revision: 1.5 done Checking in rspec/src/org/netbeans/modules/ruby/rspec/DebugFocusedTest.java; /cvs/ruby/rspec/src/org/netbeans/modules/ruby/rspec/DebugFocusedTest.java,v <-- DebugFocusedTest.java new revision: 1.2; previous revision: 1.1 done IDE: [10/21/07 9:58 AM] Committing finished This issue does not seem completely fixed to me. The problem is discoverability (is that a word? :-) ). If I right-click a Rails project the context menu displays "Generate..." and there is no keyboard shortcut listed. Why is that? I'm assuming this is because the shortcut (Alt-Insert on a PC, Ctrl-I on a Mac) only works when a .rb file has focus. In other words, since the shortcut does not work when the Projects window has focus, it is kind of misleading to display a keyboard shortcut in a menu that is only accessible from the Projects window. So if that is the case, then that makes sense to me. But I still think this is not completely fixed because with just the base IDE and Ruby pack installed there is no menu entry anywhere (at least that I can find) that lets me know that Alt-Insert brings up the Generate dialog. Another indicator of the broken-ness (another non-word? :-) ) is in the Options dialog. Under the Edit category of the keyboard shortcuts there is an entry called "Generate..." That entry is for the Project window's context menu entry and by default it does not have a keyboard shortcut. There is *another* "Generate..." entry under the Other category of the keyboard shortcuts. By default it has the keyboard shortcut (Alt-Insert on the PC, Ctrl-I on the Mac) assigned to it. Having two entries with the same name is confusing. I wish I could propose a really good solution, but I cannot think of one. :-/ One approach would be to just go ahead and enable the "Insert Code" entry in the IDE's Source menu when .rb files in Rails projects have focus and assign the keyboard shortcuts to it so that it looks the same as when the focus is on a .java file. This approach would at least make the keyboard shortcuts visible. A user would try it and hopefully it would make some sense to him/her when the Generate dialog popped up. In thinking about this more, though, it seems like using the same keyboard shortcut as "Insert Code" is a bit short-sighted. Will there be a point in the future where the IDE might offer similar code insertion features for .rb file editing as it currently offers for .java file editing? For example, "Insert Code" in a .java file offers to create a constructor - at some point will the IDE have the ability to generate an initialize() method for a class in a .rb file? If so, then hooking up Alt-Insert to the Generate dialog was probably the wrong keyboard shortcut.... Hmm, Ctrl-Insert or Alt-Insert don't seem to do anything on my Linux box. Do you have focus set to an .rb file in a Rails project? I did, but nothing happened. So I went to options -> Keymap to check to the shortcut and noticed in the Edit category there was 'Generate...' which had no shortcut assigned. First I tried to assign it to Alt-Insert, but was warned that it is already assigned to the 'Generate...' action, which must refer to the Java editor generate action (and which does work by default). Seems like there is a conflict between these two generate actions. After I assigned another shortcut for the Rails generate action it did work. |