Search in sources :

Example 1 with Separator

use of com.intellij.openapi.actionSystem.Separator in project intellij-plugins by JetBrains.

the class DartCommandLineRunningState method addObservatoryActions.

protected void addObservatoryActions(List<AnAction> actions, final ProcessHandler processHandler) {
    actions.add(new Separator());
    final OpenDartObservatoryUrlAction openObservatoryAction = new OpenDartObservatoryUrlAction(null, () -> !processHandler.isProcessTerminated());
    addObservatoryUrlConsumer(openObservatoryAction::setUrl);
    actions.add(openObservatoryAction);
}
Also used : Separator(com.intellij.openapi.actionSystem.Separator)

Example 2 with Separator

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

the class GpuMonitorView method getToolbarActions.

@Override
@NotNull
public ActionGroup getToolbarActions() {
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(new RecordingAction(this));
    group.add(new Separator());
    group.add(new BrowserHelpAction("GPU monitor", PROFILING_URL));
    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 3 with Separator

use of com.intellij.openapi.actionSystem.Separator in project intellij-community by JetBrains.

the class RunLineMarkerProvider method getLineMarkerInfo.

@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element) {
    List<RunLineMarkerContributor> contributors = RunLineMarkerContributor.EXTENSION.allForLanguage(element.getLanguage());
    Icon icon = null;
    List<Info> infos = null;
    for (RunLineMarkerContributor contributor : contributors) {
        Info info = contributor.getInfo(element);
        if (info == null) {
            continue;
        }
        if (icon == null) {
            icon = info.icon;
        }
        if (infos == null) {
            infos = new SmartList<>();
        }
        infos.add(info);
    }
    if (icon == null)
        return null;
    if (infos.size() > 1) {
        Collections.sort(infos, COMPARATOR);
        final Info first = infos.get(0);
        for (Iterator<Info> it = infos.iterator(); it.hasNext(); ) {
            Info info = it.next();
            if (info != first && first.shouldReplace(info)) {
                it.remove();
            }
        }
    }
    final DefaultActionGroup actionGroup = new DefaultActionGroup();
    for (Info info : infos) {
        for (AnAction action : info.actions) {
            actionGroup.add(new LineMarkerActionWrapper(element, action));
        }
        if (info != infos.get(infos.size() - 1)) {
            actionGroup.add(new Separator());
        }
    }
    List<Info> finalInfos = infos;
    Function<PsiElement, String> tooltipProvider = element1 -> {
        final StringBuilder tooltip = new StringBuilder();
        for (Info info : finalInfos) {
            if (info.tooltipProvider != null) {
                String string = info.tooltipProvider.apply(element1);
                if (string == null)
                    continue;
                if (tooltip.length() != 0) {
                    tooltip.append("\n");
                }
                tooltip.append(string);
            }
        }
        return tooltip.length() == 0 ? null : tooltip.toString();
    };
    return new LineMarkerInfo<PsiElement>(element, element.getTextRange(), icon, Pass.LINE_MARKERS, tooltipProvider, null, GutterIconRenderer.Alignment.CENTER) {

        @Nullable
        @Override
        public GutterIconRenderer createGutterRenderer() {
            return new LineMarkerGutterIconRenderer<PsiElement>(this) {

                @Override
                public AnAction getClickAction() {
                    return null;
                }

                @Override
                public boolean isNavigateAction() {
                    return true;
                }

                @Nullable
                @Override
                public ActionGroup getPopupMenuActions() {
                    return actionGroup;
                }
            };
        }
    };
}
Also used : java.util(java.util) AllIcons(com.intellij.icons.AllIcons) GutterIconRenderer(com.intellij.openapi.editor.markup.GutterIconRenderer) AnAction(com.intellij.openapi.actionSystem.AnAction) ActionGroup(com.intellij.openapi.actionSystem.ActionGroup) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) Pass(com.intellij.codeHighlighting.Pass) LineMarkerProviderDescriptor(com.intellij.codeInsight.daemon.LineMarkerProviderDescriptor) Nullable(org.jetbrains.annotations.Nullable) SmartList(com.intellij.util.SmartList) Function(com.intellij.util.Function) PsiElement(com.intellij.psi.PsiElement) Info(com.intellij.execution.lineMarker.RunLineMarkerContributor.Info) NotNull(org.jetbrains.annotations.NotNull) LineMarkerInfo(com.intellij.codeInsight.daemon.LineMarkerInfo) Separator(com.intellij.openapi.actionSystem.Separator) javax.swing(javax.swing) Info(com.intellij.execution.lineMarker.RunLineMarkerContributor.Info) LineMarkerInfo(com.intellij.codeInsight.daemon.LineMarkerInfo) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) AnAction(com.intellij.openapi.actionSystem.AnAction) LineMarkerInfo(com.intellij.codeInsight.daemon.LineMarkerInfo) Separator(com.intellij.openapi.actionSystem.Separator) PsiElement(com.intellij.psi.PsiElement) Nullable(org.jetbrains.annotations.Nullable)

Example 4 with Separator

use of com.intellij.openapi.actionSystem.Separator in project intellij-community by JetBrains.

the class DvcsQuickListContentProvider method getVcsActions.

@Nullable
public List<AnAction> getVcsActions(@Nullable Project project, @Nullable AbstractVcs activeVcs, @Nullable DataContext dataContext) {
    if (activeVcs == null || !getVcsName().equals(activeVcs.getName())) {
        return null;
    }
    final ActionManager manager = ActionManager.getInstance();
    final List<AnAction> actions = new ArrayList<>();
    actions.add(new Separator(activeVcs.getDisplayName()));
    add("CheckinProject", manager, actions);
    add("CheckinFiles", manager, actions);
    add("ChangesView.Revert", manager, actions);
    addSeparator(actions);
    add("Vcs.ShowTabbedFileHistory", manager, actions);
    add("Annotate", manager, actions);
    add("Compare.SameVersion", manager, actions);
    addSeparator(actions);
    addVcsSpecificActions(manager, actions);
    return actions;
}
Also used : ActionManager(com.intellij.openapi.actionSystem.ActionManager) ArrayList(java.util.ArrayList) AnAction(com.intellij.openapi.actionSystem.AnAction) Separator(com.intellij.openapi.actionSystem.Separator) Nullable(org.jetbrains.annotations.Nullable)

Example 5 with Separator

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

the class DeviceMenuActionTest method prettyPrintActions.

private static void prettyPrintActions(AnAction action, StringBuilder sb, int depth) {
    String text;
    if (action instanceof Separator) {
        text = "------------------------------------------------------";
    } else {
        text = action.getTemplatePresentation().getText();
        if (text != null && text.startsWith("AVD:")) {
            // build environment
            return;
        }
    }
    if (text != null) {
        for (int i = 0; i < depth; i++) {
            sb.append("    ");
        }
        sb.append(text).append("\n");
    }
    DefaultActionGroup group = action instanceof DefaultActionGroup ? (DefaultActionGroup) action : null;
    if (group != null) {
        for (AnAction child : group.getChildActionsOrStubs()) {
            prettyPrintActions(child, sb, depth + 1);
        }
    }
}
Also used : DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) AnAction(com.intellij.openapi.actionSystem.AnAction) Separator(com.intellij.openapi.actionSystem.Separator)

Aggregations

Separator (com.intellij.openapi.actionSystem.Separator)12 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)7 NotNull (org.jetbrains.annotations.NotNull)7 BrowserHelpAction (com.android.tools.idea.actions.BrowserHelpAction)5 AnAction (com.intellij.openapi.actionSystem.AnAction)5 RecordingAction (com.android.tools.idea.monitor.actions.RecordingAction)4 ActionGroup (com.intellij.openapi.actionSystem.ActionGroup)2 ArrayList (java.util.ArrayList)2 Nullable (org.jetbrains.annotations.Nullable)2 GcAction (com.android.tools.idea.ddms.actions.GcAction)1 ToggleAllocationTrackingAction (com.android.tools.idea.ddms.actions.ToggleAllocationTrackingAction)1 ToggleMethodProfilingAction (com.android.tools.idea.ddms.actions.ToggleMethodProfilingAction)1 DumpHprofAction (com.android.tools.idea.ddms.hprof.DumpHprofAction)1 ToggleDebugRender (com.android.tools.idea.monitor.memory.actions.ToggleDebugRender)1 Pass (com.intellij.codeHighlighting.Pass)1 LineMarkerInfo (com.intellij.codeInsight.daemon.LineMarkerInfo)1 LineMarkerProviderDescriptor (com.intellij.codeInsight.daemon.LineMarkerProviderDescriptor)1 Info (com.intellij.execution.lineMarker.RunLineMarkerContributor.Info)1 ConsoleView (com.intellij.execution.ui.ConsoleView)1 AllIcons (com.intellij.icons.AllIcons)1