Example usage for com.intellij.openapi.actionSystem ActionGroupUtil isGroupEmpty

List of usage examples for com.intellij.openapi.actionSystem ActionGroupUtil isGroupEmpty

Introduction

In this page you can find the example usage for com.intellij.openapi.actionSystem ActionGroupUtil isGroupEmpty.

Prototype

@Deprecated
public static boolean isGroupEmpty(@NotNull ActionGroup actionGroup, @NotNull AnActionEvent e) 

Source Link

Usage

From source file:com.intellij.codeInsight.generation.actions.GenerateAction.java

License:Apache License

@Override
public void update(AnActionEvent event) {
    Presentation presentation = event.getPresentation();
    DataContext dataContext = event.getDataContext();
    Project project = CommonDataKeys.PROJECT.getData(dataContext);
    if (project == null) {
        presentation.setEnabled(false);/*from  w  w w.  ja  v  a2  s.  c  o  m*/
        return;
    }

    Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
    if (editor == null) {
        presentation.setEnabled(false);
        return;
    }

    boolean groupEmpty = ActionGroupUtil.isGroupEmpty(getGroup(), event);
    presentation.setEnabled(!groupEmpty);
}

From source file:com.intellij.codeInspection.ui.actions.InvokeQuickFixAction.java

License:Apache License

@Override
public void update(AnActionEvent e) {
    if (!myView.isSingleToolInSelection()) {
        e.getPresentation().setEnabled(false);
        return;// w  w  w  .  j  av a 2  s  . com
    }

    //noinspection ConstantConditions
    @NotNull
    InspectionToolWrapper toolWrapper = myView.getTree().getSelectedToolWrapper();
    final InspectionRVContentProvider provider = myView.getProvider();
    if (provider.isContentLoaded()) {
        final QuickFixAction[] quickFixes = provider.getQuickFixes(toolWrapper, myView.getTree());
        if (quickFixes == null || quickFixes.length == 0) {
            e.getPresentation().setEnabled(false);
            return;
        }
        e.getPresentation().setEnabled(!ActionGroupUtil.isGroupEmpty(getFixes(quickFixes), e));
    }
}

From source file:com.intellij.ide.actions.NewElementAction.java

License:Apache License

@Override
public void update(AnActionEvent e) {
    final Presentation presentation = e.getPresentation();
    final DataContext context = e.getDataContext();
    final Project project = CommonDataKeys.PROJECT.getData(context);
    if (project == null) {
        presentation.setEnabled(false);//  w  w  w .  java2  s.  com
        return;
    }
    if (Boolean.TRUE.equals(LangDataKeys.NO_NEW_ACTION.getData(context))) {
        presentation.setEnabled(false);
        return;
    }
    final IdeView ideView = LangDataKeys.IDE_VIEW.getData(context);
    if (ideView == null) {
        presentation.setEnabled(false);
        return;
    }

    presentation.setEnabled(!ActionGroupUtil.isGroupEmpty(getGroup(context), e));
}

From source file:com.intellij.ide.projectView.actions.MarkRootGroup.java

License:Apache License

@Override
public void update(AnActionEvent e) {
    e.getPresentation().setVisible(!ActionGroupUtil.isGroupEmpty(this, e));
}