}
private void updateActionSets(Perspective oldPersp, Perspective newPersp) {
// Update action sets
IContextService service = (IContextService) window
.getService(IContextService.class);
try {
service.activateContext(ContextAuthority.DEFER_EVENTS);
if (newPersp != null) {
IActionSetDescriptor[] newAlwaysOn = newPersp
.getAlwaysOnActionSets();
for (int i = 0; i < newAlwaysOn.length; i++) {
IActionSetDescriptor descriptor = newAlwaysOn[i];
actionSets.showAction(descriptor);
}
IActionSetDescriptor[] newAlwaysOff = newPersp
.getAlwaysOffActionSets();
for (int i = 0; i < newAlwaysOff.length; i++) {
IActionSetDescriptor descriptor = newAlwaysOff[i];
actionSets.maskAction(descriptor);
}
}
if (oldPersp != null) {
IActionSetDescriptor[] newAlwaysOn = oldPersp
.getAlwaysOnActionSets();
for (int i = 0; i < newAlwaysOn.length; i++) {
IActionSetDescriptor descriptor = newAlwaysOn[i];
actionSets.hideAction(descriptor);
}
IActionSetDescriptor[] newAlwaysOff = oldPersp
.getAlwaysOffActionSets();
for (int i = 0; i < newAlwaysOff.length; i++) {
IActionSetDescriptor descriptor = newAlwaysOff[i];
actionSets.unmaskAction(descriptor);
}
}
} finally {
service.activateContext(ContextAuthority.SEND_EVENTS);
}
}