当前位置: 首页>>代码示例>>Java>>正文


Java KeymapUtil.getShortcutText方法代码示例

本文整理汇总了Java中com.intellij.openapi.keymap.KeymapUtil.getShortcutText方法的典型用法代码示例。如果您正苦于以下问题:Java KeymapUtil.getShortcutText方法的具体用法?Java KeymapUtil.getShortcutText怎么用?Java KeymapUtil.getShortcutText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.keymap.KeymapUtil的用法示例。


在下文中一共展示了KeymapUtil.getShortcutText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSettingsButton

import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
@NotNull
private InplaceButton createSettingsButton(@NotNull final FindUsagesHandler handler,
                                           @NotNull final RelativePoint popupPosition,
                                           final Editor editor,
                                           final int maxUsages,
                                           @NotNull final Runnable cancelAction) {
  String shortcutText = "";
  KeyboardShortcut shortcut = UsageViewImpl.getShowUsagesWithSettingsShortcut();
  if (shortcut != null) {
    shortcutText = "(" + KeymapUtil.getShortcutText(shortcut) + ")";
  }
  return new InplaceButton("Settings..." + shortcutText, AllIcons.General.Settings, new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
          showDialogAndFindUsages(handler, popupPosition, editor, maxUsages);
        }
      });
      cancelAction.run();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ShowUsagesAction.java

示例2: createActionLabel

import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
protected JLabel createActionLabel(AnAction anAction, String anActionName,
                                   Color fg, Color bg,
                                   Icon icon) {
  LayeredIcon layeredIcon = new LayeredIcon(2);
  layeredIcon.setIcon(EMPTY_ICON, 0);
  if (icon != null && icon.getIconWidth() <= EMPTY_ICON.getIconWidth() && icon.getIconHeight() <= EMPTY_ICON.getIconHeight()) {
    layeredIcon
      .setIcon(icon, 1, (-icon.getIconWidth() + EMPTY_ICON.getIconWidth()) / 2, (EMPTY_ICON.getIconHeight() - icon.getIconHeight()) / 2);
  }

  Shortcut shortcut = preferKeyboardShortcut(KeymapManager.getInstance().getActiveKeymap().getShortcuts(getActionId(anAction)));
  String actionName = anActionName + (shortcut != null ? " (" + KeymapUtil.getShortcutText(shortcut) + ")" : "");
  JLabel actionLabel = new JLabel(actionName, layeredIcon, SwingConstants.LEFT);
  actionLabel.setBackground(bg);
  actionLabel.setForeground(fg);
  return actionLabel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GotoActionModel.java

示例3: createActionLabel

import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
protected JLabel createActionLabel(final AnAction anAction, final String anActionName,
                                   final Color fg, final Color bg,
                                   final Icon icon) {
  final LayeredIcon layeredIcon = new LayeredIcon(2);
  layeredIcon.setIcon(EMPTY_ICON, 0);
  if (icon != null && icon.getIconWidth() <= EMPTY_ICON.getIconWidth() && icon.getIconHeight() <= EMPTY_ICON.getIconHeight()) {
    layeredIcon
      .setIcon(icon, 1, (-icon.getIconWidth() + EMPTY_ICON.getIconWidth()) / 2, (EMPTY_ICON.getIconHeight() - icon.getIconHeight()) / 2);
  }

  final Shortcut[] shortcutSet = KeymapManager.getInstance().getActiveKeymap().getShortcuts(getActionId(anAction));
  final String actionName = anActionName + (shortcutSet != null && shortcutSet.length > 0
                                            ? " (" + KeymapUtil.getShortcutText(shortcutSet[0]) + ")"
                                            : "");
  final JLabel actionLabel = new JLabel(actionName, layeredIcon, SwingConstants.LEFT);
  actionLabel.setBackground(bg);
  actionLabel.setForeground(fg);
  return actionLabel;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:GotoActionModel.java

示例4: createSettingsButton

import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
@NotNull
private InplaceButton createSettingsButton(@NotNull final FindUsagesHandler handler,
    @NotNull final RelativePoint popupPosition, final Editor editor, final int maxUsages,
    @NotNull final Runnable cancelAction) {
  String shortcutText = "";
  KeyboardShortcut shortcut = UsageViewImpl.getShowUsagesWithSettingsShortcut();
  if (shortcut != null) {
    shortcutText = "(" + KeymapUtil.getShortcutText(shortcut) + ")";
  }
  return new InplaceButton("Settings..." + shortcutText, AllIcons.General.Settings,
      new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
          SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
              showDialogAndFindUsages(handler, popupPosition, editor, maxUsages);
            }
          });
          cancelAction.run();
        }
      }
  );
}
 
开发者ID:square,项目名称:dagger-intellij-plugin,代码行数:25,代码来源:ShowUsagesAction.java

示例5: createSettingsButton

import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
@Nonnull
private InplaceButton createSettingsButton(@Nonnull final FindUsagesHandler handler,
                                           @Nonnull final RelativePoint popupPosition,
                                           final Editor editor,
                                           final int maxUsages,
                                           @Nonnull final Runnable cancelAction) {
  String shortcutText = "";
  KeyboardShortcut shortcut = UsageViewImpl.getShowUsagesWithSettingsShortcut();
  if (shortcut != null) {
    shortcutText = "(" + KeymapUtil.getShortcutText(shortcut) + ")";
  }
  return new InplaceButton("Settings..." + shortcutText, AllIcons.General.Settings, e -> {
    ApplicationManager.getApplication().invokeLater(() -> showDialogAndFindUsages(handler, popupPosition, editor, maxUsages));
    cancelAction.run();
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:ShowUsagesAction.java

示例6: createActionLabel

import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
protected JLabel createActionLabel(final AnAction anAction, final String anActionName,
                                   final Color fg, final Color bg,
                                   final Icon icon) {
  final LayeredIcon layeredIcon = new LayeredIcon(2);
  layeredIcon.setIcon(EMPTY_ICON, 0);
  if (icon != null && icon.getIconWidth() <= EMPTY_ICON.getIconWidth() && icon.getIconHeight() <= EMPTY_ICON.getIconHeight()) {
    layeredIcon
            .setIcon(icon, 1, (-icon.getIconWidth() + EMPTY_ICON.getIconWidth()) / 2, (EMPTY_ICON.getIconHeight() - icon.getIconHeight()) / 2);
  }

  final Shortcut shortcut = preferKeyboardShortcut(KeymapManager.getInstance().getActiveKeymap().getShortcuts(getActionId(anAction)));
  final String actionName = anActionName + (shortcut != null ? " (" + KeymapUtil.getShortcutText(shortcut) + ")" : "");
  final JLabel actionLabel = new JLabel(actionName, layeredIcon, SwingConstants.LEFT);
  actionLabel.setBackground(bg);
  actionLabel.setForeground(fg);
  return actionLabel;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:GotoActionModel.java

示例7: createSettingsButton

import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
@NotNull
private InplaceButton createSettingsButton(@NotNull final FindUsagesHandler handler,
    @NotNull final RelativePoint popupPosition,
    final Editor editor,
    final int maxUsages,
    @NotNull final Runnable cancelAction) {
  String shortcutText = "";
  KeyboardShortcut shortcut = UsageViewImpl.getShowUsagesWithSettingsShortcut();
  if (shortcut != null) {
    shortcutText = "(" + KeymapUtil.getShortcutText(shortcut) + ")";
  }
  return new InplaceButton("Settings..." + shortcutText, AllIcons.General.Settings, new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
          showDialogAndFindUsages(handler, popupPosition, editor, maxUsages);
        }
      });
      cancelAction.run();
    }
  });
}
 
开发者ID:square,项目名称:otto-intellij-plugin,代码行数:25,代码来源:ShowUsagesAction.java

示例8: getNthShortcutText

import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
@NotNull
public static String getNthShortcutText(@NotNull AnAction action, int n) {
    Shortcut[] shortcuts = action.getShortcutSet().getShortcuts();
    String shortcutText = "";
    for (Shortcut shortcut : shortcuts) {
        if (shortcut instanceof KeyboardShortcut) {
            String text = KeymapUtil.getShortcutText(shortcut);
            if (!text.isEmpty()) {
                shortcutText = text;
                if (--n <= 0) break;
            }
        }
    }
    return shortcutText;
}
 
开发者ID:vsch,项目名称:MissingInActions,代码行数:16,代码来源:CommonUIShortcuts.java

示例9: composeText

import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
@NotNull
private static String composeText(@NotNull PsiElement[] methods, @NotNull String start, @NotNull String pattern, @NotNull String actionId) {
  Shortcut[] shortcuts = ActionManager.getInstance().getAction(actionId).getShortcutSet().getShortcuts();
  Shortcut shortcut = ArrayUtil.getFirstElement(shortcuts);
  String postfix = "<br><div style='margin-top: 5px'><font size='2'>Click";
  if (shortcut != null) postfix += " or press " + KeymapUtil.getShortcutText(shortcut);
  postfix += " to navigate</font></div>";
  return GutterIconTooltipHelper.composeText(Arrays.asList(methods), start, pattern, postfix);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:MarkerType.java

示例10: createOptionsHtml

import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
@NotNull
private static String createOptionsHtml(@NonNls UsageTarget[] searchFor) {
  KeyboardShortcut shortcut = UsageViewImpl.getShowUsagesWithSettingsShortcut(searchFor);
  String shortcutText = "";
  if (shortcut != null) {
    shortcutText = "&nbsp;(" + KeymapUtil.getShortcutText(shortcut) + ")";
  }
  return "<a href='" + FIND_OPTIONS_HREF_TARGET + "'>Find Options...</a>" + shortcutText;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:SearchForUsagesRunnable.java

示例11: getShortcutText

import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
@Nullable
private static String getShortcutText(String actionId, Keymap keymap) {
  for (final Shortcut shortcut : keymap.getShortcuts(actionId)) {
    if (shortcut instanceof KeyboardShortcut) {
      return KeymapUtil.getShortcutText(shortcut);
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:TipUIUtil.java

示例12: getShortcutText

import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
public static String getShortcutText() {
  final Shortcut[] shortcuts = ActionManager.getInstance()
    .getAction(IdeActions.ACTION_HIGHLIGHT_USAGES_IN_FILE)
    .getShortcutSet()
    .getShortcuts();
  if (shortcuts.length == 0) {
    return "<no key assigned>";
  }
  return KeymapUtil.getShortcutText(shortcuts[0]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:HighlightUsagesHandler.java

示例13: getSecondInvocationTitle

import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
@Nullable
private static String getSecondInvocationTitle(@NotNull FindUsagesOptions options, @NotNull FindUsagesHandler handler) {
  if (getShowUsagesShortcut() != null) {
     GlobalSearchScope maximalScope = FindUsagesManager.getMaximalScope(handler);
    if (!options.searchScope.equals(maximalScope)) {
       return "Press " + KeymapUtil.getShortcutText(getShowUsagesShortcut()) + " again to search in " + maximalScope.getDisplayName();
     }
   }
   return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ShowUsagesAction.java

示例14: getAdText

import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
@Nullable
@Override
protected String getAdText(PsiElement source, int length) {
  if (length > 0 && !TestFinderHelper.isTest(source)) {
    final Keymap keymap = KeymapManager.getInstance().getActiveKeymap();
    final Shortcut[] shortcuts = keymap.getShortcuts(DefaultRunExecutor.getRunExecutorInstance().getContextActionId());
    if (shortcuts.length > 0) {
      return ("Press " + KeymapUtil.getShortcutText(shortcuts[0]) + " to run selected tests");
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:GotoTestOrCodeHandler.java

示例15: advertiseActions

import com.intellij.openapi.keymap.KeymapUtil; //导入方法依赖的package包/类
@Override
protected void advertiseActions(@NotNull JComponent splitters, @NotNull UIUtil.TextPainter painter) {
  String shortcut = KeymapUtil.getShortcutText(new KeyboardShortcut(KeyStroke.getKeyStroke(StudyNextWindowAction.SHORTCUT2), null));
  appendAction(painter, "Navigate to the next answer placeholder", shortcut);
  appendAction(painter, "Navigate between answer placeholders", getActionShortcutText(StudyPrevWindowAction.ACTION_ID) + separator +
                                                                getActionShortcutText(StudyNextWindowAction.ACTION_ID));
  appendAction(painter, "Navigate between tasks", getActionShortcutText(StudyPreviousStudyTaskAction.ACTION_ID) + separator +
                                                  getActionShortcutText(StudyNextStudyTaskAction.ACTION_ID));
  appendAction(painter, "Reset current task file", getActionShortcutText(StudyRefreshTaskFileAction.ACTION_ID));
  appendAction(painter, "Check task", getActionShortcutText(StudyCheckAction.ACTION_ID));
  appendAction(painter, "Get hint for the answer placeholder", getActionShortcutText(StudyShowHintAction.ACTION_ID));
  appendLine(painter,"To see your progress open the '" + StudyProgressToolWindowFactory.ID + "' panel");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:StudyInstructionPainter.java


注:本文中的com.intellij.openapi.keymap.KeymapUtil.getShortcutText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。