Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 6bc79b24fc0d11e95c0540bf0d1b60e22eb5ee87 (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
/*****************************************************************************
 * Copyright (c) 2014 CEA LIST.
 *
 * All rights reserved. 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:
 *  Mickaël Adam (ALL4TEC) mickael.adam@all4tec.net - Initial API and implementation
 *****************************************************************************/

package org.eclipse.papyrus.infra.gmfdiag.css.properties.databinding;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;

/**
 * Command to add a object to the resource.
 *
 * @author Mickael ADAM
 */
public class AddModelStyleSheetCommand extends RecordingCommand {

	/** The resource. */
	private Resource resource;

	/** The object. */
	private EObject object;

	/**
	 * Instantiates a new adds the model style sheet command.
	 *
	 * @param domain
	 *            the domain
	 * @param resource
	 *            the resource
	 * @param object
	 *            the object
	 */
	public AddModelStyleSheetCommand(TransactionalEditingDomain domain, Resource resource, EObject object) {
		super(domain);
		this.resource = resource;
		this.object = object;
	}

	/**
	 * @see org.eclipse.emf.transaction.RecordingCommand#doExecute()
	 *
	 */

	@Override
	public void doExecute() {
		resource.getContents().add(object);
	}
}

Back to the top