public void readModes( ModeSettings<Location, ?> modes, CPerspective cperspective, CControlAccess control ){
Iterator<PerspectiveElement> elements = cperspective.elements();
while( elements.hasNext() ){
PerspectiveElement next = elements.next();
if( next instanceof CommonElementPerspective ){
CDockablePerspective dockable = ((CommonElementPerspective)next).getElement().asDockable();
if( dockable != null ){
String id = null;
if( dockable instanceof SingleCDockablePerspective ){
id = ((SingleCDockablePerspective)dockable).getUniqueId();
id = control.getRegister().toSingleId( id );
}
else if( dockable instanceof MultipleCDockablePerspective ){
id = ((MultipleCDockablePerspective)dockable).getUniqueId();
id = control.getRegister().toMultiId( id );
}
if( id != null ){
int index = modes.indexOf( id );
if( index != -1 ){
Path[] order = modes.getHistory( index );
Map<Path, Location> locations = modes.getProperties( index );
LocationHistory history = dockable.getLocationHistory();
for( Path item : order ){
ExtendedMode mode = getMode( item );
if( mode == null ){
throw new IllegalStateException( "unknown ExtendedMode with id='" + item + "'" );
}