}
@Override
public void actionPerformed(ActionEvent e) {
AbstractComponent ac = getTargetComponent(actionContext);
ObjectManager om = ac.getCapability(ObjectManager.class);
Collection<AbstractComponent> modified = om != null ?
om.getAllModifiedObjects() :
Collections.<AbstractComponent>emptySet();
// Assemble objects to save.
// Make sure they pass the writeable-by-user test.
Set<AbstractComponent> canSave = new HashSet<AbstractComponent>();
Set<AbstractComponent> cannotSave = new HashSet<AbstractComponent>();
for (AbstractComponent mod : modified) {
(isComponentWriteableByUser(mod) ? canSave : cannotSave).add(mod);
}
if (ac.isDirty() && !ac.isStale()) {
(isComponentWriteableByUser(ac) ? canSave : cannotSave).add(ac);
}
if (handleWarnings(canSave, cannotSave)) {
try {
PlatformAccess.getPlatform().getPersistenceProvider().persist(canSave);
} catch (OptimisticLockException ole) {
handleStaleObject(ac);
}
if (om != null) {
om.notifySaved(canSave);
}
}
}