use of com.intellij.ide.util.gotoByName.ListChooseByNameModel in project intellij-community by JetBrains.
the class SetupTaskChooserAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final Module module = e.getData(LangDataKeys.MODULE);
if (module == null)
return;
final Project project = module.getProject();
final ListChooseByNameModel<SetupTask> model = new ListChooseByNameModel<>(project, "Enter setup.py task name", "No tasks found", SetupTaskIntrospector.getTaskList(module));
final ChooseByNamePopup popup = ChooseByNamePopup.createPopup(project, model, GotoActionBase.getPsiContext(e));
popup.setShowListForEmptyPattern(true);
popup.invoke(new ChooseByNamePopupComponent.Callback() {
public void onClose() {
}
public void elementChosen(Object element) {
if (element != null) {
final SetupTask task = (SetupTask) element;
ApplicationManager.getApplication().invokeLater(() -> runSetupTask(task.getName(), module), ModalityState.NON_MODAL);
}
}
}, ModalityState.current(), false);
}
Aggregations