Search in sources :

Example 6 with IFeatures

use of com.archimatetool.model.IFeatures in project archi by archimatetool.

the class GradientSection method createGradientControl.

private void createGradientControl(Composite parent) {
    createLabel(parent, Messages.GradientSection_0, ITabbedLayoutConstants.STANDARD_LABEL_WIDTH, SWT.CENTER);
    fGradientCombo = new Combo(parent, SWT.READ_ONLY);
    getWidgetFactory().adapt(fGradientCombo, true, true);
    fGradientCombo.setItems(GRADIENT_STYLES);
    fGradientCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            CompoundCommand result = new CompoundCommand();
            for (EObject object : getEObjects()) {
                if (isAlive(object)) {
                    Command cmd = new FeatureCommand(Messages.GradientSection_1, (IFeatures) object, IDiagramModelObject.FEATURE_GRADIENT, fGradientCombo.getSelectionIndex() - 1, IDiagramModelObject.FEATURE_GRADIENT_DEFAULT);
                    if (cmd.canExecute()) {
                        result.add(cmd);
                    }
                }
            }
            executeCommand(result.unwrap());
        }
    });
}
Also used : FeatureCommand(com.archimatetool.editor.model.commands.FeatureCommand) CompoundCommand(org.eclipse.gef.commands.CompoundCommand) FeatureCommand(com.archimatetool.editor.model.commands.FeatureCommand) Command(org.eclipse.gef.commands.Command) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) EObject(org.eclipse.emf.ecore.EObject) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Combo(org.eclipse.swt.widgets.Combo) IFeatures(com.archimatetool.model.IFeatures) CompoundCommand(org.eclipse.gef.commands.CompoundCommand)

Aggregations

FeatureCommand (com.archimatetool.editor.model.commands.FeatureCommand)6 IFeatures (com.archimatetool.model.IFeatures)6 EObject (org.eclipse.emf.ecore.EObject)6 Command (org.eclipse.gef.commands.Command)6 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)6 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)5 SelectionEvent (org.eclipse.swt.events.SelectionEvent)5 Combo (org.eclipse.swt.widgets.Combo)3 ConnectionTextPositionCommand (com.archimatetool.editor.diagram.commands.ConnectionTextPositionCommand)1 LineWidthCommand (com.archimatetool.editor.diagram.commands.LineWidthCommand)1 StyledTextControl (com.archimatetool.editor.ui.components.StyledTextControl)1