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


Java CustomShortcutSet类代码示例

本文整理汇总了Java中com.intellij.openapi.actionSystem.CustomShortcutSet的典型用法代码示例。如果您正苦于以下问题:Java CustomShortcutSet类的具体用法?Java CustomShortcutSet怎么用?Java CustomShortcutSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: installKeyAction

import com.intellij.openapi.actionSystem.CustomShortcutSet; //导入依赖的package包/类
void installKeyAction(JComponent component) {
  new AnAction() {
    @Override
    public void actionPerformed(AnActionEvent e) {
      InputEvent event = e.getInputEvent();
      if (event instanceof KeyEvent) {
        int row = myList.getSelectedIndex();
         int toSelect;
         switch (((KeyEvent)event).getKeyCode()) {
           case KeyEvent.VK_UP:
             toSelect = row == 0 ? myList.getItemsCount() - 1 : row - 1;
             myList.setSelectedIndex(toSelect);
             myList.ensureIndexIsVisible(toSelect);
             break;
           case KeyEvent.VK_DOWN:
             toSelect = row < myList.getItemsCount() - 1 ? row + 1 : 0;
             myList.setSelectedIndex(toSelect);
             myList.ensureIndexIsVisible(toSelect);
             break;
         }
      }
    }
  }.registerCustomShortcutSet(new CustomShortcutSet(KeyEvent.VK_UP, KeyEvent.VK_DOWN), component);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ProjectTypesList.java

示例2: TipManager

import com.intellij.openapi.actionSystem.CustomShortcutSet; //导入依赖的package包/类
public TipManager(final JComponent component, TipFactory factory) {
  myTipFactory = factory;
  myComponent = component;

  new UiNotifyConnector.Once(component, new Activatable() {
    public void showNotify() {
      installListeners();
    }

    public void hideNotify() {
    }
  });

  final HideTooltipAction hide = new HideTooltipAction();
  hide.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0)), myComponent);
  Disposer.register(this, new Disposable() {
    public void dispose() {
      hide.unregisterCustomShortcutSet(myComponent);
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:TipManager.java

示例3: createCenterPanel

import com.intellij.openapi.actionSystem.CustomShortcutSet; //导入依赖的package包/类
protected JComponent createCenterPanel() {
  myTextArea = new JTextArea(10, 50);
  myTextArea.setText(getText());
  myTextArea.setWrapStyleWord(true);
  myTextArea.setLineWrap(true);
  myTextArea.getDocument().addDocumentListener(new DocumentAdapter() {
    public void textChanged(DocumentEvent event) {
      if (myChangeListener != null) {
        myChangeListener.run();
      }
    }
  });

  new AnAction() {
    public void actionPerformed(AnActionEvent e) {
      doOKAction();
    }
  }.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0)), myTextArea);

  return ScrollPaneFactory.createScrollPane(myTextArea);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:AbstractFieldPanel.java

示例4: CloseOnESCAction

import com.intellij.openapi.actionSystem.CustomShortcutSet; //导入依赖的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

示例5: PaletteWindow

import com.intellij.openapi.actionSystem.CustomShortcutSet; //导入依赖的package包/类
public PaletteWindow(Project project)
{
	myProject = project;
	myProviders = Extensions.getExtensions(PaletteItemProvider.EP_NAME, project);

	setLayout(new GridLayout(1, 1));
	myScrollPane.addMouseListener(new MyScrollPanePopupHandler());
	myScrollPane.setBorder(null);
	KeyStroke escStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
	new ClearActiveItemAction().registerCustomShortcutSet(new CustomShortcutSet(escStroke), myScrollPane);

	if(!ApplicationManager.getApplication().isHeadlessEnvironment())
	{
		DragSource.getDefaultDragSource().addDragSourceListener(myDragSourceListener);
	}
}
 
开发者ID:consulo,项目名称:consulo-ui-designer,代码行数:17,代码来源:PaletteWindow.java

示例6: createCenterPanel

import com.intellij.openapi.actionSystem.CustomShortcutSet; //导入依赖的package包/类
@Override
protected JComponent createCenterPanel() {
  myTextArea = new JTextArea(10, 50);
  myTextArea.setText(getText());
  myTextArea.setWrapStyleWord(true);
  myTextArea.setLineWrap(true);
  myTextArea.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    public void textChanged(DocumentEvent event) {
      if (myChangeListener != null) {
        myChangeListener.run();
      }
    }
  });

  new AnAction() {
    @Override
    public void actionPerformed(AnActionEvent e) {
      doOKAction();
    }
  }.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0)), myTextArea);

  return ScrollPaneFactory.createScrollPane(myTextArea);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:AbstractFieldPanel.java

示例7: subInit

import com.intellij.openapi.actionSystem.CustomShortcutSet; //导入依赖的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

示例8: createInspectTree

import com.intellij.openapi.actionSystem.CustomShortcutSet; //导入依赖的package包/类
public static InspectDebuggerTree createInspectTree(final NodeDescriptorImpl descriptor, Project project) {
  final InspectDebuggerTree tree = new InspectDebuggerTree(project);
  final AnAction setValueAction = ActionManager.getInstance().getAction(DebuggerActions.SET_VALUE);
  setValueAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0)), tree);
  Disposer.register(tree, new Disposable() {
    @Override
    public void dispose() {
      setValueAction.unregisterCustomShortcutSet(tree);
    }
  });
  tree.setInspectDescriptor(descriptor);
  DebuggerContextImpl context = DebuggerManagerEx.getInstanceEx(project).getContext();
  tree.rebuild(context);
  return tree;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ValueHint.java

示例9: createFilteringActions

import com.intellij.openapi.actionSystem.CustomShortcutSet; //导入依赖的package包/类
@Override
@NotNull
public AnAction[] createFilteringActions(@NotNull final UsageView view) {
  final UsageViewImpl impl = (UsageViewImpl)view;
  if (view.getPresentation().isCodeUsages()) {
    final JComponent component = view.getComponent();
    final ShowImportsAction showImportsAction = new ShowImportsAction(impl);
    showImportsAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_I, InputEvent.CTRL_DOWN_MASK)), component, view);
    return new AnAction[] { showImportsAction };
  }
  else {
    return AnAction.EMPTY_ARRAY;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:ImportUsageFilteringRuleProvider.java

示例10: createGroupingActions

import com.intellij.openapi.actionSystem.CustomShortcutSet; //导入依赖的package包/类
@Override
@NotNull
public AnAction[] createGroupingActions(UsageView view) {
  UsageViewImpl impl = (UsageViewImpl)view;
  JComponent component = impl.getComponent();

  GroupByModuleTypeAction groupByModuleTypeAction = supportsModuleRule() ? new GroupByModuleTypeAction(impl) : null;
  if (groupByModuleTypeAction != null) {
    groupByModuleTypeAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.CTRL_DOWN_MASK)), component, impl);
  }

  GroupByFileStructureAction groupByFileStructureAction = createGroupByFileStructureAction(impl);

  GroupByScopeAction groupByScopeAction = supportsScopesRule() ? new GroupByScopeAction(impl) : null;

  GroupByPackageAction groupByPackageAction = new GroupByPackageAction(impl);
  groupByPackageAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_DOWN_MASK)), component, impl);

  ArrayList<AnAction> result = ContainerUtil.newArrayList();

  if (view.getPresentation().isUsageTypeFilteringAvailable()) {
    GroupByUsageTypeAction groupByUsageTypeAction = new GroupByUsageTypeAction(impl);
    groupByUsageTypeAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.CTRL_DOWN_MASK)), component, impl);
    
    ContainerUtil.addIfNotNull(result, groupByUsageTypeAction);
    ContainerUtil.addIfNotNull(result, groupByScopeAction);
    ContainerUtil.addIfNotNull(result, groupByModuleTypeAction);
    ContainerUtil.addIfNotNull(result, groupByPackageAction);
    ContainerUtil.addIfNotNull(result, groupByFileStructureAction);
  }
  else {
    ContainerUtil.addIfNotNull(result, groupByScopeAction);
    ContainerUtil.addIfNotNull(result, groupByModuleTypeAction);
    ContainerUtil.addIfNotNull(result, groupByPackageAction);
    ContainerUtil.addIfNotNull(result, groupByFileStructureAction);
  }
  return result.toArray(new AnAction[result.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:UsageGroupingRuleProviderImpl.java

示例11: createGroupByFileStructureAction

import com.intellij.openapi.actionSystem.CustomShortcutSet; //导入依赖的package包/类
public static GroupByFileStructureAction createGroupByFileStructureAction(UsageViewImpl impl) {
  final JComponent component = impl.getComponent();
  final GroupByFileStructureAction groupByFileStructureAction = new GroupByFileStructureAction(impl);
  groupByFileStructureAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_M,
                                                                                                    InputEvent.CTRL_DOWN_MASK)), component,
                                                       impl);

  return groupByFileStructureAction;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:UsageGroupingRuleProviderImpl.java

示例12: createShortcut

import com.intellij.openapi.actionSystem.CustomShortcutSet; //导入依赖的package包/类
/**
 * Creates shortcut for mnemonic replacing standard Alt+Letter to Ctrl+Alt+Letter on Mac with jdk version newer than 6
 * @param ch mnemonic letter
 * @return shortcut for mnemonic
 */
public static CustomShortcutSet createShortcut(char ch) {
  Character mnemonic = Character.valueOf(ch);
  String shortcut = SystemInfo.isMac && SystemInfo.isJavaVersionAtLeast("1.7") ?
                    "control alt pressed " + mnemonic :
                    "alt pressed " + mnemonic;
  return CustomShortcutSet.fromString(shortcut);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:MnemonicHelper.java

示例13: QuickFixAction

import com.intellij.openapi.actionSystem.CustomShortcutSet; //导入依赖的package包/类
protected QuickFixAction(String text, Icon icon, KeyStroke keyStroke, @NotNull InspectionToolWrapper toolWrapper) {
  super(text, null, icon);
  myToolWrapper = toolWrapper;
  if (keyStroke != null) {
    registerCustomShortcutSet(new CustomShortcutSet(keyStroke), null);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:QuickFixAction.java

示例14: createEditingActions

import com.intellij.openapi.actionSystem.CustomShortcutSet; //导入依赖的package包/类
protected void createEditingActions() {
  for (final ModuleSourceRootEditHandler<?> editor : myEditHandlers) {
    ToggleSourcesStateAction action = new ToggleSourcesStateAction(myTree, this, editor);
    CustomShortcutSet shortcutSet = editor.getMarkRootShortcutSet();
    if (shortcutSet != null) {
      action.registerCustomShortcutSet(shortcutSet, myTree);
    }
    myEditingActionsGroup.add(action);
  }

  setupExcludedAction();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ContentEntryTreeEditor.java

示例15: ShowHistoryAction

import com.intellij.openapi.actionSystem.CustomShortcutSet; //导入依赖的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


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