Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 4fb5662eb8a3ed787eb4c75d22fb5292bdc3c8e9 (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
51
package org.eclipse.etrice.ui.behavior.detailcode

import org.eclipse.emf.ecore.EObject
import org.eclipse.etrice.core.room.InterfaceItem
import org.eclipse.etrice.core.room.Port
import org.eclipse.etrice.core.room.SPP
import org.eclipse.xtend.lib.annotations.Accessors
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor

/**
 * Defines expression that does not have an model representation. Extends {@link DefaultDetailExpressionProvider} 
 */
@FinalFieldsConstructor
class RuntimeDetailExpressionProvider extends DefaultDetailExpressionProvider {

	public static val RT_METHOD_GET_REPLICATION = "getReplication"

	@Accessors
	static class RuntimeMethodExpressionData {
		//val String methodName
		//EObject eObj
	}

	override getContextFeatures(ExpressionFeature ctx) {
		val scope = super.getContextFeatures(ctx)

		switch obj : ctx.data {
			InterfaceItem: {
				if (ctx.postfix == ExpressionPostfix.NONE) {
					switch obj {
						Port case obj.multiplicity > 1/* fall through */,
						SPP: {
							// not supported yet by code translation
							//scope += createRtMethodExprFeature(RT_METHOD_GET_REPLICATION, obj)
						}
					}
				}
			}
		}

		return scope
	}

	protected def createRtMethodExprFeature(String methodName, EObject eObj) {
		val feature = new ExpressionFeature(methodName, ExpressionPostfix.PARENTHESES)
		feature.data = new RuntimeMethodExpressionData()

		return feature
	}

}

Back to the top