Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: d84dc9521cbbbf4eb01166cecacda2b5ff889a58 (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
/*****************************************************************************
 * Copyright (c) 2011 CEA LIST.
 * 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
 *****************************************************************************/
package org.eclipse.papyrus.uml.properties.creation;

import java.util.Collection;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.papyrus.views.properties.creation.EcorePropertyEditorFactory;
import org.eclipse.swt.widgets.Control;

/**
 * A Factory for creating objects in references that are subsets of {@link Namespace#getOwnedRules()}.
 * 
 * The elements are actually contained in the ownedRule containment reference,
 * and referenced from the subset feature.
 * 
 * @author Camille Letavernier
 * 
 */
public class OwnedRuleCreationFactory extends EcorePropertyEditorFactory {

	public OwnedRuleCreationFactory(EReference referenceIn) {
		super(referenceIn);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public EObject createObjectInDifferentContainer(Control widget) {
		//The base implementation is sufficient, as objects added to subsets of ownedRule are
		//already added to the right ownedRule by the UML framework.
		return simpleCreateObject(widget);
	}

	@Override
	public Collection<Object> validateObjects(Collection<Object> objectsToValidate) {
		return objectsToValidate; //Bypass the parent implementation
	}
}

Back to the top