Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.jet.editor/templates/jet2java.jet')
-rw-r--r--plugins/org.eclipse.jet.editor/templates/jet2java.jet94
1 files changed, 0 insertions, 94 deletions
diff --git a/plugins/org.eclipse.jet.editor/templates/jet2java.jet b/plugins/org.eclipse.jet.editor/templates/jet2java.jet
deleted file mode 100644
index b69d331..0000000
--- a/plugins/org.eclipse.jet.editor/templates/jet2java.jet
+++ /dev/null
@@ -1,94 +0,0 @@
-<%@jet package="org.eclipse.jet.internal.compiler.templates"
- class="JET2JavaGenerator"
- %>
-<%@jet imports="org.eclipse.jet.internal.compiler.*"%>
-<%@jet imports="org.eclipse.jet.compiler.*"%>
-<%@jet imports="org.eclipse.jet.transform.TransformContextExtender"%>
-<%@jet imports="org.eclipse.jet.taglib.TagLibraryReference"%>
-<%@jet imports="java.util.*"%>
-<%@jet imports="org.eclipse.jface.text.Position"%>
-<%!
- private XMLElement[] getAllXMLTags(JET2CompilationUnit cu) {
- final List result = new ArrayList();
- cu.accept(new DefaultJET2ASTVisitor() {
- public void visit(XMLBodyElement element) {
- result.add(element);
- }
-
- public void visit(XMLEmptyElement element) {
- result.add(element);
- }
- });
- return (XMLElement[])result.toArray(new XMLElement[result.size()]);
- }
-
- private JET2Declaration[] getAllJavaDeclarations(JET2CompilationUnit cu) {
- final List result = new ArrayList();
- cu.accept(new DefaultJET2ASTVisitor() {
- public void visit(JET2Declaration declaration) {
- result.add(declaration);
- }
- });
- return (JET2Declaration[])result.toArray(new JET2Declaration[result.size()]);
- }
-
- private void adjustGeneratedBodyPositions(Map mappingPositions, int generatedBodyOffsetStart) {
- for (Iterator iterator = mappingPositions.keySet().iterator(); iterator.hasNext();) {
- Object element = iterator.next();
- if (!(element instanceof JET2Declaration)) {
- Position position = (Position) mappingPositions.get(element);
- position.offset += generatedBodyOffsetStart;
- }
- }
- }
-%>
-<%
- JET2CompilationUnit cu = (JET2CompilationUnit) context.getVariable("cu");
- JET2Declaration allMemberDeclarations[] = getAllJavaDeclarations(cu);
- XMLElement allXMLElements[] = getAllXMLTags(cu);
- TagLibraryReference tlRefs[] = cu.getTagLibraryReferences();
- Map generatedBodyMappingPositions = new HashMap();
- Map mappingPositions = (Map) context.getVariable("org.eclipse.jet.storeJavaMappingPositions");
- org.eclipse.jet.internal.editor.JETEditorHelper.JETEditorMethodBodyCreator generatedBody = new org.eclipse.jet.internal.editor.JETEditorHelper.JETEditorMethodBodyCreator(
- TransformContextExtender.getInstance(context).getLoader(), generatedBodyMappingPositions);
- cu.accept(generatedBody);
-%>
-package <%= cu.getOutputJavaPackage() %>;
-
-import org.eclipse.jet.JET2Context;
-import org.eclipse.jet.JET2Template;
-import org.eclipse.jet.JET2Writer;
-<% if( allXMLElements.length > 0) { %>
-import org.eclipse.jet.taglib.RuntimeTagElement;
-import org.eclipse.jet.taglib.TagInfo;
-<% } %>
-<% for(Iterator i=cu.getImports().iterator();i.hasNext();) {
- String importName = (String)i.next();%>
-import <%=importName%>;
-<% } %>
-
-public class <%= cu.getOutputJavaClassName() %> implements JET2Template {
-<% if( allXMLElements.length > 0) { %>
-<% for(int i = 0; i < tlRefs.length; i++ ) { %>
- public static final String _jetns_<%= tlRefs[i].getPrefix() %> = "<%= tlRefs[i].getTagLibraryId() %>"; //$NON-NLS-1$
-<% } %>
-<% } %>
-<% for(int i = 0; i < allMemberDeclarations.length; i++) { %>
-
-<%= allMemberDeclarations[i].getJavaContent() %>
-<% } %>
-
- public <%= cu.getOutputJavaClassName() %>() {
- super();
- }
-
- public void generate(final JET2Context context, JET2Writer out) {
-<% for(int i = 0; i < allXMLElements.length; i++) {
- context.setVariable("element", allXMLElements[i]); //$NON-NLS-1$
-%>
- <c:include template="templates/tagDataDeclarations.jet"/>
-<% } %>
-<%= generatedBody.getBuffer() %>
- }
-
-}

Back to the top