开发者

Where does Eclipse store keyboard bindings?

Where does Eclipse store its user preferences? Specifically the keyb开发者_运维问答oard bindings?


When you close Eclipse, any local settings regarding key shortcuts (settings that differ from the default configuration) are saved in

</path/to/workspace>\.metadata\.plugins\org.eclipse.core.runtime\.settings\
org.eclipse.ui.workbench.prefs


You can actually just copy the whole line in the org.eclipse.ui.workbech.prefs file that starts with: org.eclipse.ui.commands= and paste it into the other corresponding eclipse workspace prefs file you want to update - at least in Eclipse Neon, and you'll get them all at once.


You can extract the bindings using the following groovy script. I'm not a groovy developer so please excuse my hack.

Groovy Script Used (substitute in a correct path to the workbench xmi file):

workbench = new XmlSlurper().parse("<path to  eclipse>/workspace/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi")

List bindingTables
workbench.bindingTables.each
{ it->
//println "\tContributorURI: ${it.@contributorURI} | \tElementID : it.@elementId";

def command = "command";
def commandName = "commandname";
def description = "description";
def category;
def name = "name";
def keys = "keys";
it.bindings.each
{bindingIt->
    //loop through every binding entry
    command = bindingIt.@command;
    keys = bindingIt.@keySequence;
    workbench.commands.each
    {commandIt->
        def thisCommand = commandIt.attributes()['{http://www.omg.org/XMI}id'];
        if(thisCommand.equals(command.toString()) )
        {
            commandName = commandIt.@commandName;
            description = commandIt.@description;
            category = commandIt.@category;
            workbench.categories.each
            {workbenchIt->
                if(workbenchIt.attributes()['{http://www.omg.org/XMI}id'].equals(category.toString()) )
                {
                    name = workbenchIt.@name;
                }
            }
        }
    }
    println "\t\tKeys: ${keys}\tCommand: ${commandName}"+
            "\tDescription: "+description+"\tName: "+name;
}
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜