Search in sources :

Example 1 with ConnectionRouterTypeCommand

use of com.archimatetool.editor.diagram.commands.ConnectionRouterTypeCommand in project archi by archimatetool.

the class DiagramModelConnectionSection method createRouterTypeControl.

private void createRouterTypeControl(Composite parent) {
    // Label
    createLabel(parent, Messages.DiagramModelConnectionSection_0, ITabbedLayoutConstants.BIG_LABEL_WIDTH, SWT.CENTER);
    // Combo
    fComboRouterType = new Combo(parent, SWT.READ_ONLY);
    fComboRouterType.setItems(comboItems);
    fComboRouterType.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            CompoundCommand result = new CompoundCommand();
            for (EObject dm : getEObjects()) {
                if (isAlive(dm)) {
                    Command cmd = new ConnectionRouterTypeCommand((IDiagramModel) dm, ConnectionRouterAction.CONNECTION_ROUTER_TYPES.get(fComboRouterType.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;
    fComboRouterType.setLayoutData(gd);
}
Also used : ConnectionRouterTypeCommand(com.archimatetool.editor.diagram.commands.ConnectionRouterTypeCommand) ConnectionRouterTypeCommand(com.archimatetool.editor.diagram.commands.ConnectionRouterTypeCommand) CompoundCommand(org.eclipse.gef.commands.CompoundCommand) Command(org.eclipse.gef.commands.Command) IDiagramModel(com.archimatetool.model.IDiagramModel) 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)

Example 2 with ConnectionRouterTypeCommand

use of com.archimatetool.editor.diagram.commands.ConnectionRouterTypeCommand in project archi by archimatetool.

the class ConnectionRouterAction method run.

@Override
public void run() {
    if (isChecked()) {
        CommandStack stack = part.getAdapter(CommandStack.class);
        stack.execute(new ConnectionRouterTypeCommand(diagramModel, getType()));
    }
}
Also used : ConnectionRouterTypeCommand(com.archimatetool.editor.diagram.commands.ConnectionRouterTypeCommand) CommandStack(org.eclipse.gef.commands.CommandStack)

Aggregations

ConnectionRouterTypeCommand (com.archimatetool.editor.diagram.commands.ConnectionRouterTypeCommand)2 IDiagramModel (com.archimatetool.model.IDiagramModel)1 EObject (org.eclipse.emf.ecore.EObject)1 Command (org.eclipse.gef.commands.Command)1 CommandStack (org.eclipse.gef.commands.CommandStack)1 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 GridData (org.eclipse.swt.layout.GridData)1 Combo (org.eclipse.swt.widgets.Combo)1