本文整理汇总了Java中com.intellij.openapi.keymap.impl.DefaultKeymap类的典型用法代码示例。如果您正苦于以下问题:Java DefaultKeymap类的具体用法?Java DefaultKeymap怎么用?Java DefaultKeymap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultKeymap类属于com.intellij.openapi.keymap.impl包,在下文中一共展示了DefaultKeymap类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateShortcuts
import com.intellij.openapi.keymap.impl.DefaultKeymap; //导入依赖的package包/类
private static void updateShortcuts(StringBuffer text) {
int lastIndex = 0;
while(true) {
lastIndex = text.indexOf(SHORTCUT_ENTITY, lastIndex);
if (lastIndex < 0) return;
final int actionIdStart = lastIndex + SHORTCUT_ENTITY.length();
int actionIdEnd = text.indexOf(";", actionIdStart);
if (actionIdEnd < 0) {
return;
}
final String actionId = text.substring(actionIdStart, actionIdEnd);
String shortcutText = getShortcutText(actionId, KeymapManager.getInstance().getActiveKeymap());
if (shortcutText == null) {
Keymap defKeymap = KeymapManager.getInstance().getKeymap(DefaultKeymap.getInstance().getDefaultKeymapName());
if (defKeymap != null) {
shortcutText = getShortcutText(actionId, defKeymap);
if (shortcutText != null) {
shortcutText += " in default keymap";
}
}
}
if (shortcutText == null) {
shortcutText = "<no shortcut for action " + actionId + ">";
}
text.replace(lastIndex, actionIdEnd + 1, shortcutText);
lastIndex += shortcutText.length();
}
}
示例2: applyKeymap
import com.intellij.openapi.keymap.impl.DefaultKeymap; //导入依赖的package包/类
private void applyKeymap(@Nonnull String keymapName) {
if(myInitial) {
return;
}
KeymapManagerEx keymapManager = KeymapManagerEx.getInstanceEx();
DefaultKeymap defaultKeymap = DefaultKeymap.getInstance();
Keymap[] keymaps = defaultKeymap.getKeymaps();
for (Keymap keymap : keymaps) {
if (keymapName.equals(keymap.getName())) {
keymapManager.setActiveKeymap(keymap);
}
}
}
示例3: updateShortcuts
import com.intellij.openapi.keymap.impl.DefaultKeymap; //导入依赖的package包/类
private static void updateShortcuts(StringBuilder text) {
int lastIndex = 0;
while (true) {
lastIndex = text.indexOf(SHORTCUT_ENTITY, lastIndex);
if (lastIndex < 0) return;
final int actionIdStart = lastIndex + SHORTCUT_ENTITY.length();
int actionIdEnd = text.indexOf(";", actionIdStart);
if (actionIdEnd < 0) {
return;
}
final String actionId = text.substring(actionIdStart, actionIdEnd);
String shortcutText = getShortcutText(actionId, KeymapManager.getInstance().getActiveKeymap());
if (shortcutText == null) {
Keymap defKeymap = KeymapManager.getInstance().getKeymap(DefaultKeymap.getInstance().getDefaultKeymapName());
if (defKeymap != null) {
shortcutText = getShortcutText(actionId, defKeymap);
if (shortcutText != null) {
shortcutText += " in default keymap";
}
}
}
if (shortcutText == null) {
shortcutText = "<no shortcut for action " + actionId + ">";
}
text.replace(lastIndex, actionIdEnd + 1, shortcutText);
lastIndex += shortcutText.length();
}
}