本文整理汇总了Java中com.intellij.openapi.actionSystem.KeyboardShortcut类的典型用法代码示例。如果您正苦于以下问题:Java KeyboardShortcut类的具体用法?Java KeyboardShortcut怎么用?Java KeyboardShortcut使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KeyboardShortcut类属于com.intellij.openapi.actionSystem包,在下文中一共展示了KeyboardShortcut类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: CloseOnESCAction
import com.intellij.openapi.actionSystem.KeyboardShortcut; //导入依赖的package包/类
public CloseOnESCAction(EditorSearchComponent editorSearchComponent, JComponent textField) {
super(editorSearchComponent);
ArrayList<Shortcut> shortcuts = new ArrayList<Shortcut>();
if (KeymapUtil.isEmacsKeymap()) {
shortcuts.add(new KeyboardShortcut(KeyStroke.getKeyStroke(KeyEvent.VK_G, InputEvent.CTRL_MASK), null));
textField.registerKeyboardAction(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
CloseOnESCAction.this.actionPerformed(null);
}
}, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_FOCUSED);
} else {
shortcuts.add(new KeyboardShortcut(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), null));
}
registerCustomShortcutSet(new CustomShortcutSet(shortcuts.toArray(new Shortcut[shortcuts.size()])), textField);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:CloseOnESCAction.java
示例2: skipAction
import com.intellij.openapi.actionSystem.KeyboardShortcut; //导入依赖的package包/类
private static boolean skipAction(KeyEvent e, List<AnAction> actionsToSkip)
{
if(actionsToSkip != null)
{
final KeyboardShortcut eventShortcut = new KeyboardShortcut(KeyStroke.getKeyStrokeForEvent(e), null);
for(AnAction action : actionsToSkip)
{
for(Shortcut sc : action.getShortcutSet().getShortcuts())
{
if(sc.isKeyboard() && sc.startsWith(eventShortcut))
{
return true;
}
}
}
}
return false;
}
开发者ID:consulo,项目名称:consulo-terminal,代码行数:19,代码来源:JBTerminalPanel.java
示例3: createSettingsButton
import com.intellij.openapi.actionSystem.KeyboardShortcut; //导入依赖的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
示例4: getActivateToolWindowVKs
import com.intellij.openapi.actionSystem.KeyboardShortcut; //导入依赖的package包/类
public static Set<Integer> getActivateToolWindowVKs() {
if (ApplicationManager.getApplication() == null) return new HashSet<>();
Keymap keymap = KeymapManager.getInstance().getActiveKeymap();
Shortcut[] baseShortcut = keymap.getShortcuts("ActivateProjectToolWindow");
int baseModifiers = 0;
for (Shortcut each : baseShortcut) {
if (each instanceof KeyboardShortcut) {
KeyStroke keyStroke = ((KeyboardShortcut)each).getFirstKeyStroke();
baseModifiers = keyStroke.getModifiers();
if (baseModifiers > 0) {
break;
}
}
}
return getModifiersVKs(baseModifiers);
}
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:DesktopToolWindowManagerImpl.java
示例5: createSettingsButton
import com.intellij.openapi.actionSystem.KeyboardShortcut; //导入依赖的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
示例6: subInit
import com.intellij.openapi.actionSystem.KeyboardShortcut; //导入依赖的package包/类
@Override
protected void subInit() {
super.subInit();
this.myMessageTextField = new EditorTextField("");
this.myKindUpDownHint = new JLabel();
this.myKindUpDownHint.setIcon(PlatformIcons.UP_DOWN_ARROWS);
this.myKindUpDownHint.setToolTipText(PhpBundle.message("actions.new.php.base.arrows.kind.tooltip"));
this.myKindComboBox = new ComboBox<String>();
this.myKindComboBox.setMinimumAndPreferredWidth(400);
this.myKindComboBox.setRenderer(new ListCellRendererWrapper<Trinity>() {
public void customize(JList list, Trinity value, int index, boolean selected, boolean hasFocus) {
this.setText((String)value.first);
this.setIcon((Icon)value.second);
}
});
ComboboxSpeedSearch var10001 = new ComboboxSpeedSearch(this.myKindComboBox) {
protected String getElementText(Object element) {
return (String)((Trinity)element).first;
}
};
KeyboardShortcut up = new KeyboardShortcut(KeyStroke.getKeyStroke(38, 0), (KeyStroke)null);
KeyboardShortcut down = new KeyboardShortcut(KeyStroke.getKeyStroke(40, 0), (KeyStroke)null);
AnAction kindArrow = PhpNewFileDialog.getCbArrowAction(this.myKindComboBox);
kindArrow.registerCustomShortcutSet(new CustomShortcutSet(new Shortcut[]{up, down}), this.myNameTextField);
List<Trinity> exceptionTypes = this.getExceptionTypes();
for(Trinity type : exceptionTypes) {
this.myKindComboBox.addItem(type);
}
}
开发者ID:aurimasniekis,项目名称:idea-php-class-templates,代码行数:34,代码来源:PhpNewExceptionClassDialog.java
示例7: registerHandlerForComplementaryAction
import com.intellij.openapi.actionSystem.KeyboardShortcut; //导入依赖的package包/类
private static void registerHandlerForComplementaryAction(final Project project,
final Editor editor,
final PsiElement aClass,
final boolean toImplement,
final MemberChooser<PsiMethodMember> chooser) {
final JComponent preferredFocusedComponent = chooser.getPreferredFocusedComponent();
final Keymap keymap = KeymapManager.getInstance().getActiveKeymap();
@NonNls final String s = toImplement ? "OverrideMethods" : "ImplementMethods";
final Shortcut[] shortcuts = keymap.getShortcuts(s);
if (shortcuts.length > 0 && shortcuts[0] instanceof KeyboardShortcut) {
preferredFocusedComponent.getInputMap().put(
((KeyboardShortcut)shortcuts[0]).getFirstKeyStroke(), s
);
preferredFocusedComponent.getActionMap().put(
s,
new AbstractAction() {
@Override
public void actionPerformed(final ActionEvent e) {
chooser.close(DialogWrapper.CANCEL_EXIT_CODE);
// invoke later in order to close previous modal dialog
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
final CodeInsightActionHandler handler = toImplement ? new OverrideMethodsHandler(): new ImplementMethodsHandler();
handler.invoke(project, editor, aClass.getContainingFile());
}
});
}
}
);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:OverrideImplementUtil.java
示例8: createOptionsHtml
import com.intellij.openapi.actionSystem.KeyboardShortcut; //导入依赖的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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:SearchForUsagesRunnable.java
示例9: removeShortcuts
import com.intellij.openapi.actionSystem.KeyboardShortcut; //导入依赖的package包/类
private void removeShortcuts(String actionId) {
Shortcut[] shortcuts = getKeymap().getShortcuts(actionId);
for (Shortcut each : shortcuts) {
if (each instanceof KeyboardShortcut) {
getKeymap().removeShortcut(actionId, each);
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:QuickAccessSettings.java
示例10: getText
import com.intellij.openapi.actionSystem.KeyboardShortcut; //导入依赖的package包/类
private static String getText(Shortcut shortcut) {
if (shortcut instanceof KeyboardShortcut) {
KeyStroke fst = ((KeyboardShortcut)shortcut).getFirstKeyStroke();
String s = KeymapImpl.getKeyShortcutString(fst);
KeyStroke snd = ((KeyboardShortcut)shortcut).getSecondKeyStroke();
if (snd != null) {
s += "," + KeymapImpl.getKeyShortcutString(snd);
}
return s;
}
return KeymapUtil.getShortcutText(shortcut);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:KeymapsTestCase.java
示例11: checkLinuxKeymap
import com.intellij.openapi.actionSystem.KeyboardShortcut; //导入依赖的package包/类
private static void checkLinuxKeymap(final Keymap keymap) {
for (String actionId : keymap.getActionIds()) {
for (Shortcut shortcut : keymap.getShortcuts(actionId)) {
if (shortcut instanceof KeyboardShortcut) {
checkCtrlAltFn(keymap, shortcut, ((KeyboardShortcut)shortcut).getFirstKeyStroke());
checkCtrlAltFn(keymap, shortcut, ((KeyboardShortcut)shortcut).getSecondKeyStroke());
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:KeymapsTestCase.java
示例12: setData
import com.intellij.openapi.actionSystem.KeyboardShortcut; //导入依赖的package包/类
public void setData(Keymap keymap, KeyboardShortcut shortcut) {
myKeymap = keymap;
myEnableSecondKeystroke.setSelected(false);
if (shortcut != null) {
myFirstStrokePanel.getShortcutTextField().setKeyStroke(shortcut.getFirstKeyStroke());
if (shortcut.getSecondKeyStroke() != null) {
myEnableSecondKeystroke.setSelected(true);
mySecondStrokePanel.getShortcutTextField().setKeyStroke(shortcut.getSecondKeyStroke());
}
}
handleSecondKey();
updateCurrentKeyStrokeInfo();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:KeyboardShortcutDialog.java
示例13: convertShortcutFromParent
import com.intellij.openapi.actionSystem.KeyboardShortcut; //导入依赖的package包/类
public static Shortcut convertShortcutFromParent(Shortcut parentShortcut) {
if (parentShortcut instanceof MouseShortcut) {
return convertMouseShortcut((MouseShortcut)parentShortcut);
}
KeyboardShortcut key = (KeyboardShortcut)parentShortcut;
return new KeyboardShortcut(convertKeyStroke(key.getFirstKeyStroke()),
convertKeyStroke(key.getSecondKeyStroke()));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:MacOSDefaultKeymap.java
示例14: printConflict
import com.intellij.openapi.actionSystem.KeyboardShortcut; //导入依赖的package包/类
private boolean printConflict(GridBagConstraints c, int actionKey, String actionId) {
boolean hasConflicts = false;
int mask = myQuickAccessSettings.getModifierMask(myModifiers);
KeyboardShortcut sc = new KeyboardShortcut(KeyStroke.getKeyStroke(actionKey, mask), null);
Map<String,ArrayList<KeyboardShortcut>> conflictMap = myQuickAccessSettings.getKeymap().getConflicts(actionId, sc);
if (conflictMap.size() > 0) {
hasConflicts = true;
JLabel scText = new JLabel(sc.toString());
c.gridy++;
c.gridx = 0;
myConflicts.add(scText, c);
Iterator<String> actions = conflictMap.keySet().iterator();
while (actions.hasNext()) {
String each = actions.next();
AnAction eachAnAction = ActionManager.getInstance().getAction(each);
if (eachAnAction != null) {
String text = eachAnAction.getTemplatePresentation().getText();
JLabel eachAction = new JLabel(text != null && text.length() > 0 ? text : each);
c.gridx = 1;
myConflicts.add(eachAction, c);
c.gridy++;
}
}
}
c.gridx = 0;
c.gridwidth = 2;
c.gridy++;
myConflicts.add(new SeparatorWithText(), c);
c.gridwidth = 1;
return hasConflicts;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:QuickAccessConfigurable.java
示例15: getShortcutText
import com.intellij.openapi.actionSystem.KeyboardShortcut; //导入依赖的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
示例16: ShowHistoryAction
import com.intellij.openapi.actionSystem.KeyboardShortcut; //导入依赖的package包/类
public ShowHistoryAction(boolean search) {
super((search ? "Search" : "Replace") + " History",
(search ? "Search" : "Replace") + " history",
IconLoader.findIcon("/com/intellij/ide/ui/laf/icons/search.png", DarculaTextFieldUI.class, true));
myShowSearchHistory = search;
KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_H, InputEvent.CTRL_DOWN_MASK);
registerCustomShortcutSet(new CustomShortcutSet(new KeyboardShortcut(stroke, null)), myTextArea);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:SearchTextArea.java
示例17: advertiseActions
import com.intellij.openapi.actionSystem.KeyboardShortcut; //导入依赖的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
示例18: invokeActionViaKeystroke
import com.intellij.openapi.actionSystem.KeyboardShortcut; //导入依赖的package包/类
private void invokeActionViaKeystroke(@NotNull String actionId) {
AnAction action = ActionManager.getInstance().getAction(actionId);
assertNotNull(actionId, action);
assertTrue(actionId + " is not enabled", action.getTemplatePresentation().isEnabled());
Keymap keymap = KeymapManager.getInstance().getActiveKeymap();
Shortcut[] shortcuts = keymap.getShortcuts(actionId);
assertNotNull(shortcuts);
assertThat(shortcuts).isNotEmpty();
Shortcut shortcut = shortcuts[0];
if (shortcut instanceof KeyboardShortcut) {
KeyboardShortcut cs = (KeyboardShortcut)shortcut;
KeyStroke firstKeyStroke = cs.getFirstKeyStroke();
Component component = getFocusedEditor();
if (component != null) {
ComponentDriver driver = new ComponentDriver(robot);
System.out.println("Invoking editor action " + actionId + " via shortcut "
+ KeyEvent.getKeyModifiersText(firstKeyStroke.getModifiers())
+ KeyEvent.getKeyText(firstKeyStroke.getKeyCode()));
driver.pressAndReleaseKey(component, firstKeyStroke.getKeyCode(), new int[]{firstKeyStroke.getModifiers()});
KeyStroke secondKeyStroke = cs.getSecondKeyStroke();
if (secondKeyStroke != null) {
System.out.println(" and "
+ KeyEvent.getKeyModifiersText(secondKeyStroke.getModifiers())
+ KeyEvent.getKeyText(secondKeyStroke.getKeyCode()));
driver.pressAndReleaseKey(component, secondKeyStroke.getKeyCode(), new int[]{secondKeyStroke.getModifiers()});
}
} else {
fail("Editor not focused for action");
}
}
else {
fail("Unsupported shortcut type " + shortcut.getClass().getName());
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:EditorFixture.java
示例19: removeFirstKeyboardShortcut
import com.intellij.openapi.actionSystem.KeyboardShortcut; //导入依赖的package包/类
@Nullable
private static KeyboardShortcut removeFirstKeyboardShortcut(Keymap keymap, String actionId) {
Shortcut[] shortcuts = keymap.getShortcuts(actionId);
for (Shortcut each : shortcuts) {
if (each instanceof KeyboardShortcut) {
keymap.removeShortcut(actionId, each);
return (KeyboardShortcut)each;
}
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:AndroidInitialConfigurator.java
示例20: registerUpDownHint
import com.intellij.openapi.actionSystem.KeyboardShortcut; //导入依赖的package包/类
public static void registerUpDownHint(JComponent component, final GrTypeComboBox combo) {
final AnAction arrow = new AnAction() {
@Override
public void actionPerformed(AnActionEvent e) {
if (e.getInputEvent() instanceof KeyEvent) {
final int code = ((KeyEvent)e.getInputEvent()).getKeyCode();
scrollBy(code == KeyEvent.VK_DOWN ? 1 : code == KeyEvent.VK_UP ? -1 : 0, combo);
}
}
};
final KeyboardShortcut up = new KeyboardShortcut(KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.ALT_DOWN_MASK), null);
final KeyboardShortcut down = new KeyboardShortcut(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.ALT_DOWN_MASK), null);
arrow.registerCustomShortcutSet(new CustomShortcutSet(up, down), component);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:GrTypeComboBox.java
注:本文中的com.intellij.openapi.actionSystem.KeyboardShortcut类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论