Does not seem to find removePerspective(name) function.
Also, how do I rename a Perspective?
Thanks.
Does not seem to find removePerspective(name) function.
Also, how do I rename a Perspective?
Thanks.
Use “CControl.delete” to remove a perspective, currently the CControlPerspective does not offer any methods to remove a Perspective (I’ll add one in the next version).
Renaming is not implemented yet, but the code below should work (“control” is your CControl).
* Renames the perspective <code>source</code> to <code>destination</code>. If there is already a
* layout with name <code>destination</code> it will be overriden.
* @param source the name of the source
* @param destination the name of the destination
* @throws IllegalArgumentException if <code>source</code> does not point to an existing layout
* @throws IllegalArgumentException if either <code>source</code> or <code>destination</code> are <code>null</code>
*/
public void renamePerspective( String source, String destination ){
if( source == null ){
throw new IllegalArgumentException( "source is null" );
}
if( destination == null ){
throw new IllegalArgumentException( "destination is null" );
}
CDockFrontend frontend = control.intern();
Setting layout = frontend.getSetting( source );
if( layout == null ){
throw new IllegalArgumentException( "no perspective registered with name '" + source + "'" );
}
frontend.setSetting( destination, layout );
frontend.delete( source );
}```
Thanks.