use of com.archimatetool.editor.model.commands.EObjectFeatureCommand in project archi by archimatetool.
the class JunctionTypeSection method createControls.
@Override
protected void createControls(Composite parent) {
createLabel(parent, Messages.JunctionTypeSection_2, ITabbedLayoutConstants.STANDARD_LABEL_WIDTH, SWT.CENTER);
fComboType = new Combo(parent, SWT.READ_ONLY);
fComboType.setItems(fComboTypeItems);
fComboType.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
getWidgetFactory().adapt(fComboType, true, true);
fComboType.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
CompoundCommand result = new CompoundCommand();
for (EObject junction : getEObjects()) {
if (isAlive(junction)) {
Command cmd = new EObjectFeatureCommand(Messages.JunctionTypeSection_3, junction, IArchimatePackage.Literals.JUNCTION__TYPE, fTypeValues[fComboType.getSelectionIndex()]);
if (cmd.canExecute()) {
result.add(cmd);
}
}
}
executeCommand(result.unwrap());
}
});
// Help ID
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, HELP_ID);
}
use of com.archimatetool.editor.model.commands.EObjectFeatureCommand in project archi by archimatetool.
the class AssociationRelationshipSection method createControls.
@Override
protected void createControls(Composite parent) {
createLabel(parent, Messages.AssociationRelationshipSection_0, ITabbedLayoutConstants.STANDARD_LABEL_WIDTH, SWT.CENTER);
fButtonDirected = getWidgetFactory().createButton(parent, null, SWT.CHECK);
fButtonDirected.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
CompoundCommand result = new CompoundCommand();
for (EObject relationship : getEObjects()) {
if (isAlive(relationship)) {
Command cmd = new EObjectFeatureCommand(Messages.AssociationRelationshipSection_1, relationship, IArchimatePackage.Literals.ASSOCIATION_RELATIONSHIP__DIRECTED, fButtonDirected.getSelection());
if (cmd.canExecute()) {
result.add(cmd);
}
}
}
executeCommand(result.unwrap());
}
});
// Help ID
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, HELP_ID);
}
use of com.archimatetool.editor.model.commands.EObjectFeatureCommand in project archi by archimatetool.
the class BorderTypeSection method createControls.
@Override
protected void createControls(Composite parent) {
createLabel(parent, Messages.BorderTypeSection_0, ITabbedLayoutConstants.STANDARD_LABEL_WIDTH, SWT.CENTER);
// Combo
fComboBorderType = new Combo(parent, SWT.READ_ONLY);
getWidgetFactory().adapt(fComboBorderType, true, true);
fComboBorderType.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
CompoundCommand result = new CompoundCommand();
for (EObject eObject : getEObjects()) {
if (isAlive(eObject)) {
Command cmd = new EObjectFeatureCommand(Messages.BorderTypeSection_1, eObject, IArchimatePackage.Literals.BORDER_TYPE__BORDER_TYPE, fComboBorderType.getSelectionIndex());
if (cmd.canExecute()) {
result.add(cmd);
}
}
}
executeCommand(result.unwrap());
}
});
// Help
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, HELP_ID);
}
use of com.archimatetool.editor.model.commands.EObjectFeatureCommand in project archi by archimatetool.
the class ViewpointAction method run.
@Override
public void run() {
if (isChecked()) {
CommandStack stack = part.getAdapter(CommandStack.class);
stack.execute(new EObjectFeatureCommand(Messages.ViewpointAction_0, diagramModel, IArchimatePackage.Literals.ARCHIMATE_DIAGRAM_MODEL__VIEWPOINT, viewPoint.getID()));
}
}
use of com.archimatetool.editor.model.commands.EObjectFeatureCommand in project archi by archimatetool.
the class EditorModelManagerTests method isModelDirty_Model.
@Test
public void isModelDirty_Model() {
IArchimateModel model = editorModelManager.createNewModel();
assertFalse(editorModelManager.isModelDirty(model));
// Execute simple command on Command Stack
Command cmd = new EObjectFeatureCommand("", model, IArchimatePackage.Literals.NAMEABLE__NAME, "Hello");
CommandStack stack = (CommandStack) model.getAdapter(CommandStack.class);
stack.execute(cmd);
assertTrue(editorModelManager.isModelDirty(model));
// Flush the Command Stack so we can close the model without a dialog asking us to save
stack.flush();
}
Aggregations