How do I get the shortcut I set

44 views
Skip to first unread message

Matthias Melzner

unread,
Sep 28, 2021, 2:46:38 AM9/28/21
to SQL Workbench/J - DBMS independent SQL tool
Hello, 
basically I want to adjust the tooltips to show both the default shortcut and the shortcut I chose. But I have a problem figuring out how to get my chosen shortcut in the Java code.

Screenshot 2021-09-28 083845.png
As you can see I want the tooltip to display both F5 and Ctrl-E but I can't figure out how to get F5 in the Java code.

Thank you for the help in advance.

Thomas Kellerer

unread,
Sep 28, 2021, 3:28:10 AM9/28/21
to sql-wo...@googlegroups.com
The tooltip is initialized in WbAction.initTooltip()

You can use getAlternateAccelerator() to get the alternate keytroke.

Thomas


Matthias Melzner schrieb am 28.09.2021 um 08:46:
> Hello,
> basically I want to adjust the tooltips to show both the default shortcut and the shortcut I chose. But I have a problem figuring out how to get my chosen shortcut in the Java code.
>
Message has been deleted

Matthias Melzner

unread,
Oct 26, 2021, 3:36:58 AM10/26/21
to SQL Workbench/J - DBMS independent SQL tool
So I looked into it and the issue seems to be that in the method WbAction.getAcceleratorDisplay() the key is always the return value of WbAction.getDefaultAccelerator() and not of WbAction.getAccelerator(). I also modified the return value of the method  WbAction.getAcceleratorDisplay() to only show the acceleratorDelimiter if the key modifier isn't blank.
In the attachments you can find a patch file with the changes.

Matthias
WbAction.patch
Message has been deleted

Matthias Melzner

unread,
Oct 28, 2021, 8:50:00 AM10/28/21
to SQL Workbench/J - DBMS independent SQL tool
I also implemented a search in the shortcut window. With my implementation it looks through all three columns and updates the table upon entering a symbol. But it is easily changeable if you want only to search certain columns or start the search when a button or the enter key is pressed. 

In the attachments you can find a patch file with the changes.

ShortcutEditor.patch

Thomas Kellerer

unread,
Oct 28, 2021, 2:43:12 PM10/28/21
to sql-wo...@googlegroups.com
Thanks I applied with some changes. Mainly doing the filtering through DataStoreTableModel.applyFilter() rather then re-creating the model with each keystroke.

rg
Reply all
Reply to author
Forward
0 new messages