Debian Codegraph @

plugins/org.eclipse.emf.databinding.edit/src/org/eclipse/emf/databinding/edit/internal/EMFEditValueProperty.java

raw
1 /**
2 * Copyright (c) 2009 BestSolution.at and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v2.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v20.html
7 *
8 * Contributors:
9 * Tom Schindl <[email protected]> - Initial API and implementation (bug 262160)
10 */
11 package org.eclipse.emf.databinding.edit.internal;
12
13 import org.eclipse.emf.common.command.Command;
14 import org.eclipse.emf.databinding.internal.EMFValueProperty;
15 import org.eclipse.emf.ecore.EObject;
16 import org.eclipse.emf.ecore.EStructuralFeature;
17 import org.eclipse.emf.edit.command.SetCommand;
18 import org.eclipse.emf.edit.domain.EditingDomain;
19
20
21 /**
22 * <p><b>PROVISIONAL:</b> This API is subject to arbitrary change, including renaming or removal.</p>
23 *
24 * @since 2.5
25 */
26 public class EMFEditValueProperty extends EMFValueProperty
27 {
28 private final EditingDomain editingDomain;
29
30 public EMFEditValueProperty(EditingDomain editingDomain, EStructuralFeature eStructuralFeature)
31 {
32 super(eStructuralFeature);
33 this.editingDomain = editingDomain;
34 }
35
36 @Override
37 protected void doSetValue(Object source, Object value)
38 {
39 EObject eObject = (EObject)source;
40 Command command = SetCommand.create(editingDomain, eObject, getFeature(), value);
41 editingDomain.getCommandStack().execute(command);
42 }
43 }