public void setCompilerLibraryById(LibraryId id) { if (id.isEmpty()) { // myCompilerLibrary.addItem(null); myCompilerLibrary.setSelectedItem(null); } else { LibraryDescriptor descriptor = findLibraryDescriptorFor(id); if (descriptor == null) { LibraryDescriptor newId = LibraryDescriptor.createFor(id); myCompilerLibrary.addItem(newId); myCompilerLibrary.setSelectedItem(newId); } else { myCompilerLibrary.setSelectedItem(descriptor); } } }