use of com.intellij.openapi.actionSystem.impl.ActionButton in project intellij-community by JetBrains.
the class SearchTextArea method createButton.
private static ActionButton createButton(AnAction action) {
Presentation presentation = action.getTemplatePresentation();
Dimension d = new JBDimension(16, 16);
ActionButton button = new ActionButton(action, presentation, ActionPlaces.UNKNOWN, d) {
@Override
protected DataContext getDataContext() {
return DataManager.getInstance().getDataContext(this);
}
};
button.setLook(new InplaceActionButtonLook());
button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
button.updateIcon();
return button;
}
use of com.intellij.openapi.actionSystem.impl.ActionButton in project intellij-community by JetBrains.
the class SetTodoFilterAction method createCustomComponent.
@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;
}
use of com.intellij.openapi.actionSystem.impl.ActionButton in project android by JetBrains.
the class ActionButtonFixture method findByActionId.
@NotNull
public static ActionButtonFixture findByActionId(@NotNull final String actionId, @NotNull final Robot robot, @NotNull final Container container) {
final Ref<ActionButton> actionButtonRef = new Ref<>();
Wait.seconds(1).expecting("ActionButton with ID '" + actionId + "' to be visible").until(() -> {
Collection<ActionButton> found = robot.finder().findAll(container, new GenericTypeMatcher<ActionButton>(ActionButton.class) {
@Override
protected boolean isMatching(@NotNull ActionButton button) {
if (button.isVisible()) {
AnAction action = button.getAction();
if (action != null) {
String id = ActionManager.getInstance().getId(action);
return actionId.equals(id);
}
}
return false;
}
});
if (found.size() == 1) {
actionButtonRef.set(getFirstItem(found));
return true;
}
return false;
});
ActionButton button = actionButtonRef.get();
if (button == null) {
throw new ComponentLookupException("Failed to find ActionButton with ID '" + actionId + "'");
}
return new ActionButtonFixture(robot, button);
}
use of com.intellij.openapi.actionSystem.impl.ActionButton in project android by JetBrains.
the class LibraryPropertiesDialog method createCenterPanel.
@Nullable
@Override
protected JComponent createCenterPanel() {
myIconLabel.setIcon(AllIcons.Modules.Library);
myNameLabel.setText(myLibrary.getName());
LibraryEditor editor = new SourcesAndDocsOnlyEditor(myLibrary);
myLibraryEditorComponent = new LibraryRootsComponent(myProject, editor) {
@Override
public void updatePropertiesLabel() {
JComponent c = getComponent();
if (c != null) {
MultiLineLabel propertiesLabel = findComponentOfType(c, MultiLineLabel.class);
if (propertiesLabel != null) {
propertiesLabel.setText("Add or remove source/Javadoc attachments");
}
}
}
};
myLibraryEditorComponent.updatePropertiesLabel();
JComponent c = myLibraryEditorComponent.getComponent();
// Remove "Exclude" button. We don't support this in libraries.
List<ActionButton> actionButtons = findComponentsOfType(c, ActionButton.class);
for (ActionButton actionButton : actionButtons) {
String text = actionButton.getAction().getTemplatePresentation().getText();
if (text != null && text.startsWith("Exclude")) {
actionButton.setVisible(false);
break;
}
}
MultiLineLabel propertiesLabel = findComponentOfType(c, MultiLineLabel.class);
if (propertiesLabel != null) {
propertiesLabel.setBorder(BorderFactory.createEmptyBorder(1, 1, 0, 1));
}
myTreePanel.add(c, BorderLayout.CENTER);
myTreePanel.setBorder(customLine(OnePixelDivider.BACKGROUND, 1, 1, 1, 1));
return myMainPanel;
}
use of com.intellij.openapi.actionSystem.impl.ActionButton in project android by JetBrains.
the class AttachedToolWindowTest method findButtonByName.
private static ActionButton findButtonByName(@NotNull Container container, @NotNull String name) {
for (Component component : container.getComponents()) {
if (component instanceof ActionButton) {
ActionButton button = (ActionButton) component;
AnAction action = button.getAction();
if (action != null && name.equals(action.getTemplatePresentation().getText())) {
return button;
}
}
if (component instanceof Container) {
ActionButton button = findButtonByName((Container) component, name);
if (button != null) {
return button;
}
}
}
return null;
}
Aggregations