nearestPaths[ idx++ ] = root;
Object p = root;
for ( int i = 1; i < elements.length; i++ ) {
if ( elements[ i ] instanceof XTreeModelAdapter ) {
XTreeModelAdapter tma = (XTreeModelAdapter)elements[ i ];
XModel model = tma.getModel();
int numChildren = tm.getChildCount( p );
for ( int j = 0; j < numChildren; j++ ) {
Object childObj = tm.getChild( p, j );
if ( childObj instanceof XTreeModelAdapter ) {
XTreeModelAdapter childTma = (XTreeModelAdapter)childObj;
XModel childModel = childTma.getModel();
if ( childModel.getId().equals( model.getId() )) {
nearestPaths[ idx++ ] = childObj;
p = childObj;
break;