@@ -0,0 +1,2293 @@
+/*%0A * Copyright 2000-2017 JetBrains s.r.o.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.intellij.openapi.keymap;%0A%0Aimport com.intellij.idea.Bombed;%0Aimport com.intellij.openapi.actionSystem.Shortcut;%0Aimport com.intellij.openapi.application.PathManager;%0Aimport com.intellij.openapi.keymap.ex.KeymapManagerEx;%0Aimport com.intellij.openapi.util.io.FileUtil;%0Aimport com.intellij.openapi.util.text.StringUtil;%0Aimport com.intellij.testFramework.PlatformTestCase;%0A%0Aimport java.io.File;%0Aimport java.util.Calendar;%0A%0A/**%0A * @author Konstantin Bulenkov%0A */%0A@SuppressWarnings(%22JUnitTestClassNamingConvention%22)%0Apublic class KeymapGen extends PlatformTestCase %7B%0A  @Bombed(user = %22kb%22, year = 2117, month = Calendar.NOVEMBER, day = 17)%0A  public void testGenerate() throws Exception %7B%0A    StringBuilder xml = new StringBuilder();%0A    xml.append(%22%3CKeymaps%3E%5Cn%22);%0A%0A    for (Keymap keymap : KeymapManagerEx.getInstanceEx().getAllKeymaps()) %7B%0A      xml.append(%22  %3CKeymap name=%5C%22%22).append(keymap.getName()).append(%22%5C%22%3E%5Cn%22);%0A      for (String id : keymap.getActionIdList()) %7B%0A        String shortcuts = KeymapUtil.getShortcutsText(keymap.getShortcuts(id));%0A        if (!StringUtil.isEmpty(shortcuts)) %7B%0A          xml.append(%22    %3CAction id=%5C%22%22).append(id).append(%22%5C%22%3E%5Cn%22);%0A          for (Shortcut shortcut : keymap.getShortcuts(id)) %7B%0A            xml.append(%22      %3CShortcut%3E%22).append(KeymapUtil.getShortcutText(shortcut)).append(%22%3C/Shortcut%3E%5Cn%22);%0A          %7D%0A          xml.append(%22    %3C/Action%3E%5Cn%22);%0A        %7D%0A      %7D%0A      xml.append(%22  %3C/Keymap%3E%5Cn%22);%0A    %7D%0A    xml.append(%22%3C/Keymaps%3E%22);%0A%0A    File out = new File(PathManager.getHomePath() + File.separator + %22AllKeymaps.xml%22);%0A    FileUtil.writeToFile(out, xml.toString());%0A    System.out.println(%22Saved to: %22 + out.getAbsolutePath());%0A  %7D%0A%7D%0A

move KeymapGen