blob: 78d4422f36b3a5c3445ee3a33aface2fe62380bc (
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
|
<%
//input: [oeg].common.codegen.ImportAssistant importManager
//input: [oeg].graphdef.codegen GraphDefDispatcher dispatcher
//input: [oeg].gmfgraph.Figure figure
{ //namespace -- use "bfm" (stands for BorderFactoryMethod) to avoid name clashes
int bfmNextIndex = 1;
String bfmLastFigureName = "";
for (Iterator bfmAllCustomBorders = EcoreUtil.getAllContents(figure, false); bfmAllCustomBorders.hasNext();){
EObject bfmNext = (EObject)bfmAllCustomBorders.next();
if (GMFGraphPackage.eINSTANCE.getFigure().isSuperTypeOf(bfmNext.eClass())){
bfmLastFigureName = (String)bfmNext.eGet(GMFGraphPackage.eINSTANCE.getIdentity_Name());
if (bfmLastFigureName == null){
bfmLastFigureName = "";
}
}
// XXX [artem] why not do this with ((Figure) bfmNext).getBorder()?
if (bfmNext.eClass().getClassifierID() != GMFGraphPackage.CUSTOM_BORDER){
continue;
}
String bfmNextImplClass = dispatcher.getFQNSwitch().get(bfmNext, importManager);
String bfmNextMethodName = "createBorder_" + CodeGenUtil.capName(bfmLastFigureName) + "_" + (bfmNextIndex++);
%>
/**
* @generated
*/
private <%=importManager.getImportedName("org.eclipse.draw2d.Border")%> <%=bfmNextMethodName%>() {
<%=bfmNextImplClass%> result = new <%=bfmNextImplClass%>();
<%=dispatcher.dispatch("customAttributes", new Object[] {bfmNext, dispatcher, "result"} )%>
return result;
}
<%
dispatcher.getAuxiliaryDataStorage().registerData(bfmNext, bfmNextMethodName);
}
} //end of namespace
%>
|