Anywhere in the surface that we check selection type we should probably be passing that functionality off to a handler, for example instead of:
if ( selection instanceof ve.dm.LinearSelection ) {
doSomethingLinear();
} else if ( selection instanceof ve.dm.TableSelection ) {
doSomethingTabular();
} else {
doNothing(); // selection type is probably null??
}use
handler = doSomethingHandlerRegistry.lookup( selection.getName() ); handler.doSomething();
This removes a ton of switch-like statements and would also allow a user to remove all the logic associated with a particular selection type (e.g. for a VE instance that didn't require TableSelections).