use of com.intellij.openapi.actionSystem.DefaultActionGroup in project android by JetBrains.
the class OrientationMenuAction method createPopupActionGroup.
@Override
@NotNull
protected DefaultActionGroup createPopupActionGroup() {
DefaultActionGroup group = new DefaultActionGroup(null, true);
Configuration configuration = myRenderContext.getConfiguration();
if (configuration != null) {
Device device = configuration.getDevice();
if (device != null) {
List<State> states = device.getAllStates();
State current = configuration.getDeviceState();
if (states.size() > 1 && current != null) {
State flip = configuration.getNextDeviceState(current);
State nextSate = flip == null ? current : flip;
String title = getPresentationDescription(nextSate);
group.add(new SetDeviceStateAction(myRenderContext, title, nextSate, false, true));
group.addSeparator();
}
for (State config : states) {
String stateName = config.getName();
String title = stateName;
VirtualFile better = ConfigurationMatcher.getBetterMatch(configuration, null, stateName, null, null);
if (better != null) {
title = ConfigurationAction.getBetterMatchLabel(stateName, better, configuration.getFile());
}
group.add(new SetDeviceStateAction(myRenderContext, title, config, config == current, false));
}
group.addSeparator();
}
group.addSeparator();
DefaultActionGroup uiModeGroup = new DefaultActionGroup("_UI Mode", true);
UiMode currentUiMode = configuration.getUiMode();
for (UiMode uiMode : UiMode.values()) {
String title = uiMode.getShortDisplayValue();
boolean checked = uiMode == currentUiMode;
uiModeGroup.add(new SetUiModeAction(myRenderContext, title, uiMode, checked));
}
group.add(uiModeGroup);
group.addSeparator();
DefaultActionGroup nightModeGroup = new DefaultActionGroup("_Night Mode", true);
NightMode currentNightMode = configuration.getNightMode();
for (NightMode nightMode : NightMode.values()) {
String title = nightMode.getShortDisplayValue();
boolean checked = nightMode == currentNightMode;
nightModeGroup.add(new SetNightModeAction(myRenderContext, title, nightMode, checked));
}
group.add(nightModeGroup);
}
return group;
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project android by JetBrains.
the class LocaleMenuAction method createPopupActionGroup.
@Override
@NotNull
protected DefaultActionGroup createPopupActionGroup() {
DefaultActionGroup group = new DefaultActionGroup(null, true);
// TODO: Offer submenus, lazily populated, which offer languages either by code or by name.
// However, this doesn't currently work for the JBPopup dialog we're using as part
// of the combo action (and using the JBPopup dialog rather than a Swing menu has some
// other advantages: fitting in with the overall IDE look and feel (e.g. dark colors),
// allowing typing to filter, etc.
List<Locale> locales = getRelevantLocales();
Configuration configuration = myRenderContext.getConfiguration();
if (configuration != null && locales.size() > 0) {
group.add(new SetLocaleAction(myRenderContext, getLocaleLabel(Locale.ANY, false, myClassicStyle), Locale.ANY));
group.addSeparator();
Collections.sort(locales, Locale.LANGUAGE_CODE_COMPARATOR);
for (Locale locale : locales) {
String title = getLocaleLabel(locale, false, myClassicStyle);
VirtualFile better = ConfigurationMatcher.getBetterMatch(configuration, null, null, locale, null);
if (better != null) {
title = ConfigurationAction.getBetterMatchLabel(getLocaleLabel(locale, true, myClassicStyle), better, configuration.getFile());
}
group.add(new SetLocaleAction(myRenderContext, title, locale));
}
group.addSeparator();
}
group.add(new EditTranslationAction());
return group;
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project android by JetBrains.
the class ProjectProfileSelectionDialog method createTreePanel.
@NotNull
static JPanel createTreePanel(@NotNull CheckboxTreeView tree) {
JPanel treePanel = new JPanel(new BorderLayout());
DefaultActionGroup group = new DefaultActionGroup();
CommonActionsManager actions = CommonActionsManager.getInstance();
group.addAll(actions.createExpandAllAction(tree, treePanel), actions.createCollapseAllAction(tree, treePanel));
ActionToolbar actionToolBar = ActionManager.getInstance().createActionToolbar("AndroidProjectProfileSelection", group, true);
JPanel buttonsPanel = new JPanel(new BorderLayout());
buttonsPanel.add(actionToolBar.getComponent(), BorderLayout.CENTER);
buttonsPanel.setBorder(new SideBorder(JBColor.border(), SideBorder.TOP | SideBorder.LEFT | SideBorder.RIGHT, 1));
treePanel.add(buttonsPanel, BorderLayout.NORTH);
treePanel.add(ScrollPaneFactory.createScrollPane(tree), BorderLayout.CENTER);
return treePanel;
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project android by JetBrains.
the class DumpSysActions method create.
public static DefaultActionGroup create(@NotNull Project p, @NotNull final DeviceContext context) {
DefaultActionGroup group = new DefaultActionGroup("System Information", true) {
@Override
public void update(AnActionEvent e) {
e.getPresentation().setText("System Information");
e.getPresentation().setIcon(AndroidIcons.Ddms.SysInfo);
e.getPresentation().setEnabled(context.getSelectedDevice() != null);
}
@Override
public boolean isDumbAware() {
return true;
}
};
group.add(new MyDumpSysAction(p, context, "activity", "Activity Manager State"));
group.add(new MyDumpSysAction(p, context, "package", "Package Information"));
group.add(new MyDumpSysAction(p, context, "meminfo", "Memory Usage"));
group.add(new MyDumpProcStatsAction(p, context, "procstats", "Memory use over time"));
group.add(new MyDumpSysAction(p, context, "gfxinfo", "Graphics State"));
return group;
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-plugins by JetBrains.
the class IDEtalkToolWindow method createToolWindowComponent.
@Override
protected void createToolWindowComponent() {
StartupManager.getInstance(myProject).registerPostStartupActivity(() -> initializeTransports(myProject.getName()));
StatusToolbar statusToolbar = ((StatusToolbar) myContainer.getComponentInstanceOfType(StatusToolbar.class));
DefaultActionGroup toolbarActions = new DefaultActionGroup();
ActionGroup actions = (ActionGroup) myActionManager.getAction("IDEtalk");
if (actions != null) {
toolbarActions.addAll(actions);
}
toolbarActions.add(new ContextHelpAction("reference.toolWindows.idetalk"));
ActionGroup treeActions = (ActionGroup) myActionManager.getAction("IDEtalk_Tree");
JPanel toolbarPanel = new JPanel();
toolbarPanel.setLayout(new BoxLayout(toolbarPanel, BoxLayout.X_AXIS));
toolbarPanel.add(DropDownButton.wrap(new DropDownButton(new FindUsersAction(), IconUtil.getAddIcon())));
toolbarPanel.add(createToolbar(toolbarActions).getComponent());
toolbarPanel.add(Box.createHorizontalStrut(10));
toolbarPanel.add(new SeparatorComponent(JBColor.LIGHT_GRAY, SeparatorOrientation.VERTICAL));
toolbarPanel.add(Box.createHorizontalStrut(3));
toolbarPanel.add(DropDownButton.wrap(new OptionsButton()));
toolbarPanel.add(statusToolbar.createComponent());
toolbarPanel.add(new JPanel() {
@Override
public Dimension getPreferredSize() {
return new Dimension(Short.MAX_VALUE, 10);
}
});
if (treeActions != null) {
JComponent component = createToolbar(treeActions).getComponent();
component.setMinimumSize(component.getPreferredSize());
toolbarPanel.add(component);
}
toolbarPanel.setAlignmentX(0);
myTopPanel.add(toolbarPanel);
myPanel.add(myTopPanel, BorderLayout.NORTH);
myPanel.add(ScrollPaneFactory.createScrollPane(myUserListComponent.getComponent()));
ActionGroup group = (ActionGroup) myActionManager.getAction("IDEtalkPopup");
if (group != null) {
IDEAFacade.installPopupMenu(group, myUserListComponent.getTree(), myActionManager);
}
}
Aggregations