summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2007-04-12 16:41:15 (EDT)
committer pelder2007-04-12 16:41:15 (EDT)
commit2b98f13e290e5edcbceab839bcf5747c212c7eb8 (patch)
tree0cc1063b9f43a801c62a02c26d540f13de5c7cf5
parentfa8f3e9ae43c97b2d63fd9ad1d90de1e7ed0d698 (diff)
downloadorg.eclipse.jet-2b98f13e290e5edcbceab839bcf5747c212c7eb8.zip
org.eclipse.jet-2b98f13e290e5edcbceab839bcf5747c212c7eb8.tar.gz
org.eclipse.jet-2b98f13e290e5edcbceab839bcf5747c212c7eb8.tar.bz2
[182184] Update copyright notices/dates. Releng update copyrights tool got too agressive, and updated JET generated output. Reinstate the machine generated output.
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/CodeGenTemplateLoader.java10
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/DummyMain.java40
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/JET2JavaGenerator.java101
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/JET2TransformGenerator.java54
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/TagDataDeclGenerator.java64
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/WriteJavaExpressionTemplate.java29
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/WriteTextElementTemplate.java33
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/XMLEndGenerator.java75
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/XMLStartGenerator.java125
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/v1/JET1JavaGenerator.java121
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/v2/JET2JavaGeneratorNew.java305
11 files changed, 564 insertions, 393 deletions
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/CodeGenTemplateLoader.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/CodeGenTemplateLoader.java
index e3d456d..a2cd96b 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/CodeGenTemplateLoader.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/CodeGenTemplateLoader.java
@@ -1,13 +1,3 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
package org.eclipse.jet.internal.compiler.templates;
import java.util.HashMap;
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/DummyMain.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/DummyMain.java
index 34c5671..aff1fbe 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/DummyMain.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/DummyMain.java
@@ -1,13 +1,3 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
package org.eclipse.jet.internal.compiler.templates;
import org.eclipse.jet.JET2Context;
@@ -17,35 +7,41 @@ import org.eclipse.jet.taglib.RuntimeTagElement;
import org.eclipse.jet.taglib.TagInfo;
public class DummyMain implements JET2Template {
- public static final String _jetns_f = "org.eclipse.jet.formatTags"; //$NON-NLS-1$
- public static final String _jetns_c = "org.eclipse.jet.controlTags"; //$NON-NLS-1$
- public static final String _jetns_java = "org.eclipse.jet.javaTags"; //$NON-NLS-1$
+ private static final String _jetns_c = "org.eclipse.jet.controlTags"; //$NON-NLS-1$
public DummyMain() {
super();
}
- public void generate(final JET2Context context, JET2Writer out) {
- final TagInfo _jettd_c_log_2_1 = new TagInfo("c:log", //$NON-NLS-1$
+ private static final String NL = System.getProperties().getProperty("line.separator");
+
+ private static final class _TEXT {
+ private static final String TEXT_1 = "This transform in not intended to be run."; //$NON-NLS-1$
+ private static final String TEXT_2 = NL;
+ }
+
+ private static final class _TAGS {
+ private static final TagInfo c_log_2_1 = new TagInfo("c:log", //$NON-NLS-1$
2, 1,
new String[] {
},
new String[] {
} );
- RuntimeTagElement _jettag_c_log_2_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "log", "c:log", _jettd_c_log_2_1); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public void generate(final JET2Context context, JET2Writer out) {
+ RuntimeTagElement _jettag_c_log_2_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "log", "c:log", _TAGS.c_log_2_1); //$NON-NLS-1$ //$NON-NLS-2$
_jettag_c_log_2_1.setRuntimeParent(null);
- _jettag_c_log_2_1.setTagInfo(_jettd_c_log_2_1);
+ _jettag_c_log_2_1.setTagInfo(_TAGS.c_log_2_1);
_jettag_c_log_2_1.doStart(context, out);
JET2Writer _jettag_c_log_2_1_saved_out = out;
while (_jettag_c_log_2_1.okToProcessBody()) {
out = out.newNestedContentWriter();
- out.write( "This transform in not intended to be run." ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_1);
_jettag_c_log_2_1.handleBodyContent(out);
}
out = _jettag_c_log_2_1_saved_out;
_jettag_c_log_2_1.doEnd();
- out.write( "\r\n" ); //$NON-NLS-1$
-
- }
-
+ out.write(_TEXT.TEXT_2);
+ }
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/JET2JavaGenerator.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/JET2JavaGenerator.java
index 46943f1..be48209 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/JET2JavaGenerator.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/JET2JavaGenerator.java
@@ -1,13 +1,3 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
package org.eclipse.jet.internal.compiler.templates;
import org.eclipse.jet.JET2Context;
@@ -24,11 +14,9 @@ import java.util.List;
import java.util.Iterator;
public class JET2JavaGenerator implements JET2Template {
- public static final String _jetns_f = "org.eclipse.jet.formatTags"; //$NON-NLS-1$
- public static final String _jetns_c = "org.eclipse.jet.controlTags"; //$NON-NLS-1$
- public static final String _jetns_java = "org.eclipse.jet.javaTags"; //$NON-NLS-1$
-
+ private static final String _jetns_c = "org.eclipse.jet.controlTags"; //$NON-NLS-1$
+
private XMLElement[] getAllXMLTags(JET2CompilationUnit cu) {
final List result = new ArrayList();
cu.accept(new DefaultJET2ASTVisitor() {
@@ -53,13 +41,32 @@ public class JET2JavaGenerator implements JET2Template {
return (JET2Declaration[])result.toArray(new JET2Declaration[result.size()]);
}
-
public JET2JavaGenerator() {
super();
}
- public void generate(final JET2Context context, JET2Writer out) {
- final TagInfo _jettd_c_include_80_4 = new TagInfo("c:include", //$NON-NLS-1$
+ private static final String NL = System.getProperties().getProperty("line.separator");
+
+ private static final class _TEXT {
+ private static final String TEXT_1 = "package "; //$NON-NLS-1$
+ private static final String TEXT_2 = ";" + NL + NL + "import org.eclipse.jet.JET2Context;" + NL + "import org.eclipse.jet.JET2Template;" + NL + "import org.eclipse.jet.JET2Writer;" + NL; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ private static final String TEXT_3 = "import org.eclipse.jet.taglib.RuntimeTagElement;" + NL + "import org.eclipse.jet.taglib.TagInfo;" + NL; //$NON-NLS-1$ //$NON-NLS-2$
+ private static final String TEXT_4 = "import "; //$NON-NLS-1$
+ private static final String TEXT_5 = ";" + NL; //$NON-NLS-1$
+ private static final String TEXT_6 = NL + "public class "; //$NON-NLS-1$
+ private static final String TEXT_7 = " implements JET2Template {" + NL; //$NON-NLS-1$
+ private static final String TEXT_8 = " public static final String _jetns_"; //$NON-NLS-1$
+ private static final String TEXT_9 = " = \""; //$NON-NLS-1$
+ private static final String TEXT_10 = "\"; //$NON-NLS-1$" + NL; //$NON-NLS-1$
+ private static final String TEXT_11 = NL;
+ private static final String TEXT_12 = NL;
+ private static final String TEXT_13 = NL + "\tpublic "; //$NON-NLS-1$
+ private static final String TEXT_14 = "() {" + NL + "\t\tsuper();" + NL + "\t}" + NL + NL + "\tpublic void generate(final JET2Context context, JET2Writer out) {" + NL; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ private static final String TEXT_15 = NL + "\t}" + NL + NL + "}" + NL; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ private static final class _TAGS {
+ private static final TagInfo c_include_80_4 = new TagInfo("c:include", //$NON-NLS-1$
80, 4,
new String[] {
"template", //$NON-NLS-1$
@@ -67,7 +74,10 @@ public class JET2JavaGenerator implements JET2Template {
new String[] {
"templates/tagDataDeclarations.jet", //$NON-NLS-1$
} );
+ }
+ public void generate(final JET2Context context, JET2Writer out) {
+
JET2CompilationUnit cu = (JET2CompilationUnit)context.getVariable("cu"); //$NON-NLS-1$
final JET2Declaration[] allMemberDeclarations = getAllJavaDeclarations(cu);
@@ -77,38 +87,49 @@ public class JET2JavaGenerator implements JET2Template {
MethodBodyCreator generatedBody = new MethodBodyCreator(TransformContextExtender.getInstance(context).getLoader());
cu.accept(generatedBody);
- out.write( "package " ); //$NON-NLS-1$
+
+ out.write(_TEXT.TEXT_1);
out.write( cu.getOutputJavaPackage() );
- out.write( ";\r\n\r\nimport org.eclipse.jet.JET2Context;\r\nimport org.eclipse.jet.JET2Template;\r\nimport org.eclipse.jet.JET2Writer;\r\n" ); //$NON-NLS-1$
- if( allXMLElements.length > 0) { out.write( "import org.eclipse.jet.taglib.RuntimeTagElement;\r\nimport org.eclipse.jet.taglib.TagInfo;\r\n" ); //$NON-NLS-1$
- } for(Iterator i=cu.getImports().iterator();i.hasNext();) {
- String importName = (String)i.next(); out.write( "import " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_2);
+ if( allXMLElements.length > 0) {
+ out.write(_TEXT.TEXT_3);
+ }
+ for(Iterator i=cu.getImports().iterator();i.hasNext();) {
+ String importName = (String)i.next();
+ out.write(_TEXT.TEXT_4);
out.write(importName);
- out.write( ";\r\n" ); //$NON-NLS-1$
- } out.write( "\r\npublic class " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_5);
+ }
+ out.write(_TEXT.TEXT_6);
out.write( cu.getOutputJavaClassName() );
- out.write( " implements JET2Template {\r\n" ); //$NON-NLS-1$
- if( allXMLElements.length > 0) { for(int i = 0; i < tlRefs.length; i++ ) { out.write( " public static final String _jetns_" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_7);
+ if( allXMLElements.length > 0) {
+ for(int i = 0; i < tlRefs.length; i++ ) {
+ out.write(_TEXT.TEXT_8);
out.write( tlRefs[i].getPrefix() );
- out.write( " = \"" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_9);
out.write( tlRefs[i].getTagLibraryId() );
- out.write( "\"; //$NON-NLS-1$\r\n" ); //$NON-NLS-1$
- } } for(int i = 0; i < allMemberDeclarations.length; i++) { out.write( "\r\n" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_10);
+ }
+ }
+ for(int i = 0; i < allMemberDeclarations.length; i++) {
+ out.write(_TEXT.TEXT_11);
out.write( allMemberDeclarations[i].getJavaContent() );
- out.write( "\r\n" ); //$NON-NLS-1$
- } out.write( "\r\n\tpublic " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_12);
+ }
+ out.write(_TEXT.TEXT_13);
out.write( cu.getOutputJavaClassName() );
- out.write( "() {\r\n\t\tsuper();\r\n\t}\r\n\r\n\tpublic void generate(final JET2Context context, JET2Writer out) {\r\n" ); //$NON-NLS-1$
- for(int i = 0; i < allXMLElements.length; i++) {
+ out.write(_TEXT.TEXT_14);
+ for(int i = 0; i < allXMLElements.length; i++) {
context.setVariable("element", allXMLElements[i]); //$NON-NLS-1$
- RuntimeTagElement _jettag_c_include_80_4 = context.getTagFactory().createRuntimeTag(_jetns_c, "include", "c:include", _jettd_c_include_80_4); //$NON-NLS-1$ //$NON-NLS-2$
+
+ RuntimeTagElement _jettag_c_include_80_4 = context.getTagFactory().createRuntimeTag(_jetns_c, "include", "c:include", _TAGS.c_include_80_4); //$NON-NLS-1$ //$NON-NLS-2$
_jettag_c_include_80_4.setRuntimeParent(null);
- _jettag_c_include_80_4.setTagInfo(_jettd_c_include_80_4);
+ _jettag_c_include_80_4.setTagInfo(_TAGS.c_include_80_4);
_jettag_c_include_80_4.doStart(context, out);
_jettag_c_include_80_4.doEnd();
- } out.write( generatedBody.getBuffer() );
- out.write( "\r\n\t}\r\n\r\n}\r\n" ); //$NON-NLS-1$
-
- }
-
+ }
+ out.write( generatedBody.getBuffer() );
+ out.write(_TEXT.TEXT_15);
+ }
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/JET2TransformGenerator.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/JET2TransformGenerator.java
index 425149b..d6829f8 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/JET2TransformGenerator.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/JET2TransformGenerator.java
@@ -1,13 +1,3 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
package org.eclipse.jet.internal.compiler.templates;
import org.eclipse.jet.JET2Context;
@@ -23,28 +13,44 @@ public class JET2TransformGenerator implements JET2Template {
super();
}
- public void generate(final JET2Context context, JET2Writer out) {
+ private static final String NL = System.getProperties().getProperty("line.separator");
+
+ private static final class _TEXT {
+ private static final String TEXT_1 = "package "; //$NON-NLS-1$
+ private static final String TEXT_2 = ";" + NL + NL + "import java.util.HashMap;" + NL + "import java.util.Map;" + NL + NL + "import org.eclipse.jet.JET2TemplateLoader;" + NL + "import org.eclipse.jet.JET2TemplateLoaderExtension;" + NL + "import org.eclipse.jet.JET2Template;" + NL + NL + "public class "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+ private static final String TEXT_3 = " implements JET2TemplateLoader, JET2TemplateLoaderExtension {" + NL + NL + "\tprivate static final class TemplateFactoryMethod {" + NL + NL + "\t\tprivate final String templatePath;" + NL + "\t\tprivate final String templateClass;" + NL + NL + "\t\tpublic TemplateFactoryMethod(String templatePath, String templateClass) {" + NL + "\t\t\tthis.templatePath = templatePath;" + NL + "\t\t\tthis.templateClass = templateClass;" + NL + "\t\t\t" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\tpublic String getTemplateClass() {" + NL + "\t\t\treturn templateClass;" + NL + "\t\t}" + NL + NL + "\t\tpublic String getTemplatePath() {" + NL + "\t\t\treturn templatePath;" + NL + "\t\t}" + NL + NL + "\t\tpublic JET2Template newTemplate() {" + NL + "\t\t\tJET2Template template = null;" + NL + "\t\t\ttry {" + NL + "\t\t\t\ttemplate = (JET2Template) Class.forName(templateClass).newInstance();" + NL + "\t\t\t} catch (InstantiationException e) {" + NL + "\t\t\t} catch (IllegalAccessException e) {" + NL + "\t\t\t} catch (ClassNotFoundException e) {" + NL + "\t\t\t}" + NL + "\t\t\treturn template;" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t" + NL + "\t}" + NL + NL + "\tprivate Map pathToFactoryMap = null;" + NL + "\t" + NL + "\tprivate JET2TemplateLoader delegate = null;" + NL + NL + "\tpublic "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$ //$NON-NLS-18$ //$NON-NLS-19$ //$NON-NLS-20$ //$NON-NLS-21$ //$NON-NLS-22$ //$NON-NLS-23$ //$NON-NLS-24$ //$NON-NLS-25$ //$NON-NLS-26$ //$NON-NLS-27$ //$NON-NLS-28$ //$NON-NLS-29$ //$NON-NLS-30$ //$NON-NLS-31$ //$NON-NLS-32$ //$NON-NLS-33$
+ private static final String TEXT_4 = "() {" + NL + "\t\tsuper();" + NL + "\t}" + NL + NL + "\tpublic JET2Template getTemplate(String templatePath) {" + NL + "\t if(pathToFactoryMap == null) {" + NL + " \t initPathToFactoryMap();" + NL + " }" + NL + " TemplateFactoryMethod factory = (TemplateFactoryMethod)pathToFactoryMap.get(templatePath);" + NL + "\t\treturn factory == null ? delegate == null ? null : delegate.getTemplate(templatePath) : factory.newTemplate();" + NL + "\t}" + NL + NL + "\tprivate void addTemplate(String templatePath, String templateClass) {" + NL + "\t\tpathToFactoryMap.put(templatePath, //$NON-NLS-1$" + NL + "\t\t new TemplateFactoryMethod(templatePath, templateClass));" + NL + "\t}" + NL + "\t" + NL + " private void initPathToFactoryMap() {" + NL + "\t pathToFactoryMap = new HashMap("; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$
+ private static final String TEXT_5 = ");" + NL; //$NON-NLS-1$
+ private static final String TEXT_6 = "\t\t addTemplate(\""; //$NON-NLS-1$
+ private static final String TEXT_7 = "\", \""; //$NON-NLS-1$
+ private static final String TEXT_8 = "\" ); //$NON-NLS-1$ //$NON-NLS-2$" + NL; //$NON-NLS-1$
+ private static final String TEXT_9 = "\t}" + NL + NL + " public void setDelegateLoader(JET2TemplateLoader loader) {" + NL + " this.delegate = loader;" + NL + " }" + NL + " " + NL + " public JET2TemplateLoader getDelegateLoader() {" + NL + " return delegate;" + NL + " }" + NL + "}" + NL + NL; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
+ }
+
+ public void generate(final JET2Context context, JET2Writer out) {
+
LoaderGenerationParameters parms = (LoaderGenerationParameters)context.getVariable("args"); //$NON-NLS-1$
Map templateMap = (Map) parms.getTemplateMap();;
- out.write( "package " ); //$NON-NLS-1$
+
+ out.write(_TEXT.TEXT_1);
out.write( parms.getPackageName() );
- out.write( ";\r\n\r\nimport java.util.HashMap;\r\nimport java.util.Map;\r\n\r\nimport org.eclipse.jet.JET2TemplateLoader;\r\nimport org.eclipse.jet.JET2TemplateLoaderExtension;\r\nimport org.eclipse.jet.JET2Template;\r\n\r\npublic class " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_2);
out.write( parms.getClassName() );
- out.write( " implements JET2TemplateLoader, JET2TemplateLoaderExtension {\r\n\r\n\tprivate static final class TemplateFactoryMethod {\r\n\r\n\t\tprivate final String templatePath;\r\n\t\tprivate final String templateClass;\r\n\r\n\t\tpublic TemplateFactoryMethod(String templatePath, String templateClass) {\r\n\t\t\tthis.templatePath = templatePath;\r\n\t\t\tthis.templateClass = templateClass;\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\tpublic String getTemplateClass() {\r\n\t\t\treturn templateClass;\r\n\t\t}\r\n\r\n\t\tpublic String getTemplatePath() {\r\n\t\t\treturn templatePath;\r\n\t\t}\r\n\r\n\t\tpublic JET2Template newTemplate() {\r\n\t\t\tJET2Template template = null;\r\n\t\t\ttry {\r\n\t\t\t\ttemplate = (JET2Template) Class.forName(templateClass).newInstance();\r\n\t\t\t} catch (InstantiationException e) {\r\n\t\t\t} catch (IllegalAccessException e) {\r\n\t\t\t} catch (ClassNotFoundException e) {\r\n\t\t\t}\r\n\t\t\treturn template;\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t}\r\n\r\n\tprivate Map pathToFactoryMap = null;\r\n\t\r\n\tprivate JET2TemplateLoader delegate = null;\r\n\r\n\tpublic " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_3);
out.write( parms.getClassName() );
- out.write( "() {\r\n\t\tsuper();\r\n\t}\r\n\r\n\tpublic JET2Template getTemplate(String templatePath) {\r\n\t if(pathToFactoryMap == null) {\r\n \t initPathToFactoryMap();\r\n }\r\n TemplateFactoryMethod factory = (TemplateFactoryMethod)pathToFactoryMap.get(templatePath);\r\n\t\treturn factory == null ? delegate == null ? null : delegate.getTemplate(templatePath) : factory.newTemplate();\r\n\t}\r\n\r\n\tprivate void addTemplate(String templatePath, String templateClass) {\r\n\t\tpathToFactoryMap.put(templatePath, //$NON-NLS-1$\r\n\t\t new TemplateFactoryMethod(templatePath, templateClass));\r\n\t}\r\n\t\r\n private void initPathToFactoryMap() {\r\n\t pathToFactoryMap = new HashMap(" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_4);
out.write( templateMap.size() );
- out.write( ");\r\n" ); //$NON-NLS-1$
- for(Iterator i = templateMap.entrySet().iterator(); i.hasNext();){
+ out.write(_TEXT.TEXT_5);
+ for(Iterator i = templateMap.entrySet().iterator(); i.hasNext();){
Map.Entry entry = (Map.Entry)i.next();
- out.write( "\t\t addTemplate(\"" ); //$NON-NLS-1$
+
+ out.write(_TEXT.TEXT_6);
out.write( entry.getKey() );
- out.write( "\", \"" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_7);
out.write( entry.getValue() );
- out.write( "\" ); //$NON-NLS-1$ //$NON-NLS-2$\r\n" ); //$NON-NLS-1$
- } out.write( "\t}\r\n\r\n public void setDelegateLoader(JET2TemplateLoader loader) {\r\n this.delegate = loader;\r\n }\r\n \r\n public JET2TemplateLoader getDelegateLoader() {\r\n return delegate;\r\n }\r\n}\r\n\r\n" ); //$NON-NLS-1$
-
- }
-
+ out.write(_TEXT.TEXT_8);
+ }
+ out.write(_TEXT.TEXT_9);
+ }
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/TagDataDeclGenerator.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/TagDataDeclGenerator.java
index 8647e70..a76f6b5 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/TagDataDeclGenerator.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/TagDataDeclGenerator.java
@@ -1,13 +1,3 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
package org.eclipse.jet.internal.compiler.templates;
import org.eclipse.jet.JET2Context;
@@ -25,8 +15,25 @@ public class TagDataDeclGenerator implements JET2Template {
super();
}
- public void generate(final JET2Context context, JET2Writer out) {
+ private static final String NL = System.getProperties().getProperty("line.separator");
+
+ private static final class _TEXT {
+ private static final String TEXT_1 = " final TagInfo "; //$NON-NLS-1$
+ private static final String TEXT_2 = " = new TagInfo(\""; //$NON-NLS-1$
+ private static final String TEXT_3 = "\", //$NON-NLS-1$" + NL + " "; //$NON-NLS-1$ //$NON-NLS-2$
+ private static final String TEXT_4 = ", "; //$NON-NLS-1$
+ private static final String TEXT_5 = "," + NL + " new String[] {" + NL; //$NON-NLS-1$ //$NON-NLS-2$
+ private static final String TEXT_6 = " \""; //$NON-NLS-1$
+ private static final String TEXT_7 = "\", //$NON-NLS-1$" + NL; //$NON-NLS-1$
+ private static final String TEXT_8 = " }," + NL + " new String[] {" + NL; //$NON-NLS-1$ //$NON-NLS-2$
+ private static final String TEXT_9 = " \""; //$NON-NLS-1$
+ private static final String TEXT_10 = "\", //$NON-NLS-1$" + NL; //$NON-NLS-1$
+ private static final String TEXT_11 = " } );" + NL; //$NON-NLS-1$
+ }
+
+ public void generate(final JET2Context context, JET2Writer out) {
+
XMLElement element;
try {
element = (XMLElement)context.getVariable("element"); //$NON-NLS-1$
@@ -36,26 +43,29 @@ public class TagDataDeclGenerator implements JET2Template {
}
String varName = MethodBodyCreator.tagInfoVariableName(element);
- out.write( " final TagInfo " ); //$NON-NLS-1$
+
+ out.write(_TEXT.TEXT_1);
out.write( varName );
- out.write( " = new TagInfo(\"" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_2);
out.write(element.getName());
- out.write( "\", //$NON-NLS-1$\r\n " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_3);
out.write( element.getLine() );
- out.write( ", " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_4);
out.write( element.getColumn() );
- out.write( ",\r\n new String[] {\r\n" ); //$NON-NLS-1$
- for (Iterator i = element.getAttributes().keySet().iterator(); i.hasNext();) {
- String attrName = (String) i.next(); out.write( " \"" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_5);
+ for (Iterator i = element.getAttributes().keySet().iterator(); i.hasNext();) {
+ String attrName = (String) i.next();
+ out.write(_TEXT.TEXT_6);
out.write( attrName );
- out.write( "\", //$NON-NLS-1$\r\n" ); //$NON-NLS-1$
- } out.write( " },\r\n new String[] {\r\n" ); //$NON-NLS-1$
- for (Iterator i = element.getAttributes().values().iterator(); i.hasNext();) {
- String attrValue = (String) i.next(); out.write( " \"" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_7);
+ }
+ out.write(_TEXT.TEXT_8);
+ for (Iterator i = element.getAttributes().values().iterator(); i.hasNext();) {
+ String attrValue = (String) i.next();
+ out.write(_TEXT.TEXT_9);
out.write( JavaUtil.escapeJavaString(attrValue.toCharArray()) );
- out.write( "\", //$NON-NLS-1$\r\n" ); //$NON-NLS-1$
- } out.write( " } );\r\n" ); //$NON-NLS-1$
-
- }
-
+ out.write(_TEXT.TEXT_10);
+ }
+ out.write(_TEXT.TEXT_11);
+ }
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/WriteJavaExpressionTemplate.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/WriteJavaExpressionTemplate.java
index 4da9ed0..9d0afdd 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/WriteJavaExpressionTemplate.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/WriteJavaExpressionTemplate.java
@@ -1,13 +1,3 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
package org.eclipse.jet.internal.compiler.templates;
import org.eclipse.jet.JET2Context;
@@ -21,15 +11,22 @@ public class WriteJavaExpressionTemplate implements JET2Template {
super();
}
- public void generate(final JET2Context context, JET2Writer out) {
+ private static final String NL = System.getProperties().getProperty("line.separator");
+
+ private static final class _TEXT {
+ private static final String TEXT_1 = "out.write("; //$NON-NLS-1$
+ private static final String TEXT_2 = ");" + NL; //$NON-NLS-1$
+ }
+
+ public void generate(final JET2Context context, JET2Writer out) {
+
final String indent = (String)context.getVariable("indent"); //$NON-NLS-1$
final JET2Expression expr = (JET2Expression)context.getVariable("element"); //$NON-NLS-1$
+
out.write( indent );
- out.write( "out.write(" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_1);
out.write( expr.getJavaContent() );
- out.write( ");\r\n" ); //$NON-NLS-1$
-
- }
-
+ out.write(_TEXT.TEXT_2);
+ }
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/WriteTextElementTemplate.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/WriteTextElementTemplate.java
index 8596e54..cdbe7e1 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/WriteTextElementTemplate.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/WriteTextElementTemplate.java
@@ -1,13 +1,3 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
package org.eclipse.jet.internal.compiler.templates;
import org.eclipse.jet.JET2Context;
@@ -22,15 +12,24 @@ public class WriteTextElementTemplate implements JET2Template {
super();
}
- public void generate(final JET2Context context, JET2Writer out) {
+ private static final String NL = System.getProperties().getProperty("line.separator");
+
+ private static final class _TEXT {
+ private static final String TEXT_1 = "out.write( "; //$NON-NLS-1$
+ private static final String TEXT_2 = " ); //$NON-NLS-1$" + NL; //$NON-NLS-1$
+ }
+
+ public void generate(final JET2Context context, JET2Writer out) {
+
final String indent = (String)context.getVariable("indent"); //$NON-NLS-1$
final TextElement text = (TextElement)context.getVariable("element"); //$NON-NLS-1$
- if(text.getText().length > 0) { out.write( indent );
- out.write( "out.write( " ); //$NON-NLS-1$
- out.write( JavaUtil.asJavaQuotedString(text.getText()) );
- out.write( " ); //$NON-NLS-1$\r\n" ); //$NON-NLS-1$
- }
- }
+ if(text.getText().length > 0) {
+ out.write( indent );
+ out.write(_TEXT.TEXT_1);
+ out.write( JavaUtil.asJavaQuotedString(text.getText()) );
+ out.write(_TEXT.TEXT_2);
+ }
+ }
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/XMLEndGenerator.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/XMLEndGenerator.java
index 04446f9..4d26546 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/XMLEndGenerator.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/XMLEndGenerator.java
@@ -1,13 +1,3 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
package org.eclipse.jet.internal.compiler.templates;
import org.eclipse.jet.JET2Context;
@@ -18,16 +8,25 @@ import org.eclipse.jet.taglib.TagInfo;
import org.eclipse.jet.internal.compiler.GenXMLElement;
public class XMLEndGenerator implements JET2Template {
- public static final String _jetns_f = "org.eclipse.jet.formatTags"; //$NON-NLS-1$
- public static final String _jetns_c = "org.eclipse.jet.controlTags"; //$NON-NLS-1$
- public static final String _jetns_java = "org.eclipse.jet.javaTags"; //$NON-NLS-1$
+ private static final String _jetns_c = "org.eclipse.jet.controlTags"; //$NON-NLS-1$
public XMLEndGenerator() {
super();
}
- public void generate(final JET2Context context, JET2Writer out) {
- final TagInfo _jettd_c_get_7_1 = new TagInfo("c:get", //$NON-NLS-1$
+ private static final String NL = System.getProperties().getProperty("line.separator");
+
+ private static final class _TEXT {
+ private static final String TEXT_1 = " "; //$NON-NLS-1$
+ private static final String TEXT_2 = ".handleBodyContent(out);" + NL; //$NON-NLS-1$
+ private static final String TEXT_3 = "}" + NL; //$NON-NLS-1$
+ private static final String TEXT_4 = "out = "; //$NON-NLS-1$
+ private static final String TEXT_5 = "_saved_out;" + NL; //$NON-NLS-1$
+ private static final String TEXT_6 = ".doEnd();" + NL; //$NON-NLS-1$
+ }
+
+ private static final class _TAGS {
+ private static final TagInfo c_get_7_1 = new TagInfo("c:get", //$NON-NLS-1$
7, 1,
new String[] {
"select", //$NON-NLS-1$
@@ -35,7 +34,7 @@ public class XMLEndGenerator implements JET2Template {
new String[] {
"$indent", //$NON-NLS-1$
} );
- final TagInfo _jettd_c_get_8_1 = new TagInfo("c:get", //$NON-NLS-1$
+ private static final TagInfo c_get_8_1 = new TagInfo("c:get", //$NON-NLS-1$
8, 1,
new String[] {
"select", //$NON-NLS-1$
@@ -43,7 +42,7 @@ public class XMLEndGenerator implements JET2Template {
new String[] {
"$indent", //$NON-NLS-1$
} );
- final TagInfo _jettd_c_get_10_1 = new TagInfo("c:get", //$NON-NLS-1$
+ private static final TagInfo c_get_10_1 = new TagInfo("c:get", //$NON-NLS-1$
10, 1,
new String[] {
"select", //$NON-NLS-1$
@@ -51,7 +50,7 @@ public class XMLEndGenerator implements JET2Template {
new String[] {
"$indent", //$NON-NLS-1$
} );
- final TagInfo _jettd_c_get_13_1 = new TagInfo("c:get", //$NON-NLS-1$
+ private static final TagInfo c_get_13_1 = new TagInfo("c:get", //$NON-NLS-1$
13, 1,
new String[] {
"select", //$NON-NLS-1$
@@ -59,38 +58,44 @@ public class XMLEndGenerator implements JET2Template {
new String[] {
"$indent", //$NON-NLS-1$
} );
+ }
+ public void generate(final JET2Context context, JET2Writer out) {
+
GenXMLElement element = (GenXMLElement) context.getVariable("element"); //$NON-NLS-1$
- if(element.hasBody()) { RuntimeTagElement _jettag_c_get_7_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _jettd_c_get_7_1); //$NON-NLS-1$ //$NON-NLS-2$
+
+ if(element.hasBody()) {
+ RuntimeTagElement _jettag_c_get_7_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _TAGS.c_get_7_1); //$NON-NLS-1$ //$NON-NLS-2$
_jettag_c_get_7_1.setRuntimeParent(null);
- _jettag_c_get_7_1.setTagInfo(_jettd_c_get_7_1);
+ _jettag_c_get_7_1.setTagInfo(_TAGS.c_get_7_1);
_jettag_c_get_7_1.doStart(context, out);
_jettag_c_get_7_1.doEnd();
- out.write( " " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_1);
out.write( element.getTagVariable() );
- out.write( ".handleBodyContent(out);\r\n" ); //$NON-NLS-1$
- RuntimeTagElement _jettag_c_get_8_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _jettd_c_get_8_1); //$NON-NLS-1$ //$NON-NLS-2$
+ out.write(_TEXT.TEXT_2);
+ RuntimeTagElement _jettag_c_get_8_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _TAGS.c_get_8_1); //$NON-NLS-1$ //$NON-NLS-2$
_jettag_c_get_8_1.setRuntimeParent(null);
- _jettag_c_get_8_1.setTagInfo(_jettd_c_get_8_1);
+ _jettag_c_get_8_1.setTagInfo(_TAGS.c_get_8_1);
_jettag_c_get_8_1.doStart(context, out);
_jettag_c_get_8_1.doEnd();
- out.write( "}\r\n" ); //$NON-NLS-1$
- if(element.requiresNewWriter()) { RuntimeTagElement _jettag_c_get_10_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _jettd_c_get_10_1); //$NON-NLS-1$ //$NON-NLS-2$
+ out.write(_TEXT.TEXT_3);
+ if(element.requiresNewWriter()) {
+ RuntimeTagElement _jettag_c_get_10_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _TAGS.c_get_10_1); //$NON-NLS-1$ //$NON-NLS-2$
_jettag_c_get_10_1.setRuntimeParent(null);
- _jettag_c_get_10_1.setTagInfo(_jettd_c_get_10_1);
+ _jettag_c_get_10_1.setTagInfo(_TAGS.c_get_10_1);
_jettag_c_get_10_1.doStart(context, out);
_jettag_c_get_10_1.doEnd();
- out.write( "out = " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_4);
out.write( element.getTagVariable() );
- out.write( "_saved_out;\r\n" ); //$NON-NLS-1$
- } } RuntimeTagElement _jettag_c_get_13_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _jettd_c_get_13_1); //$NON-NLS-1$ //$NON-NLS-2$
+ out.write(_TEXT.TEXT_5);
+ }
+ }
+ RuntimeTagElement _jettag_c_get_13_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _TAGS.c_get_13_1); //$NON-NLS-1$ //$NON-NLS-2$
_jettag_c_get_13_1.setRuntimeParent(null);
- _jettag_c_get_13_1.setTagInfo(_jettd_c_get_13_1);
+ _jettag_c_get_13_1.setTagInfo(_TAGS.c_get_13_1);
_jettag_c_get_13_1.doStart(context, out);
_jettag_c_get_13_1.doEnd();
out.write( element.getTagVariable() );
- out.write( ".doEnd();\r\n" ); //$NON-NLS-1$
-
- }
-
+ out.write(_TEXT.TEXT_6);
+ }
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/XMLStartGenerator.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/XMLStartGenerator.java
index f52f121..a327f96 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/XMLStartGenerator.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/XMLStartGenerator.java
@@ -1,13 +1,3 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
package org.eclipse.jet.internal.compiler.templates;
import org.eclipse.jet.JET2Context;
@@ -18,16 +8,35 @@ import org.eclipse.jet.taglib.TagInfo;
import org.eclipse.jet.internal.compiler.GenXMLElement;
public class XMLStartGenerator implements JET2Template {
- public static final String _jetns_f = "org.eclipse.jet.formatTags"; //$NON-NLS-1$
- public static final String _jetns_c = "org.eclipse.jet.controlTags"; //$NON-NLS-1$
- public static final String _jetns_java = "org.eclipse.jet.javaTags"; //$NON-NLS-1$
+ private static final String _jetns_c = "org.eclipse.jet.controlTags"; //$NON-NLS-1$
public XMLStartGenerator() {
super();
}
- public void generate(final JET2Context context, JET2Writer out) {
- final TagInfo _jettd_c_get_6_1 = new TagInfo("c:get", //$NON-NLS-1$
+ private static final String NL = System.getProperties().getProperty("line.separator");
+
+ private static final class _TEXT {
+ private static final String TEXT_1 = "RuntimeTagElement "; //$NON-NLS-1$
+ private static final String TEXT_2 = " = context.getTagFactory().createRuntimeTag(_jetns_"; //$NON-NLS-1$
+ private static final String TEXT_3 = ", \""; //$NON-NLS-1$
+ private static final String TEXT_4 = "\", \""; //$NON-NLS-1$
+ private static final String TEXT_5 = "\", "; //$NON-NLS-1$
+ private static final String TEXT_6 = "); //$NON-NLS-1$ //$NON-NLS-2$" + NL; //$NON-NLS-1$
+ private static final String TEXT_7 = ".setRuntimeParent("; //$NON-NLS-1$
+ private static final String TEXT_8 = ");" + NL; //$NON-NLS-1$
+ private static final String TEXT_9 = ".setTagInfo("; //$NON-NLS-1$
+ private static final String TEXT_10 = ");" + NL; //$NON-NLS-1$
+ private static final String TEXT_11 = ".doStart(context, out);" + NL; //$NON-NLS-1$
+ private static final String TEXT_12 = "JET2Writer "; //$NON-NLS-1$
+ private static final String TEXT_13 = "_saved_out = out;" + NL; //$NON-NLS-1$
+ private static final String TEXT_14 = "while ("; //$NON-NLS-1$
+ private static final String TEXT_15 = ".okToProcessBody()) {" + NL; //$NON-NLS-1$
+ private static final String TEXT_16 = " out = out.newNestedContentWriter();" + NL; //$NON-NLS-1$
+ }
+
+ private static final class _TAGS {
+ private static final TagInfo c_get_6_1 = new TagInfo("c:get", //$NON-NLS-1$
6, 1,
new String[] {
"select", //$NON-NLS-1$
@@ -35,7 +44,7 @@ public class XMLStartGenerator implements JET2Template {
new String[] {
"$indent", //$NON-NLS-1$
} );
- final TagInfo _jettd_c_get_7_1 = new TagInfo("c:get", //$NON-NLS-1$
+ private static final TagInfo c_get_7_1 = new TagInfo("c:get", //$NON-NLS-1$
7, 1,
new String[] {
"select", //$NON-NLS-1$
@@ -43,7 +52,7 @@ public class XMLStartGenerator implements JET2Template {
new String[] {
"$indent", //$NON-NLS-1$
} );
- final TagInfo _jettd_c_get_8_1 = new TagInfo("c:get", //$NON-NLS-1$
+ private static final TagInfo c_get_8_1 = new TagInfo("c:get", //$NON-NLS-1$
8, 1,
new String[] {
"select", //$NON-NLS-1$
@@ -51,7 +60,7 @@ public class XMLStartGenerator implements JET2Template {
new String[] {
"$indent", //$NON-NLS-1$
} );
- final TagInfo _jettd_c_get_9_1 = new TagInfo("c:get", //$NON-NLS-1$
+ private static final TagInfo c_get_9_1 = new TagInfo("c:get", //$NON-NLS-1$
9, 1,
new String[] {
"select", //$NON-NLS-1$
@@ -59,7 +68,7 @@ public class XMLStartGenerator implements JET2Template {
new String[] {
"$indent", //$NON-NLS-1$
} );
- final TagInfo _jettd_c_get_12_1 = new TagInfo("c:get", //$NON-NLS-1$
+ private static final TagInfo c_get_12_1 = new TagInfo("c:get", //$NON-NLS-1$
12, 1,
new String[] {
"select", //$NON-NLS-1$
@@ -67,7 +76,7 @@ public class XMLStartGenerator implements JET2Template {
new String[] {
"$indent", //$NON-NLS-1$
} );
- final TagInfo _jettd_c_get_14_1 = new TagInfo("c:get", //$NON-NLS-1$
+ private static final TagInfo c_get_14_1 = new TagInfo("c:get", //$NON-NLS-1$
14, 1,
new String[] {
"select", //$NON-NLS-1$
@@ -75,7 +84,7 @@ public class XMLStartGenerator implements JET2Template {
new String[] {
"$indent", //$NON-NLS-1$
} );
- final TagInfo _jettd_c_get_16_1 = new TagInfo("c:get", //$NON-NLS-1$
+ private static final TagInfo c_get_16_1 = new TagInfo("c:get", //$NON-NLS-1$
16, 1,
new String[] {
"select", //$NON-NLS-1$
@@ -83,72 +92,80 @@ public class XMLStartGenerator implements JET2Template {
new String[] {
"$indent", //$NON-NLS-1$
} );
+ }
+ public void generate(final JET2Context context, JET2Writer out) {
+
GenXMLElement element = (GenXMLElement) context.getVariable("element"); //$NON-NLS-1$
- RuntimeTagElement _jettag_c_get_6_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _jettd_c_get_6_1); //$NON-NLS-1$ //$NON-NLS-2$
+
+ RuntimeTagElement _jettag_c_get_6_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _TAGS.c_get_6_1); //$NON-NLS-1$ //$NON-NLS-2$
_jettag_c_get_6_1.setRuntimeParent(null);
- _jettag_c_get_6_1.setTagInfo(_jettd_c_get_6_1);
+ _jettag_c_get_6_1.setTagInfo(_TAGS.c_get_6_1);
_jettag_c_get_6_1.doStart(context, out);
_jettag_c_get_6_1.doEnd();
- out.write( "RuntimeTagElement " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_1);
out.write( element.getTagVariable() );
- out.write( " = context.getTagFactory().createRuntimeTag(_jetns_" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_2);
out.write( element.getNSPrefix() );
- out.write( ", \"" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_3);
out.write( element.getTagNCName() );
- out.write( "\", \"" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_4);
out.write( element.getName() );
- out.write( "\", " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_5);
out.write( element.getTagInfoVariable() );
- out.write( "); //$NON-NLS-1$ //$NON-NLS-2$\r\n" ); //$NON-NLS-1$
- RuntimeTagElement _jettag_c_get_7_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _jettd_c_get_7_1); //$NON-NLS-1$ //$NON-NLS-2$
+ out.write(_TEXT.TEXT_6);
+ RuntimeTagElement _jettag_c_get_7_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _TAGS.c_get_7_1); //$NON-NLS-1$ //$NON-NLS-2$
_jettag_c_get_7_1.setRuntimeParent(null);
- _jettag_c_get_7_1.setTagInfo(_jettd_c_get_7_1);
+ _jettag_c_get_7_1.setTagInfo(_TAGS.c_get_7_1);
_jettag_c_get_7_1.doStart(context, out);
_jettag_c_get_7_1.doEnd();
out.write( element.getTagVariable() );
- out.write( ".setRuntimeParent(" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_7);
out.write( element.getParentTagVariable() );
- out.write( ");\r\n" ); //$NON-NLS-1$
- RuntimeTagElement _jettag_c_get_8_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _jettd_c_get_8_1); //$NON-NLS-1$ //$NON-NLS-2$
+ out.write(_TEXT.TEXT_8);
+ RuntimeTagElement _jettag_c_get_8_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _TAGS.c_get_8_1); //$NON-NLS-1$ //$NON-NLS-2$
_jettag_c_get_8_1.setRuntimeParent(null);
- _jettag_c_get_8_1.setTagInfo(_jettd_c_get_8_1);
+ _jettag_c_get_8_1.setTagInfo(_TAGS.c_get_8_1);
_jettag_c_get_8_1.doStart(context, out);
_jettag_c_get_8_1.doEnd();
out.write( element.getTagVariable() );
- out.write( ".setTagInfo(" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_9);
out.write( element.getTagInfoVariable() );
- out.write( ");\r\n" ); //$NON-NLS-1$
- RuntimeTagElement _jettag_c_get_9_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _jettd_c_get_9_1); //$NON-NLS-1$ //$NON-NLS-2$
+ out.write(_TEXT.TEXT_10);
+ RuntimeTagElement _jettag_c_get_9_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _TAGS.c_get_9_1); //$NON-NLS-1$ //$NON-NLS-2$
_jettag_c_get_9_1.setRuntimeParent(null);
- _jettag_c_get_9_1.setTagInfo(_jettd_c_get_9_1);
+ _jettag_c_get_9_1.setTagInfo(_TAGS.c_get_9_1);
_jettag_c_get_9_1.doStart(context, out);
_jettag_c_get_9_1.doEnd();
out.write( element.getTagVariable() );
- out.write( ".doStart(context, out);\r\n" ); //$NON-NLS-1$
- if(element.hasBody()) { if(element.requiresNewWriter()) { RuntimeTagElement _jettag_c_get_12_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _jettd_c_get_12_1); //$NON-NLS-1$ //$NON-NLS-2$
+ out.write(_TEXT.TEXT_11);
+ if(element.hasBody()) {
+ if(element.requiresNewWriter()) {
+ RuntimeTagElement _jettag_c_get_12_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _TAGS.c_get_12_1); //$NON-NLS-1$ //$NON-NLS-2$
_jettag_c_get_12_1.setRuntimeParent(null);
- _jettag_c_get_12_1.setTagInfo(_jettd_c_get_12_1);
+ _jettag_c_get_12_1.setTagInfo(_TAGS.c_get_12_1);
_jettag_c_get_12_1.doStart(context, out);
_jettag_c_get_12_1.doEnd();
- out.write( "JET2Writer " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_12);
out.write( element.getTagVariable() );
- out.write( "_saved_out = out;\r\n" ); //$NON-NLS-1$
- } RuntimeTagElement _jettag_c_get_14_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _jettd_c_get_14_1); //$NON-NLS-1$ //$NON-NLS-2$
+ out.write(_TEXT.TEXT_13);
+ }
+ RuntimeTagElement _jettag_c_get_14_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _TAGS.c_get_14_1); //$NON-NLS-1$ //$NON-NLS-2$
_jettag_c_get_14_1.setRuntimeParent(null);
- _jettag_c_get_14_1.setTagInfo(_jettd_c_get_14_1);
+ _jettag_c_get_14_1.setTagInfo(_TAGS.c_get_14_1);
_jettag_c_get_14_1.doStart(context, out);
_jettag_c_get_14_1.doEnd();
- out.write( "while (" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_14);
out.write( element.getTagVariable() );
- out.write( ".okToProcessBody()) {\r\n" ); //$NON-NLS-1$
- if(element.requiresNewWriter()) { RuntimeTagElement _jettag_c_get_16_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _jettd_c_get_16_1); //$NON-NLS-1$ //$NON-NLS-2$
+ out.write(_TEXT.TEXT_15);
+ if(element.requiresNewWriter()) {
+ RuntimeTagElement _jettag_c_get_16_1 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _TAGS.c_get_16_1); //$NON-NLS-1$ //$NON-NLS-2$
_jettag_c_get_16_1.setRuntimeParent(null);
- _jettag_c_get_16_1.setTagInfo(_jettd_c_get_16_1);
+ _jettag_c_get_16_1.setTagInfo(_TAGS.c_get_16_1);
_jettag_c_get_16_1.doStart(context, out);
_jettag_c_get_16_1.doEnd();
- out.write( " out = out.newNestedContentWriter();\r\n" ); //$NON-NLS-1$
- } }
- }
-
+ out.write(_TEXT.TEXT_16);
+ }
+ }
+ }
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/v1/JET1JavaGenerator.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/v1/JET1JavaGenerator.java
index 35cc198..a534a27 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/v1/JET1JavaGenerator.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/v1/JET1JavaGenerator.java
@@ -1,13 +1,3 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
package org.eclipse.jet.internal.compiler.templates.v1;
import org.eclipse.jet.JET2Context;
@@ -24,78 +14,117 @@ public class JET1JavaGenerator implements JET2Template {
super();
}
- public void generate(final JET2Context context, JET2Writer out) {
+ private static final String NL = System.getProperties().getProperty("line.separator");
+
+ private static final class _TEXT {
+ private static final String TEXT_1 = "package "; //$NON-NLS-1$
+ private static final String TEXT_2 = ";" + NL + NL; //$NON-NLS-1$
+ private static final String TEXT_3 = "import "; //$NON-NLS-1$
+ private static final String TEXT_4 = ";" + NL; //$NON-NLS-1$
+ private static final String TEXT_5 = NL + "public class "; //$NON-NLS-1$
+ private static final String TEXT_6 = NL + "{" + NL; //$NON-NLS-1$
+ private static final String TEXT_7 = "\t"; //$NON-NLS-1$
+ private static final String TEXT_8 = NL;
+ private static final String TEXT_9 = " protected static String nl;" + NL + " public static synchronized "; //$NON-NLS-1$ //$NON-NLS-2$
+ private static final String TEXT_10 = " create(String lineSeparator)" + NL + " {" + NL + " nl = lineSeparator;" + NL + " "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ private static final String TEXT_11 = " result = new "; //$NON-NLS-1$
+ private static final String TEXT_12 = "();" + NL + " nl = null;" + NL + " return result;" + NL + " }" + NL + NL + " protected final String NL = nl == null ? (System.getProperties().getProperty(\"line.separator\")) : nl;" + NL; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ private static final String TEXT_13 = " protected final String TEXT_"; //$NON-NLS-1$
+ private static final String TEXT_14 = " = "; //$NON-NLS-1$
+ private static final String TEXT_15 = ";"; //$NON-NLS-1$
+ private static final String TEXT_16 = NL;
+ private static final String TEXT_17 = NL + " public String generate(Object argument)" + NL + " {" + NL + " final StringBuffer stringBuffer = new StringBuffer();" + NL; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ private static final String TEXT_18 = " stringBuffer.append(TEXT_"; //$NON-NLS-1$
+ private static final String TEXT_19 = ");" + NL; //$NON-NLS-1$
+ private static final String TEXT_20 = " "; //$NON-NLS-1$
+ private static final String TEXT_21 = NL;
+ private static final String TEXT_22 = " stringBuffer.append("; //$NON-NLS-1$
+ private static final String TEXT_23 = ");" + NL; //$NON-NLS-1$
+ private static final String TEXT_24 = " return stringBuffer.toString();" + NL + " }" + NL + "}" + NL; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ public void generate(final JET2Context context, JET2Writer out) {
+
JETCompilationUnit cu = (JETCompilationUnit)context.getVariable("cu"); //$NON-NLS-1$
- out.write( "package " ); //$NON-NLS-1$
+
+ out.write(_TEXT.TEXT_1);
out.write( cu.getOutputJavaPackage() );
- out.write( ";\r\n\r\n" ); //$NON-NLS-1$
- for(Iterator i=cu.getImports().iterator();i.hasNext();) {
- String importName = (String)i.next(); out.write( "import " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_2);
+ for(Iterator i=cu.getImports().iterator();i.hasNext();) {
+ String importName = (String)i.next();
+ out.write(_TEXT.TEXT_3);
out.write(importName);
- out.write( ";\r\n" ); //$NON-NLS-1$
- } out.write( "\r\npublic class " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_4);
+ }
+ out.write(_TEXT.TEXT_5);
out.write( cu.getOutputJavaClassName() );
- out.write( "\r\n{\r\n" ); //$NON-NLS-1$
- cu.accept(new SafeJETASTVisitor(context,out) {
+ out.write(_TEXT.TEXT_6);
+ cu.accept(new SafeJETASTVisitor(context,out) {
public boolean visit(JavaDeclaration decl) {
- out.write( "\t" ); //$NON-NLS-1$
- out.write( decl.getJavaContent() );
- out.write( "\r\n" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_7);
+ out.write( decl.getJavaContent() );
+ out.write(_TEXT.TEXT_8);
+
return true;
}
});
- out.write( " protected static String nl;\r\n public static synchronized " ); //$NON-NLS-1$
+
+ out.write(_TEXT.TEXT_9);
out.write( cu.getOutputJavaClassName() );
- out.write( " create(String lineSeparator)\r\n {\r\n nl = lineSeparator;\r\n " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_10);
out.write( cu.getOutputJavaClassName() );
- out.write( " result = new " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_11);
out.write( cu.getOutputJavaClassName() );
- out.write( "();\r\n nl = null;\r\n return result;\r\n }\r\n\r\n protected final String NL = nl == null ? (System.getProperties().getProperty(\"line.separator\")) : nl;\r\n" ); //$NON-NLS-1$
- cu.accept(new SafeJETASTVisitor(context,out) {
+ out.write(_TEXT.TEXT_12);
+ cu.accept(new SafeJETASTVisitor(context,out) {
private int textCount = 0;
public boolean visit(TextElement text) {
textCount++;
- out.write( " protected final String TEXT_" ); //$NON-NLS-1$
+
+ out.write(_TEXT.TEXT_13);
out.write(textCount);
- out.write( " = " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_14);
out.write(JavaUtil.asJavaQuoteStringWithNLRemoved(text.getText()));
- out.write( ";" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_15);
out.write(JavaUtil.nlsCommentsForJavaQuoteStringWithNLRemoved(text.getText()));
- out.write( "\r\n" ); //$NON-NLS-1$
-
+ out.write(_TEXT.TEXT_16);
+
return true;
}
});
- out.write( "\r\n public String generate(Object argument)\r\n {\r\n final StringBuffer stringBuffer = new StringBuffer();\r\n" ); //$NON-NLS-1$
- cu.accept(new SafeJETASTVisitor(context,out) {
+
+ out.write(_TEXT.TEXT_17);
+ cu.accept(new SafeJETASTVisitor(context,out) {
private int textCount = 0;
public boolean visit(TextElement text) {
textCount++;
- out.write( " stringBuffer.append(TEXT_" ); //$NON-NLS-1$
- out.write(textCount);
- out.write( ");\r\n" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_18);
+ out.write(textCount);
+ out.write(_TEXT.TEXT_19);
+
return true;
}
public boolean visit(JavaScriptlet scriptlet) {
- out.write( " " ); //$NON-NLS-1$
- out.write( scriptlet.getJavaContent() );
- out.write( "\r\n" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_20);
+ out.write( scriptlet.getJavaContent() );
+ out.write(_TEXT.TEXT_21);
+
return true;
}
public boolean visit(JavaExpression expr) {
- out.write( " stringBuffer.append(" ); //$NON-NLS-1$
- out.write( expr.getJavaContent() );
- out.write( ");\r\n" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_22);
+ out.write( expr.getJavaContent() );
+ out.write(_TEXT.TEXT_23);
+
return true;
}
});
- out.write( " return stringBuffer.toString();\r\n }\r\n}\r\n" ); //$NON-NLS-1$
-
- }
+ out.write(_TEXT.TEXT_24);
+ }
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/v2/JET2JavaGeneratorNew.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/v2/JET2JavaGeneratorNew.java
index de378ae..648d75f 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/v2/JET2JavaGeneratorNew.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/v2/JET2JavaGeneratorNew.java
@@ -1,13 +1,3 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
package org.eclipse.jet.internal.compiler.templates.v2;
import org.eclipse.jet.JET2Context;
@@ -26,59 +16,152 @@ public class JET2JavaGeneratorNew implements JET2Template {
super();
}
- public void generate(final JET2Context context, JET2Writer out) {
+ private static final String NL = System.getProperties().getProperty("line.separator");
+
+ private static final class _TEXT {
+ private static final String TEXT_1 = "package "; //$NON-NLS-1$
+ private static final String TEXT_2 = ";" + NL + NL + "import org.eclipse.jet.JET2Context;" + NL + "import org.eclipse.jet.JET2Template;" + NL + "import org.eclipse.jet.JET2Writer;" + NL; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ private static final String TEXT_3 = "import org.eclipse.jet.taglib.RuntimeTagElement;" + NL + "import org.eclipse.jet.taglib.TagInfo;" + NL; //$NON-NLS-1$ //$NON-NLS-2$
+ private static final String TEXT_4 = "import "; //$NON-NLS-1$
+ private static final String TEXT_5 = ";" + NL; //$NON-NLS-1$
+ private static final String TEXT_6 = NL + "public class "; //$NON-NLS-1$
+ private static final String TEXT_7 = " implements JET2Template {" + NL; //$NON-NLS-1$
+ private static final String TEXT_8 = " private static final String _jetns_"; //$NON-NLS-1$
+ private static final String TEXT_9 = " = \""; //$NON-NLS-1$
+ private static final String TEXT_10 = "\"; //$NON-NLS-1$" + NL; //$NON-NLS-1$
+ private static final String TEXT_11 = NL;
+ private static final String TEXT_12 = "\t"; //$NON-NLS-1$
+ private static final String TEXT_13 = NL;
+ private static final String TEXT_14 = "\tpublic "; //$NON-NLS-1$
+ private static final String TEXT_15 = "() {" + NL + "\t\tsuper();" + NL + "\t}" + NL + NL + " private static final String NL = System.getProperties().getProperty(\"line.separator\");" + NL + " " + NL + " private static final class _TEXT {" + NL; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ private static final String TEXT_16 = " private static final String "; //$NON-NLS-1$
+ private static final String TEXT_17 = " = "; //$NON-NLS-1$
+ private static final String TEXT_18 = ";"; //$NON-NLS-1$
+ private static final String TEXT_19 = NL;
+ private static final String TEXT_20 = " }" + NL + NL; //$NON-NLS-1$
+ private static final String TEXT_21 = " private static final class _TAGS {" + NL; //$NON-NLS-1$
+ private static final String TEXT_22 = " private static final TagInfo "; //$NON-NLS-1$
+ private static final String TEXT_23 = " = new TagInfo(\""; //$NON-NLS-1$
+ private static final String TEXT_24 = "\", //$NON-NLS-1$" + NL + " "; //$NON-NLS-1$ //$NON-NLS-2$
+ private static final String TEXT_25 = ", "; //$NON-NLS-1$
+ private static final String TEXT_26 = "," + NL + " new String[] {" + NL; //$NON-NLS-1$ //$NON-NLS-2$
+ private static final String TEXT_27 = " \""; //$NON-NLS-1$
+ private static final String TEXT_28 = "\", //$NON-NLS-1$" + NL; //$NON-NLS-1$
+ private static final String TEXT_29 = " }," + NL + " new String[] {" + NL; //$NON-NLS-1$ //$NON-NLS-2$
+ private static final String TEXT_30 = " \""; //$NON-NLS-1$
+ private static final String TEXT_31 = "\", //$NON-NLS-1$" + NL; //$NON-NLS-1$
+ private static final String TEXT_32 = " } );" + NL; //$NON-NLS-1$
+ private static final String TEXT_33 = " }" + NL; //$NON-NLS-1$
+ private static final String TEXT_34 = NL + "\tpublic void generate(final JET2Context context, JET2Writer out) {" + NL; //$NON-NLS-1$
+ private static final String TEXT_35 = " out.write(_TEXT."; //$NON-NLS-1$
+ private static final String TEXT_36 = ");" + NL; //$NON-NLS-1$
+ private static final String TEXT_37 = " "; //$NON-NLS-1$
+ private static final String TEXT_38 = NL;
+ private static final String TEXT_39 = " out.write("; //$NON-NLS-1$
+ private static final String TEXT_40 = ");" + NL; //$NON-NLS-1$
+ private static final String TEXT_41 = " RuntimeTagElement "; //$NON-NLS-1$
+ private static final String TEXT_42 = " = context.getTagFactory().createRuntimeTag(_jetns_"; //$NON-NLS-1$
+ private static final String TEXT_43 = ", \""; //$NON-NLS-1$
+ private static final String TEXT_44 = "\", \""; //$NON-NLS-1$
+ private static final String TEXT_45 = "\", _TAGS."; //$NON-NLS-1$
+ private static final String TEXT_46 = "); //$NON-NLS-1$ //$NON-NLS-2$" + NL + " "; //$NON-NLS-1$ //$NON-NLS-2$
+ private static final String TEXT_47 = ".setRuntimeParent("; //$NON-NLS-1$
+ private static final String TEXT_48 = ");" + NL + " "; //$NON-NLS-1$ //$NON-NLS-2$
+ private static final String TEXT_49 = ".setTagInfo(_TAGS."; //$NON-NLS-1$
+ private static final String TEXT_50 = ");" + NL + " "; //$NON-NLS-1$ //$NON-NLS-2$
+ private static final String TEXT_51 = ".doStart(context, out);" + NL; //$NON-NLS-1$
+ private static final String TEXT_52 = " JET2Writer "; //$NON-NLS-1$
+ private static final String TEXT_53 = "_saved_out = out;" + NL; //$NON-NLS-1$
+ private static final String TEXT_54 = " while ("; //$NON-NLS-1$
+ private static final String TEXT_55 = ".okToProcessBody()) {" + NL; //$NON-NLS-1$
+ private static final String TEXT_56 = " out = out.newNestedContentWriter();" + NL; //$NON-NLS-1$
+ private static final String TEXT_57 = " "; //$NON-NLS-1$
+ private static final String TEXT_58 = ".handleBodyContent(out);" + NL + " }" + NL; //$NON-NLS-1$ //$NON-NLS-2$
+ private static final String TEXT_59 = " out = "; //$NON-NLS-1$
+ private static final String TEXT_60 = "_saved_out;" + NL; //$NON-NLS-1$
+ private static final String TEXT_61 = " "; //$NON-NLS-1$
+ private static final String TEXT_62 = ".doEnd();" + NL; //$NON-NLS-1$
+ private static final String TEXT_63 = " RuntimeTagElement "; //$NON-NLS-1$
+ private static final String TEXT_64 = " = context.getTagFactory().createRuntimeTag(_jetns_"; //$NON-NLS-1$
+ private static final String TEXT_65 = ", \""; //$NON-NLS-1$
+ private static final String TEXT_66 = "\", \""; //$NON-NLS-1$
+ private static final String TEXT_67 = "\", _TAGS."; //$NON-NLS-1$
+ private static final String TEXT_68 = "); //$NON-NLS-1$ //$NON-NLS-2$" + NL + " "; //$NON-NLS-1$ //$NON-NLS-2$
+ private static final String TEXT_69 = ".setRuntimeParent("; //$NON-NLS-1$
+ private static final String TEXT_70 = ");" + NL + " "; //$NON-NLS-1$ //$NON-NLS-2$
+ private static final String TEXT_71 = ".setTagInfo(_TAGS."; //$NON-NLS-1$
+ private static final String TEXT_72 = ");" + NL + " "; //$NON-NLS-1$ //$NON-NLS-2$
+ private static final String TEXT_73 = ".doStart(context, out);" + NL + " "; //$NON-NLS-1$ //$NON-NLS-2$
+ private static final String TEXT_74 = ".doEnd();" + NL; //$NON-NLS-1$
+ private static final String TEXT_75 = " }" + NL + "}" + NL; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public void generate(final JET2Context context, JET2Writer out) {
+
JETCompilationUnit cu = (JETCompilationUnit)context.getVariable("cu"); //$NON-NLS-1$
TagUsageVisitor tuv = new TagUsageVisitor();
cu.accept(tuv);
TagLibraryReference[] tlrefs = tuv.getUsedTagLibraryReferences(cu);
- out.write( "package " ); //$NON-NLS-1$
+
+ out.write(_TEXT.TEXT_1);
out.write( cu.getOutputJavaPackage() );
- out.write( ";\r\n\r\nimport org.eclipse.jet.JET2Context;\r\nimport org.eclipse.jet.JET2Template;\r\nimport org.eclipse.jet.JET2Writer;\r\n" ); //$NON-NLS-1$
- if(tuv.hasTags()) { out.write( "import org.eclipse.jet.taglib.RuntimeTagElement;\r\nimport org.eclipse.jet.taglib.TagInfo;\r\n" ); //$NON-NLS-1$
- } for(Iterator i=cu.getImports().iterator();i.hasNext();) { out.write( "import " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_2);
+ if(tuv.hasTags()) {
+ out.write(_TEXT.TEXT_3);
+ }
+ for(Iterator i=cu.getImports().iterator();i.hasNext();) {
+ out.write(_TEXT.TEXT_4);
out.write( (String)i.next() );
- out.write( ";\r\n" ); //$NON-NLS-1$
- } out.write( "\r\npublic class " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_5);
+ }
+ out.write(_TEXT.TEXT_6);
out.write( cu.getOutputJavaClassName() );
- out.write( " implements JET2Template {\r\n" ); //$NON-NLS-1$
- for(int i = 0; i < tlrefs.length; i++ ) { out.write( " private static final String _jetns_" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_7);
+ for(int i = 0; i < tlrefs.length; i++ ) {
+ out.write(_TEXT.TEXT_8);
out.write( tlrefs[i].getPrefix() );
- out.write( " = \"" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_9);
out.write( tlrefs[i].getTagLibraryId() );
- out.write( "\"; //$NON-NLS-1$\r\n" ); //$NON-NLS-1$
- } out.write( "\r\n" ); //$NON-NLS-1$
- cu.accept(new V2CodeGenVisitor(context,out) {
+ out.write(_TEXT.TEXT_10);
+ }
+ out.write(_TEXT.TEXT_11);
+ cu.accept(new V2CodeGenVisitor(context,out) {
public boolean visit(JavaDeclaration decl) {
- out.write( "\t" ); //$NON-NLS-1$
- out.write( decl.getJavaContent() );
- out.write( "\r\n" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_12);
+ out.write( decl.getJavaContent() );
+ out.write(_TEXT.TEXT_13);
+
return true;
}
});
- out.write( "\tpublic " ); //$NON-NLS-1$
+
+ out.write(_TEXT.TEXT_14);
out.write( cu.getOutputJavaClassName() );
- out.write( "() {\r\n\t\tsuper();\r\n\t}\r\n\r\n private static final String NL = System.getProperties().getProperty(\"line.separator\");\r\n \r\n private static final class _TEXT {\r\n" ); //$NON-NLS-1$
- cu.accept(new V2CodeGenVisitor(context,out) {
+ out.write(_TEXT.TEXT_15);
+ cu.accept(new V2CodeGenVisitor(context,out) {
private int textCount = 0;
public boolean visit(TextElement text) {
if(text.getText().length > 0) {
- out.write( " private static final String " ); //$NON-NLS-1$
+
+ out.write(_TEXT.TEXT_16);
out.write( textVar(++textCount) );
- out.write( " = " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_17);
out.write(textExpr(text));
- out.write( ";" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_18);
out.write(nlsComment(text));
- out.write( "\r\n" ); //$NON-NLS-1$
-
+ out.write(_TEXT.TEXT_19);
+
}
return true;
}
});
- out.write( " }\r\n\r\n" ); //$NON-NLS-1$
- if(tuv.hasTags()) { out.write( " private static final class _TAGS {\r\n" ); //$NON-NLS-1$
- cu.accept(new V2CodeGenVisitor(context,out, " ") { //$NON-NLS-1$
+
+ out.write(_TEXT.TEXT_20);
+ if(tuv.hasTags()) {
+ out.write(_TEXT.TEXT_21);
+ cu.accept(new V2CodeGenVisitor(context,out, " ") { //$NON-NLS-1$
public boolean visit(XMLBodyElement e) {
doElementVisit(e);
return true;
@@ -88,129 +171,147 @@ public class JET2JavaGeneratorNew implements JET2Template {
return true;
}
public void doElementVisit(XMLElement e) {
- out.write( " private static final TagInfo " ); //$NON-NLS-1$
+
+ out.write(_TEXT.TEXT_22);
out.write( tagInfoVar(e) );
- out.write( " = new TagInfo(\"" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_23);
out.write(e.getName());
- out.write( "\", //$NON-NLS-1$\r\n " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_24);
out.write( e.getLine() );
- out.write( ", " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_25);
out.write( e.getColumn() );
- out.write( ",\r\n new String[] {\r\n" ); //$NON-NLS-1$
- for (Iterator i = e.getAttributes().keySet().iterator(); i.hasNext();) { out.write( " \"" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_26);
+ for (Iterator i = e.getAttributes().keySet().iterator(); i.hasNext();) {
+ out.write(_TEXT.TEXT_27);
out.write( (String) i.next() );
- out.write( "\", //$NON-NLS-1$\r\n" ); //$NON-NLS-1$
- } out.write( " },\r\n new String[] {\r\n" ); //$NON-NLS-1$
- for (Iterator i = e.getAttributes().values().iterator(); i.hasNext();) {
- String attrValue = (String) i.next(); out.write( " \"" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_28);
+ }
+ out.write(_TEXT.TEXT_29);
+ for (Iterator i = e.getAttributes().values().iterator(); i.hasNext();) {
+ String attrValue = (String) i.next();
+ out.write(_TEXT.TEXT_30);
out.write( JavaUtil.escapeJavaString(attrValue.toCharArray()) );
- out.write( "\", //$NON-NLS-1$\r\n" ); //$NON-NLS-1$
- } out.write( " } );\r\n" ); //$NON-NLS-1$
- }
- }); out.write( " }\r\n" ); //$NON-NLS-1$
- } out.write( "\r\n\tpublic void generate(final JET2Context context, JET2Writer out) {\r\n" ); //$NON-NLS-1$
- cu.accept(new V2CodeGenVisitor(context,out, " ") { //$NON-NLS-1$
+ out.write(_TEXT.TEXT_31);
+ }
+ out.write(_TEXT.TEXT_32);
+ }
+ });
+ out.write(_TEXT.TEXT_33);
+ }
+ out.write(_TEXT.TEXT_34);
+ cu.accept(new V2CodeGenVisitor(context,out, " ") { //$NON-NLS-1$
private int textCount = 0;
public boolean visit(TextElement text) {
if(text.getText().length > 0) {
- out.write( " out.write(_TEXT." ); //$NON-NLS-1$
- out.write(textVar(++textCount));
- out.write( ");\r\n" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_35);
+ out.write(textVar(++textCount));
+ out.write(_TEXT.TEXT_36);
+
}
return true;
}
public boolean visit(JavaScriptlet scriptlet) {
- out.write( " " ); //$NON-NLS-1$
- out.write( scriptlet.getJavaContent() );
- out.write( "\r\n" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_37);
+ out.write( scriptlet.getJavaContent() );
+ out.write(_TEXT.TEXT_38);
+
return true;
}
public boolean visit(JavaExpression expr) {
- out.write( " out.write(" ); //$NON-NLS-1$
- out.write( expr.getJavaContent() );
- out.write( ");\r\n" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_39);
+ out.write( expr.getJavaContent() );
+ out.write(_TEXT.TEXT_40);
+
return true;
}
public boolean visit(XMLBodyElement e) {
- out.write( " RuntimeTagElement " ); //$NON-NLS-1$
+
+ out.write(_TEXT.TEXT_41);
out.write( tagVar(e) );
- out.write( " = context.getTagFactory().createRuntimeTag(_jetns_" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_42);
out.write( e.getNSPrefix() );
- out.write( ", \"" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_43);
out.write( e.getTagNCName() );
- out.write( "\", \"" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_44);
out.write( e.getName() );
- out.write( "\", _TAGS." ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_45);
out.write( tagInfoVar(e) );
- out.write( "); //$NON-NLS-1$ //$NON-NLS-2$\r\n " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_46);
out.write( tagVar(e) );
- out.write( ".setRuntimeParent(" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_47);
out.write( parentTagVar(e) );
- out.write( ");\r\n " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_48);
out.write( tagVar(e) );
- out.write( ".setTagInfo(_TAGS." ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_49);
out.write( tagInfoVar(e) );
- out.write( ");\r\n " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_50);
out.write( tagVar(e) );
- out.write( ".doStart(context, out);\r\n" ); //$NON-NLS-1$
- if(requiresOwnWriter(e)) { out.write( " JET2Writer " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_51);
+ if(requiresOwnWriter(e)) {
+ out.write(_TEXT.TEXT_52);
out.write( tagVar(e) );
- out.write( "_saved_out = out;\r\n" ); //$NON-NLS-1$
- } out.write( " while (" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_53);
+ }
+ out.write(_TEXT.TEXT_54);
out.write( tagVar(e) );
- out.write( ".okToProcessBody()) {\r\n" ); //$NON-NLS-1$
- if(requiresOwnWriter(e)) { out.write( " out = out.newNestedContentWriter();\r\n" ); //$NON-NLS-1$
- }
+ out.write(_TEXT.TEXT_55);
+ if(requiresOwnWriter(e)) {
+ out.write(_TEXT.TEXT_56);
+ }
+
in();
return true;
}
public void endVisit(XMLBodyElement e) {
out();
- out.write( " " ); //$NON-NLS-1$
+
+ out.write(_TEXT.TEXT_57);
out.write( tagVar(e) );
- out.write( ".handleBodyContent(out);\r\n }\r\n" ); //$NON-NLS-1$
- if(requiresOwnWriter(e)) { out.write( " out = " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_58);
+ if(requiresOwnWriter(e)) {
+ out.write(_TEXT.TEXT_59);
out.write( tagVar(e) );
- out.write( "_saved_out;\r\n" ); //$NON-NLS-1$
- } out.write( " " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_60);
+ }
+ out.write(_TEXT.TEXT_61);
out.write( tagVar(e) );
- out.write( ".doEnd();\r\n" ); //$NON-NLS-1$
-
+ out.write(_TEXT.TEXT_62);
+
}
public boolean visit(XMLEmptyElement e) {
- out.write( " RuntimeTagElement " ); //$NON-NLS-1$
+
+ out.write(_TEXT.TEXT_63);
out.write( tagVar(e) );
- out.write( " = context.getTagFactory().createRuntimeTag(_jetns_" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_64);
out.write( e.getNSPrefix() );
- out.write( ", \"" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_65);
out.write( e.getTagNCName() );
- out.write( "\", \"" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_66);
out.write( e.getName() );
- out.write( "\", _TAGS." ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_67);
out.write( tagInfoVar(e) );
- out.write( "); //$NON-NLS-1$ //$NON-NLS-2$\r\n " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_68);
out.write( tagVar(e) );
- out.write( ".setRuntimeParent(" ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_69);
out.write( parentTagVar(e) );
- out.write( ");\r\n " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_70);
out.write( tagVar(e) );
- out.write( ".setTagInfo(_TAGS." ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_71);
out.write( tagInfoVar(e) );
- out.write( ");\r\n " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_72);
out.write( tagVar(e) );
- out.write( ".doStart(context, out);\r\n " ); //$NON-NLS-1$
+ out.write(_TEXT.TEXT_73);
out.write( tagVar(e) );
- out.write( ".doEnd();\r\n" ); //$NON-NLS-1$
-
+ out.write(_TEXT.TEXT_74);
+
return true;
}
});
- out.write( " }\r\n}\r\n" ); //$NON-NLS-1$
-
- }
+ out.write(_TEXT.TEXT_75);
+ }
}