Search in sources :

Example 26 with ListPopup

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

the class PlaySavedMacros method actionPerformed.

@Override
public void actionPerformed(final AnActionEvent e) {
    final ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup("Play Saved Macros", new MacrosGroup(), e.getDataContext(), JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false);
    final Project project = e.getProject();
    if (project != null) {
        popup.showCenteredInCurrentWindow(project);
    } else {
        popup.showInFocusCenter();
    }
}
Also used : Project(com.intellij.openapi.project.Project) ListPopup(com.intellij.openapi.ui.popup.ListPopup)

Example 27 with ListPopup

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

the class EncodingPanel method showPopup.

private void showPopup(@NotNull MouseEvent e) {
    if (!actionEnabled) {
        return;
    }
    DataContext dataContext = getContext();
    ListPopup popup = new ChangeFileEncodingAction().createPopup(dataContext);
    if (popup != null) {
        Dimension dimension = popup.getContent().getPreferredSize();
        Point at = new Point(0, -dimension.height);
        popup.show(new RelativePoint(e.getComponent(), at));
        // destroy popup on unexpected project close
        Disposer.register(this, popup);
    }
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) SimpleDataContext(com.intellij.openapi.actionSystem.impl.SimpleDataContext) ListPopup(com.intellij.openapi.ui.popup.ListPopup) ChangeFileEncodingAction(com.intellij.openapi.vfs.encoding.ChangeFileEncodingAction) RelativePoint(com.intellij.ui.awt.RelativePoint) RelativePoint(com.intellij.ui.awt.RelativePoint)

Example 28 with ListPopup

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

the class ChangeFileEncodingAction method actionPerformed.

@Override
public final void actionPerformed(final AnActionEvent e) {
    DataContext dataContext = e.getDataContext();
    ListPopup popup = createPopup(dataContext);
    if (popup != null) {
        popup.showInBestPositionFor(dataContext);
    }
}
Also used : ListPopup(com.intellij.openapi.ui.popup.ListPopup)

Example 29 with ListPopup

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

the class BeforeRunStepsPanel method doAddAction.

void doAddAction(AnActionButton button) {
    if (isUnknown()) {
        return;
    }
    final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
    final BeforeRunTaskProvider<BeforeRunTask>[] providers = Extensions.getExtensions(BeforeRunTaskProvider.EXTENSION_POINT_NAME, myRunConfiguration.getProject());
    Set<Key> activeProviderKeys = getActiveProviderKeys();
    DefaultActionGroup actionGroup = new DefaultActionGroup(null, false);
    for (final BeforeRunTaskProvider<BeforeRunTask> provider : providers) {
        if (provider.createTask(myRunConfiguration) == null)
            continue;
        if (activeProviderKeys.contains(provider.getId()) && provider.isSingleton())
            continue;
        AnAction providerAction = new AnAction(provider.getName(), null, provider.getIcon()) {

            @Override
            public void actionPerformed(AnActionEvent e) {
                BeforeRunTask task = provider.createTask(myRunConfiguration);
                if (task != null) {
                    provider.configureTask(myRunConfiguration, task);
                    if (!provider.canExecuteTask(myRunConfiguration, task))
                        return;
                } else {
                    return;
                }
                task.setEnabled(true);
                Set<RunConfiguration> configurationSet = new HashSet<>();
                getAllRunBeforeRuns(task, configurationSet);
                if (configurationSet.contains(myRunConfiguration)) {
                    JOptionPane.showMessageDialog(BeforeRunStepsPanel.this, ExecutionBundle.message("before.launch.panel.cyclic_dependency_warning", myRunConfiguration.getName(), provider.getDescription(task)), ExecutionBundle.message("warning.common.title"), JOptionPane.WARNING_MESSAGE);
                    return;
                }
                addTask(task);
                myListener.fireStepsBeforeRunChanged();
            }
        };
        actionGroup.add(providerAction);
    }
    final ListPopup popup = popupFactory.createActionGroupPopup(ExecutionBundle.message("add.new.run.configuration.acrtion.name"), actionGroup, SimpleDataContext.getProjectContext(myRunConfiguration.getProject()), false, false, false, null, -1, Conditions.<AnAction>alwaysTrue());
    popup.show(button.getPreferredPopupPoint());
}
Also used : ListPopup(com.intellij.openapi.ui.popup.ListPopup) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) AnAction(com.intellij.openapi.actionSystem.AnAction) BeforeRunTask(com.intellij.execution.BeforeRunTask) UnknownRunConfiguration(com.intellij.execution.configurations.UnknownRunConfiguration) RunConfiguration(com.intellij.execution.configurations.RunConfiguration) JBPopupFactory(com.intellij.openapi.ui.popup.JBPopupFactory) BeforeRunTaskProvider(com.intellij.execution.BeforeRunTaskProvider) Key(com.intellij.openapi.util.Key) HashSet(com.intellij.util.containers.hash.HashSet)

Example 30 with ListPopup

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

the class ExportHTMLAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    final ListPopup popup = JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<String>(InspectionsBundle.message("inspection.action.export.popup.title"), HTML, XML) {

        @Override
        public PopupStep onChosen(final String selectedValue, final boolean finalChoice) {
            return doFinalStep(() -> exportHTML(Comparing.strEqual(selectedValue, HTML)));
        }
    });
    InspectionResultsView.showPopup(e, popup);
}
Also used : ListPopup(com.intellij.openapi.ui.popup.ListPopup) BaseListPopupStep(com.intellij.openapi.ui.popup.util.BaseListPopupStep) PopupStep(com.intellij.openapi.ui.popup.PopupStep)

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