Search in sources :

Example 6 with FeatureCommand

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

the class DiagramConnectionSection method createDisplayNameControl.

private void createDisplayNameControl(Composite parent) {
    // $NON-NLS-1$
    createLabel(parent, Messages.DiagramConnectionSection_8 + ":", ITabbedLayoutConstants.STANDARD_LABEL_WIDTH, SWT.CENTER);
    fButtonDisplayName = getWidgetFactory().createButton(parent, null, SWT.CHECK);
    fButtonDisplayName.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            CompoundCommand result = new CompoundCommand();
            for (EObject connection : getEObjects()) {
                if (isAlive(connection)) {
                    Command cmd = new FeatureCommand(Messages.DiagramConnectionSection_8, (IFeatures) connection, IDiagramModelConnection.FEATURE_NAME_VISIBLE, fButtonDisplayName.getSelection(), IDiagramModelConnection.FEATURE_NAME_VISIBLE_DEFAULT);
                    if (cmd.canExecute()) {
                        result.add(cmd);
                    }
                }
            }
            executeCommand(result.unwrap());
        }
    });
}
Also used : FeatureCommand(com.archimatetool.editor.model.commands.FeatureCommand) LineWidthCommand(com.archimatetool.editor.diagram.commands.LineWidthCommand) CompoundCommand(org.eclipse.gef.commands.CompoundCommand) ConnectionTextPositionCommand(com.archimatetool.editor.diagram.commands.ConnectionTextPositionCommand) 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) IFeatures(com.archimatetool.model.IFeatures) CompoundCommand(org.eclipse.gef.commands.CompoundCommand)

Example 7 with FeatureCommand

use of com.archimatetool.editor.model.commands.FeatureCommand 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)7 Command (org.eclipse.gef.commands.Command)7 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)7 IFeatures (com.archimatetool.model.IFeatures)6 EObject (org.eclipse.emf.ecore.EObject)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)2 LineWidthCommand (com.archimatetool.editor.diagram.commands.LineWidthCommand)2 BorderColorCommand (com.archimatetool.editor.diagram.commands.BorderColorCommand)1 ConnectionLineTypeCommand (com.archimatetool.editor.diagram.commands.ConnectionLineTypeCommand)1 DiagramModelObjectAlphaCommand (com.archimatetool.editor.diagram.commands.DiagramModelObjectAlphaCommand)1 DiagramModelObjectOutlineAlphaCommand (com.archimatetool.editor.diagram.commands.DiagramModelObjectOutlineAlphaCommand)1 FillColorCommand (com.archimatetool.editor.diagram.commands.FillColorCommand)1 FontColorCommand (com.archimatetool.editor.diagram.commands.FontColorCommand)1 FontStyleCommand (com.archimatetool.editor.diagram.commands.FontStyleCommand)1 LineColorCommand (com.archimatetool.editor.diagram.commands.LineColorCommand)1 TextAlignmentCommand (com.archimatetool.editor.diagram.commands.TextAlignmentCommand)1 TextPositionCommand (com.archimatetool.editor.diagram.commands.TextPositionCommand)1