Search in sources :

Example 56 with DefaultActionGroup

use of com.intellij.openapi.actionSystem.DefaultActionGroup in project android by JetBrains.

the class AndroidToolWindowFactory method getToolbarActions.

@NotNull
public ActionGroup getToolbarActions(Project project, DeviceContext deviceContext) {
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(new ScreenshotAction(project, deviceContext));
    group.add(new ScreenRecorderAction(project, deviceContext));
    group.add(DumpSysActions.create(project, deviceContext));
    group.add(new Separator());
    group.add(new TerminateVMAction(deviceContext));
    group.add(new HierarchyViewAction(project, deviceContext));
    group.add(new Separator());
    group.add(new BrowserHelpAction("Android Monitor", "http://developer.android.com/r/studio-ui/android-monitor.html"));
    return group;
}
Also used : BrowserHelpAction(com.android.tools.idea.actions.BrowserHelpAction) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) Separator(com.intellij.openapi.actionSystem.Separator) NotNull(org.jetbrains.annotations.NotNull)

Example 57 with DefaultActionGroup

use of com.intellij.openapi.actionSystem.DefaultActionGroup in project android by JetBrains.

the class CpuMonitorView method getToolbarActions.

@Override
@NotNull
public ActionGroup getToolbarActions() {
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(new RecordingAction(this));
    group.add(new Separator());
    group.add(new ToggleMethodProfilingAction(myProject, myDeviceContext));
    //group.add(new MyThreadDumpAction()); // thread dump -> systrace
    group.add(new Separator());
    group.add(new BrowserHelpAction("CPU monitor", "http://developer.android.com/r/studio-ui/am-cpu.html"));
    return group;
}
Also used : ToggleMethodProfilingAction(com.android.tools.idea.ddms.actions.ToggleMethodProfilingAction) BrowserHelpAction(com.android.tools.idea.actions.BrowserHelpAction) RecordingAction(com.android.tools.idea.monitor.actions.RecordingAction) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) Separator(com.intellij.openapi.actionSystem.Separator) NotNull(org.jetbrains.annotations.NotNull)

Example 58 with DefaultActionGroup

use of com.intellij.openapi.actionSystem.DefaultActionGroup in project android by JetBrains.

the class MemoryMonitorView method getToolbarActions.

@Override
@NotNull
public ActionGroup getToolbarActions() {
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(new RecordingAction(this));
    group.add(new Separator());
    group.add(new GcAction(myDeviceContext));
    group.add(new DumpHprofAction(myProject, myDeviceContext, myEvents));
    group.add(new ToggleAllocationTrackingAction(myProject, myDeviceContext, myEvents));
    group.add(new Separator());
    group.add(new BrowserHelpAction("Memory monitor", "http://developer.android.com/r/studio-ui/am-memory.html"));
    if (Boolean.getBoolean("studio.profiling.debug")) {
        group.addSeparator();
        group.add(new ToggleDebugRender(myTimelineComponent));
    }
    return group;
}
Also used : ToggleDebugRender(com.android.tools.idea.monitor.memory.actions.ToggleDebugRender) GcAction(com.android.tools.idea.ddms.actions.GcAction) DumpHprofAction(com.android.tools.idea.ddms.hprof.DumpHprofAction) BrowserHelpAction(com.android.tools.idea.actions.BrowserHelpAction) RecordingAction(com.android.tools.idea.monitor.actions.RecordingAction) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) Separator(com.intellij.openapi.actionSystem.Separator) ToggleAllocationTrackingAction(com.android.tools.idea.ddms.actions.ToggleAllocationTrackingAction) NotNull(org.jetbrains.annotations.NotNull)

Example 59 with DefaultActionGroup

use of com.intellij.openapi.actionSystem.DefaultActionGroup in project android by JetBrains.

the class NetworkMonitorView method getToolbarActions.

@Override
@NotNull
public ActionGroup getToolbarActions() {
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(new RecordingAction(this));
    group.add(new Separator());
    group.add(new BrowserHelpAction("Network monitor", "http://developer.android.com/r/studio-ui/am-network.html"));
    return group;
}
Also used : BrowserHelpAction(com.android.tools.idea.actions.BrowserHelpAction) RecordingAction(com.android.tools.idea.monitor.actions.RecordingAction) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) Separator(com.intellij.openapi.actionSystem.Separator) NotNull(org.jetbrains.annotations.NotNull)

Example 60 with DefaultActionGroup

use of com.intellij.openapi.actionSystem.DefaultActionGroup in project android by JetBrains.

the class DeviceMenuAction method createPopupActionGroup.

@Override
@NotNull
protected DefaultActionGroup createPopupActionGroup() {
    DefaultActionGroup group = new DefaultActionGroup(null, true);
    Configuration configuration = myRenderContext.getConfiguration();
    if (configuration == null) {
        return group;
    }
    Device current = configuration.getDevice();
    ConfigurationManager configurationManager = configuration.getConfigurationManager();
    List<Device> deviceList = configurationManager.getDevices();
    if (LIST_RECENT_DEVICES) {
        List<Device> recent = configurationManager.getDevices();
        if (recent.size() > 1) {
            boolean separatorNeeded = false;
            for (Device device : recent) {
                String label = getLabel(device, isNexus(device));
                Icon icon = getDeviceClassIcon(device);
                group.add(new SetDeviceAction(myRenderContext, label, device, icon, device == current));
                separatorNeeded = true;
            }
            if (separatorNeeded) {
                group.addSeparator();
            }
        }
    }
    AndroidFacet facet = AndroidFacet.getInstance(configurationManager.getModule());
    if (facet == null) {
        // Unlikely, but has happened - see http://b.android.com/68091
        return group;
    }
    if (!deviceList.isEmpty()) {
        Map<String, List<Device>> manufacturers = new TreeMap<>();
        for (Device device : deviceList) {
            List<Device> devices;
            if (manufacturers.containsKey(device.getManufacturer())) {
                devices = manufacturers.get(device.getManufacturer());
            } else {
                devices = new ArrayList<>();
                manufacturers.put(device.getManufacturer(), devices);
            }
            devices.add(device);
        }
        List<Device> nexus = new ArrayList<>();
        Map<FormFactor, List<Device>> deviceMap = Maps.newEnumMap(FormFactor.class);
        for (FormFactor factor : FormFactor.values()) {
            deviceMap.put(factor, Lists.newArrayList());
        }
        for (List<Device> devices : manufacturers.values()) {
            for (Device device : devices) {
                if (isNexus(device) && !device.getManufacturer().equals(MANUFACTURER_GENERIC) && !isWear(device) && !isTv(device)) {
                    nexus.add(device);
                } else {
                    deviceMap.get(FormFactor.getFormFactor(device)).add(device);
                }
            }
        }
        sortDevicesByScreenSize(nexus);
        for (List<Device> list : splitDevicesByScreenSize(nexus)) {
            addNexusDeviceSection(group, current, list);
            group.addSeparator();
        }
        addDeviceSection(group, current, deviceMap, false, FormFactor.WEAR);
        group.addSeparator();
        addDeviceSection(group, current, deviceMap, false, FormFactor.TV);
        group.addSeparator();
        final AvdManager avdManager = facet.getAvdManagerSilently();
        if (avdManager != null) {
            boolean separatorNeeded = false;
            boolean first = true;
            for (AvdInfo avd : avdManager.getValidAvds()) {
                Device device = configurationManager.createDeviceForAvd(avd);
                if (device != null) {
                    String avdName = "AVD: " + avd.getName();
                    boolean selected = current != null && (current.getDisplayName().equals(avdName) || current.getId().equals(avdName));
                    Icon icon = first ? getDeviceClassIcon(device) : null;
                    group.add(new SetDeviceAction(myRenderContext, avdName, device, icon, selected));
                    first = false;
                    separatorNeeded = true;
                }
            }
            if (separatorNeeded) {
                group.addSeparator();
            }
        }
        DefaultActionGroup genericGroup = new DefaultActionGroup("_Generic Phones and Tablets", true);
        sortDevicesByScreenSize(deviceMap.get(FormFactor.MOBILE));
        addDeviceSection(genericGroup, current, deviceMap, true, FormFactor.MOBILE);
        group.add(genericGroup);
    }
    group.add(new RunAndroidAvdManagerAction("Add Device Definition..."));
    return group;
}
Also used : Device(com.android.sdklib.devices.Device) AvdInfo(com.android.sdklib.internal.avd.AvdInfo) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) AndroidFacet(org.jetbrains.android.facet.AndroidFacet) FormFactor(com.android.tools.idea.npw.FormFactor) AvdManager(com.android.sdklib.internal.avd.AvdManager) RunAndroidAvdManagerAction(org.jetbrains.android.actions.RunAndroidAvdManagerAction) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)109 NotNull (org.jetbrains.annotations.NotNull)38 AnAction (com.intellij.openapi.actionSystem.AnAction)22 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)16 Nullable (org.jetbrains.annotations.Nullable)11 ActionManager (com.intellij.openapi.actionSystem.ActionManager)8 ActionGroup (com.intellij.openapi.actionSystem.ActionGroup)7 Separator (com.intellij.openapi.actionSystem.Separator)7 ListPopup (com.intellij.openapi.ui.popup.ListPopup)7 Content (com.intellij.ui.content.Content)6 BrowserHelpAction (com.android.tools.idea.actions.BrowserHelpAction)5 Project (com.intellij.openapi.project.Project)5 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 List (java.util.List)5 RecordingAction (com.android.tools.idea.monitor.actions.RecordingAction)4 ActionToolbar (com.intellij.openapi.actionSystem.ActionToolbar)4 DumbAwareAction (com.intellij.openapi.project.DumbAwareAction)4 javax.swing (javax.swing)4 FolderConfiguration (com.android.ide.common.resources.configuration.FolderConfiguration)3 CommonActionsManager (com.intellij.ide.CommonActionsManager)3