Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: bd70cfdf2d36818f9e6dcf575f84c880207090a9 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/*******************************************************************************
 * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 * 
 * CONTRIBUTORS:
 * 		Juergen Haug (initial contribution)
 * 		Eyrak Paen
 * 
 *******************************************************************************/

package org.eclipse.etrice.core.common.postprocessing

import org.eclipse.xtext.GeneratedMetamodel

import static extension org.eclipse.etrice.core.common.postprocessing.PostprocessingHelpers.*

class DocuPostprocessor {
	def process(GeneratedMetamodel metamodel) {
		val pckg = metamodel.EPackage
		
		//------------------------------------------------------------------
		
		var cls = pckg.getClass("Import")
		cls.setDocumentation(
			'''
				The import declares an imported {@link org.eclipse.etrice.core.room.RoomModel room model} (given as a URI) and
				an optional imported namespace.
			''')
		
		cls.getAttribute("importedNamespace").setDocumentation(
			'''
				The imported name space has to be a dot separated qualified name followed by .*.
				Example: my.namespace.*
			''')
		
		cls.getAttribute("importURI").setDocumentation(
			'''
				The import URI can be a relative or absolute file system path.
				It may contain environment variables in ${} which will be expanded.
				<p>
				Examples:
				<ul>
				  <li>import model "AnotherModel.room"</li>
				  <li>import my.namespace.* from "AnotherModel.room"</li>
				  <li>import my.namespace.* from "../../AnotherProject/models/AnotherModel.room"</li>
				  <li>import my.namespace.* from "/${ROOM_MODELS}/SomeModel.room"</li>
				</ul>
				</p>
			''')
		
		//------------------------------------------------------------------
		cls = pckg.getClass("LiteralArray")
		cls.setDocumentation(
			'''
				Aggregates one or more {@link Literal literals}.		
			''')
			
		cls.getReference("literals").setDocumentation(
			'''
				This is a list of literals.
			''')
			
		//------------------------------------------------------------------
		
		cls = pckg.getClass("Literal")
		cls.setDocumentation(
			'''
				It is the super class of
				<ul>
					<li>{@link BooleanLiteral}</li>
					<li>{@link NumberLiteral}</li>
					<li>{@link StringLiteral}</li>
				</ul>
				that represents a primitive value.
			''')
			
		//------------------------------------------------------------------
		cls = pckg.getClass("Documentation")
		cls.setDocumentation('''
			A piece of documentation that can be optionally attached at
			certain places in the model.
		''')
		
		cls.getAttribute("lines").setDocumentation(
			'''
				This is the documentation's contents.
			''')

		//------------------------------------------------------------------
		cls = pckg.getClass("Annotation")
		cls.setDocumentation('''
			An annotation similar to Java annotations that can be used
			to add {@link KeyValue} pairs to certain model items. The structure 
			of Annotations are defined by {@link AnnotationType}s.
		''')
		
		cls.getReference("type").setDocumentation(
			'''
				The {@link AnnotationType} that defines the structure of 
				the annotation.
			''')
		
		cls.getReference("attributes").setDocumentation(
			'''
				This is a list of key/value pairs.
			''')

		//------------------------------------------------------------------
		cls = pckg.getClass("KeyValue")
		cls.setDocumentation('''
			A key/value pair.
		''')
		
		cls.getAttribute("key").setDocumentation(
			'''
				This is the key of the pair.
			''')
		
		cls.getReference("value").setDocumentation(
			'''
				This is the value of the pair.
			''')
		
		//------------------------------------------------------------------
		cls = pckg.getClass("AnnotationType")
		cls.setDocumentation(
			'''Defines the structure of {@link Annotation}s.'''
		)
		cls.getAttribute("name").setDocumentation(
			'''The name of the AnnotationType'''
		)
		cls.getAttribute("targets").setDocumentation(
			'''A list of names representing the locations in which 
			{@link Annotation}s of this AnnotationType can occur'''
		)
		cls.getReference("docu").setDocumentation(
			'''Optional model-level documentation'''
		)
		cls.getReference("attributes").setDocumentation(
			'''Defines the {@link AnnotationAttribute}s that are required or allowed in 
			{@link Annotation} instances of this AnnotationType'''
		)
				
		//------------------------------------------------------------------
		cls = pckg.getClass("AnnotationAttribute")
		cls.setDocumentation(
			'''Defines an attribute in an {@link AnnotationType}. This attribute 
			can then be declared in respective {@link Annotation} instances.'''
		)
		cls.getAttribute("optional").setDocumentation(
			'''Specifies whether the attribute should be optional or not. If the 
			attribute is optional, it can be omitted by {@link Annotation}s of 
			the same {@link AnnotationType}.
			'''
		)
		cls.getAttribute("name").setDocumentation(
			'''The name of the attribute'''
		)
		
		//------------------------------------------------------------------
		cls = pckg.getClass("SimpleAnnotationAttribute")
		cls.setDocumentation(
			'''An {@link AnnotationAttribute} that is associated with a 
			{@link LiteralType}.'''
		)
		cls.getAttribute("type").setDocumentation(
			'''The type of the attribute'''
		)
		
		//------------------------------------------------------------------
		cls = pckg.getClass("EnumAnnotationAttribute")
		cls.setDocumentation(
			'''An {@link AnnotationAttribute} whose possible values are defined 
			by a list of String values.'''
		)
		cls.getAttribute("values").setDocumentation(
			'''A list of values that define the enumeration'''
		)
		
		
	}
}

Back to the top