void () { ArrangementMatchingRulesModel model = getModel(); if (myEditorRow >= model.getSize()) { myEditorRow = -1; for (int i = 0, max = model.getSize(); i < max; i++) { if (model.getElementAt(i) instanceof ArrangementEditorComponent) { myEditorRow = i; break; } } } if (myEditorRow < 0) { return; } ListSelectionModel selectionModel = getSelectionModel(); if (selectionModel.isSelectionEmpty()) { hideEditor(); return; } int selectedRow = selectionModel.getMinSelectionIndex(); if (selectedRow != selectionModel.getMaxSelectionIndex()) { // More than one row is selected. hideEditor(); return; } if (selectedRow != myEditorRow && selectedRow != myEditorRow - 1) { hideEditor(); } }