use of com.intellij.openapi.ui.popup.ListPopup in project intellij-community by JetBrains.
the class PythonSdkDetailsStep method show.
public static void show(final Project project, final Sdk[] existingSdks, @Nullable final DialogWrapper moreDialog, JComponent ownerComponent, final Point popupPoint, final NullableConsumer<Sdk> sdkAddedCallback, boolean isNewProject) {
final PythonSdkDetailsStep sdkHomesStep = new PythonSdkDetailsStep(project, moreDialog, ownerComponent, existingSdks, sdkAddedCallback);
sdkHomesStep.setNewProject(isNewProject);
final ListPopup popup = JBPopupFactory.getInstance().createListPopup(sdkHomesStep);
popup.showInScreenCoordinates(ownerComponent, popupPoint);
}
use of com.intellij.openapi.ui.popup.ListPopup in project intellij-community by JetBrains.
the class IpnbEditablePanel method addRightClickMenu.
@Override
protected void addRightClickMenu() {
myViewPanel.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
if (SwingUtilities.isRightMouseButton(e) && e.getClickCount() == 1) {
final DefaultActionGroup group = new DefaultActionGroup(new IpnbMergeCellAboveAction(), new IpnbMergeCellBelowAction());
final ListPopup menu = createPopupMenu(group);
menu.show(RelativePoint.fromScreen(e.getLocationOnScreen()));
}
}
});
myEditableTextArea.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
if (SwingUtilities.isRightMouseButton(e) && e.getClickCount() == 1) {
final DefaultActionGroup group = new DefaultActionGroup(new IpnbSplitCellAction());
final ListPopup menu = createPopupMenu(group);
menu.show(RelativePoint.fromScreen(e.getLocationOnScreen()));
}
}
});
}
use of com.intellij.openapi.ui.popup.ListPopup in project intellij-community by JetBrains.
the class LineSeparatorPanel method showPopup.
private void showPopup(MouseEvent e) {
if (!myActionEnabled) {
return;
}
DataContext dataContext = getContext();
AnAction group = ActionManager.getInstance().getAction("ChangeLineSeparators");
if (!(group instanceof ActionGroup)) {
return;
}
ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup("Line separator", (ActionGroup) group, dataContext, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false);
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);
}
use of com.intellij.openapi.ui.popup.ListPopup in project intellij-community by JetBrains.
the class IntelliSortChooserPopupAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
VcsLogUi logUI = e.getRequiredData(VcsLogDataKeys.VCS_LOG_UI);
VcsLogUiProperties properties = e.getRequiredData(VcsLogInternalDataKeys.LOG_UI_PROPERTIES);
ActionGroup settingsGroup = new DefaultActionGroup(ContainerUtil.map(PermanentGraph.SortType.values(), (Function<PermanentGraph.SortType, AnAction>) sortType -> new SelectIntelliSortTypeAction(logUI, properties, sortType)));
ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(null, settingsGroup, e.getDataContext(), JBPopupFactory.ActionSelectionAid.MNEMONICS, true, ToolWindowContentUi.POPUP_PLACE);
Component component = e.getInputEvent().getComponent();
if (component instanceof ActionButtonComponent) {
popup.showUnderneathOf(component);
} else {
popup.showInCenterOf(component);
}
}
use of com.intellij.openapi.ui.popup.ListPopup in project intellij-community by JetBrains.
the class ToolWindowContentUi method toggleContentPopup.
public void toggleContentPopup() {
if (myShouldNotShowPopup) {
myShouldNotShowPopup = false;
return;
}
final Ref<AnAction> selected = Ref.create();
final Ref<AnAction> selectedTab = Ref.create();
final Content[] contents = myManager.getContents();
final Content selectedContent = myManager.getSelectedContent();
final AnAction[] actions = new AnAction[contents.length];
for (int i = 0; i < actions.length; i++) {
final Content content = contents[i];
if (content instanceof TabbedContent) {
final TabbedContent tabbedContent = (TabbedContent) content;
final List<Pair<String, JComponent>> tabs = ((TabbedContent) content).getTabs();
final AnAction[] tabActions = new AnAction[tabs.size()];
for (int j = 0; j < tabActions.length; j++) {
final int index = j;
tabActions[j] = new DumbAwareAction(tabs.get(index).first) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
myManager.setSelectedContent(tabbedContent);
tabbedContent.selectContent(index);
}
};
}
final DefaultActionGroup group = new DefaultActionGroup(tabActions);
group.getTemplatePresentation().setText(((TabbedContent) content).getTitlePrefix());
group.setPopup(true);
actions[i] = group;
if (content == selectedContent) {
selected.set(group);
final int selectedIndex = ContentUtilEx.getSelectedTab(tabbedContent);
if (selectedIndex != -1) {
selectedTab.set(tabActions[selectedIndex]);
}
}
} else {
actions[i] = new DumbAwareAction() {
{
getTemplatePresentation().setText(content.getTabName(), false);
}
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
myManager.setSelectedContent(content, true, true);
}
};
if (content == selectedContent) {
selected.set(actions[i]);
}
}
}
final ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(null, new DefaultActionGroup(actions), DataManager.getInstance().getDataContext(myManager.getComponent()), false, true, true, null, -1, action -> action == selected.get() || action == selectedTab.get());
getCurrentLayout().showContentPopup(popup);
if (selectedContent instanceof TabbedContent) {
new Alarm(Alarm.ThreadToUse.SWING_THREAD, popup).addRequest(() -> popup.handleSelect(true), 30);
}
}
Aggregations