本文整理汇总了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"));
}
}
示例2: getShortcut
import com.intellij.openapi.actionSystem.ShortcutProvider; //导入依赖的package包/类
@Nullable
@Override
public ShortcutSet getShortcut() {
return myAction instanceof ShortcutProvider ? ((ShortcutProvider)myAction).getShortcut() : null;
}
示例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"));
}
}
示例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;
}