use of com.intellij.openapi.ui.popup.ListPopupStep in project intellij-community by JetBrains.
the class ConfigureTasksActivationDialog method createCenterPanel.
protected JComponent createCenterPanel() {
ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myTree).setAddAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
ProjectItem projectItem = (ProjectItem) projectCombobox.getSelectedItem();
if (projectItem == null)
return;
final ExternalProjectInfo projectData = ProjectDataManager.getInstance().getExternalProjectData(myProject, myProjectSystemId, projectItem.myProjectSettings.getExternalProjectPath());
if (projectData == null || projectData.getExternalProjectStructure() == null)
return;
final List<ProjectPopupItem> popupItems = ContainerUtil.newArrayList();
for (DataNode<ModuleData> moduleDataNode : ExternalSystemApiUtil.findAllRecursively(projectData.getExternalProjectStructure(), ProjectKeys.MODULE)) {
if (moduleDataNode.isIgnored())
continue;
final List<String> tasks = ContainerUtil.map(ExternalSystemApiUtil.findAll(moduleDataNode, ProjectKeys.TASK), node -> node.getData().getName());
if (!tasks.isEmpty()) {
popupItems.add(new ProjectPopupItem(moduleDataNode.getData(), tasks));
}
}
final ChooseProjectStep projectStep = new ChooseProjectStep(popupItems);
final List<ProjectPopupItem> projectItems = projectStep.getValues();
ListPopupStep step = projectItems.size() == 1 ? (ListPopupStep) projectStep.onChosen(projectItems.get(0), false) : projectStep;
assert step != null;
JBPopupFactory.getInstance().createListPopup(step).show(ObjectUtils.notNull(button.getPreferredPopupPoint(), RelativePoint.getSouthEastOf(projectCombobox)));
}
}).setRemoveAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
List<TaskActivationEntry> tasks = findSelectedTasks();
myTaskActivator.removeTasks(tasks);
updateTree(null);
}
}).setMoveUpAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
moveAction(-1);
}
}).setMoveUpActionUpdater(new AnActionButtonUpdater() {
@Override
public boolean isEnabled(AnActionEvent e) {
return isMoveActionEnabled(-1);
}
}).setMoveDownAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
moveAction(+1);
}
}).setMoveDownActionUpdater(new AnActionButtonUpdater() {
@Override
public boolean isEnabled(AnActionEvent e) {
return isMoveActionEnabled(+1);
}
}).setToolbarPosition(ActionToolbarPosition.RIGHT).setToolbarBorder(IdeBorderFactory.createEmptyBorder());
tasksPanel.add(decorator.createPanel());
return contentPane;
}
use of com.intellij.openapi.ui.popup.ListPopupStep in project intellij-community by JetBrains.
the class GroupToolbarAction method actionPerformed.
public void actionPerformed(AnActionEvent e) {
final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
final ListPopupStep popupStep = popupFactory.createActionsStep(myGroup, e.getDataContext(), false, false, myGroup.getTemplatePresentation().getText(), myToolbarComponent, false, 0, false);
popupFactory.createListPopup(popupStep).showUnderneathOf(myToolbarComponent);
}
Aggregations