blob: 4ed12621cb36572f9611afa0c6403ae398363002 (
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
|
<%@ jet package = "org.eclipse.papyrus.cpp.codegen.jet.util"
skeleton = "../../generator.skeleton"
imports = "org.eclipse.uml2.uml.* java.util.* org.eclipse.papyrus.cpp.codegen.utils.GenUtils Cpp.*"
class = "CppClassInheritedDeclarations"
%>
<%
//////////////////////////////////////////////////////////////////////////////////////////
// Java preparation
//////////////////////////////////////////////////////////////////////////////////////////
// Retrieve the class
Classifier currentClass = (Classifier) argument;
String targetName = "";
String visibility = "";
String decl = "";
// Get generalization and implementation relationships
Iterator<DirectedRelationship> relationshipIt =
currentClass.getSourceDirectedRelationships().iterator();
// Iterator impIt = currentClass.getImplementations().iterator();
while (relationshipIt.hasNext()) {
DirectedRelationship relationship = relationshipIt.next();
if ((relationship instanceof Generalization) ||
(relationship instanceof InterfaceRealization))
{
org.eclipse.uml2.uml.Classifier target = null;
if (relationship.getTargets ().size() > 0) {
// there should always be at least one element in the target
// list and it should be a classifier, but better check.
org.eclipse.uml2.uml.Element element =
relationship.getTargets().get(0);
if (element instanceof org.eclipse.uml2.uml.Classifier) {
target = (org.eclipse.uml2.uml.Classifier) element;
}
}
if (target != null) {
// If not <NoCodeGen>
if (!GenUtils.hasStereotype(target, CppNoCodeGen.class))
{
CppVisibility cppVisibility = GenUtils.getApplication(relationship, CppVisibility.class);
if (cppVisibility != null) {
visibility = cppVisibility.getValue();
} else {
visibility = "public";
}
targetName = GenUtils.qualifiedName (target);
if (!decl.equals("")) {
decl = decl + ", ";
}
decl = decl+visibility+" "+targetName;
}
}
}
}
// Parse implementations
// RS: removed code: Implementation does not exist in UML2 v2.
// TODO: replace Implementation with new UML2 constructions?
// Implementation currentImp;
//
// while (impIt.hasNext()) {
//
// currentImp = (Implementation) impIt.next();
// currentNE = (NamedElement) currentImp;
//
// // get visibility and target name
// visibility = currentNE.getVisibilityAsString();
//
// // If not <NoCodeGen>
// if (!GenUtils.hasStereotype(currentImp.getTarget(), CppNoCodeGen.class)) {
//
// targetName = currentImp.getTarget().getName();
//
// if (!decl.equals("")) {
// decl = decl + ", ";
// }
// decl = decl+visibility+" "+targetName;
//
// }
// }
// ":" if decl non empty
String prefix = "";
if (!decl.equals("")) {
prefix = " : ";
}
//////////////////////////////////////////////////////////////////////////////////////////
// The following part contains the template
//////////////////////////////////////////////////////////////////////////////////////////%>
<%= prefix %><%= decl %>
|