mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-165950 National keyboard layouts support
This commit is contained in:
+10
-9
@@ -67,7 +67,8 @@ public class KeyboardSettingsExternalizable implements PersistentStateComponent<
|
||||
}
|
||||
|
||||
public static final class OptionSet {
|
||||
public boolean USE_NON_ENGLISH_KEYBOARD = false;
|
||||
public boolean PREFER_KEY_POSITION_OVER_CHAR_OPTION
|
||||
= "true".equals(System.getProperty("com.jetbrains.use.old.keyevent.processing"));
|
||||
}
|
||||
|
||||
private OptionSet myOptions = new OptionSet();
|
||||
@@ -89,19 +90,19 @@ public class KeyboardSettingsExternalizable implements PersistentStateComponent<
|
||||
|
||||
@Override
|
||||
public void loadState(OptionSet state) {
|
||||
state.PREFER_KEY_POSITION_OVER_CHAR_OPTION
|
||||
= state.PREFER_KEY_POSITION_OVER_CHAR_OPTION
|
||||
|| "true".equals(System.getProperty("com.jetbrains.use.old.keyevent.processing"));
|
||||
|
||||
myOptions = state;
|
||||
}
|
||||
|
||||
public boolean isUkrainianKeyboard (Component c) {
|
||||
return c!=null && "uk".equals(c.getInputContext().getLocale().getLanguage());
|
||||
public boolean isPreferKeyPositionOverCharOption () {
|
||||
return myOptions.PREFER_KEY_POSITION_OVER_CHAR_OPTION;
|
||||
}
|
||||
|
||||
public boolean isNonEnglishKeyboardSupportEnabled () {
|
||||
return myOptions.USE_NON_ENGLISH_KEYBOARD;
|
||||
}
|
||||
|
||||
public void setNonEnglishKeyboardSupportEnabled (boolean enabled) {
|
||||
myOptions.USE_NON_ENGLISH_KEYBOARD = enabled;
|
||||
public void setPreferKeyPositionOverCharOption (boolean enabled) {
|
||||
myOptions.PREFER_KEY_POSITION_OVER_CHAR_OPTION = enabled;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ public class KeyboardInternationalizationNotificationManager {
|
||||
if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
|
||||
final String description = event.getDescription();
|
||||
if ("enable".equals(description)) {
|
||||
KeyboardSettingsExternalizable.getInstance().setNonEnglishKeyboardSupportEnabled(true);
|
||||
KeyboardSettingsExternalizable.getInstance().setPreferKeyPositionOverCharOption(true);
|
||||
}
|
||||
else if ("settings".equals(description)) {
|
||||
final ShowSettingsUtil util = ShowSettingsUtil.getInstance();
|
||||
|
||||
@@ -87,15 +87,15 @@ public class KeymapPanel extends JPanel implements SearchableConfigurable, Confi
|
||||
preferKeyPositionOverCharOption = new JCheckBox(new AbstractAction(" " + KeyMapBundle.message("prefer.key.position")) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
KeyboardSettingsExternalizable.getInstance().setPreferKeyPositionOverCharOption(preferKeyPositionOverCharOption.isSelected());
|
||||
VMOptions.writeOption("com.jetbrains.use.old.keyevent.processing", "=",
|
||||
Boolean.toString(preferKeyPositionOverCharOption.isSelected()));
|
||||
Boolean.toString(KeyboardSettingsExternalizable.getInstance().isPreferKeyPositionOverCharOption()));
|
||||
ApplicationManager.getApplication().invokeLater(
|
||||
() -> ApplicationManager.getApplication().restart(),
|
||||
ModalityState.NON_MODAL
|
||||
);
|
||||
}
|
||||
});
|
||||
//preferKeyPositionOverCharOption.setSelected();
|
||||
preferKeyPositionOverCharOption.setBorder(new EmptyBorder(0, 0, 0, 0));
|
||||
keymapPanel.add(preferKeyPositionOverCharOption, BorderLayout.SOUTH);
|
||||
}
|
||||
@@ -438,7 +438,7 @@ public class KeymapPanel extends JPanel implements SearchableConfigurable, Confi
|
||||
@Override
|
||||
public void reset() {
|
||||
if (preferKeyPositionOverCharOption != null) {
|
||||
preferKeyPositionOverCharOption.setSelected(KeyboardSettingsExternalizable.getInstance().isNonEnglishKeyboardSupportEnabled());
|
||||
preferKeyPositionOverCharOption.setSelected(KeyboardSettingsExternalizable.getInstance().isPreferKeyPositionOverCharOption());
|
||||
}
|
||||
myManager.reset();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user