Skip to main content
summaryrefslogtreecommitdiffstats
blob: 5b8f8bdcf0432972822001719eb6637add095f42 (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
<%!
/*  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