| ... |
... |
@@ -148,7 +148,8 @@ public class ConfigUIHandler extends StorageTabUIHandler<ConfigUI> implements UI |
|
148
|
148
|
public void addRemoteConfiguration(ObserveMainUI mainUI, RemoteDataSourceConfiguration configuration, int position) {
|
|
149
|
149
|
JMenuItem item = new JMenuItem(configuration.getName());
|
|
150
|
150
|
item.putClientProperty("configuration", configuration);
|
|
151
|
|
- UseRemoteConfigurationUIAction action = new UseRemoteConfigurationUIAction(mainUI, ui, UseRemoteConfigurationUIAction.ACTION_NAME + position, configuration, KeyStroke.getKeyStroke("F" + position));
|
|
|
151
|
+ KeyStroke keyStroke = getKeyStroke(position);
|
|
|
152
|
+ UseRemoteConfigurationUIAction action = new UseRemoteConfigurationUIAction(mainUI, ui, UseRemoteConfigurationUIAction.ACTION_NAME + position, configuration, keyStroke);
|
|
152
|
153
|
action.initForMainUi(item, ui.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT), observeActionMap);
|
|
153
|
154
|
|
|
154
|
155
|
ui.getRemoteMenu().add(item);
|
| ... |
... |
@@ -157,12 +158,29 @@ public class ConfigUIHandler extends StorageTabUIHandler<ConfigUI> implements UI |
|
157
|
158
|
public void addServerConfiguration(ObserveMainUI mainUI, ServerDataSourceConfiguration configuration, int position) {
|
|
158
|
159
|
JMenuItem item = new JMenuItem(configuration.getName());
|
|
159
|
160
|
item.putClientProperty("configuration", configuration);
|
|
160
|
|
- UseServerConfigurationUIAction action = new UseServerConfigurationUIAction(mainUI, ui, UseServerConfigurationUIAction.ACTION_NAME + position, configuration, KeyStroke.getKeyStroke("F" + position));
|
|
|
161
|
+ KeyStroke keyStroke = getKeyStroke(position);
|
|
|
162
|
+ UseServerConfigurationUIAction action = new UseServerConfigurationUIAction(mainUI, ui, UseServerConfigurationUIAction.ACTION_NAME + position, configuration, keyStroke);
|
|
161
|
163
|
action.initForMainUi(item, ui.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT), observeActionMap);
|
|
162
|
164
|
|
|
163
|
165
|
ui.getServerMenu().add(item);
|
|
164
|
166
|
}
|
|
165
|
167
|
|
|
|
168
|
+ private KeyStroke getKeyStroke(int position) {
|
|
|
169
|
+ if (position<(12)+1) {
|
|
|
170
|
+ return KeyStroke.getKeyStroke("F" + position);
|
|
|
171
|
+ }
|
|
|
172
|
+ if (position<(12*2)+1) {
|
|
|
173
|
+ return KeyStroke.getKeyStroke("shift pressed F" + (position-12));
|
|
|
174
|
+ }
|
|
|
175
|
+ if (position<(12*3)+1) {
|
|
|
176
|
+ return KeyStroke.getKeyStroke("ctrl pressed F" + (position-24));
|
|
|
177
|
+ }
|
|
|
178
|
+ if (position<(12*4)+1) {
|
|
|
179
|
+ return KeyStroke.getKeyStroke("shift ctrl pressed F" + (position-36));
|
|
|
180
|
+ }
|
|
|
181
|
+ return null;
|
|
|
182
|
+ }
|
|
|
183
|
+
|
|
166
|
184
|
private void refreshConfig(ConfigUI ui, String configId) {
|
|
167
|
185
|
JComponent c = (JComponent) ui.getObjectById(configId);
|
|
168
|
186
|
if (c != null) {
|