Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.gmf.graphdef.codegen/templates/children/Figure.javajet')
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/children/Figure.javajet98
1 files changed, 0 insertions, 98 deletions
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/children/Figure.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/children/Figure.javajet
deleted file mode 100644
index b687ec355..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/children/Figure.javajet
+++ /dev/null
@@ -1,98 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="FigureChildrenGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.gmfgraph.util.* org.eclipse.emf.codegen.util.CodeGenUtil java.util.*"%>
-<%
-GraphDefDispatcher.LayoutArgs parentArgs = (GraphDefDispatcher.LayoutArgs) argument;
-final Figure root = parentArgs.getFigure();
-final GraphDefDispatcher dispatcher = parentArgs.getDispatcher();
-final ImportAssistant importManager = dispatcher.getImportManager();
-
-final List/*<Figure>*/ fieldsRequired = new LinkedList/*<Figure>*/();
-final Stack/*GraphDefDispatcher.LayoutArgs*/ contextStack = new Stack/*GraphDefDispatcher.LayoutArgs*/();
-final LinkedList queue = new LinkedList();
-final Object marker = new Object();
-final NamingStrategy namingStrategy = NamingStrategy.INSTANCE;
-
-class FieldSupport {
- private final Figure myRoot;
-
- public FieldSupport(Figure root){
- myRoot = root;
- }
-
- public boolean isFieldRequired(Figure descendant){
- return myRoot.equals(descendant.getParent()) || !descendant.getReferencingElements().isEmpty();
- }
-}
-final FieldSupport fieldSupport = new FieldSupport(root);
-
-%>
-
- /**
- * @generated
- */
- private void createContents(){
-<%
-queue.addAll(root.getChildren());
-int figureCount = 0;
-while (!queue.isEmpty()){
- Object _nxt = queue.removeFirst();
- if (_nxt == marker){
- parentArgs = (GraphDefDispatcher.LayoutArgs)contextStack.pop();
- continue;
- }
- if (_nxt instanceof FigureRef) {
- throw new IllegalStateException("FIXME: sorry, don't support FigureRef for a while");
- }
- final Figure nextChild = (Figure) _nxt;
- final String childVarName = "fig_" + figureCount;
- final String childLayoutManager = "layouter" + figureCount;
- final String childConstraint = "layData" + figureCount;
- figureCount++;
-
- // FIXME instantiate - FigureRef - dispatch to 'instantiate' template?
- GraphDefDispatcher.LayoutArgs nextLevelArgs = dispatcher.createLayoutArgs(nextChild, childVarName, childLayoutManager, childConstraint);%>
- <%=dispatcher.dispatch("instantiate", nextLevelArgs)%>
-<%
-if (fieldSupport.isFieldRequired(nextChild)){
- fieldsRequired.add(nextChild); %>
- setFigure<%=nextChild.getName()%>(<%=childVarName%>);
-<%}%>
- <%=dispatcher.dispatch("createLayoutData", nextLevelArgs)%>
- <%=parentArgs.getVariableName()%>.add(<%=childVarName%>, <%=childConstraint%>);
-<%
- if (!nextChild.getChildren().isEmpty()) {
- queue.addFirst(marker);
- queue.addAll(0, nextChild.getChildren());
- contextStack.push(parentArgs);
- parentArgs = nextLevelArgs; // go on processing children of new parentFigure
- }
-} // while
-%>
- }
-
-<%
- final FigureQualifiedNameSwitch fqnSwitch = dispatcher.getFQNSwitch();
- for (Iterator fieldFigures = fieldsRequired.iterator(); fieldFigures.hasNext();){
- Figure next = (Figure)fieldFigures.next();
- final String nextClassName = fqnSwitch.get(next, importManager);%>
-
- /**
- * @generated
- */
- private <%=nextClassName%> f<%=CodeGenUtil.capName(next.getName())%>;
-
- /**
- * @generated
- */
- public <%=nextClassName%> <%=namingStrategy.getChildFigureGetterName(next)%>() {
- return f<%=CodeGenUtil.capName(next.getName())%>;
- }
-
- /**
- * @generated
- */
- private void setFigure<%=next.getName()%>(<%=nextClassName%> fig){
- f<%=CodeGenUtil.capName(next.getName())%> = fig;
- }
-
-<% }%>

Back to the top