use of com.archimatetool.editor.diagram.commands.LockObjectCommand in project archi by archimatetool.
the class LockObjectAction method createLockCommand.
private Command createLockCommand(List<?> objects) {
CompoundCommand command = new CompoundCommand();
boolean lock = isToLock();
for (Object object : objects) {
if (object instanceof EditPart) {
EditPart part = (EditPart) object;
if (part.getModel() instanceof ILockable) {
ILockable model = (ILockable) part.getModel();
if (model.isLocked() != lock) {
Command cmd = new LockObjectCommand(model, lock);
command.add(cmd);
}
}
}
}
return command.unwrap();
}
use of com.archimatetool.editor.diagram.commands.LockObjectCommand in project archi by archimatetool.
the class LockedSection method createControls.
@Override
protected void createControls(Composite parent) {
createLabel(parent, Messages.LockedSection_0, ITabbedLayoutConstants.STANDARD_LABEL_WIDTH, SWT.CENTER);
fButtonLocked = new Button(parent, SWT.CHECK);
fButtonLocked.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
CompoundCommand result = new CompoundCommand();
for (EObject lockable : getEObjects()) {
if (isAlive(lockable)) {
Command cmd = new LockObjectCommand((ILockable) lockable, fButtonLocked.getSelection());
if (cmd.canExecute()) {
result.add(cmd);
}
}
}
executeCommand(result.unwrap());
}
});
// Help
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, HELP_ID);
}
Aggregations