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


Java ShortcutProvider类代码示例

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


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

示例1: customizeComponent

import com.intellij.openapi.actionSystem.ShortcutProvider; //导入依赖的package包/类
@Override
protected void customizeComponent(JList list, Object value, boolean isSelected) {
  ListPopupStep<Object> step = myPopup.getListStep();
  boolean isSelectable = step.isSelectable(value);
  myTextLabel.setEnabled(isSelectable);
  if (!isSelected && step instanceof BaseListPopupStep) {
    Color bg = ((BaseListPopupStep)step).getBackgroundFor(value);
    Color fg = ((BaseListPopupStep)step).getForegroundFor(value);
    if (fg != null) myTextLabel.setForeground(fg);
    if (bg != null) UIUtil.setBackgroundRecursively(myComponent, bg);
  }

  if (step.isMnemonicsNavigationEnabled()) {
    final int pos = step.getMnemonicNavigationFilter().getMnemonicPos(value);
    if (pos != -1) {
      String text = myTextLabel.getText();
      text = text.substring(0, pos) + text.substring(pos + 1);
      myTextLabel.setText(text);
      myTextLabel.setDisplayedMnemonicIndex(pos);
    }
  }
  else {
    myTextLabel.setDisplayedMnemonicIndex(-1);
  }

  if (step.hasSubstep(value) && isSelectable) {
    myNextStepLabel.setVisible(true);
    final boolean isDark = ColorUtil.isDark(UIUtil.getListSelectionBackground());
    myNextStepLabel.setIcon(isSelected ? isDark ? AllIcons.Icons.Ide.NextStepInverted
                                                : AllIcons.Icons.Ide.NextStep
                                       : AllIcons.Icons.Ide.NextStepGrayed);
  }
  else {
    myNextStepLabel.setVisible(false);
    //myNextStepLabel.setIcon(PopupIcons.EMPTY_ICON);
  }

  setSelected(myNextStepLabel, isSelected);


  if (myShortcutLabel != null) {
    myShortcutLabel.setText("");
    if (value instanceof ShortcutProvider) {
      ShortcutSet set = ((ShortcutProvider)value).getShortcut();
      if (set != null) {
        Shortcut shortcut = ArrayUtil.getFirstElement(set.getShortcuts());
        if (shortcut != null) {
          myShortcutLabel.setText("     " + KeymapUtil.getShortcutText(shortcut));
        }
      }
    }
    setSelected(myShortcutLabel, isSelected);
    myShortcutLabel.setForeground(isSelected ? UIManager.getColor("MenuItem.acceleratorSelectionForeground") : UIManager.getColor("MenuItem.acceleratorForeground"));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:56,代码来源:PopupListElementRenderer.java

示例2: getShortcut

import com.intellij.openapi.actionSystem.ShortcutProvider; //导入依赖的package包/类
@Nullable
@Override
public ShortcutSet getShortcut() {
  return myAction instanceof ShortcutProvider ? ((ShortcutProvider)myAction).getShortcut() : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:IntentionActionWithTextCaching.java

示例3: customizeComponent

import com.intellij.openapi.actionSystem.ShortcutProvider; //导入依赖的package包/类
@Override
protected void customizeComponent(JList<? extends E> list, E value, boolean isSelected) {
  ListPopupStep<Object> step = myPopup.getListStep();
  boolean isSelectable = step.isSelectable(value);
  myTextLabel.setEnabled(isSelectable);
  if (!isSelected && step instanceof BaseListPopupStep) {
    Color bg = ((BaseListPopupStep)step).getBackgroundFor(value);
    Color fg = ((BaseListPopupStep)step).getForegroundFor(value);
    if (fg != null) myTextLabel.setForeground(fg);
    if (bg != null) UIUtil.setBackgroundRecursively(myComponent, bg);
  }

  if (step.isMnemonicsNavigationEnabled()) {
    final int pos = step.getMnemonicNavigationFilter().getMnemonicPos(value);
    if (pos != -1) {
      String text = myTextLabel.getText();
      text = text.substring(0, pos) + text.substring(pos + 1);
      myTextLabel.setText(text);
      myTextLabel.setDisplayedMnemonicIndex(pos);
    }
  }
  else {
    myTextLabel.setDisplayedMnemonicIndex(-1);
  }

  if (step.hasSubstep(value) && isSelectable) {
    myNextStepLabel.setVisible(true);
    final boolean isDark = ColorUtil.isDark(UIUtil.getListSelectionBackground());
    myNextStepLabel.setIcon(isSelected ? isDark ? AllIcons.Icons.Ide.NextStepInverted
                                                : AllIcons.Icons.Ide.NextStep
                                       : AllIcons.Icons.Ide.NextStepGrayed);
  }
  else {
    myNextStepLabel.setVisible(false);
    //myNextStepLabel.setIcon(PopupIcons.EMPTY_ICON);
  }

  setSelected(myNextStepLabel, isSelected);


  if (myShortcutLabel != null) {
    myShortcutLabel.setEnabled(isSelectable);
    myShortcutLabel.setText("");
    if (value instanceof ShortcutProvider) {
      ShortcutSet set = ((ShortcutProvider)value).getShortcut();
      if (set != null) {
        Shortcut shortcut = ArrayUtil.getFirstElement(set.getShortcuts());
        if (shortcut != null) {
          myShortcutLabel.setText("     " + KeymapUtil.getShortcutText(shortcut));
        }
      }
    }
    setSelected(myShortcutLabel, isSelected);
    myShortcutLabel.setForeground(isSelected ? UIManager.getColor("MenuItem.acceleratorSelectionForeground") : UIManager.getColor("MenuItem.acceleratorForeground"));
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:57,代码来源:PopupListElementRenderer.java

示例4: getShortcut

import com.intellij.openapi.actionSystem.ShortcutProvider; //导入依赖的package包/类
@Nullable
@Override
public ShortcutSet getShortcut() {
  IntentionAction delegate = getDelegate();
  return delegate instanceof ShortcutProvider ? ((ShortcutProvider)delegate).getShortcut() : null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:7,代码来源:IntentionActionWrapper.java


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