use of com.intellij.openapi.actionSystem.DefaultActionGroup in project android by JetBrains.
the class NlActionsToolbar method getRhsActions.
private static ActionGroup getRhsActions(DesignSurface surface) {
DefaultActionGroup group = new DefaultActionGroup();
group.add(new SetZoomAction(surface, ZoomType.OUT));
group.add(new ZoomLabelAction(surface));
group.add(new SetZoomAction(surface, ZoomType.IN));
group.add(new SetZoomAction(surface, ZoomType.FIT));
group.add(new TogglePanningDialogAction(surface));
group.addSeparator();
group.add(new LintNotificationAction(surface));
return group;
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project android by JetBrains.
the class DefaultGradleConsoleView method createToolWindowContent.
@Override
public void createToolWindowContent(@NotNull ToolWindow toolWindow) {
//Create runner UI layout
RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(myProject);
RunnerLayoutUi layoutUi = factory.create("", "", "session", myProject);
JComponent layoutComponent = layoutUi.getComponent();
// Adding actions
DefaultActionGroup group = new DefaultActionGroup();
layoutUi.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN);
Content console = layoutUi.createContent(GradleConsoleToolWindowFactory.ID, myConsoleView.getComponent(), "", null, null);
AnAction[] consoleActions = myConsoleView.createConsoleActions();
for (AnAction action : consoleActions) {
if (!shouldIgnoreAction(action)) {
group.add(action);
}
}
layoutUi.addContent(console, 0, PlaceInGrid.right, false);
myConsolePanel.add(layoutComponent, BorderLayout.CENTER);
//noinspection ConstantConditions
Content content = ContentFactory.SERVICE.getInstance().createContent(layoutComponent, null, true);
toolWindow.getContentManager().addContent(content);
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project android by JetBrains.
the class ConfigurationMenuAction method createPopupActionGroup.
@Override
@NotNull
protected DefaultActionGroup createPopupActionGroup() {
DefaultActionGroup group = new DefaultActionGroup("Configuration", true);
Configuration configuration = mySurface.getConfiguration();
if (configuration == null) {
return group;
}
VirtualFile virtualFile = configuration.getFile();
if (virtualFile != null) {
Module module = configuration.getModule();
if (module == null) {
return group;
}
Project project = module.getProject();
List<VirtualFile> variations = ResourceHelper.getResourceVariations(virtualFile, true);
if (variations.size() > 1) {
for (VirtualFile file : variations) {
String title = String.format("Switch to %1$s", file.getParent().getName());
group.add(new SwitchToVariationAction(title, project, file, virtualFile.equals(file)));
}
group.addSeparator();
}
ResourceFolderType folderType = ResourceHelper.getFolderType(configuration.getFile());
if (folderType == ResourceFolderType.LAYOUT) {
boolean haveLandscape = false;
boolean haveLarge = false;
for (VirtualFile file : variations) {
String name = file.getParent().getName();
if (name.startsWith(FD_RES_LAYOUT)) {
FolderConfiguration config = FolderConfiguration.getConfigForFolder(name);
if (config != null) {
ScreenOrientationQualifier orientation = config.getScreenOrientationQualifier();
if (orientation != null && orientation.getValue() == ScreenOrientation.LANDSCAPE) {
haveLandscape = true;
if (haveLarge) {
break;
}
}
ScreenSizeQualifier size = config.getScreenSizeQualifier();
if (size != null && size.getValue() == ScreenSize.XLARGE) {
haveLarge = true;
if (haveLandscape) {
break;
}
}
}
}
}
// Do statistics on what is needed!
if (!haveLandscape) {
group.add(new CreateVariationAction(mySurface, "Create Landscape Variation", "layout-land"));
}
if (!haveLarge) {
group.add(new CreateVariationAction(mySurface, "Create layout-xlarge Variation", "layout-xlarge"));
//group.add(new CreateVariationAction(mySurface, "Create layout-sw600dp Variation...", "layout-sw600dp"));
}
group.add(new CreateVariationAction(mySurface, "Create Other...", null));
} else {
group.add(new CreateVariationAction(mySurface, "Create Alternative...", null));
}
/* TODO: Restore multi-configuration editing
if (mySurface.supportsPreviews()) {
addMultiConfigActions(group);
}
*/
}
return group;
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project android by JetBrains.
the class TargetMenuAction method createPopupActionGroup.
@Override
@NotNull
protected DefaultActionGroup createPopupActionGroup() {
DefaultActionGroup group = new DefaultActionGroup(null, true);
Configuration configuration = myRenderContext.getConfiguration();
if (configuration == null) {
return group;
}
group.add(new TogglePickBestAction(configuration.getConfigurationManager()));
group.addSeparator();
if (myUseCompatibilityTarget && configuration.getConfigurationManager().getHighestApiTarget() != null) {
addCompatibilityTargets(group);
} else {
addRealTargets(group);
}
return group;
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project android by JetBrains.
the class ModulesComboBoxAction method createPopupActionGroup.
@Override
@NotNull
protected DefaultActionGroup createPopupActionGroup(JComponent button) {
DefaultActionGroup group = new DefaultActionGroup();
for (PsModule module : myExtraTopModules) {
group.add(new ModuleAction(module));
}
myContext.getProject().forEachModule(module -> group.add(new ModuleAction(module)));
return group;
}
Aggregations