use of com.intellij.openapi.ui.popup.ListPopup in project intellij-community by JetBrains.
the class DetectionExcludesConfigurable method doAddAction.
private void doAddAction(AnActionButton button) {
final List<FrameworkType> types = new ArrayList<>();
for (FrameworkType type : FrameworkDetectorRegistry.getInstance().getFrameworkTypes()) {
if (!isExcluded(type)) {
types.add(type);
}
}
Collections.sort(types, (o1, o2) -> o1.getPresentableName().compareToIgnoreCase(o2.getPresentableName()));
types.add(0, null);
final ListPopup popup = JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<FrameworkType>("Framework to Exclude", types) {
@Override
public Icon getIconFor(FrameworkType value) {
return value != null ? value.getIcon() : null;
}
@NotNull
@Override
public String getTextFor(FrameworkType value) {
return value != null ? value.getPresentableName() : "All Frameworks...";
}
@Override
public boolean hasSubstep(FrameworkType selectedValue) {
return selectedValue != null;
}
@Override
public PopupStep onChosen(final FrameworkType frameworkType, boolean finalChoice) {
if (frameworkType == null) {
return doFinalStep(() -> chooseDirectoryAndAdd(null));
} else {
return addExcludedFramework(frameworkType);
}
}
});
final RelativePoint popupPoint = button.getPreferredPopupPoint();
if (popupPoint != null) {
popup.show(popupPoint);
} else {
popup.showInCenterOf(myMainPanel);
}
}
use of com.intellij.openapi.ui.popup.ListPopup in project intellij-community by JetBrains.
the class NewElementSamePlaceAction method showPopup.
protected void showPopup(DataContext context) {
ListPopup popup = createPopup(context);
Project project = CommonDataKeys.PROJECT.getData(context);
if (project != null) {
popup.showCenteredInCurrentWindow(project);
} else {
popup.showInBestPositionFor(context);
}
}
use of com.intellij.openapi.ui.popup.ListPopup in project intellij-community by JetBrains.
the class ComboBoxAction method createActionPopup.
@NotNull
private ListPopup createActionPopup(@NotNull DataContext context, @NotNull JComponent component, @Nullable Runnable disposeCallback) {
DefaultActionGroup group = createPopupActionGroup(component, context);
ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(myPopupTitle, group, context, false, shouldShowDisabledActions(), false, disposeCallback, getMaxRows(), getPreselectCondition());
popup.setMinimumSize(new Dimension(getMinWidth(), getMinHeight()));
return popup;
}
use of com.intellij.openapi.ui.popup.ListPopup in project intellij-community by JetBrains.
the class ComboBoxAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
Project project = e.getProject();
if (project == null)
return;
JFrame frame = WindowManager.getInstance().getFrame(project);
if (!(frame instanceof IdeFrame))
return;
ListPopup popup = createActionPopup(e.getDataContext(), ((IdeFrame) frame).getComponent(), null);
popup.showCenteredInCurrentWindow(project);
}
use of com.intellij.openapi.ui.popup.ListPopup in project intellij-community by JetBrains.
the class GenerateAction method actionPerformed.
@Override
public void actionPerformed(final AnActionEvent e) {
DataContext dataContext = e.getDataContext();
Project project = ObjectUtils.assertNotNull(getEventProject(e));
final ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(CodeInsightBundle.message("generate.list.popup.title"), wrapGroup(getGroup(), dataContext, project), dataContext, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false);
popup.showInBestPositionFor(dataContext);
}
Aggregations