private void checkCanApply(FileTemplateTab list) throws ConfigurationException {
    List<FileTemplate> templates = currentTab.getTemplates();
    Set<String> allNames = new HashSet<>();
    FileTemplate itemWithError = null;
    String errorString = null;
    for (FileTemplate template : templates) {
      String currName = template.getName();
      if (currName.isEmpty()) {
        itemWithError = template;
        errorString = IdeBundle.message("error.please.specify.template.name");
        break;
      }
      if (!allNames.add(currName + "." + template.getExtension())) {
        itemWithError = template;
        errorString = LangBundle.message("dialog.message.template.with.name.already.exists", currName);
        break;
      }
    }

    if (itemWithError != null) {
      myTabbedPane.setSelectedIndex(Arrays.asList(myTabs).indexOf(list));
      selectTemplate(itemWithError);
      list.selectTemplate(itemWithError);
      ApplicationManager.getApplication().invokeLater(editor::focusToNameField);
      throw new ConfigurationException(errorString);
    }
  }
private void checkCanApply(FileTemplateTab list)