Debian Codegraph @

plugins/org.eclipse.emf.databinding.edit/src/org/eclipse/emf/databinding/edit/internal/EMFEditMapProperty.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 java.util.Map;
14
15 import org.eclipse.core.databinding.observable.map.MapDiff;
16 import org.eclipse.emf.common.command.Command;
17 import org.eclipse.emf.databinding.internal.EMFMapProperty;
18 import org.eclipse.emf.ecore.EObject;
19 import org.eclipse.emf.ecore.EStructuralFeature;
20 import org.eclipse.emf.edit.command.SetCommand;
21 import org.eclipse.emf.edit.domain.EditingDomain;
22
23
24 /**
25 * <p><b>PROVISIONAL:</b> This API is subject to arbitrary change, including renaming or removal.</p>
26 *
27 * @since 2.5
28 */
29 public class EMFEditMapProperty extends EMFMapProperty
30 {
31 private final EditingDomain editingDomain;
32
33 public EMFEditMapProperty(EditingDomain editingDomain, EStructuralFeature eStructuralFeature)
34 {
35 super(eStructuralFeature);
36 this.editingDomain = editingDomain;
37 }
38
39 @Override
40 protected void doSetMap(Object source, Map map, MapDiff diff)
41 {
42 EObject eObject = (EObject)source;
43 Command command = SetCommand.create(editingDomain, eObject, getFeature(), map);
44 editingDomain.getCommandStack().execute(command);
45 }
46
47 }