use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-community by JetBrains.
the class SmartPopupActionGroup method getChildrenCountRecursive.
private static int getChildrenCountRecursive(ActionGroup group) {
AnAction[] children;
if (group instanceof DefaultActionGroup) {
children = ((DefaultActionGroup) group).getChildActionsOrStubs();
} else {
children = group.getChildren(null);
}
int count = 0;
for (AnAction child : children) {
if (child instanceof ActionGroup) {
count += getChildrenCountRecursive((ActionGroup) child);
} else {
count++;
}
}
return count;
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-community by JetBrains.
the class ShowQuickActionPopupAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
QuickActionProvider provider = e.getRequiredData(QuickActionProvider.KEY);
List<AnAction> actions = provider.getActions(true);
DefaultActionGroup group = new DefaultActionGroup(actions);
group.addSeparator();
JComponent component = provider.getComponent();
if (component != null && !provider.isCycleRoot()) {
Component eachParent = component.getParent();
while (eachParent != null) {
QuickActionProvider parentProvider = ObjectUtils.tryCast(eachParent, QuickActionProvider.class);
if (parentProvider != null) {
List<AnAction> parentActions = parentProvider.getActions(false);
if (!parentActions.isEmpty()) {
String name = StringUtil.notNullize(parentProvider.getName(), "");
DefaultActionGroup parentGroup = new DefaultActionGroup(name, parentActions);
if (!StringUtil.isEmpty(name)) {
parentGroup.setPopup(true);
} else {
group.add(Separator.getInstance());
}
group.add(parentGroup);
}
if (parentProvider.isCycleRoot())
break;
}
eachParent = eachParent.getParent();
}
}
JBPopupFactory.getInstance().createActionGroupPopup(null, group, e.getDataContext(), ALPHA_NUMBERING, true).showInBestPositionFor(e.getDataContext());
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-community by JetBrains.
the class XFramesView method createToolbar.
private ActionToolbarImpl createToolbar() {
final DefaultActionGroup framesGroup = new DefaultActionGroup();
CommonActionsManager actionsManager = CommonActionsManager.getInstance();
framesGroup.add(actionsManager.createPrevOccurenceAction(myFramesList));
framesGroup.add(actionsManager.createNextOccurenceAction(myFramesList));
framesGroup.addAll(ActionManager.getInstance().getAction(XDebuggerActions.FRAMES_TOP_TOOLBAR_GROUP));
final ActionToolbarImpl toolbar = (ActionToolbarImpl) ActionManager.getInstance().createActionToolbar(ActionPlaces.DEBUGGER_TOOLBAR, framesGroup, true);
toolbar.setReservePlaceAutoPopupIcon(false);
toolbar.setAddSeparatorFirst(true);
toolbar.getComponent().setBorder(new EmptyBorder(1, 0, 0, 0));
return toolbar;
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-community by JetBrains.
the class AbstractVcsHelperImpl method openCommittedChangesTab.
public void openCommittedChangesTab(final CommittedChangesProvider provider, final RepositoryLocation location, final ChangeBrowserSettings settings, final int maxCount, String title) {
DefaultActionGroup extraActions = new DefaultActionGroup();
CommittedChangesPanel panel = new CommittedChangesPanel(myProject, provider, settings, location, extraActions);
panel.setMaxCount(maxCount);
panel.refreshChanges(false);
final ContentFactory factory = ContentFactory.SERVICE.getInstance();
if (title == null && location != null) {
title = VcsBundle.message("browse.changes.content.title", location.toPresentableString());
}
final Content content = factory.createContent(panel, title, false);
final ChangesViewContentI contentManager = ChangesViewContentManager.getInstance(myProject);
contentManager.addContent(content);
contentManager.setSelectedContent(content);
extraActions.add(new CloseTabToolbarAction() {
public void actionPerformed(final AnActionEvent e) {
contentManager.removeContent(content);
}
});
ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(ChangesViewContentManager.TOOLWINDOW_ID);
if (!window.isVisible()) {
window.activate(null);
}
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-community by JetBrains.
the class DateFilterPopupComponent method createActionGroup.
@Override
protected ActionGroup createActionGroup() {
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.DAY_OF_YEAR, -1);
Date oneDayBefore = cal.getTime();
cal.add(Calendar.DAY_OF_YEAR, -6);
Date oneWeekBefore = cal.getTime();
return new DefaultActionGroup(createAllAction(), new SelectAction(), new DateAction(oneDayBefore, "Last 24 hours"), new DateAction(oneWeekBefore, "Last 7 days"));
}
Aggregations