Search in sources :

Example 1 with ModuleListCellRenderer

use of com.intellij.application.options.ModuleListCellRenderer in project intellij-community by JetBrains.

the class AddModuleDependencyFix method invoke.

@Override
public void invoke(@NotNull Project project, @Nullable Editor editor, PsiFile file) {
    if (myModules.size() == 1) {
        addDependencyOnModule(project, editor, ContainerUtil.getFirstItem(myModules));
    } else {
        JBList<Module> list = new JBList<>(myModules);
        list.setCellRenderer(new ModuleListCellRenderer());
        JBPopup popup = JBPopupFactory.getInstance().createListPopupBuilder(list).setTitle(QuickFixBundle.message("orderEntry.fix.choose.module.to.add.dependency.on")).setMovable(false).setResizable(false).setRequestFocus(true).setItemChoosenCallback(() -> addDependencyOnModule(project, editor, list.getSelectedValue())).createPopup();
        if (editor != null) {
            popup.showInBestPositionFor(editor);
        } else {
            popup.showCenteredInCurrentWindow(project);
        }
    }
}
Also used : ModuleListCellRenderer(com.intellij.application.options.ModuleListCellRenderer) JBList(com.intellij.ui.components.JBList) Module(com.intellij.openapi.module.Module) JBPopup(com.intellij.openapi.ui.popup.JBPopup)

Aggregations

ModuleListCellRenderer (com.intellij.application.options.ModuleListCellRenderer)1 Module (com.intellij.openapi.module.Module)1 JBPopup (com.intellij.openapi.ui.popup.JBPopup)1 JBList (com.intellij.ui.components.JBList)1