本文整理汇总了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();
}
});
}
示例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;
}
示例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;
}
示例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();
}
}
);
}
示例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();
});
}
示例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;
}
示例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();
}
});
}
示例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;
}
示例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);
}
示例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 = " (" + KeymapUtil.getShortcutText(shortcut) + ")";
}
return "<a href='" + FIND_OPTIONS_HREF_TARGET + "'>Find Options...</a>" + shortcutText;
}
示例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;
}
示例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]);
}
示例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;
}
示例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;
}
示例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");
}