void (final boolean forceSynch) { if (myInsideSynch) { return; } myInsideSynch = true; try { RadComponent[] newSelection = myComponentTree.getSelectedComponents(); if (!forceSynch && mySelection.size() == newSelection.length) { boolean anyChanges = false; for(RadComponent c: newSelection) { if (!mySelection.contains(c)) { anyChanges = true; break; } } if (!anyChanges) return; } mySelection.clear(); Collections.addAll(mySelection, newSelection); if (isEditing()){ cellEditor.stopCellEditing(); } // Store selected property final int selectedRow=getSelectedRow(); Property selectedProperty=null; if(selectedRow >= 0 && selectedRow < myProperties.size()){ selectedProperty=myProperties.get(selectedRow); } collectPropertiesForSelection(); myModel.fireTableDataChanged(); // Try to restore selection final ArrayList<Property> reversePath= new ArrayList<>(2); while(selectedProperty!=null){ reversePath.add(selectedProperty); selectedProperty=selectedProperty.getParent(); } int indexToSelect=-1; for(int i=reversePath.size()-1;i>=0;i--){ final Property property=reversePath.get(i); int index=findPropertyByName(myProperties, property.getName()); if(index==-1 && indexToSelect!=-1){ // try to expand parent and try again expandProperty(indexToSelect); index=findPropertyByName(myProperties, property.getName()); if(index!=-1){ indexToSelect=index; }else{ break; } }else{ indexToSelect=index; } } if(indexToSelect!=-1){ getSelectionModel().setSelectionInterval(indexToSelect,indexToSelect); }else if(getRowCount()>0){ // Select first row if it's impossible to restore selection getSelectionModel().setSelectionInterval(0,0); } TableUtil.scrollSelectionToVisible(this); } finally { myInsideSynch = false; } }