void (ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { // equality check is needed to prevent resetting of combobox with filters // on initial projects update MantisProject project = (MantisProject)myProjectCombobox.getSelectedItem(); if (project != null) { //noinspection unchecked myFilterCombobox.setModel(new DefaultComboBoxModel(ArrayUtil.toObjectArray(project.getFilters()))); if (!project.equals(myRepository.getCurrentProject())) { // unspecified filter should always be available myFilterCombobox.setSelectedIndex(0); doApply(); } else if (!myInitialized) { // matters only on initialization myFilterCombobox.setSelectedItem(myRepository.getCurrentFilter()); myInitialized = true; } } } }