Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/main.jet')
-rw-r--r--examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/main.jet74
1 files changed, 74 insertions, 0 deletions
diff --git a/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/main.jet b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/main.jet
new file mode 100644
index 0000000..5b8f8bd
--- /dev/null
+++ b/examples/org.eclipse.jet.ec2008.swtgen.codebehind/templates/main.jet
@@ -0,0 +1,74 @@
+<%!
+/* Copyright 2008 IBM Corp. All rights reserved. This source code is made available under the terms of the Eclipse Public License, v1.0. */
+%>
+<%@taglib prefix="ws" id="org.eclipse.jet.workspaceTags" %>
+<%-- Main entry point for org.eclipse.jet.ec2008.swtgen --%>
+
+<%--
+TODO: traverse input model, performing calculations and storing
+the results as model annotations via c:set tag
+--%>
+<%-- Flatten the recurive control sturcture --%>
+<c:loadContent var="flattened"><c:include template="templates/wizardPage/flatten.xml.jet"/></c:loadContent>
+<%-- DEBUG: write the flattend file just so we can see it--%>
+<ws:file template="templates/wizardPage/flatten.xml.jet" path="{$org.eclipse.jet.resource.parent.fullPath}/flattened.xml"/>
+
+<%-- Load control data --%>
+<c:loadContent var="controlData">
+<controls>
+ <c:include template="templates/control/controlData.xml.jet"/>
+</controls>
+</c:loadContent>
+
+<%-- Load event data --%>
+<c:loadContent var="eventData">
+<events>
+ <c:include template="templates/event/eventData.xml.jet"/>
+</events>
+</c:loadContent>
+
+<c:setVariable var="wizardPage" select="$flattened/wizardPage"/>
+
+<%-- do calculations for wizardPage --%>
+<c:set select="$wizardPage" name="codeBehindClass"><c:get select="$wizardPage/@class"/>Code</c:set>
+
+<c:iterate select="$wizardPage/control" var="control">
+ <%-- do calculations for control --%>
+ <c:setVariable var="data" select="$controlData/controls/{$control/@type}"/>
+ <c:set select="$control" name="javaType"><c:get select="$data/@javaType"/></c:set>
+ <c:set select="$control" name="initControlTemplate"><c:get select="$data/@initControlTemplate"/></c:set>
+ <c:set select="$control" name="swtStylesTemplate"><c:get select="$data/@swtStylesTemplate"/></c:set>
+
+ <c:iterate select="$control/event" var="event">
+ <%-- do calculations for event --%>
+ <c:setVariable var="data" select="$eventData/events/{$event/@name}"/>
+ <c:set select="$event" name="addListenerMethod"><c:get select="$data/@addListenerMethod"/></c:set>
+ <c:set select="$event" name="handlerBaseClass"><c:get select="$data/@handlerBaseClass"/></c:set>
+ <c:set select="$event" name="handlerMethod"><c:get select="$data/@handlerMethod"/></c:set>
+ <c:set select="$event" name="eventClass"><c:get select="$data/@eventClass"/></c:set>
+ <c:set select="$event" name="delegateMethod"><c:get select="$control/@name"/><c:get select="$data/@delegateMethodSuffix"/></c:set>
+ </c:iterate>
+</c:iterate>
+
+<%--
+TODO: traverse annotated model, performing text generation actions
+such as ws:file, ws:folder and ws:project
+--%>
+<%-- do actions for wizardPage --%>
+<java:class srcFolder="{$wizardPage/@srcFolder}"
+ package="{$wizardPage/@package}"
+ name="{$wizardPage/@class}"
+ template="templates/wizardPage/wizardPage.java.jet"/>
+<java:class srcFolder="{$wizardPage/@srcFolder}"
+ package="{$wizardPage/@package}"
+ name="{$wizardPage/@codeBehindClass}"
+ template="templates/wizardPage/codeBehind.java.jet"/>
+
+<%-- For debug purposes, dump the annotated input model in
+ the root of the project containing the original input model.
+
+ Note that model formatting may not be identical, and that in
+ the case of non-XML input models, the dump may look quite different.
+--%>
+
+<ws:file template="templates/dump.jet" path="{$org.eclipse.jet.resource.parent.fullPath}/dump.xml"/>

Back to the top