private CSetting convert( CPerspective perspective, boolean includeWorkingAreas ){
perspective.storeLocations();
DockFrontendPerspective frontend = conversion( perspective, includeWorkingAreas );
Perspective conversion = frontend.getPerspective();
CSetting setting = new CSetting();
// layout
for( String key : perspective.getStationKeys() ){
CStationPerspective station = perspective.getStation( key );
if( station.asDockable() == null || station.asDockable().getParent() == null ){
setting.putRoot( key, conversion.convert( station.intern() ) );
}
}
// invisible items (storing location of visible items as well)
for( String key : perspective.getDockableKeys() ){
CDockablePerspective dockable = perspective.getDockable( key );
Location location = getInvisibleLocation( dockable );
if( location != null ){
setting.addInvisible( key, location.getRoot(), null, location.getLocation() );
}
}
ModeSettings<Location, Location> settings = perspective.getLocationManager().writeModes( control );
setting.setModes( settings );
return setting;
}