extension behaving strangely

Hi, I encounter some strange behaviour in an extension I wrote. I made a search button respond to the enter key. In Eclipse it responds immediately, but in oXygen a user has to use the enter key twice to make the extension respond. I did this to make it work: btnSearch.registerKeyboardAction(btnSearch.getActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, false)), KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_IN_FOCUSED_WINDOW); btnSearch.registerKeyboardAction(btnSearch.getActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, true)), KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, true), JComponent.WHEN_IN_FOCUSED_WINDOW); btnSearch.addActionListener(this); What should I do to make it respond immediately in oXygen? Kind regards, Roderik Dernison ________________________________ ---------------------------------------------------------- Aan dit bericht kunnen geen rechten worden ontleend. Het bericht is alleen bestemd voor de geadresseerde. Indien het bericht niet voor u is bestemd, verzoeken wij u dit aan ons te melden en het bericht te verwijderen. This message shall not constitute any obligations. This message is intended solely for the addressee. If you have received this message in error, please inform us and delete the message. ----------------------------------------------------------

Hi Roderick, The standard way in Java to get a button from a dialog to respond to the ENTER key is to make it the default button in the JDialog like:
JDialog.getRootPane().setDefaultButton(btnSearch);
What exactly is the context of your customization? Are you implementing your custom Swing dialog and showing it when the user performs a certain action in Oxygen? Regards, Radu Radu Coravu <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com On 3/29/2012 5:26 PM, Roderik Dernison wrote:
Hi,
I encounter some strange behaviour in an extension I wrote.
I made a search button respond to the enter key. In Eclipse it responds immediately, but in oXygen a user has to use the enter key twice to make the extension respond.
I did this to make it work:
btnSearch.registerKeyboardAction(btnSearch.getActionForKeyStroke(KeyStroke./getKeyStroke/(KeyEvent./VK_SPACE/, 0, *false*)), KeyStroke./getKeyStroke/(KeyEvent./VK_ENTER/, 0, *false*), JComponent./WHEN_IN_FOCUSED_WINDOW/);
btnSearch.registerKeyboardAction(btnSearch.getActionForKeyStroke(KeyStroke./getKeyStroke/(KeyEvent./VK_SPACE/, 0, *true*)), KeyStroke./getKeyStroke/(KeyEvent./VK_ENTER/, 0, *true*), JComponent./WHEN_IN_FOCUSED_WINDOW/);
btnSearch.addActionListener(*this*);
What should I do to make it respond immediately in oXygen?
Kind regards,
Roderik Dernison
------------------------------------------------------------------------
---------------------------------------------------------- Aan dit bericht kunnen geen rechten worden ontleend. Het bericht is alleen bestemd voor de geadresseerde. Indien het bericht niet voor u is bestemd, verzoeken wij u dit aan ons te melden en het bericht te verwijderen.
This message shall not constitute any obligations. This message is intended solely for the addressee. If you have received this message in error, please inform us and delete the message. ----------------------------------------------------------
_______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user
participants (2)
-
Oxygen XML Editor Support
-
Roderik Dernison