本文整理汇总了Java中com.intellij.openapi.keymap.KeymapUtil.getShortcutsText方法的典型用法代码示例。如果您正苦于以下问题:Java KeymapUtil.getShortcutsText方法的具体用法?Java KeymapUtil.getShortcutsText怎么用?Java KeymapUtil.getShortcutsText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.keymap.KeymapUtil
的用法示例。
在下文中一共展示了KeymapUtil.getShortcutsText方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getValueAt
import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
public Object getValueAt(Object value, int column) {
if (!(value instanceof DefaultMutableTreeNode)) {
return "???";
}
if (column == 0) {
return value;
}
else if (column == 1) {
Object userObject = ((DefaultMutableTreeNode)value).getUserObject();
if (userObject instanceof QuickList) {
userObject = ((QuickList)userObject).getActionId();
}
return userObject instanceof String ? KeymapUtil.getShortcutsText(myKeymap.getShortcuts((String)userObject)) : "";
}
else {
return "???";
}
}
示例2: getValueAt
import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
public Object getValueAt(Object value, int column) {
if (!(value instanceof DefaultMutableTreeNode)) {
return "???";
}
if (column == 0) {
return value;
}
else if (column == 1) {
Object userObject = ((DefaultMutableTreeNode)value).getUserObject();
if (userObject instanceof QuickList) {
userObject = ((QuickList)userObject).getActionId();
}
if (userObject instanceof String) {
Shortcut[] shortcuts = myKeymap.getShortcuts((String)userObject);
return KeymapUtil.getShortcutsText(shortcuts);
}
else {
return "";
}
}
else {
return "???";
}
}
示例3: getShortcut
import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
private static String getShortcut() {
String shortcutText;
final Shortcut[] shortcuts = KeymapManager.getInstance().getActiveKeymap().getShortcuts(IdeActions.ACTION_SEARCH_EVERYWHERE);
if (shortcuts.length == 0) {
shortcutText = "Double " + (SystemInfo.isMac ? MacKeymapUtil.SHIFT : "Shift");
} else {
shortcutText = KeymapUtil.getShortcutsText(shortcuts);
}
return shortcutText;
}
示例4: getShowMoreShortCut
import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
private String getShowMoreShortCut() {
if (myShortcutText == null) {
final KeymapManager keymapManager = KeymapManager.getInstance();
if (keymapManager != null) {
final Keymap keymap = keymapManager.getActiveKeymap();
myShortcutText =
keymap == null ? "" : "(" + KeymapUtil.getShortcutsText(keymap.getShortcuts(IdeActions.ACTION_SHOW_ERROR_DESCRIPTION)) + ")";
}
else {
myShortcutText = "";
}
}
return myShortcutText;
}
示例5: main
import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
@Override
public void main(String[] args) {
StringBuilder xml = new StringBuilder();
xml.append("<Keymaps>\n");
for (Keymap keymap : KeymapManagerEx.getInstanceEx().getAllKeymaps()) {
xml.append(" <Keymap name=\"").append(keymap.getName()).append("\">\n");
for (String id : keymap.getActionIds()) {
String shortcuts = KeymapUtil.getShortcutsText(keymap.getShortcuts(id));
if (!StringUtil.isEmpty(shortcuts)) {
xml.append(" <Action id=\"").append(id).append("\">\n");
for (Shortcut shortcut : keymap.getShortcuts(id)) {
xml.append(" <Shortcut>").append(KeymapUtil.getShortcutText(shortcut)).append("</Shortcut>\n");
}
xml.append(" </Action>\n");
}
}
xml.append(" </Keymap>\n");
}
xml.append("</Keymaps>");
final String path = args.length == 2 ? args[1] : PathManager.getHomePath() + File.separator + "AllKeymaps.xml";
File out = new File(path);
try {
FileUtil.writeToFile(out, xml.toString());
System.out.println("Saved to: " + out.getAbsolutePath());
}
catch (IOException e) {
e.printStackTrace();
System.exit(1);
}
System.exit(0);
}
示例6: getDescription
import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
public String getDescription(MavenProject project, String goal) {
String actionId = getActionId(project.getPath(), goal);
if (actionId == null) return "";
Keymap activeKeymap = KeymapManager.getInstance().getActiveKeymap();
Shortcut[] shortcuts = activeKeymap.getShortcuts(actionId);
if (shortcuts == null || shortcuts.length == 0) return "";
return KeymapUtil.getShortcutsText(shortcuts);
}
示例7: getShortcut
import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
private static String getShortcut() {
String shortcutText;
final Shortcut[] shortcuts = KeymapManager.getInstance().getActiveKeymap().getShortcuts(IdeActions.ACTION_SEARCH_EVERYWHERE);
if (shortcuts.length == 0) {
shortcutText = "Double " + (SystemInfo.isMac ? MacKeymapUtil.SHIFT : "Shift");
}
else {
shortcutText = KeymapUtil.getShortcutsText(shortcuts);
}
return shortcutText;
}
示例8: getDescription
import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
public String getDescription(@Nullable String projectPath, @Nullable String taskName) {
Shortcut[] shortcuts = getShortcuts(projectPath, taskName);
if (shortcuts.length == 0) return "";
return KeymapUtil.getShortcutsText(shortcuts);
}
示例9: main
import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
@Override
public void main(String[] args) {
ActionManager actionManager = ActionManager.getInstance();
StringBuilder xml = new StringBuilder();
xml.append("<Keymaps>\n");
for (Keymap keymap : KeymapManagerEx.getInstanceEx().getAllKeymaps()) {
xml.append(" <Keymap name=\"").append(keymap.getPresentableName()).append("\">\n");
for (String id : keymap.getActionIds()) {
String shortcuts = KeymapUtil.getShortcutsText(keymap.getShortcuts(id));
if (!StringUtil.isEmpty(shortcuts)) {
AnAction action = actionManager.getAction(id);
xml.append(" <Action id=\"").append(id).append("\">\n");
Set<String> addedShortcuts = new THashSet<String>();
for (Shortcut shortcut : keymap.getShortcuts(id)) {
// Different shortcuts may have equal display strings (e.g. shift+minus and shift+subtract)
// We don't want them do be duplicated for users
String shortcutText = KeymapUtil.getShortcutText(shortcut);
if (addedShortcuts.add(shortcutText)) {
xml.append(" <Shortcut>").append(shortcutText).append("</Shortcut>\n");
}
}
if (action != null) {
String text = action.getTemplatePresentation().getText();
if (text != null) {
xml.append(" <Text>").append(StringUtil.escapeXml(text)).append("</Text>\n");
}
}
xml.append(" </Action>\n");
}
}
xml.append(" </Keymap>\n");
}
xml.append("</Keymaps>");
final String path = args.length == 2 ? args[1] : PathManager.getHomePath() + File.separator + "AllKeymaps.xml";
File out = new File(path);
try {
FileUtil.writeToFile(out, xml.toString());
System.out.println("Saved to: " + out.getAbsolutePath());
}
catch (IOException e) {
e.printStackTrace();
System.exit(1);
}
System.exit(0);
}
示例10: getDescription
import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
public String getDescription(MavenProject project, String goal) {
Shortcut[] shortcuts = getShortcuts(project, goal);
if (shortcuts.length == 0) return "";
return KeymapUtil.getShortcutsText(shortcuts);
}