private void initializeClientsList() {
   myClientsList.setModel(myClientsListModel);
   myClientsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   myClientsList.setEmptyText("No debuggable applications");
   myClientsList.setCellRenderer(new ClientCellRenderer());
   new ListSpeedSearch(myClientsList) {
     @Override
     protected boolean isMatchingElement(Object element, String pattern) {
       if (element instanceof Client) {
         String pkg = ((Client) element).getClientData().getClientDescription();
         return pkg != null && pkg.contains(pattern);
       }
       return false;
     }
   };
   myClientsList.addListSelectionListener(
       new ListSelectionListener() {
         @Override
         public void valueChanged(ListSelectionEvent e) {
           if (e.getValueIsAdjusting() || myIgnoreListeners) {
             return;
           }
           Object sel = myClientsList.getSelectedValue();
           Client c = (sel instanceof Client) ? (Client) sel : null;
           myDeviceContext.fireClientSelected(c);
         }
       });
 }
 @Nullable
 @Override
 public JComponent createComponent() {
   final JBList dependenciesList = new JBList();
   dependenciesList.setCellRenderer(
       new ColoredListCellRendererWrapper<DependencyOnPlugin>() {
         @Override
         protected void doCustomize(
             JList list, DependencyOnPlugin value, int index, boolean selected, boolean hasFocus) {
           if (value != null) {
             append(
                 getPluginNameById(value.getPluginId()),
                 SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
             String minVersion = value.getMinVersion();
             String maxVersion = value.getMaxVersion();
             if (minVersion != null || maxVersion != null) {
               append(", version ");
             }
             if (minVersion != null && minVersion.equals(maxVersion)) {
               append(minVersion, SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
             } else if (minVersion != null && maxVersion != null) {
               append("between ");
               append(minVersion, SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
               append(" and ");
               append(maxVersion, SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
             } else if (minVersion != null) {
               append("at least ");
               append(minVersion, SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
             } else if (maxVersion != null) {
               append("at most ");
               append(maxVersion, SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
             }
           }
         }
       });
   dependenciesList.setModel(myListModel);
   JPanel dependenciesPanel =
       ToolbarDecorator.createDecorator(dependenciesList)
           .disableUpDownActions()
           .setAddAction(
               new AnActionButtonRunnable() {
                 @Override
                 public void run(AnActionButton button) {
                   replaceDependency(
                       new DependencyOnPlugin("", null, null, null), dependenciesList);
                 }
               })
           .setEditAction(
               new AnActionButtonRunnable() {
                 @Override
                 public void run(AnActionButton button) {
                   DependencyOnPlugin selected =
                       (DependencyOnPlugin) dependenciesList.getSelectedValue();
                   if (selected != null) {
                     replaceDependency(selected, dependenciesList);
                   }
                 }
               })
           .createPanel();
   return FormBuilder.createFormBuilder()
       .addLabeledComponentFillVertically(
           "Plugins which are required to work on this project.", dependenciesPanel)
       .getPanel();
 }
  public LibraryBundlingEditorComponent(@NotNull Project project) {
    myProject = project;
    GuiUtils.replaceJSplitPaneWithIDEASplitter(myMainPanel);
    ((JBSplitter) myMainPanel.getComponent(0)).setProportion(0.4f);

    myRulesPanel.add(
        ToolbarDecorator.createDecorator(myRulesList)
            .setAddAction(
                new AnActionButtonRunnable() {
                  @Override
                  public void run(AnActionButton button) {
                    updateCurrentRule();
                    myRulesModel.add(new LibraryBundlificationRule());
                    myRulesList.setSelectedIndex(myRulesModel.getSize() - 1);
                    updateFields();
                  }
                })
            .setRemoveAction(
                new AnActionButtonRunnable() {
                  @Override
                  public void run(AnActionButton button) {
                    myLastSelected = -1;
                    if (myRulesModel.getSize() == 1) {
                      myRulesModel.setElementAt(new LibraryBundlificationRule(), 0);
                      myRulesList.setSelectedIndex(0);
                    } else {
                      int index = myRulesList.getSelectedIndex();
                      myRulesModel.remove(index);
                      myRulesList.setSelectedIndex(index > 0 ? index - 1 : 0);
                    }
                    updateFields();
                  }
                })
            .setMoveUpAction(
                new AnActionButtonRunnable() {
                  @Override
                  public void run(AnActionButton button) {
                    updateCurrentRule();
                    myLastSelected = -1;
                    ListUtil.moveSelectedItemsUp(myRulesList);
                    updateFields();
                  }
                })
            .setMoveDownAction(
                new AnActionButtonRunnable() {
                  @Override
                  public void run(AnActionButton button) {
                    updateCurrentRule();
                    myLastSelected = -1;
                    ListUtil.moveSelectedItemsDown(myRulesList);
                    updateFields();
                  }
                })
            .addExtraAction(
                new AnActionButton("Copy", PlatformIcons.COPY_ICON) {
                  @Override
                  public void actionPerformed(AnActionEvent e) {
                    updateCurrentRule();
                    int index = myRulesList.getSelectedIndex();
                    if (index >= 0) {
                      myRulesModel.add(myRulesModel.getElementAt(index).copy());
                      myRulesList.setSelectedIndex(myRulesModel.getSize() - 1);
                      updateFields();
                    }
                  }

                  @Override
                  public boolean isEnabled() {
                    return myRulesList.getSelectedIndex() >= 0;
                  }
                })
            .createPanel(),
        BorderLayout.CENTER);

    myRulesModel = new CollectionListModel<>();
    //noinspection unchecked
    myRulesList.setModel(myRulesModel);
    myRulesList.addListSelectionListener(
        new ListSelectionListener() {
          @Override
          public void valueChanged(ListSelectionEvent e) {
            updateCurrentRule();
            updateFields();
          }
        });
  }
Пример #4
0
  public ProjectTypeStep(
      WizardContext context, NewProjectWizard wizard, ModulesProvider modulesProvider) {
    myContext = context;
    myWizard = wizard;

    myTemplatesMap = new ConcurrentMultiMap<TemplatesGroup, ProjectTemplate>();
    final List<TemplatesGroup> groups = fillTemplatesMap(context);

    myProjectTypeList.setModel(new CollectionListModel<TemplatesGroup>(groups));
    myProjectTypeList.setSelectionModel(new SingleSelectionModel());
    myProjectTypeList.addListSelectionListener(
        new ListSelectionListener() {
          @Override
          public void valueChanged(ListSelectionEvent e) {
            updateSelection();
          }
        });
    myProjectTypeList.setCellRenderer(
        new GroupedItemsListRenderer(
            new ListItemDescriptorAdapter<TemplatesGroup>() {
              @Nullable
              @Override
              public String getTextFor(TemplatesGroup value) {
                return value.getName();
              }

              @Nullable
              @Override
              public String getTooltipFor(TemplatesGroup value) {
                return value.getDescription();
              }

              @Nullable
              @Override
              public Icon getIconFor(TemplatesGroup value) {
                return value.getIcon();
              }

              @Override
              public boolean hasSeparatorAboveOf(TemplatesGroup value) {
                int index = groups.indexOf(value);
                if (index < 1) return false;
                TemplatesGroup upper = groups.get(index - 1);
                if (upper.getParentGroup() == null && value.getParentGroup() == null) return true;
                return !Comparing.equal(upper.getParentGroup(), value.getParentGroup())
                    && !Comparing.equal(upper.getName(), value.getParentGroup());
              }
            }) {
          @Override
          protected JComponent createItemComponent() {
            JComponent component = super.createItemComponent();
            myTextLabel.setBorder(IdeBorderFactory.createEmptyBorder(3));
            return component;
          }
        });

    new ListSpeedSearch(myProjectTypeList) {
      @Override
      protected String getElementText(Object element) {
        return ((TemplatesGroup) element).getName();
      }
    };

    myModulesProvider = modulesProvider;
    Project project = context.getProject();
    final LibrariesContainer container =
        LibrariesContainerFactory.createContainer(context, modulesProvider);
    FrameworkSupportModelBase model =
        new FrameworkSupportModelBase(project, null, container) {
          @NotNull
          @Override
          public String getBaseDirectoryForLibrariesPath() {
            ModuleBuilder builder = getSelectedBuilder();
            return StringUtil.notNullize(builder.getContentEntryPath());
          }

          @Override
          public ModuleBuilder getModuleBuilder() {
            return getSelectedBuilder();
          }
        };
    myFrameworksPanel =
        new AddSupportForFrameworksPanel(
            Collections.<FrameworkSupportInModuleProvider>emptyList(), model, true, myHeaderPanel);
    Disposer.register(this, myFrameworksPanel);
    myFrameworksPanelPlaceholder.add(myFrameworksPanel.getMainPanel());

    myConfigurationUpdater =
        new ModuleBuilder.ModuleConfigurationUpdater() {
          @Override
          public void update(@NotNull Module module, @NotNull ModifiableRootModel rootModel) {
            if (isFrameworksMode()) {
              myFrameworksPanel.addSupport(module, rootModel);
            }
          }
        };

    myProjectTypeList
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {
              @Override
              public void valueChanged(ListSelectionEvent e) {
                projectTypeChanged();
              }
            });

    myTemplatesList.addListSelectionListener(
        new ListSelectionListener() {
          @Override
          public void valueChanged(ListSelectionEvent e) {
            updateSelection();
          }
        });

    for (TemplatesGroup templatesGroup : myTemplatesMap.keySet()) {
      ModuleBuilder builder = templatesGroup.getModuleBuilder();
      if (builder != null) {
        myWizard.getSequence().addStepsForBuilder(builder, context, modulesProvider);
      }
      for (ProjectTemplate template : myTemplatesMap.get(templatesGroup)) {
        myWizard
            .getSequence()
            .addStepsForBuilder(myBuilders.get(template), context, modulesProvider);
      }
    }

    final String groupId = PropertiesComponent.getInstance().getValue(PROJECT_WIZARD_GROUP);
    if (groupId != null) {
      TemplatesGroup group =
          ContainerUtil.find(
              groups,
              new Condition<TemplatesGroup>() {
                @Override
                public boolean value(TemplatesGroup group) {
                  return groupId.equals(group.getId());
                }
              });
      if (group != null) {
        myProjectTypeList.setSelectedValue(group, true);
      }
    }
    if (myProjectTypeList.getSelectedValue() == null) {
      myProjectTypeList.setSelectedIndex(0);
    }
    myTemplatesList.restoreSelection();
  }
Пример #5
0
  private void initLeftPanel() {
    myLeftPanel = new JPanel(new GridLayoutManager(2, 1, JBInsets.NONE, -1, -1));

    mySearchField = new SearchTextField(false);
    mySearchField.addDocumentListener(
        new DocumentAdapter() {
          @Override
          protected void textChanged(DocumentEvent e) {
            TemplateItem tmp = myCurrentTemplateItem;
            myFilteringListModel.refilter();
            int idx = myFilteringListModel.getElementIndex(tmp);
            myList.setSelectedIndex(idx < 0 ? 0 : idx);
          }
        });

    new AnAction() {
      @Override
      public void actionPerformed(AnActionEvent e) {
        InputEvent event = e.getInputEvent();
        if (event instanceof KeyEvent) {
          int row = myList.getSelectedIndex();
          int toSelect;
          switch (((KeyEvent) event).getKeyCode()) {
            case KeyEvent.VK_UP:
              toSelect = row == 0 ? myList.getItemsCount() - 1 : row - 1;
              myList.setSelectedIndex(toSelect);
              myList.ensureIndexIsVisible(toSelect);
              break;
            case KeyEvent.VK_DOWN:
              toSelect = row < myList.getItemsCount() - 1 ? row + 1 : 0;
              myList.setSelectedIndex(toSelect);
              myList.ensureIndexIsVisible(toSelect);
              break;
          }
        }
      }
    }.registerCustomShortcutSet(
        new CustomShortcutSet(KeyEvent.VK_UP, KeyEvent.VK_DOWN), mySearchField);

    myLeftPanel.add(
        mySearchField,
        new GridConstraints(
            0,
            0,
            1,
            1,
            GridConstraints.ANCHOR_NORTHWEST,
            GridConstraints.FILL_HORIZONTAL,
            GridConstraints.SIZEPOLICY_CAN_SHRINK,
            GridConstraints.SIZEPOLICY_FIXED,
            null,
            null,
            null));

    myList = new JBList();

    List<ProjectTemplatesGroup> templatesGroups =
        new SortedList<ProjectTemplatesGroup>(
            new Comparator<ProjectTemplatesGroup>() {
              @Override
              public int compare(ProjectTemplatesGroup o1, ProjectTemplatesGroup o2) {
                // Put DSL/Development groups on top & Other group to the last place
                if (o1.getName().equals("DSL")) return -1;
                if (o2.getName().equals("DSL")) return 1;
                if (o1.getName().equals("Development")) return -1;
                if (o2.getName().equals("Development")) return 1;
                if (o1.getName().equals("Other")) return 1;
                if (o2.getName().equals("Other")) return -1;
                return o1.getName().compareToIgnoreCase(o2.getName());
              }
            });
    List<TemplateItem> templateItems = new LinkedList<TemplateItem>();

    templatesGroups.addAll(Arrays.asList(ProjectTemplatesGroup.EP_NAME.getExtensions()));

    for (ProjectTemplatesGroup templatesGroup : templatesGroups) {
      for (MPSProjectTemplate template : templatesGroup.getTemplates()) {
        templateItems.add(new TemplateItem(template, templatesGroup));
      }
    }

    CollectionListModel<TemplateItem> model = new CollectionListModel<TemplateItem>(templateItems);
    myFilteringListModel = new FilteringListModel<TemplateItem>(model);
    myFilteringListModel.setFilter(
        new Condition<TemplateItem>() {
          @Override
          public boolean value(TemplateItem templateItem) {
            return templateItem
                .getName()
                .toLowerCase()
                .contains(mySearchField.getText().trim().toLowerCase());
          }
        });
    myList.setModel(myFilteringListModel);

    myList.setCellRenderer(
        new GroupedItemsListRenderer(
            new ListItemDescriptor() {
              @Nullable
              @Override
              public String getTextFor(Object value) {
                return ((TemplateItem) value).getName();
              }

              @Nullable
              @Override
              public String getTooltipFor(Object value) {
                return null;
              }

              @Nullable
              @Override
              public Icon getIconFor(Object value) {
                return ((TemplateItem) value).getIcon();
              }

              @Override
              public boolean hasSeparatorAboveOf(Object value) {
                TemplateItem item = (TemplateItem) value;
                int index = myFilteringListModel.getElementIndex(item);
                return index == 0
                    || !myFilteringListModel
                        .getElementAt(index - 1)
                        .getGroupName()
                        .equals(item.getGroupName());
              }

              @Nullable
              @Override
              public String getCaptionAboveOf(Object value) {
                return ((TemplateItem) value).getGroupName();
              }
            }));

    myList
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {

              @Override
              public void valueChanged(ListSelectionEvent e) {
                myCurrentTemplateItem = (TemplateItem) myList.getSelectedValue();
                updateRightPanel();
              }
            });

    myLeftPanel.add(
        ScrollPaneFactory.createScrollPane(myList),
        new GridConstraints(
            1,
            0,
            1,
            1,
            GridConstraints.ANCHOR_NORTHWEST,
            GridConstraints.FILL_BOTH,
            GridConstraints.SIZEPOLICY_CAN_SHRINK,
            GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_CAN_SHRINK,
            null,
            null,
            null));
    myLeftPanel.setPreferredSize(new Dimension(200, 400));
  }
  public ProjectTypesList(
      JBList list,
      SearchTextField searchField,
      MultiMap<TemplatesGroup, ProjectTemplate> map,
      final WizardContext context) {
    myList = list;
    mySearchField = searchField;

    List<TemplateItem> items = buildItems(map);
    final RemoteTemplatesFactory factory = new RemoteTemplatesFactory();
    final String groupName = factory.getGroups()[0];
    final TemplatesGroup samplesGroup = new TemplatesGroup(groupName, "", null);
    myLoadingItem =
        new TemplateItem(new LoadingProjectTemplate(), samplesGroup) {
          @Override
          Icon getIcon() {
            return null;
          }

          @Override
          String getDescription() {
            return "";
          }
        };
    items.add(myLoadingItem);
    final CollectionListModel<TemplateItem> model = new CollectionListModel<TemplateItem>(items);
    myFilteringListModel = new FilteringListModel<TemplateItem>(model);

    ProgressManager.getInstance()
        .run(
            new Task.Backgroundable(context.getProject(), "Loading Samples") {
              @Override
              public void run(@NotNull ProgressIndicator indicator) {
                try {
                  myList.setPaintBusy(true);
                  final ProjectTemplate[] templates = factory.createTemplates(groupName, context);
                  Runnable runnable =
                      new Runnable() {
                        public void run() {
                          int index = myList.getSelectedIndex();
                          model.remove(myLoadingItem);
                          for (ProjectTemplate template : templates) {
                            model.add(new TemplateItem(template, samplesGroup));
                          }
                          myList.setSelectedIndex(index);
                        }
                      };
                  SwingUtilities.invokeLater(runnable);
                } finally {
                  myList.setPaintBusy(false);
                }
              }
            });

    myList.setCellRenderer(
        new GroupedItemsListRenderer(
            new ListItemDescriptor() {
              @Nullable
              @Override
              public String getTextFor(Object value) {
                return ((TemplateItem) value).getName();
              }

              @Nullable
              @Override
              public String getTooltipFor(Object value) {
                return null;
              }

              @Nullable
              @Override
              public Icon getIconFor(Object value) {
                return ((TemplateItem) value).getIcon();
              }

              @Override
              public boolean hasSeparatorAboveOf(Object value) {
                TemplateItem item = (TemplateItem) value;
                int index = myFilteringListModel.getElementIndex(item);
                return index == 0
                    || !myFilteringListModel
                        .getElementAt(index - 1)
                        .getGroupName()
                        .equals(item.getGroupName());
              }

              @Nullable
              @Override
              public String getCaptionAboveOf(Object value) {
                return ((TemplateItem) value).getGroupName();
              }
            }));

    myFilteringListModel.setFilter(
        new Condition<TemplateItem>() {
          @Override
          public boolean value(TemplateItem item) {
            return item.getMatchingDegree() > Integer.MIN_VALUE;
          }
        });

    myList.setModel(myFilteringListModel);
    mySearchField.addDocumentListener(
        new DocumentAdapter() {
          @Override
          protected void textChanged(DocumentEvent e) {
            String text = "*" + mySearchField.getText().trim();
            myMatcher = NameUtil.buildMatcher(text, NameUtil.MatchingCaseSensitivity.NONE);

            TemplateItem value = (TemplateItem) myList.getSelectedValue();
            int degree = value == null ? Integer.MIN_VALUE : value.getMatchingDegree();
            myBestMatch = Pair.create(degree > Integer.MIN_VALUE ? value : null, degree);

            myFilteringListModel.refilter();
            if (myBestMatch.first != null) {
              myList.setSelectedValue(myBestMatch.first, true);
            }
          }
        });

    new AnAction() {
      @Override
      public void actionPerformed(AnActionEvent e) {
        InputEvent event = e.getInputEvent();
        if (event instanceof KeyEvent) {
          int row = myList.getSelectedIndex();
          int toSelect;
          switch (((KeyEvent) event).getKeyCode()) {
            case KeyEvent.VK_UP:
              toSelect = row == 0 ? myList.getItemsCount() - 1 : row - 1;
              myList.setSelectedIndex(toSelect);
              myList.ensureIndexIsVisible(toSelect);
              break;
            case KeyEvent.VK_DOWN:
              toSelect = row < myList.getItemsCount() - 1 ? row + 1 : 0;
              myList.setSelectedIndex(toSelect);
              myList.ensureIndexIsVisible(toSelect);
              break;
          }
        }
      }
    }.registerCustomShortcutSet(
        new CustomShortcutSet(KeyEvent.VK_UP, KeyEvent.VK_DOWN), mySearchField);
  }
  @SuppressWarnings("unchecked")
  private void createUIComponents() {
    final JBList projectExistLocalesList = new JBList();
    final MyExistLocalesListModel existLocalesListModel = new MyExistLocalesListModel();
    projectExistLocalesList.setModel(existLocalesListModel);
    projectExistLocalesList.setCellRenderer(getLocaleRenderer());
    myProjectExistLocalesPanel =
        ToolbarDecorator.createDecorator(projectExistLocalesList)
            .disableRemoveAction()
            .disableUpDownActions()
            .createPanel();
    myProjectExistLocalesPanel.setBorder(
        IdeBorderFactory.createTitledBorder("Project locales", false));

    final JBList localesToAddList = new JBList();

    final List<Locale> locales;
    final List<Locale> restrictedLocales;
    if (myResourceBundle == null) {
      locales = Collections.singletonList(PropertiesUtil.DEFAULT_LOCALE);
      restrictedLocales = Collections.emptyList();
    } else {
      locales = Collections.emptyList();
      restrictedLocales =
          ContainerUtil.map(myResourceBundle.getPropertiesFiles(), PropertiesFile::getLocale);
    }
    myLocalesModel =
        new CollectionListModel<Locale>(locales) {
          @Override
          public void add(@NotNull List<? extends Locale> elements) {
            final List<Locale> currentItems = getItems();
            elements =
                ContainerUtil.filter(
                    elements,
                    locale ->
                        !restrictedLocales.contains(locale) && !currentItems.contains(locale));
            super.add(elements);
          }
        };
    localesToAddList.setModel(myLocalesModel);
    localesToAddList.setCellRenderer(getLocaleRenderer());
    localesToAddList.addFocusListener(
        new FocusAdapter() {
          @Override
          public void focusGained(FocusEvent e) {
            projectExistLocalesList.clearSelection();
          }
        });
    projectExistLocalesList.addFocusListener(
        new FocusAdapter() {
          @Override
          public void focusGained(FocusEvent e) {
            localesToAddList.clearSelection();
          }
        });

    myNewBundleLocalesPanel =
        ToolbarDecorator.createDecorator(localesToAddList)
            .setAddAction(
                new AnActionButtonRunnable() {
                  @Override
                  public void run(AnActionButton button) {
                    final String rawAddedLocales =
                        Messages.showInputDialog(
                            myProject,
                            PropertiesBundle.message(
                                "create.resource.bundle.dialog.add.locales.validator.message"),
                            PropertiesBundle.message(
                                "create.resource.bundle.dialog.add.locales.validator.title"),
                            null,
                            null,
                            new InputValidatorEx() {
                              @Nullable
                              @Override
                              public String getErrorText(String inputString) {
                                return checkInput(inputString) ? null : "Invalid locales";
                              }

                              @Override
                              public boolean checkInput(String inputString) {
                                return extractLocalesFromString(inputString) != null;
                              }

                              @Override
                              public boolean canClose(String inputString) {
                                return checkInput(inputString);
                              }
                            });
                    if (rawAddedLocales != null) {
                      final List<Locale> locales = extractLocalesFromString(rawAddedLocales);
                      LOG.assertTrue(locales != null);
                      myLocalesModel.add(locales);
                    }
                  }
                })
            .setAddActionName("Add locales by suffix")
            .disableUpDownActions()
            .createPanel();
    myNewBundleLocalesPanel.setBorder(IdeBorderFactory.createTitledBorder("Locales to add", false));

    myAddLocaleFromExistButton = new JButton(AllIcons.Actions.Forward);
    new ClickListener() {
      @Override
      public boolean onClick(@NotNull MouseEvent event, int clickCount) {
        if (clickCount == 1) {
          myLocalesModel.add(
              ContainerUtil.map(projectExistLocalesList.getSelectedValues(), o -> (Locale) o));
          return true;
        }
        return false;
      }
    }.installOn(myAddLocaleFromExistButton);

    projectExistLocalesList.addListSelectionListener(
        new ListSelectionListener() {
          @Override
          public void valueChanged(ListSelectionEvent e) {
            final List<Locale> currentItems = myLocalesModel.getItems();
            for (Object o : projectExistLocalesList.getSelectedValues()) {
              Locale l = (Locale) o;
              if (!restrictedLocales.contains(l) && !currentItems.contains(l)) {
                myAddLocaleFromExistButton.setEnabled(true);
                return;
              }
            }
            myAddLocaleFromExistButton.setEnabled(false);
          }
        });
    myAddLocaleFromExistButton.setEnabled(false);

    myAddAllButton = new JButton("Add All");
    new ClickListener() {
      @Override
      public boolean onClick(@NotNull MouseEvent event, int clickCount) {
        if (clickCount == 1) {
          myLocalesModel.add(existLocalesListModel.getLocales());
        }
        return false;
      }
    }.installOn(myAddAllButton);
  }