void (@Nullable String selectedItem) { ListModel<TemplatePresentation> model = myTemplatesList.getModel(); for (int i = 0; i < model.getSize(); i++) { String templateID = model.getElementAt(i).templateName(); if (StringUtil.equals(selectedItem, templateID)) { myTemplatesList.setSelectedIndex(i); return; } } myTemplatesList.setSelectedIndex(0); }