if (!newList.contains(desc)) {
SetRec rec = (SetRec) mapDescToRec.get(desc);
if (rec != null) {
mapDescToRec.remove(desc);
IActionSet set = rec.set;
SubActionBars bars = rec.bars;
if (bars != null) {
SetRec invisibleRec = new SetRec(desc, set, bars);
invisibleBars.put(desc, invisibleRec);
bars.deactivate();
}
}
}
}
// Add new actions.
ArrayList sets = new ArrayList();
for (int i = 0; i < newArray.length; i++) {
IActionSetDescriptor desc = newArray[i];
if (!mapDescToRec.containsKey(desc)) {
try {
SetRec rec;
// If the action bars and sets have already been created
// then
// reuse those action sets
if (invisibleBars.containsKey(desc)) {
rec = (SetRec) invisibleBars.get(desc);
if (rec.bars != null) {
rec.bars.activate();
}
invisibleBars.remove(desc);
} else {
IActionSet set = desc.createActionSet();
SubActionBars bars = new ActionSetActionBars(window
.getActionBars(), window,
(IActionBarConfigurer2) window.getWindowConfigurer()
.getActionBarConfigurer(), desc.getId());
rec = new SetRec(desc, set, bars);
set.init(window, bars);