Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 5f20fcbb14c2577f95eed9f72ec3239b22bd92c4 (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
/*******************************************************************************
 * 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 v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * 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("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 {@AnnotationType}s.
		''')
		
		cls.getReference("type").setDocumentation(
			'''
				The {@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 
			{@Annotation}s of this AnnotationType can occur'''
		)
		cls.getReference("docu").setDocumentation(
			'''Optional model-level documentation'''
		)
		cls.getReference("attributes").setDocumentation(
			'''Defines the {@link Attribute}s that are required or allowed in 
			{@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