List of usage examples for com.intellij.openapi.keymap KeymapManager DEFAULT_IDEA_KEYMAP
String DEFAULT_IDEA_KEYMAP
To view the source code for com.intellij.openapi.keymap KeymapManager DEFAULT_IDEA_KEYMAP.
Click Source Link
From source file:com.intellij.application.options.InitialConfigurationDialog.java
License:Apache License
public InitialConfigurationDialog(Component parent, String colorSettingsPage) { super(parent, true); myColorSettingsPage = colorSettingsPage; setTitle(ApplicationNamesInfo.getInstance().getFullProductName() + " Initial Configuration"); final ArrayList<Keymap> keymaps = new ArrayList<Keymap>(); for (Keymap keymap : ((KeymapManagerImpl) KeymapManager.getInstance()).getAllKeymaps()) { if (matchesPlatform(keymap)) { keymaps.add(keymap);/*from ww w . j ava 2 s . c o m*/ } } myAppearanceComboBox .setModel(new DefaultComboBoxModel(LafManager.getInstance().getInstalledLookAndFeels())); myAppearanceComboBox.setRenderer(new LafComboBoxRenderer()); myAppearanceComboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { preselectColorScheme(); } }); myAppearanceComboBox.setSelectedItem(LafManager.getInstance().getCurrentLookAndFeel()); myColorSchemeComboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { EditorColorsScheme scheme = (EditorColorsScheme) myColorSchemeComboBox.getSelectedItem(); if (scheme.getName().equals("Darcula")) { UIManager.LookAndFeelInfo[] lafs = LafManager.getInstance().getInstalledLookAndFeels(); for (UIManager.LookAndFeelInfo laf : lafs) { if (laf.getName().contains("Darcula")) { myAppearanceComboBox.setSelectedItem(laf); break; } } } } }); myKeymapComboBox.setModel(new DefaultComboBoxModel(keymaps.toArray(new Keymap[keymaps.size()]))); myKeymapComboBox.setRenderer(new ListCellRendererWrapper() { @Override public void customize(final JList list, final Object value, final int index, final boolean selected, final boolean cellHasFocus) { Keymap keymap = (Keymap) value; if (keymap == null) { return; } if (KeymapManager.DEFAULT_IDEA_KEYMAP.equals(keymap.getName())) { setText("IntelliJ IDEA Classic"); } else if ("Mac OS X".equals(keymap.getName())) { setText("IntelliJ IDEA Classic - Mac OS X"); } else { setText(keymap.getPresentableName()); } } }); preselectKeyMap(keymaps); final EditorColorsScheme[] colorSchemes = EditorColorsManager.getInstance().getAllSchemes(); myColorSchemeComboBox.setModel(new DefaultComboBoxModel(colorSchemes)); myColorSchemeComboBox.setRenderer(new ListCellRendererWrapper() { @Override public void customize(JList list, Object value, int index, boolean selected, boolean cellHasFocus) { if (value != null) { setText(((EditorColorsScheme) value).getName()); } } }); myColorSchemeComboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { if (myHidingPreviewPanel != null) myHidingPreviewPanel.updateColorSchemePreview(true); } }); preselectColorScheme(); setResizable(false); setCancelButtonText("Skip"); init(); final boolean canCreateLauncherScript = canCreateLauncherScript(); myCreateScriptCheckbox.setVisible(canCreateLauncherScript); myCreateScriptCheckbox.setSelected(canCreateLauncherScript); myCreateScriptPanel.setVisible(canCreateLauncherScript); if (canCreateLauncherScript) { myScriptPathTextField.setText("/usr/local/bin/" + CreateLauncherScriptAction.defaultScriptName()); } final boolean canCreateDesktopEntry = canCreateDesktopEntry(); myCreateEntryCheckBox.setVisible(canCreateDesktopEntry); myCreateEntryCheckBox.setSelected(canCreateDesktopEntry); myCreateEntryPanel.setVisible(canCreateDesktopEntry); if (canCreateDesktopEntry) { myGlobalEntryCheckBox.setSelected(!PathManager.getHomePath().startsWith("/home")); } myPreferencesLabel.setText( "You can use " + CommonBundle.settingsActionPath() + " to configure any of these settings later."); Disposer.register(myDisposable, new Disposable() { @Override public void dispose() { disposeUIResources(); } }); }
From source file:com.intellij.application.options.InitialConfigurationDialog.java
License:Apache License
private static boolean matchesPlatform(Keymap keymap) { final String name = keymap.getName(); if (KeymapManager.DEFAULT_IDEA_KEYMAP.equals(name)) { return SystemInfo.isWindows; } else if (KeymapManager.MAC_OS_X_KEYMAP.equals(name) || "Mac OS X 10.5+".equals(name)) { return SystemInfo.isMac; } else if (KeymapManager.X_WINDOW_KEYMAP.equals(name) || "Default for GNOME".equals(name) || "Default for KDE".equals(name)) { return SystemInfo.isXWindow; }/* ww w .ja v a 2 s . c o m*/ return true; }
From source file:org.jetbrains.idea.devkit.util.ActionType.java
License:Apache License
public void patchPluginXml(XmlFile pluginXml, PsiClass klass, ActionData dialog) throws IncorrectOperationException { final XmlTag rootTag = pluginXml.getDocument().getRootTag(); if (rootTag != null && "idea-plugin".equals(rootTag.getName())) { XmlTag actions = rootTag.findFirstSubTag("actions"); if (actions == null || !actions.isPhysical()) { actions = (XmlTag) rootTag/* ww w. j ava 2 s .c om*/ .add(rootTag.createChildTag("actions", rootTag.getNamespace(), null, false)); } XmlTag actionTag = (XmlTag) actions .add(actions.createChildTag(myName, actions.getNamespace(), null, false)); actionTag.setAttribute("id", dialog.getActionId()); actionTag.setAttribute("class", klass.getQualifiedName()); actionTag.setAttribute("text", dialog.getActionText()); String description = dialog.getActionDescription(); if (description != null && description.length() > 0) { actionTag.setAttribute("description", description); } String groupId = dialog.getSelectedGroupId(); if (groupId != null) { XmlTag groupTag = (XmlTag) actionTag .add(actionTag.createChildTag("add-to-group", actions.getNamespace(), null, false)); groupTag.setAttribute("group-id", groupId); @NonNls final String anchor = dialog.getSelectedAnchor(); groupTag.setAttribute("anchor", anchor); if (anchor.equals("before") || anchor.equals("after")) { groupTag.setAttribute("relative-to-action", dialog.getSelectedActionId()); } } String firstKeyStroke = dialog.getFirstKeyStroke(); if (firstKeyStroke != null && firstKeyStroke.length() > 0) { XmlTag keyTag = (XmlTag) actionTag .add(actionTag.createChildTag("keyboard-shortcut", actions.getNamespace(), null, false)); keyTag.setAttribute("keymap", KeymapManager.DEFAULT_IDEA_KEYMAP); keyTag.setAttribute("first-keystroke", firstKeyStroke); final String secondKeyStroke = dialog.getSecondKeyStroke(); if (secondKeyStroke != null && secondKeyStroke.length() > 0) { keyTag.setAttribute("second-keystroke", secondKeyStroke); } } } }
From source file:org.jetbrains.plugins.ruby.settings.RSettings.java
License:Apache License
private void loadRegisteredData() { final RubyShortcutsSettings settings = RubyShortcutsSettings.getInstance(); if (settings.serializableGenerators != null) { loadGenerator(settings.serializableGenerators); }//from ww w . ja v a 2 s . co m if (settings.serializableRakeTask != null) { loadRakeTask(settings.serializableRakeTask); } //Register default actions in dedault keymap final Keymap[] keymaps = KeymapManagerEx.getInstanceEx().getAllKeymaps(); for (Keymap keymap : keymaps) { if (KeymapManager.DEFAULT_IDEA_KEYMAP.equals(keymap.getName())) { registerDefaultActions(keymap); } } }