Search in sources :

Example 31 with ListPopup

use of com.intellij.openapi.ui.popup.ListPopup in project intellij-community by JetBrains.

the class InvokeQuickFixAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    final ActionGroup fixes = (ActionGroup) ActionManager.getInstance().getAction("QuickFixes");
    if (fixes.getChildren(e).length == 0) {
        Messages.showInfoMessage(myView, "There are no applicable quick fixes", "Nothing Found to Fix");
        return;
    }
    DataContext dataContext = e.getDataContext();
    final ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(InspectionsBundle.message("inspection.tree.popup.title"), fixes, dataContext, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false);
    InspectionResultsView.showPopup(e, popup);
}
Also used : ListPopup(com.intellij.openapi.ui.popup.ListPopup)

Example 32 with ListPopup

use of com.intellij.openapi.ui.popup.ListPopup in project intellij-community by JetBrains.

the class ListenerNavigateButton method showNavigatePopup.

public static void showNavigatePopup(final RadComponent component, final boolean showIfEmpty) {
    final DefaultActionGroup actionGroup = prepareActionGroup(component);
    if (actionGroup != null && actionGroup.getChildrenCount() == 0 && showIfEmpty) {
        actionGroup.add(new MyNavigateAction(UIDesignerBundle.message("navigate.to.listener.empty"), null));
    }
    if (actionGroup != null && actionGroup.getChildrenCount() > 0) {
        final DataContext context = DataManager.getInstance().getDataContext(component.getDelegee());
        final JBPopupFactory factory = JBPopupFactory.getInstance();
        final ListPopup popup = factory.createActionGroupPopup(UIDesignerBundle.message("navigate.to.listener.title"), actionGroup, context, JBPopupFactory.ActionSelectionAid.NUMBERING, true);
        FormEditingUtil.showPopupUnderComponent(popup, component);
    }
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) JBPopupFactory(com.intellij.openapi.ui.popup.JBPopupFactory) ListPopup(com.intellij.openapi.ui.popup.ListPopup) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup)

Example 33 with ListPopup

use of com.intellij.openapi.ui.popup.ListPopup in project intellij-community by JetBrains.

the class CreateComponentAction method actionPerformed.

protected void actionPerformed(final GuiEditor editor, final List<RadComponent> selection, final AnActionEvent e) {
    Processor<ComponentItem> processor = selectedValue -> {
        if (selectedValue != null) {
            myLastCreatedComponent = selectedValue;
            editor.getMainProcessor().startInsertProcessor(selectedValue, getCreateLocation(editor, selection));
        }
        return true;
    };
    PaletteListPopupStep step = new PaletteListPopupStep(editor, myLastCreatedComponent, processor, UIDesignerBundle.message("create.component.title"));
    final ListPopup listPopup = JBPopupFactory.getInstance().createListPopup(step);
    if (selection.size() > 0) {
        FormEditingUtil.showPopupUnderComponent(listPopup, selection.get(0));
    } else {
        listPopup.showInCenterOf(editor.getRootContainer().getDelegee());
    }
}
Also used : UIDesignerBundle(com.intellij.uiDesigner.UIDesignerBundle) com.intellij.uiDesigner.designSurface(com.intellij.uiDesigner.designSurface) ComponentItem(com.intellij.uiDesigner.palette.ComponentItem) RadRootContainer(com.intellij.uiDesigner.radComponents.RadRootContainer) RadComponent(com.intellij.uiDesigner.radComponents.RadComponent) FormEditingUtil(com.intellij.uiDesigner.FormEditingUtil) java.awt(java.awt) ListPopup(com.intellij.openapi.ui.popup.ListPopup) List(java.util.List) JBPopupFactory(com.intellij.openapi.ui.popup.JBPopupFactory) Processor(com.intellij.util.Processor) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) GridConstraints(com.intellij.uiDesigner.core.GridConstraints) RadContainer(com.intellij.uiDesigner.radComponents.RadContainer) ComponentItem(com.intellij.uiDesigner.palette.ComponentItem) ListPopup(com.intellij.openapi.ui.popup.ListPopup)

Example 34 with ListPopup

use of com.intellij.openapi.ui.popup.ListPopup in project intellij-community by JetBrains.

the class DeepCompareAction method selectBranchAndPerformAction.

private static void selectBranchAndPerformAction(@NotNull VcsLogDataPack dataPack, @NotNull AnActionEvent event, @NotNull final Consumer<String> consumer, @NotNull Collection<VirtualFile> visibleRoots) {
    ActionGroup actionGroup = new BranchPopupBuilder(dataPack, visibleRoots, null) {

        @NotNull
        @Override
        protected AnAction createAction(@NotNull final String name) {
            return new DumbAwareAction(name) {

                @Override
                public void actionPerformed(AnActionEvent e) {
                    consumer.consume(name);
                }
            };
        }
    }.build();
    ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup("Select branch to compare", actionGroup, event.getDataContext(), false, false, false, null, -1, null);
    InputEvent inputEvent = event.getInputEvent();
    if (inputEvent instanceof MouseEvent) {
        popup.show(new RelativePoint((MouseEvent) inputEvent));
    } else {
        popup.showInBestPositionFor(event.getDataContext());
    }
}
Also used : BranchPopupBuilder(com.intellij.vcs.log.ui.filter.BranchPopupBuilder) MouseEvent(java.awt.event.MouseEvent) ListPopup(com.intellij.openapi.ui.popup.ListPopup) InputEvent(java.awt.event.InputEvent) RelativePoint(com.intellij.ui.awt.RelativePoint) NotNull(org.jetbrains.annotations.NotNull) DumbAwareAction(com.intellij.openapi.project.DumbAwareAction)

Example 35 with ListPopup

use of com.intellij.openapi.ui.popup.ListPopup in project intellij-community by JetBrains.

the class AbstractQuickFixManager method showPopup.

private void showPopup() {
    if (myHint == null || !myHint.isVisible()) {
        return;
    }
    List<ErrorInfo> errorInfos = getErrorInfos();
    if (!ErrorInfo.haveFixes(errorInfos)) {
        return;
    }
    ListPopup popup = JBPopupFactory.getInstance().createListPopup(new FirstStep(errorInfos));
    popup.showUnderneathOf(myHint.getComponent());
}
Also used : ErrorInfo(com.intellij.designer.model.ErrorInfo) ListPopup(com.intellij.openapi.ui.popup.ListPopup)

Aggregations

ListPopup (com.intellij.openapi.ui.popup.ListPopup)49 JBPopupFactory (com.intellij.openapi.ui.popup.JBPopupFactory)11 BaseListPopupStep (com.intellij.openapi.ui.popup.util.BaseListPopupStep)10 NotNull (org.jetbrains.annotations.NotNull)10 RelativePoint (com.intellij.ui.awt.RelativePoint)8 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)7 Project (com.intellij.openapi.project.Project)7 PopupStep (com.intellij.openapi.ui.popup.PopupStep)7 DataContext (com.intellij.openapi.actionSystem.DataContext)5 DumbAwareAction (com.intellij.openapi.project.DumbAwareAction)4 RadComponent (com.intellij.uiDesigner.radComponents.RadComponent)4 MouseEvent (java.awt.event.MouseEvent)4 ArrayList (java.util.ArrayList)4 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)3 SimpleDataContext (com.intellij.openapi.actionSystem.impl.SimpleDataContext)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 Nullable (org.jetbrains.annotations.Nullable)3 JBScrollPane (com.intellij.ui.components.JBScrollPane)2 GuiEditor (com.intellij.uiDesigner.designSurface.GuiEditor)2 java.awt (java.awt)2