Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 50698bb43ed4b3f57c0e8bffae392845e73126d1 (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
/*****************************************************************************
 * Copyright (c) 2010 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:
 *  Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
 *
 *****************************************************************************/
package org.eclipse.papyrus.infra.emf.providers;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.infra.core.IElementWithSemantic;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;

/**
 * This class is used to obtain the semantic element for element of the model explorer
 */
//FIXME: Remove the dependency to gmf
public class SemanticFromModelExplorer implements IElementWithSemantic {

	/**
	 * {@inheritDoc}
	 */
	public Object getSemanticElement(Object wrapper) {
		EObject semantic = EMFHelper.getEObject(wrapper);
		if(semantic != null) {
			return semantic;
		}

		if(wrapper instanceof Diagram) {
			return wrapper;
		}

		return null;
	}

}

Back to the top