use of org.eclipse.emf.edit.command.SetCommand in project statecharts by Yakindu.
the class StatechartDefinitionSection method createNameLabel.
protected void createNameLabel(Composite labelComposite) {
Text nameLabel = new Text(labelComposite, SWT.SINGLE | SWT.NORMAL);
GridDataFactory.fillDefaults().indent(5, 1).grab(true, false).align(SWT.FILL, SWT.CENTER).applyTo(nameLabel);
nameLabel.setText(getStatechartName());
nameLabel.setEditable(isStatechart());
nameLabel.setBackground(ColorConstants.white);
nameModificationListener = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
if (getContextObject() instanceof Statechart) {
getSash().setRedraw(false);
TransactionalEditingDomain domain = getTransactionalEditingDomain();
SetCommand command = new SetCommand(domain, getContextObject(), BasePackage.Literals.NAMED_ELEMENT__NAME, nameLabel.getText());
domain.getCommandStack().execute(command);
refresh(nameLabel.getParent());
getSash().setRedraw(true);
}
}
};
nameLabel.addModifyListener(nameModificationListener);
}
use of org.eclipse.emf.edit.command.SetCommand in project statecharts by Yakindu.
the class StatechartDefinitionSection method setInlineStyleValue.
protected void setInlineStyleValue(BooleanValueStyle inlineStyle, TransactionalEditingDomain domain) {
SetCommand command = new SetCommand(domain, inlineStyle, NotationPackage.Literals.BOOLEAN_VALUE_STYLE__BOOLEAN_VALUE, !inlineStyle.isBooleanValue());
domain.getCommandStack().execute(command);
}
Aggregations