Search in sources :

Example 26 with EObjectFeatureCommand

use of com.archimatetool.editor.model.commands.EObjectFeatureCommand in project archi by archimatetool.

the class ImageChooserSection method doImagePathCommand.

protected void doImagePathCommand(String path) {
    CompoundCommand result = new CompoundCommand();
    for (EObject dmo : getEObjects()) {
        if (isAlive(dmo)) {
            Command cmd = new EObjectFeatureCommand(path == null ? Messages.DiagramModelImageSection_4 : Messages.DiagramModelImageSection_7, dmo, IArchimatePackage.Literals.DIAGRAM_MODEL_IMAGE_PROVIDER__IMAGE_PATH, path);
            if (cmd.canExecute()) {
                result.add(cmd);
            }
        }
    }
    executeCommand(result.unwrap());
}
Also used : CompoundCommand(org.eclipse.gef.commands.CompoundCommand) EObjectFeatureCommand(com.archimatetool.editor.model.commands.EObjectFeatureCommand) Command(org.eclipse.gef.commands.Command) EObjectFeatureCommand(com.archimatetool.editor.model.commands.EObjectFeatureCommand) EObject(org.eclipse.emf.ecore.EObject) CompoundCommand(org.eclipse.gef.commands.CompoundCommand)

Example 27 with EObjectFeatureCommand

use of com.archimatetool.editor.model.commands.EObjectFeatureCommand in project archi by archimatetool.

the class SketchModelBackgroundSection method createBackgroundControl.

private void createBackgroundControl(Composite parent) {
    // Label
    createLabel(parent, Messages.SketchModelBackgroundSection_0, ITabbedLayoutConstants.BIG_LABEL_WIDTH, SWT.CENTER);
    // Combo
    fComboBackground = new Combo(parent, SWT.READ_ONLY);
    fComboBackground.setItems(ISketchEditor.BACKGROUNDS);
    getWidgetFactory().adapt(fComboBackground, true, true);
    fComboBackground.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            CompoundCommand result = new CompoundCommand();
            for (EObject sketchModel : getEObjects()) {
                if (isAlive(sketchModel)) {
                    Command cmd = new EObjectFeatureCommand(Messages.SketchModelBackgroundSection_1, sketchModel, IArchimatePackage.Literals.SKETCH_MODEL__BACKGROUND, fComboBackground.getSelectionIndex());
                    if (cmd.canExecute()) {
                        result.add(cmd);
                    }
                }
            }
            executeCommand(result.unwrap());
        }
    });
    GridData gd = new GridData(SWT.NONE, SWT.NONE, true, false);
    gd.minimumWidth = ITabbedLayoutConstants.COMBO_WIDTH;
    fComboBackground.setLayoutData(gd);
}
Also used : CompoundCommand(org.eclipse.gef.commands.CompoundCommand) EObjectFeatureCommand(com.archimatetool.editor.model.commands.EObjectFeatureCommand) Command(org.eclipse.gef.commands.Command) EObjectFeatureCommand(com.archimatetool.editor.model.commands.EObjectFeatureCommand) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) EObject(org.eclipse.emf.ecore.EObject) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) Combo(org.eclipse.swt.widgets.Combo) CompoundCommand(org.eclipse.gef.commands.CompoundCommand)

Aggregations

EObjectFeatureCommand (com.archimatetool.editor.model.commands.EObjectFeatureCommand)27 Command (org.eclipse.gef.commands.Command)22 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)21 EObject (org.eclipse.emf.ecore.EObject)19 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)8 SelectionEvent (org.eclipse.swt.events.SelectionEvent)8 Combo (org.eclipse.swt.widgets.Combo)8 GridData (org.eclipse.swt.layout.GridData)6 StyledTextControl (com.archimatetool.editor.ui.components.StyledTextControl)5 CommandStack (org.eclipse.gef.commands.CommandStack)5 NonNotifyingCompoundCommand (com.archimatetool.editor.model.commands.NonNotifyingCompoundCommand)4 IArchiveManager (com.archimatetool.editor.model.IArchiveManager)3 INameable (com.archimatetool.model.INameable)3 File (java.io.File)3 PropertySectionTextControl (com.archimatetool.editor.propertysections.PropertySectionTextControl)2 IDiagramModelObject (com.archimatetool.model.IDiagramModelObject)2 IOException (java.io.IOException)2 Label (org.eclipse.swt.widgets.Label)2 Text (org.eclipse.swt.widgets.Text)2 BorderColorCommand (com.archimatetool.editor.diagram.commands.BorderColorCommand)1