Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 5ed820c58a09d705ab8e59b86a02cd0b754e153d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*******************************************************************************
 * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others.
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *    Obeo - initial API and implementation
 *******************************************************************************/
package org.eclipse.sirius.diagram.ui.business.internal.command;

import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.sirius.business.api.session.Session;
import org.eclipse.sirius.diagram.DSemanticDiagram;
import org.eclipse.sirius.diagram.business.internal.dialect.DiagramDialectServices;
import org.eclipse.sirius.diagram.ui.provider.Messages;

/**
 * Specific command to create and store gmf diagram.
 * 
 * @author mporhel
 */
public final class CreateAndStoreGMFDiagramCommand extends RecordingCommand {

    private final DSemanticDiagram diag;

    private final Session session;

    /**
     * Constructor.
     * 
     * @param session
     *            the current session.
     * @param diag
     *            the diagram to refresh.
     */
    public CreateAndStoreGMFDiagramCommand(Session session, DSemanticDiagram diag) {
        super(session.getTransactionalEditingDomain(), Messages.CreateAndStoreGMFDiagramCommand_label);
        this.session = session;
        this.diag = diag;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected void doExecute() {
        DiagramDialectServices.createAndStoreGMFDiagram(session, diag);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean canUndo() {
        /* we should not be able to undo this */
        return false;
    }
}

Back to the top