如何解析IDEA快捷键配置文件及其对应翻译文件?

2026-04-28 03:211阅读0评论SEO资源
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计258个文字,预计阅读时间需要2分钟。

如何解析IDEA快捷键配置文件及其对应翻译文件?

javapackage linwancheng.IDEAkeymap;

如何解析IDEA快捷键配置文件及其对应翻译文件?

import java.util.List;import org.dom4j.Document;import org.dom4j.DocumentException;import org.dom4j.Element;import org.dom4j.io.SAXReader;

public class XmlPrint { public static void main(String[] a) { // 代码省略,请补充实现 }}

XmlPrint.java

package linwancheng.IDEAkeymap; import java.util.List; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.Element; import org.dom4j.io.SAXReader; public class XmlPrint { public static void main(String[] args) throws DocumentException { SAXReader saxReader = new SAXReader(); //C:\Program Files\JetBrains\IntelliJ IDEA 2017.2\lib\resources.jar\keymaps\$default.xml Document read = saxReader.read("$default.xml"); Element rootElement = read.getRootElement(); @SuppressWarnings("unchecked") List actions = rootElement.elements(); for (Element action : actions) { @SuppressWarnings("unchecked") List keyboards = action.elements(); for (Element keyboard : keyboards) { System.out.println(action.attributeValue("id")+","+keyboard.attributeValue("first-keystroke")); } } } } PorpPrint.java

package linwancheng.IDEAkeymap; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Map.Entry; import java.util.Properties; import java.util.Set; public class PorpPrint { public static void main(String[] args) throws FileNotFoundException, IOException { //C:\Program Files\JetBrains\IntelliJ IDEA 2017.2\lib\resources_cn.jar\messages\ActionsBundle.properties FileInputStream fileInputStream = new FileInputStream("ActionsBundle.properties"); Properties properties = new Properties(); properties.load(fileInputStream); Set > entrySet = properties.entrySet(); for (Entry entry : entrySet) { String string = entry.getKey().toString(); String key = string.substring(string.indexOf(".")+1, string.lastIndexOf(".")); System.out.println(key+","+entry.getValue()); } } }

本文共计258个文字,预计阅读时间需要2分钟。

如何解析IDEA快捷键配置文件及其对应翻译文件?

javapackage linwancheng.IDEAkeymap;

如何解析IDEA快捷键配置文件及其对应翻译文件?

import java.util.List;import org.dom4j.Document;import org.dom4j.DocumentException;import org.dom4j.Element;import org.dom4j.io.SAXReader;

public class XmlPrint { public static void main(String[] a) { // 代码省略,请补充实现 }}

XmlPrint.java

package linwancheng.IDEAkeymap; import java.util.List; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.Element; import org.dom4j.io.SAXReader; public class XmlPrint { public static void main(String[] args) throws DocumentException { SAXReader saxReader = new SAXReader(); //C:\Program Files\JetBrains\IntelliJ IDEA 2017.2\lib\resources.jar\keymaps\$default.xml Document read = saxReader.read("$default.xml"); Element rootElement = read.getRootElement(); @SuppressWarnings("unchecked") List actions = rootElement.elements(); for (Element action : actions) { @SuppressWarnings("unchecked") List keyboards = action.elements(); for (Element keyboard : keyboards) { System.out.println(action.attributeValue("id")+","+keyboard.attributeValue("first-keystroke")); } } } } PorpPrint.java

package linwancheng.IDEAkeymap; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Map.Entry; import java.util.Properties; import java.util.Set; public class PorpPrint { public static void main(String[] args) throws FileNotFoundException, IOException { //C:\Program Files\JetBrains\IntelliJ IDEA 2017.2\lib\resources_cn.jar\messages\ActionsBundle.properties FileInputStream fileInputStream = new FileInputStream("ActionsBundle.properties"); Properties properties = new Properties(); properties.load(fileInputStream); Set > entrySet = properties.entrySet(); for (Entry entry : entrySet) { String string = entry.getKey().toString(); String key = string.substring(string.indexOf(".")+1, string.lastIndexOf(".")); System.out.println(key+","+entry.getValue()); } } }