Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: a0c687e784452e24816b97285a46230ae713bc26 (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
/*****************************************************************************
 * 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:
 *  CEA LIST - Initial API and implementation
 *
 *****************************************************************************/
package org.eclipse.papyrus.constraintwithvsl.editor.xtext.validation;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.marte.vsl.validation.VSLJavaValidator;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Type;

public class ContextUtil {
	public static Type getExpectedType(EObject rule) {
//		EObject context = rule ;
//		while (context != null && !(context instanceof TagSpecificationRule)) {
//			context = context.eContainer() ;
//		}
//		if (context != null) {
//			TagSpecificationRule tag = (TagSpecificationRule) context ;
//			if (tag.getProperty() != null)
//				return tag.getProperty().getType() ;
//		}
//		return null ;
		return VSLJavaValidator._boolean ;
	}
	
	public static Element getContextElement(EObject rule) {
//		EObject context = rule ;
//		while (context != null && !(context instanceof TagSpecificationRule)) {
//			context = context.eContainer() ;
//		}
//		if (context != null) {
//			TagSpecificationRule tag = (TagSpecificationRule) context ;
//			return tag.getProperty() ;
//		}
//		return null ;
		return VSLJavaValidator.getContextElement() ;
	}
}

Back to the top