本文整理汇总了Java中com.intellij.openapi.actionSystem.impl.ActionButton类的典型用法代码示例。如果您正苦于以下问题:Java ActionButton类的具体用法?Java ActionButton怎么用?Java ActionButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActionButton类属于com.intellij.openapi.actionSystem.impl包,在下文中一共展示了ActionButton类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createButton
import com.intellij.openapi.actionSystem.impl.ActionButton; //导入依赖的package包/类
@NotNull
private ActionButton createButton(@NotNull final ButtonType type) {
final AnAction action;
switch (type) {
case LEFT:
action = new LeftAction();
break;
case RIGHT:
action = new RightAction();
break;
case ALL_LEFT:
action = new AllLeftAction();
break;
case ALL_RIGHT:
action = new AllRightAction();
break;
default: throw new IllegalArgumentException("Unsupported button type: " + type);
}
ActionButton button = createButton(action);
myButtons.put(type, button);
return button;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:JBMovePanel.java
示例2: SearchTextArea
import com.intellij.openapi.actionSystem.impl.ActionButton; //导入依赖的package包/类
public SearchTextArea(boolean search) {
myTextArea = new JTextArea();
setBorder(JBUI.Borders.empty(6, 6, 6, 8));
setLayout(new BorderLayout(JBUI.scale(4), 0));
myTextArea.addPropertyChangeListener("background", this);
myTextArea.addFocusListener(this);
myTextArea.setBorder(null);
myTextArea.setOpaque(false);
JBScrollPane scrollPane = new JBScrollPane(myTextArea,
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.getVerticalScrollBar().setBackground(UIUtil.TRANSPARENT_COLOR);
scrollPane.getViewport().setBorder(null);
scrollPane.getViewport().setOpaque(false);
scrollPane.setBorder(JBUI.Borders.emptyRight(2));
scrollPane.setOpaque(false);
ShowHistoryAction historyAction = new ShowHistoryAction(search);
ActionButton button =
new ActionButton(historyAction, historyAction.getTemplatePresentation(), ActionPlaces.UNKNOWN, new Dimension(JBUI.scale(16), JBUI.scale(16)));
button.setLook(new InplaceActionButtonLook());
JPanel p = new NonOpaquePanel(new BorderLayout());
p.add(button, BorderLayout.NORTH);
add(p, BorderLayout.WEST);
add(scrollPane, BorderLayout.CENTER);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:SearchTextArea.java
示例3: stop
import com.intellij.openapi.actionSystem.impl.ActionButton; //导入依赖的package包/类
@TestOnly
public boolean stop() {
for (ActionButton button : getToolbarButtons()) {
final AnAction action = button.getAction();
if (action != null && action.getClass().getName().equals("com.intellij.execution.actions.StopAction")) {
//noinspection ConstantConditions
boolean enabled = method("isButtonEnabled").withReturnType(boolean.class).in(button).invoke();
if (enabled) {
button.click();
return true;
}
return false;
}
}
return false;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ExecutionToolWindowFixture.java
示例4: getMnemonicCharIndex
import com.intellij.openapi.actionSystem.impl.ActionButton; //导入依赖的package包/类
private int getMnemonicCharIndex(ActionButton button, AnAction action, String text) {
final int mnemonicIndex = button.getPresentation().getDisplayedMnemonicIndex();
if (mnemonicIndex != -1) {
return mnemonicIndex;
}
final ShortcutSet shortcutSet = action.getShortcutSet();
final Shortcut[] shortcuts = shortcutSet.getShortcuts();
for (int i = 0; i < shortcuts.length; i++) {
Shortcut shortcut = shortcuts[i];
if (shortcut instanceof KeyboardShortcut) {
KeyboardShortcut keyboardShortcut = (KeyboardShortcut)shortcut;
if (keyboardShortcut.getSecondKeyStroke() == null) { // we are interested only in "mnemonic-like" shortcuts
final KeyStroke keyStroke = keyboardShortcut.getFirstKeyStroke();
final int modifiers = keyStroke.getModifiers();
if ((modifiers & KeyEvent.ALT_MASK) != 0) {
return (keyStroke.getKeyChar() != KeyEvent.CHAR_UNDEFINED)
? text.indexOf(keyStroke.getKeyChar())
: text.indexOf(KeyEvent.getKeyText(keyStroke.getKeyCode()));
}
}
}
}
return -1;
}
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:ActionButtonUI.java
示例5: paintDefaultButton
import com.intellij.openapi.actionSystem.impl.ActionButton; //导入依赖的package包/类
private void paintDefaultButton(Graphics g, ActionButton c) {
AnAction action = c.getAction();
int state = c.getPopState();
if (state != ActionButtonComponent.NORMAL) {
paintBackground(c, g, c.getSize(), state);
paintBorder(c, g, c.getSize(), state);
}
paintIcon(g, c, c.getIcon());
if (action instanceof ActionGroup && ((ActionGroup)action).isPopup()) {
int x = JBUI.scale(5);
int y = JBUI.scale(4);
if (state == ActionButtonComponent.PUSHED) {
x += JBUI.scale(1);
y += JBUI.scale(1);
}
AllIcons.General.Dropdown.paintIcon(c, g, x, y);
}
}
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:ActionButtonUI.java
示例6: paintBorder
import com.intellij.openapi.actionSystem.impl.ActionButton; //导入依赖的package包/类
protected void paintBorder(ActionButton button, Graphics g, Dimension size, int state) {
if (UIUtil.isUnderAquaLookAndFeel()) {
if (state == ActionButtonComponent.POPPED) {
g.setColor(ALPHA_30);
g.drawRoundRect(0, 0, size.width - 2, size.height - 2, 4, 4);
}
}
else {
final double shift = UIUtil.isUnderDarcula() ? 1 / 0.49 : 0.49;
g.setColor(ColorUtil.shift(UIUtil.getPanelBackground(), shift));
((Graphics2D)g).setStroke(BASIC_STROKE);
final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
g.drawRoundRect(0, 0, size.width - JBUI.scale(2), size.height - JBUI.scale(2), JBUI.scale(4), JBUI.scale(4));
config.restore();
}
}
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:ActionButtonUI.java
示例7: paintBackground
import com.intellij.openapi.actionSystem.impl.ActionButton; //导入依赖的package包/类
protected void paintBackground(ActionButton button, Graphics g, Dimension size, int state) {
if (UIUtil.isUnderAquaLookAndFeel()) {
if (state == ActionButtonComponent.PUSHED) {
((Graphics2D)g).setPaint(UIUtil.getGradientPaint(0, 0, ALPHA_40, size.width, size.height, ALPHA_20));
g.fillRect(0, 0, size.width - 1, size.height - 1);
g.setColor(ALPHA_120);
g.drawLine(0, 0, 0, size.height - 2);
g.drawLine(1, 0, size.width - 2, 0);
g.setColor(ALPHA_30);
g.drawRect(1, 1, size.width - 3, size.height - 3);
}
else if (state == ActionButtonComponent.POPPED) {
((Graphics2D)g).setPaint(UIUtil.getGradientPaint(0, 0, Gray._235, 0, size.height, Gray._200));
g.fillRect(1, 1, size.width - 3, size.height - 3);
}
}
else {
final Color bg = UIUtil.getPanelBackground();
final boolean dark = UIUtil.isUnderDarcula();
g.setColor(state == ActionButtonComponent.PUSHED ? ColorUtil.shift(bg, dark ? 1d / 0.7d : 0.7d) : dark ? Gray._255.withAlpha(40) : ALPHA_40);
g.fillRect(JBUI.scale(1), JBUI.scale(1), size.width - JBUI.scale(2), size.height - JBUI.scale(2));
}
}
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:ActionButtonUI.java
示例8: createToolbar
import com.intellij.openapi.actionSystem.impl.ActionButton; //导入依赖的package包/类
private ActionToolbar createToolbar(final ActionGroup group) {
final ActionToolbarImpl actionToolbar =
new ActionToolbarImpl(ActionPlaces.CONTEXT_TOOLBAR, group, true, DataManager.getInstance(), ActionManagerEx.getInstanceEx(),
KeymapManagerEx.getInstanceEx()) {
@Override
protected ActionButton createToolbarButton(final AnAction action,
boolean minimalMode,
boolean decorateButtons,
final String place,
final Presentation presentation,
final Dimension minimumSize) {
final ActionButton result = new ActionButton(action, presentation, place, minimumSize);
result.setMinimalMode(minimalMode);
result.setDecorateButtons(decorateButtons);
return result;
}
};
actionToolbar.setTargetComponent(myEditor.getContentComponent());
return actionToolbar;
}
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:ContextMenuImpl.java
示例9: createButton
import com.intellij.openapi.actionSystem.impl.ActionButton; //导入依赖的package包/类
@Nonnull
private ActionButton createButton(@Nonnull final ButtonType type) {
final AnAction action;
switch (type) {
case LEFT:
action = new LeftAction();
break;
case RIGHT:
action = new RightAction();
break;
case ALL_LEFT:
action = new AllLeftAction();
break;
case ALL_RIGHT:
action = new AllRightAction();
break;
default: throw new IllegalArgumentException("Unsupported button type: " + type);
}
ActionButton button = createButton(action);
myButtons.put(type, button);
return button;
}
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:JBMovePanel.java
示例10: KeyPromoterAction
import com.intellij.openapi.actionSystem.impl.ActionButton; //导入依赖的package包/类
/**
* Constructor used when have to fall back to inspect an AWT event instead of actions that are directly provided
* by IDEA. Tool-window stripe buttons are such a case where I'm not notified by IDEA if one is pressed
*
* @param event mouse event that happened
*/
KeyPromoterAction(AWTEvent event) {
final Object source = event.getSource();
if (source instanceof ActionButton) {
analyzeActionButton((ActionButton) source);
} else if (source instanceof StripeButton) {
analyzeStripeButton((StripeButton) source);
} else if (source instanceof ActionMenuItem) {
analyzeActionMenuItem((ActionMenuItem) source);
} else if (source instanceof JButton) {
analyzeJButton((JButton) source);
}
}
开发者ID:halirutan,项目名称:IntelliJ-Key-Promoter-X,代码行数:20,代码来源:KeyPromoterAction.java
示例11: analyzeActionButton
import com.intellij.openapi.actionSystem.impl.ActionButton; //导入依赖的package包/类
/**
* Information extraction for buttons on the toolbar
*
* @param source source of the action
*/
private void analyzeActionButton(ActionButton source) {
final AnAction action = source.getAction();
if (action != null) {
fixValuesFromAction(action);
}
mySource = ActionSource.MAIN_TOOLBAR;
}
开发者ID:halirutan,项目名称:IntelliJ-Key-Promoter-X,代码行数:13,代码来源:KeyPromoterAction.java
示例12: buildShortcutIfAvailable
import com.intellij.openapi.actionSystem.impl.ActionButton; //导入依赖的package包/类
public static Optional<ShortcutAction> buildShortcutIfAvailable(Component eventSource) {
ShortcutAction shortcut = null;
if (isActionButton(eventSource)) {
shortcut = buildShortcut((ActionButton) eventSource);
} else if (isActionMenuItem(eventSource)) {
shortcut = buildShortcut((ActionMenuItem) eventSource);
}
if (shortcut != null && StringUtil.isEmptyOrSpaces(shortcut.getShortcutText())) {
return Optional.empty();
}
return Optional.ofNullable(shortcut);
}
开发者ID:treytrahin,项目名称:force-shortcuts-intellij-plugin,代码行数:16,代码来源:ShortcutActionFactory.java
示例13: buildShortcut
import com.intellij.openapi.actionSystem.impl.ActionButton; //导入依赖的package包/类
public static ShortcutAction buildShortcut(ActionButton actionButton) {
AnAction anAction = actionButton.getAction();
if (anAction == null) {
return null;
}
String shortcutText = KeymapUtil.getFirstKeyboardShortcutText(anAction);
String description = anAction.getTemplatePresentation().getText();
return new ShortcutAction(shortcutText, description);
}
开发者ID:treytrahin,项目名称:force-shortcuts-intellij-plugin,代码行数:12,代码来源:ShortcutActionFactory.java
示例14: setShowButtons
import com.intellij.openapi.actionSystem.impl.ActionButton; //导入依赖的package包/类
public void setShowButtons(@NotNull ButtonType... types) {
for (ActionButton button : myButtons.values()) {
button.setVisible(false);
}
for (ButtonType type : types) {
myButtons.get(type).setVisible(true);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:JBMovePanel.java
示例15: setEnabled
import com.intellij.openapi.actionSystem.impl.ActionButton; //导入依赖的package包/类
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
myLeftList.setEnabled(enabled);
myRightList.setEnabled(enabled);
for (ActionButton button : myButtons.values()) {
button.setEnabled(enabled);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JBMovePanel.java
示例16: createReloadButtonPanel
import com.intellij.openapi.actionSystem.impl.ActionButton; //导入依赖的package包/类
@NotNull
private JPanel createReloadButtonPanel() {
ReloadAction reloadAction = new ReloadAction();
ActionButton reloadButton = new ActionButton(
reloadAction,
reloadAction.getTemplatePresentation().clone(),
CONTROL_PLACE,
ActionToolbar.DEFAULT_MINIMUM_BUTTON_SIZE
);
JPanel panel = new JPanel(new BorderLayout(0, 0));
panel.add(reloadButton, BorderLayout.WEST);
return panel;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ReloadableComboBoxPanel.java
示例17: QuickDocInfoPane
import com.intellij.openapi.actionSystem.impl.ActionButton; //导入依赖的package包/类
QuickDocInfoPane(@NotNull PsiElement documentationAnchor,
@NotNull PsiElement elementUnderMouse,
@NotNull JComponent baseDocControl) {
myBaseDocControl = baseDocControl;
PresentationFactory presentationFactory = new PresentationFactory();
for (AbstractDocumentationTooltipAction action : ourTooltipActions) {
Icon icon = action.getTemplatePresentation().getIcon();
Dimension minSize = new Dimension(icon.getIconWidth(), icon.getIconHeight());
myButtons.add(new ActionButton(action, presentationFactory.getPresentation(action), IdeTooltipManager.IDE_TOOLTIP_PLACE, minSize));
action.setDocInfo(documentationAnchor, elementUnderMouse);
}
Collections.reverse(myButtons);
setPreferredSize(baseDocControl.getPreferredSize());
setMaximumSize(baseDocControl.getMaximumSize());
setMinimumSize(baseDocControl.getMinimumSize());
setBackground(baseDocControl.getBackground());
add(baseDocControl, Integer.valueOf(0));
int minWidth = 0;
int minHeight = 0;
int buttonWidth = 0;
for (JComponent button : myButtons) {
button.setBorder(null);
button.setBackground(baseDocControl.getBackground());
add(button, Integer.valueOf(1));
button.setVisible(false);
Dimension preferredSize = button.getPreferredSize();
minWidth += preferredSize.width;
minHeight = Math.max(minHeight, preferredSize.height);
buttonWidth = Math.max(buttonWidth, preferredSize.width);
}
myButtonWidth = buttonWidth;
int margin = 2;
myMinWidth = minWidth + margin * 2 + (myButtons.size() - 1) * BUTTON_HGAP;
myMinHeight = minHeight + margin * 2;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:CtrlMouseHandler.java
示例18: actionPerformed
import com.intellij.openapi.actionSystem.impl.ActionButton; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
final ActionButton secondaryActions = myToolbarComponent.getSecondaryActionsButton();
if (secondaryActions != null) {
secondaryActions.click();
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ShowMoreOptions.java
示例19: createCustomComponent
import com.intellij.openapi.actionSystem.impl.ActionButton; //导入依赖的package包/类
@Override
public JComponent createCustomComponent(Presentation presentation) {
ActionButton button = new ActionButton(
this,
presentation,
ActionPlaces.TODO_VIEW_TOOLBAR,
ActionToolbar.DEFAULT_MINIMUM_BUTTON_SIZE
);
presentation.putClientProperty("button", button);
return button;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:SetTodoFilterAction.java
示例20: createUIComponents
import com.intellij.openapi.actionSystem.impl.ActionButton; //导入依赖的package包/类
private void createUIComponents() {
myCloudProjectIdLabel = new CloudProjectIdLabel(MATRIX);
AnAction action = new AnAction() {
@Override
public void actionPerformed(AnActionEvent e) {
if (myCloudConfigurationProvider == null) {
return;
}
String selectedProjectId =
myCloudConfigurationProvider.openCloudProjectConfigurationDialog(myProject, myCloudProjectIdLabel.getText());
if (selectedProjectId != null) {
myCloudProjectIdLabel.updateCloudProjectId(selectedProjectId);
updateOkButton();
}
}
@Override
public void update(AnActionEvent event) {
Presentation presentation = event.getPresentation();
presentation.setIcon(AllIcons.General.Settings);
}
};
myCloudProjectIdUpdateButton =
new ActionButton(action, new PresentationFactory().getPresentation(action), "MyPlace", new Dimension(25, 25));
myCloudConfigurationCombo = new CloudConfigurationComboBox(MATRIX);
Disposer.register(myDisposable, myCloudConfigurationCombo);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:ExtendedDeviceChooserDialog.java
注:本文中的com.intellij.openapi.actionSystem.impl.ActionButton类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论