当前位置 : 主页 > 编程语言 > c++ >

IDEA快捷键配置文件与对应翻译文件解析

来源:互联网 收集:自由互联 发布时间:2021-06-30
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[] 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()); } } }
  
 
网友评论