NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

How to add hotkey shortcuts

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Developers
View previous topic :: View next topic  
Author Message
CandyMan



Joined: 20 Jan 2009
Posts: 6

PostPosted: Thu Feb 26, 2009 9:03 am    Post subject: How to add hotkey shortcuts Reply with quote

I have already build some custom file menu items and toolbar items. But I did'nt realized that I might be required to access those items with hotkeys (like F5 for running a custom debugger, F6 for compiling custom file type e.t.c.). How do I add hotkey shortcuts to my already existing toolbar and menu items?

I tried to edit a few xml files but seems like I'm lost.

Thanks in advance Smile
Back to top
tomwheeler



Joined: 03 Sep 2008
Posts: 950

PostPosted: Thu Feb 26, 2009 9:38 pm    Post subject: How to add hotkey shortcuts Reply with quote

You're on the right track with editing the XML files. Basically there
are two steps. First you find the entry in the Actions folder of the
action for which you want to create a hotkey (key binding), then you
assign a keybinding to it. See this FAQ entry for details and an
example:

http://wiki.netbeans.org/DevFaqKeybindings

On Thu, Feb 26, 2009 at 3:03 AM, CandyMan <address-removed> wrote:
Quote:
I have alreayd built custom file menu items and toolbar items. But I did'nt realized that I might be required to access to those items with hotkeys (like F5 for running a custom debugger). How do I add hotkey shortcuts to my already existing toolbar and menu items.



I tried to edit a few xml files but seems like I'm lost.



Thanks in advance :)








--
Tom Wheeler
http://www.tomwheeler.com/
Back to top
CandyMan



Joined: 20 Jan 2009
Posts: 6

PostPosted: Mon Mar 02, 2009 1:54 am    Post subject: Reply with quote

Thanks tomwheeler, this is what I did for my continue action button but it does not seem to work.

Code:
<folder name="Shortcuts">
        <file name="F5.shadow">
            <attr name="originalFile" stringvalue="Actions/Debug/org-teambeans-sodbeans-actions-actContinue.instance"/>
        </file>
</folder>



I have seen a few examples and it seems like I've done exactly the same (except the string value that needs to be changed for my module).

I think I'm still missing something... is there anything else that I need to keep in mind?
Back to top
tomwheeler



Joined: 03 Sep 2008
Posts: 950

PostPosted: Mon Mar 02, 2009 2:46 am    Post subject: How to add hotkey shortcuts Reply with quote

Hi Candyman,

That seems right to me. I guess I'd check a few things to debug...

It's possible that the shortcut is just not calling your action at
all. Maybe that keystroke is already bound to something else, perhaps
even in your operating system. Or it's possible that it is invoking
your action, but your action is not doing what you think it should.

To test the first case, change it to use some other shortcut, at least
temporarily. It's possible that your operating system considers F5
special for some reason. I'd try something obscure, like Ctrl+Shift+Q.

To test the second case, make the first line of your action's method
write something to System.out and check for it in the logs, or have it
pop up a dialog. If your action does something complex, it's possible
that it dies before it reaches a point where you'd see the results you
expect.

Hope that helps,

On Sun, Mar 1, 2009 at 7:54 PM, CandyMan <address-removed> wrote:
Quote:
Thanks tomwheeler,
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Developers All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo