Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2008-02-11 11:40:23 -0500
committerpelder2008-02-11 11:40:23 -0500
commit1c10d76fc4b4612bfaa5dcc54980bee364eb7cff (patch)
treef83ca8c0e1ef88ed671d32c565e95e7ab6f2868e
parent5d767e7019bb66e3a7b24d661683e4fe066b2d55 (diff)
downloadorg.eclipse.jet-1c10d76fc4b4612bfaa5dcc54980bee364eb7cff.tar.gz
org.eclipse.jet-1c10d76fc4b4612bfaa5dcc54980bee364eb7cff.tar.xz
org.eclipse.jet-1c10d76fc4b4612bfaa5dcc54980bee364eb7cff.zip
[196814] New JET projects should not have any Java or PDE warnings
-rw-r--r--plugins/org.eclipse.jet.core/src/org/eclipse/jet/core/compiler/JETCompilerOptions.java32
-rw-r--r--plugins/org.eclipse.jet.ui/.cvsignore1
-rw-r--r--plugins/org.eclipse.jet.ui/NewJETProject.p1.wzPage.xml42
-rw-r--r--plugins/org.eclipse.jet.ui/NewJETProject.p2.wzPage.xml71
-rw-r--r--plugins/org.eclipse.jet.ui/src/org/eclipse/jet/internal/ui/l10n/Messages.java2
-rw-r--r--plugins/org.eclipse.jet.ui/src/org/eclipse/jet/internal/ui/l10n/messages.properties1
-rw-r--r--plugins/org.eclipse.jet.ui/src/org/eclipse/jet/internal/ui/prefs/CompilePreferencePage.java6
-rw-r--r--plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/Messages.java32
-rw-r--r--plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewJETProjectPage1.java75
-rw-r--r--plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewJETProjectPage1Controls.java126
-rw-r--r--plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewJETProjectPage2.java101
-rw-r--r--plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewJETProjectPage2Controls.java210
-rw-r--r--plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewProjectInfo.java21
-rw-r--r--plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewProjectWizard.java30
-rw-r--r--plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/messages.properties15
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/SimplifiedCompiler.java9
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/JET2TransformGenerator.java13
-rw-r--r--plugins/org.eclipse.jet/templates/jet2transform.jet9
-rw-r--r--plugins/org.eclipse.jet/transforms/plugins/org.eclipse.jet.transforms.newproject_1.0.0.jarbin31083 -> 49443 bytes
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/compiler/TestSimplifiedCompiler.java3
-rw-r--r--transforms/org.eclipse.jet.transforms.newproject/sample.xml2
-rw-r--r--transforms/org.eclipse.jet.transforms.newproject/templates/createBasicProject.jet2
-rw-r--r--transforms/org.eclipse.jet.transforms.newproject/templates/project/manifest.mf.jet2
-rw-r--r--transforms/org.eclipse.jet.transforms.newproject/templates/project/org.eclipse.jet.prefs.jet5
-rw-r--r--transforms/org.eclipse.jet.transforms.newproject/templates/project/plugin.xml.jet8
25 files changed, 798 insertions, 20 deletions
diff --git a/plugins/org.eclipse.jet.core/src/org/eclipse/jet/core/compiler/JETCompilerOptions.java b/plugins/org.eclipse.jet.core/src/org/eclipse/jet/core/compiler/JETCompilerOptions.java
index 3e08378..5619c19 100644
--- a/plugins/org.eclipse.jet.core/src/org/eclipse/jet/core/compiler/JETCompilerOptions.java
+++ b/plugins/org.eclipse.jet.core/src/org/eclipse/jet/core/compiler/JETCompilerOptions.java
@@ -1,7 +1,7 @@
/**
* <copyright>
*
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2008 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
@@ -12,7 +12,7 @@
*
* </copyright>
*
- * $Id: JETCompilerOptions.java,v 1.2 2007/04/04 17:27:56 pelder Exp $
+ * $Id: JETCompilerOptions.java,v 1.3 2008/02/11 16:40:17 pelder Exp $
*/
package org.eclipse.jet.core.compiler;
@@ -121,10 +121,34 @@ public final class JETCompilerOptions {
public static final String OPTION_V1_TEMPLATES_DIR = NS + "v1TemplatesDir"; //$NON-NLS-1$
/**
- * Default value for {@link #OPTION_V1_TEMPLATES_DIR}; value "{@value #DEFAULT_V1_TEMPLATES_DIR}.
+ * Default value for {@link #OPTION_V1_TEMPLATES_DIR}; value "{@value #DEFAULT_V1_TEMPLATES_DIR}".
*/
public static final String DEFAULT_V1_TEMPLATES_DIR = "templates"; //$NON-NLS-1$
+
+ /**
+ * Folder name into which Java compiler will place its output of compiled JET templates
+ * @since 0.9.0
+ */
+ public static final String OPTION_JAVA_OUTPUT_FOLDER = NS + "javaOutputFolder"; //$NON-NLS-1$
+
+ /**
+ * Default value for {@link #DEFAULT_JAVA_OUTPUT_FOLDER}; value "{@value #DEFAULT_JAVA_OUTPUT_FOLDER}".
+ * @since 0.9.0
+ */
+ public static final String DEFAULT_JAVA_OUTPUT_FOLDER = "bin"; //$NON-NLS-1$
+
+ /**
+ * Indicates whether the JET Compiler will emit code requiring Java 5 source compliance.
+ * @since 0.9.0
+ */
+ public static final String OPTION_USE_JAVA5 = NS + "useJava5"; //$NON-NLS-1$
+
+ /**
+ * Default value for {@link #OPTION_USE_JAVA5}; value: {@value #DEFAULT_USE_JAVA5}.
+ */
+ public static final String DEFAULT_USE_JAVA5 = Boolean.TRUE.toString();
+
/**
* Lazily initialized Map containing the default compiler options
*/
@@ -168,6 +192,8 @@ public final class JETCompilerOptions {
map.put(OPTION_V1_BASE_TRANSFORMATION,
DEFAULT_V1_BASE_TRANSFORMATION);
map.put(OPTION_V1_TEMPLATES_DIR, DEFAULT_V1_TEMPLATES_DIR);
+ map.put(OPTION_JAVA_OUTPUT_FOLDER, DEFAULT_JAVA_OUTPUT_FOLDER);
+ map.put(OPTION_USE_JAVA5, DEFAULT_USE_JAVA5);
synchronized (defaultCompileOptionsLock) {
defaultCompileOptions = Collections.unmodifiableMap(map);
diff --git a/plugins/org.eclipse.jet.ui/.cvsignore b/plugins/org.eclipse.jet.ui/.cvsignore
index c64fc1c..21c69d5 100644
--- a/plugins/org.eclipse.jet.ui/.cvsignore
+++ b/plugins/org.eclipse.jet.ui/.cvsignore
@@ -1,2 +1,3 @@
bin
org
+dump.xml
diff --git a/plugins/org.eclipse.jet.ui/NewJETProject.p1.wzPage.xml b/plugins/org.eclipse.jet.ui/NewJETProject.p1.wzPage.xml
new file mode 100644
index 0000000..2394733
--- /dev/null
+++ b/plugins/org.eclipse.jet.ui/NewJETProject.p1.wzPage.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../ui.maker/schema.xsd">
+ <wizardPage qualifiedName="org.eclipse.jet.ui.newproject.NewJETProjectPage1">
+ <baseClass qualifiedName="org.eclipse.ui.dialogs.WizardNewProjectCreationPage"/>
+ <control parentID="TOP" id="gProjSet">
+ <type><group text="Project Settings" shadow="NONE"><gridLayout numColumns="2"/></group></type>
+ <gridData><hAlign value="FILL"/><hGrabExcessSpace/></gridData>
+ </control>
+ <control parentID="gProjSet" id="lblTemplateFolder">
+ <type><label text="&amp;Template folder:"/></type>
+ </control>
+ <control parentID="gProjSet" id="txtTemplateFolder">
+ <var name="txtTemplateFolder"/>
+ <type><text multi="false" readOnly="false"></text></type>
+ <gridData><hAlign value="FILL"/><hGrabExcessSpace/></gridData>
+ </control>
+ <control parentID="gProjSet" id="lblJETOutput">
+ <type><label text="J&amp;ET output folder"/></type>
+ </control>
+ <control parentID="gProjSet" id="txtJETOutput">
+ <var name="txtJETOutput"/>
+ <type><text multi="false" readOnly="false"></text></type>
+ <gridData><hAlign value="FILL"/><hGrabExcessSpace/></gridData>
+ </control>
+ <control parentID="gProjSet" id="lblJavaOutput">
+ <type><label text="J&amp;ava output folder"/></type>
+ </control>
+ <control parentID="gProjSet" id="txtJavaOutput">
+ <var name="txtJavaOutput"/>
+ <type><text multi="false" readOnly="false"></text></type>
+ <gridData><hAlign value="FILL"/><hGrabExcessSpace/></gridData>
+ </control>
+ <control parentID="gProjSet" id="lblDefJavaPackage">
+ <type><label text="&amp;Default Java package"/></type>
+ </control>
+ <control parentID="gProjSet" id="txtDefJavaPackage">
+ <var name="txtDefJavaPackage"/>
+ <type><text multi="false" readOnly="false"></text></type>
+ <gridData><hAlign value="FILL"/><hGrabExcessSpace/></gridData>
+ </control>
+ </wizardPage>
+</root>
diff --git a/plugins/org.eclipse.jet.ui/NewJETProject.p2.wzPage.xml b/plugins/org.eclipse.jet.ui/NewJETProject.p2.wzPage.xml
new file mode 100644
index 0000000..fed8823
--- /dev/null
+++ b/plugins/org.eclipse.jet.ui/NewJETProject.p2.wzPage.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../ui.maker/schema.xsd">
+ <wizardPage qualifiedName="org.eclipse.jet.ui.newproject.NewJETProjectPage2">
+ <control parentID="TOP" id="top">
+ <type><composite><gridLayout numColumns="1"/></composite></type>
+ <gridData><hAlign value="FILL"/><vAlign value="FILL"/><hGrabExcessSpace/><vGrabExcessSpace/></gridData>
+ </control>
+ <control parentID="top" id="grpTransProps">
+ <type><group text="Transformation (plug-in) Properties" shadow="NONE"><gridLayout numColumns="2"/></group></type>
+ <gridData><hAlign value="FILL"/><hGrabExcessSpace/></gridData>
+ </control>
+ <!-- Transformation ID: -->
+ <control parentID="grpTransProps" id="lblID">
+ <type><label text="Transformation &amp;ID:"/></type>
+ </control>
+ <control parentID="grpTransProps" id="txtID">
+ <var name="txtID"/>
+ <type><text multi="false" readOnly="false"></text></type>
+ <gridData><hAlign value="FILL"/><hGrabExcessSpace/></gridData>
+ </control>
+
+ <!-- Transformation Name: -->
+ <control parentID="grpTransProps" id="lblName">
+ <type><label text="Transformation &amp;Name:"/></type>
+ </control>
+ <control parentID="grpTransProps" id="txtName">
+ <var name="txtName"/>
+ <type><text multi="false" readOnly="false"></text></type>
+ <gridData><hAlign value="FILL"/><hGrabExcessSpace/></gridData>
+ </control>
+ <!-- Description -->
+ <control parentID="grpTransProps" id="lblDescription">
+ <type><label text="Transformation &amp;Description:"/></type>
+ </control>
+ <control parentID="grpTransProps" id="txtDescription">
+ <var name="txtDescription"/>
+ <type><text multi="false" readOnly="false"></text></type>
+ <gridData><hAlign value="FILL"/><hGrabExcessSpace/></gridData>
+ </control>
+ <!-- Template Loader -->
+ <control parentID="grpTransProps" id="lblTemplateLoader">
+ <type><label text="Template &amp;Loader:"/></type>
+ </control>
+ <control parentID="grpTransProps" id="txtTemplateLoader">
+ <var name="txtTemplateLoader"/>
+ <type><text multi="false" readOnly="false"></text></type>
+ <gridData><hAlign value="FILL"/><hGrabExcessSpace/></gridData>
+ </control>
+
+ <!-- Extensions -->
+ <control parentID="top" id="grpExtensions">
+ <type><group text="Extensions" shadow="NONE"><gridLayout numColumns="2"/></group></type>
+ <gridData><hAlign value="FILL"/><hGrabExcessSpace/></gridData>
+ </control>
+ <control parentID="grpExtensions" id="cbxExtends">
+ <var name="cbxExtends"/>
+ <type><checkButton text="E&amp;xtends Existing JET Transformation"><selection/></checkButton></type>
+ <gridData><hSpan columns="2"/></gridData>
+ </control>
+ <control parentID="grpExtensions" id="lblBaseTx">
+ <var name="lblBaseTx"/>
+ <type><label text="&amp;Base Transformation:"/></type>
+ <gridData><hIndent chars="4"/></gridData>
+ </control>
+ <control parentID="grpExtensions" id="ddlBaseTx">
+ <var name="ddlBaseTx"/>
+ <type><combo dropDown="true" readOnly="true"></combo></type>
+ <gridData><hAlign value="FILL"/><hGrabExcessSpace/></gridData>
+ </control>
+ </wizardPage>
+</root>
diff --git a/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/internal/ui/l10n/Messages.java b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/internal/ui/l10n/Messages.java
index cbd78bf..2a40b37 100644
--- a/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/internal/ui/l10n/Messages.java
+++ b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/internal/ui/l10n/Messages.java
@@ -59,6 +59,8 @@ public class Messages extends NLS {
public static String CompilePreferencePage_TemplatesDirLabel;
+ public static String CompilePreferencePage_use_java5;
+
public static String ExtensionListEditor_AddDialogErrorMsg;
public static String ExtensionListEditor_AddDialogPrompt;
diff --git a/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/internal/ui/l10n/messages.properties b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/internal/ui/l10n/messages.properties
index 2eac7d9..db65712 100644
--- a/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/internal/ui/l10n/messages.properties
+++ b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/internal/ui/l10n/messages.properties
@@ -53,6 +53,7 @@ CompilePreferencePage_CompileBaseTemplates=&Compile all base templates to Java c
CompilePreferencePage_JavaPackage=Default Java &Package:
CompilePreferencePage_JET1_OPTION=JET&1 - String generate(Object argument)
CompilePreferencePage_JET2_Option=JET&2 - void generate(JET2Context context, JET2Writer out)
+CompilePreferencePage_use_java5=Use &Java 5 language features
CompilePreferencePage_FileExtensions=&File extensions for templates:
CompilePreferencePage_SourceFolder=Java &Source folder:
CompilePreferencePage_DeriveJavaFiles=&Hide compiled Java from Team system (mark .java files derived)
diff --git a/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/internal/ui/prefs/CompilePreferencePage.java b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/internal/ui/prefs/CompilePreferencePage.java
index 740ca84..e0047d5 100644
--- a/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/internal/ui/prefs/CompilePreferencePage.java
+++ b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/internal/ui/prefs/CompilePreferencePage.java
@@ -69,6 +69,7 @@ public class CompilePreferencePage extends FieldEditorPreferencePage implements
private Composite v1OptionsGroup;
private Composite v2OptionsGroup;
private boolean v1OptionsEnabled;
+ private BooleanFieldEditor useJava5FieldEditor;
/**
* @param style
@@ -126,6 +127,9 @@ public class CompilePreferencePage extends FieldEditorPreferencePage implements
Messages.CompilePreferencePage_DeriveJavaFiles, javaGenerationGroup);
addField(derivedJavaFieldEditor);
+ useJava5FieldEditor = new BooleanFieldEditor(JETCompilerOptions.OPTION_USE_JAVA5, Messages.CompilePreferencePage_use_java5, javaGenerationGroup);
+ addField(useJava5FieldEditor);
+
// v1 options group
v1OptionsGroup = createGroup(Messages.CompilePreferencePage_JET1OptionsGroupLabel);
templatesFolderFieldEditor = new StringFieldEditor(JETCompilerOptions.OPTION_V1_TEMPLATES_DIR,
@@ -148,6 +152,7 @@ public class CompilePreferencePage extends FieldEditorPreferencePage implements
compileBaseTemplatesFieldEditor = new BooleanFieldEditor(JETCompilerOptions.OPTION_V1_COMPILE_BASE_TEMPLATES, Messages.CompilePreferencePage_CompileBaseTemplates, v1OptionsGroup);
addField(compileBaseTemplatesFieldEditor);
+
}
// v2 options group
@@ -162,6 +167,7 @@ public class CompilePreferencePage extends FieldEditorPreferencePage implements
addField(packageFieldEditor);
+
}
private boolean isValidURIList(String uriList) {
diff --git a/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/Messages.java b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/Messages.java
new file mode 100644
index 0000000..faa98b6
--- /dev/null
+++ b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/Messages.java
@@ -0,0 +1,32 @@
+
+package org.eclipse.jet.ui.newproject;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.jet.ui.newproject.messages"; //$NON-NLS-1$
+ public static String NewJETProjectPage2Controls__groupgrpTransProps_text;
+ public static String NewJETProjectPage2Controls__labellblID_text;
+ public static String NewJETProjectPage2Controls__labellblName_text;
+ public static String NewJETProjectPage2Controls__labellblDescription_text;
+ public static String NewJETProjectPage2Controls__labellblTemplateLoader_text;
+ public static String NewJETProjectPage2Controls__groupgrpExtensions_text;
+ public static String NewJETProjectPage2Controls_cbxExtends_text;
+ public static String NewJETProjectPage2Controls_lblBaseTx_text;
+ public static String NewJETProjectPage2Controls__labellblBaseTx_text;
+ public static String NewJETProjectPage1Controls__groupgProjSet_text;
+ public static String NewJETProjectPage1Controls__groupgProjectSettings_text;
+ public static String NewJETProjectPage1Controls__labellblJETVersion_text;
+ public static String NewJETProjectPage1Controls__labellblTemplateFolder_text;
+ public static String NewJETProjectPage1Controls__labellblJETOutput_text;
+ public static String NewJETProjectPage1Controls__labellblJavaOutput_text;
+ public static String NewJETProjectPage1Controls__labellblDefJavaPackage_text;
+ public static String NewJETProjectPage1Controls__labellblJabaCompliance_text;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewJETProjectPage1.java b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewJETProjectPage1.java
new file mode 100644
index 0000000..18371d3
--- /dev/null
+++ b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewJETProjectPage1.java
@@ -0,0 +1,75 @@
+
+package org.eclipse.jet.ui.newproject;
+
+import org.eclipse.swt.events.*;
+import org.eclipse.jet.core.compiler.JETCompilerOptions;
+import org.eclipse.jet.ui.Activator;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.widgets.Composite;
+
+public class NewJETProjectPage1 extends NewJETProjectPage1Controls {
+
+
+ public NewJETProjectPage1(String pageName) {
+ super(pageName);
+ }
+
+ public void createControl(Composite parent) {
+ // super.createControl guarantees all controls are created.
+ super.createControl(parent);
+
+ // initialize control data
+ final IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
+
+ txtTemplateFolder.setText("templates");
+ txtJETOutput.setText(preferenceStore.getDefaultString(JETCompilerOptions.OPTION_COMPILED_TEMPLATE_SRC_DIR));
+ txtJavaOutput.setText(preferenceStore.getDefaultString(JETCompilerOptions.OPTION_JAVA_OUTPUT_FOLDER));
+ txtDefJavaPackage.setText(preferenceStore.getDefaultString(JETCompilerOptions.OPTION_COMPILED_TEMPLATE_PACKAGE));
+
+ }
+
+ protected boolean validatePage() {
+ // TODO Auto-generated method stub
+ final boolean parentValid = super.validatePage();
+ if(!parentValid) {
+ return false;
+ }
+
+ final String id = getBaseID();
+
+ txtDefJavaPackage.setText(id + ".compiled");
+
+ return true;
+ }
+
+ /**
+ * @return
+ */
+ String getBaseID() {
+ final String projectName = getProjectName();
+
+ final String id = projectName.replaceAll("[^a-zA-Z0-9\\._]", "_");
+ return id;
+ }
+
+ public String getDefJavaPackage() {
+ return txtDefJavaPackage.getText();
+ }
+
+ public String getTemplateFolder() {
+ return txtTemplateFolder.getText().trim();
+ }
+
+ public String getJETOutputFolder() {
+ return txtJETOutput.getText().trim();
+ }
+
+ public String getJavaOutputFolder() {
+ return txtJavaOutput.getText().trim();
+ }
+
+ public String getDefaultJavaPackage() {
+ return txtDefJavaPackage.getText().trim();
+ }
+
+}
diff --git a/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewJETProjectPage1Controls.java b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewJETProjectPage1Controls.java
new file mode 100644
index 0000000..4d48b52
--- /dev/null
+++ b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewJETProjectPage1Controls.java
@@ -0,0 +1,126 @@
+package org.eclipse.jet.ui.newproject;
+
+import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.layout.*;
+import org.eclipse.swt.widgets.*;
+
+public abstract class NewJETProjectPage1Controls
+ extends WizardNewProjectCreationPage {
+
+ protected Text txtTemplateFolder;
+ protected Text txtJETOutput;
+ protected Text txtJavaOutput;
+ protected Text txtDefJavaPackage;
+
+
+ protected NewJETProjectPage1Controls(String pageName) {
+ super(pageName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ super.createControl(parent);
+ // retarget parent to the control composite established by the base class
+ parent = (Composite)getControl();
+ initializeDialogUnits(parent);
+
+ // working variables for creating grid layout info
+ GridLayout _gl;
+ GridData _gd;
+
+ Group _groupgProjSet;
+ _groupgProjSet = new Group(parent, SWT.NONE);
+ _groupgProjSet.setText(Messages.NewJETProjectPage1Controls__groupgProjSet_text);
+ _groupgProjSet.setFont(parent.getFont());
+
+
+ // layout _groupgProjSet within parent
+ _gd = new GridData();
+ _gd.horizontalAlignment = GridData.FILL;
+ _gd.grabExcessHorizontalSpace = true;
+ _groupgProjSet.setLayoutData(_gd);
+
+ // Initialize _groupgProjSet layout
+ _gl = new GridLayout();
+ _gl.numColumns = 2;
+ _groupgProjSet.setLayout(_gl);
+
+ Label _labellblTemplateFolder;
+ _labellblTemplateFolder = new Label(_groupgProjSet, SWT.NONE);
+ _labellblTemplateFolder.setText(Messages.NewJETProjectPage1Controls__labellblTemplateFolder_text);
+ _labellblTemplateFolder.setFont(_groupgProjSet.getFont());
+
+
+
+ txtTemplateFolder = new Text(_groupgProjSet, SWT.BORDER);
+ txtTemplateFolder.setFont(_groupgProjSet.getFont());
+
+
+ // layout txtTemplateFolder within _groupgProjSet
+ _gd = new GridData();
+ _gd.horizontalAlignment = GridData.FILL;
+ _gd.grabExcessHorizontalSpace = true;
+ txtTemplateFolder.setLayoutData(_gd);
+
+ Label _labellblJETOutput;
+ _labellblJETOutput = new Label(_groupgProjSet, SWT.NONE);
+ _labellblJETOutput.setText(Messages.NewJETProjectPage1Controls__labellblJETOutput_text);
+ _labellblJETOutput.setFont(_groupgProjSet.getFont());
+
+
+
+ txtJETOutput = new Text(_groupgProjSet, SWT.BORDER);
+ txtJETOutput.setFont(_groupgProjSet.getFont());
+
+
+ // layout txtJETOutput within _groupgProjSet
+ _gd = new GridData();
+ _gd.horizontalAlignment = GridData.FILL;
+ _gd.grabExcessHorizontalSpace = true;
+ txtJETOutput.setLayoutData(_gd);
+
+ Label _labellblJavaOutput;
+ _labellblJavaOutput = new Label(_groupgProjSet, SWT.NONE);
+ _labellblJavaOutput.setText(Messages.NewJETProjectPage1Controls__labellblJavaOutput_text);
+ _labellblJavaOutput.setFont(_groupgProjSet.getFont());
+
+
+
+ txtJavaOutput = new Text(_groupgProjSet, SWT.BORDER);
+ txtJavaOutput.setFont(_groupgProjSet.getFont());
+
+
+ // layout txtJavaOutput within _groupgProjSet
+ _gd = new GridData();
+ _gd.horizontalAlignment = GridData.FILL;
+ _gd.grabExcessHorizontalSpace = true;
+ txtJavaOutput.setLayoutData(_gd);
+
+ Label _labellblDefJavaPackage;
+ _labellblDefJavaPackage = new Label(_groupgProjSet, SWT.NONE);
+ _labellblDefJavaPackage.setText(Messages.NewJETProjectPage1Controls__labellblDefJavaPackage_text);
+ _labellblDefJavaPackage.setFont(_groupgProjSet.getFont());
+
+
+
+ txtDefJavaPackage = new Text(_groupgProjSet, SWT.BORDER);
+ txtDefJavaPackage.setFont(_groupgProjSet.getFont());
+
+
+ // layout txtDefJavaPackage within _groupgProjSet
+ _gd = new GridData();
+ _gd.horizontalAlignment = GridData.FILL;
+ _gd.grabExcessHorizontalSpace = true;
+ txtDefJavaPackage.setLayoutData(_gd);
+
+
+ }
+
+
+
+
+}
diff --git a/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewJETProjectPage2.java b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewJETProjectPage2.java
new file mode 100644
index 0000000..354dff7
--- /dev/null
+++ b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewJETProjectPage2.java
@@ -0,0 +1,101 @@
+
+package org.eclipse.jet.ui.newproject;
+
+import org.eclipse.jet.JET2Platform;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.widgets.Composite;
+
+public class NewJETProjectPage2 extends NewJETProjectPage2Controls {
+
+
+ private NewJETProjectPage1 page1;
+
+
+ public NewJETProjectPage2(String pageName) {
+ super(pageName);
+ setTitle("JET Transformation Properties");
+ setDescription("Enter the data required to generate the JET transformation");
+ }
+
+ public void createControl(Composite parent) {
+ // super.createControl guarantees all controls are created.
+ super.createControl(parent);
+
+ // initialize control data
+ setExtends(false);
+
+ final String[] allIDs = JET2Platform.getJETBundleManager().getAllTransformIds();
+ for (int i = 0; i < allIDs.length; i++) {
+ ddlBaseTx.add(allIDs[i]);
+ }
+ }
+
+ private void setExtends(boolean setExtends) {
+ // TODO Auto-generated method stub
+ if(setExtends != cbxExtends.getSelection()) {
+ cbxExtends.setSelection(setExtends);
+ }
+ lblBaseTx.setEnabled(setExtends);
+ ddlBaseTx.setEnabled(setExtends);
+
+ }
+
+ public void setJETProjectPage1(NewJETProjectPage1 page1) {
+ this.page1 = page1;
+
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jet.ui.newproject.NewJETProjectPage2Controls#cbxExtends_selection(org.eclipse.swt.events.SelectionEvent)
+ */
+ protected void cbxExtends_selection(SelectionEvent e) {
+ final boolean selected = cbxExtends.getSelection();
+ setExtends(selected);
+ if(selected) {
+ ddlBaseTx.setFocus();
+ }
+ getContainer().updateButtons();
+ }
+
+
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+ if(visible && page1 != null) {
+ txtTemplateLoader.setText(page1.getDefJavaPackage() + "._jet_transformation");
+ txtID.setText(page1.getBaseID());
+ txtName.setText(page1.getBaseID());
+ }
+ }
+
+ public boolean isExtension() {
+ return cbxExtends.getSelection();
+ }
+
+ public String getTransformID() {
+ return txtID.getText().trim();
+ }
+
+ public String getTransformName() {
+ return txtName.getText().trim();
+ }
+
+ public String getTransformDescription() {
+ return txtDescription.getText().trim();
+ }
+
+ public String getTemplateLoader() {
+ return txtTemplateLoader.getText().trim();
+ }
+
+ public String getBaseTransformID() {
+ return ddlBaseTx.getText().trim();
+ }
+
+ public IWizardPage getNextPage() {
+ if(getWizard() != null && isExtension()) {
+ return super.getNextPage();
+ } else {
+ return null;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewJETProjectPage2Controls.java b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewJETProjectPage2Controls.java
new file mode 100644
index 0000000..50eaf6a
--- /dev/null
+++ b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewJETProjectPage2Controls.java
@@ -0,0 +1,210 @@
+package org.eclipse.jet.ui.newproject;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.layout.*;
+import org.eclipse.swt.widgets.*;
+
+public abstract class NewJETProjectPage2Controls
+ extends WizardPage {
+
+ protected Text txtID;
+ protected Text txtName;
+ protected Text txtDescription;
+ protected Text txtTemplateLoader;
+ protected Button cbxExtends;
+ protected Label lblBaseTx;
+ protected Combo ddlBaseTx;
+
+
+ protected NewJETProjectPage2Controls(String pageName) {
+ super(pageName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ initializeDialogUnits(parent);
+
+ // working variables for creating grid layout info
+ GridLayout _gl;
+ GridData _gd;
+
+ Composite _compositetop;
+ _compositetop = new Composite(parent, SWT.NULL);
+ _compositetop.setFont(parent.getFont());
+ setControl(_compositetop);
+
+
+ // layout _compositetop within parent
+ _gd = new GridData();
+ _gd.horizontalAlignment = GridData.FILL;
+ _gd.grabExcessHorizontalSpace = true;
+ _gd.verticalAlignment = GridData.FILL;
+ _gd.grabExcessVerticalSpace = true;
+ _compositetop.setLayoutData(_gd);
+
+ // Initialize _compositetop layout
+ _gl = new GridLayout();
+ _gl.numColumns = 1;
+ _compositetop.setLayout(_gl);
+
+ Group _groupgrpTransProps;
+ _groupgrpTransProps = new Group(_compositetop, SWT.NONE);
+ _groupgrpTransProps.setText(Messages.NewJETProjectPage2Controls__groupgrpTransProps_text);
+ _groupgrpTransProps.setFont(_compositetop.getFont());
+
+
+ // layout _groupgrpTransProps within _compositetop
+ _gd = new GridData();
+ _gd.horizontalAlignment = GridData.FILL;
+ _gd.grabExcessHorizontalSpace = true;
+ _groupgrpTransProps.setLayoutData(_gd);
+
+ // Initialize _groupgrpTransProps layout
+ _gl = new GridLayout();
+ _gl.numColumns = 2;
+ _groupgrpTransProps.setLayout(_gl);
+
+ Label _labellblID;
+ _labellblID = new Label(_groupgrpTransProps, SWT.NONE);
+ _labellblID.setText(Messages.NewJETProjectPage2Controls__labellblID_text);
+ _labellblID.setFont(_groupgrpTransProps.getFont());
+
+
+
+ txtID = new Text(_groupgrpTransProps, SWT.BORDER);
+ txtID.setFont(_groupgrpTransProps.getFont());
+
+
+ // layout txtID within _groupgrpTransProps
+ _gd = new GridData();
+ _gd.horizontalAlignment = GridData.FILL;
+ _gd.grabExcessHorizontalSpace = true;
+ txtID.setLayoutData(_gd);
+
+ Label _labellblName;
+ _labellblName = new Label(_groupgrpTransProps, SWT.NONE);
+ _labellblName.setText(Messages.NewJETProjectPage2Controls__labellblName_text);
+ _labellblName.setFont(_groupgrpTransProps.getFont());
+
+
+
+ txtName = new Text(_groupgrpTransProps, SWT.BORDER);
+ txtName.setFont(_groupgrpTransProps.getFont());
+
+
+ // layout txtName within _groupgrpTransProps
+ _gd = new GridData();
+ _gd.horizontalAlignment = GridData.FILL;
+ _gd.grabExcessHorizontalSpace = true;
+ txtName.setLayoutData(_gd);
+
+ Label _labellblDescription;
+ _labellblDescription = new Label(_groupgrpTransProps, SWT.NONE);
+ _labellblDescription.setText(Messages.NewJETProjectPage2Controls__labellblDescription_text);
+ _labellblDescription.setFont(_groupgrpTransProps.getFont());
+
+
+
+ txtDescription = new Text(_groupgrpTransProps, SWT.BORDER);
+ txtDescription.setFont(_groupgrpTransProps.getFont());
+
+
+ // layout txtDescription within _groupgrpTransProps
+ _gd = new GridData();
+ _gd.horizontalAlignment = GridData.FILL;
+ _gd.grabExcessHorizontalSpace = true;
+ txtDescription.setLayoutData(_gd);
+
+ Label _labellblTemplateLoader;
+ _labellblTemplateLoader = new Label(_groupgrpTransProps, SWT.NONE);
+ _labellblTemplateLoader.setText(Messages.NewJETProjectPage2Controls__labellblTemplateLoader_text);
+ _labellblTemplateLoader.setFont(_groupgrpTransProps.getFont());
+
+
+
+ txtTemplateLoader = new Text(_groupgrpTransProps, SWT.BORDER);
+ txtTemplateLoader.setFont(_groupgrpTransProps.getFont());
+
+
+ // layout txtTemplateLoader within _groupgrpTransProps
+ _gd = new GridData();
+ _gd.horizontalAlignment = GridData.FILL;
+ _gd.grabExcessHorizontalSpace = true;
+ txtTemplateLoader.setLayoutData(_gd);
+
+ Group _groupgrpExtensions;
+ _groupgrpExtensions = new Group(_compositetop, SWT.NONE);
+ _groupgrpExtensions.setText(Messages.NewJETProjectPage2Controls__groupgrpExtensions_text);
+ _groupgrpExtensions.setFont(_compositetop.getFont());
+
+
+ // layout _groupgrpExtensions within _compositetop
+ _gd = new GridData();
+ _gd.horizontalAlignment = GridData.FILL;
+ _gd.grabExcessHorizontalSpace = true;
+ _groupgrpExtensions.setLayoutData(_gd);
+
+ // Initialize _groupgrpExtensions layout
+ _gl = new GridLayout();
+ _gl.numColumns = 2;
+ _groupgrpExtensions.setLayout(_gl);
+
+ cbxExtends = new Button(_groupgrpExtensions, SWT.CHECK | SWT.RIGHT);
+ cbxExtends.setText(Messages.NewJETProjectPage2Controls_cbxExtends_text);
+
+ cbxExtends.setFont(_groupgrpExtensions.getFont());
+
+
+ // layout cbxExtends within _groupgrpExtensions
+ _gd = new GridData();
+ _gd.horizontalSpan = 2;
+ cbxExtends.setLayoutData(_gd);
+ // register event handlers for cbxExtends
+ cbxExtends.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ cbxExtends_selection(e);
+ }
+ });
+
+ lblBaseTx = new Label(_groupgrpExtensions, SWT.NONE);
+ lblBaseTx.setText(Messages.NewJETProjectPage2Controls_lblBaseTx_text);
+ lblBaseTx.setFont(_groupgrpExtensions.getFont());
+
+
+ // layout lblBaseTx within _groupgrpExtensions
+ _gd = new GridData();
+ _gd.horizontalIndent = convertWidthInCharsToPixels(4);
+ lblBaseTx.setLayoutData(_gd);
+
+ ddlBaseTx = new Combo(_groupgrpExtensions, SWT.RIGHT
+ | SWT.DROP_DOWN
+ | SWT.READ_ONLY
+ );
+ ddlBaseTx.setFont(_groupgrpExtensions.getFont());
+
+
+ // layout ddlBaseTx within _groupgrpExtensions
+ _gd = new GridData();
+ _gd.horizontalAlignment = GridData.FILL;
+ _gd.grabExcessHorizontalSpace = true;
+ ddlBaseTx.setLayoutData(_gd);
+
+
+ }
+
+
+ /**
+ * Selection event handler for {@link #cbxExtends}.
+ * @param e an event containing information on the selection
+ * @see SelectionListener
+ * @see SelectionListener#widgetSelected(SelectionEvent)
+ */
+ protected abstract void cbxExtends_selection(SelectionEvent e);
+
+
+
+}
diff --git a/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewProjectInfo.java b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewProjectInfo.java
index 6c95a44..9aa0269 100644
--- a/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewProjectInfo.java
+++ b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewProjectInfo.java
@@ -1,7 +1,7 @@
/**
* <copyright>
*
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2008 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
@@ -25,13 +25,13 @@ import java.util.Map;
* Represents information required to create a new JET2 Project
*
*/
-public class NewProjectInfo {
+public final class NewProjectInfo {
private String projectName;
private Map otherInfo = null;
private static final String NL = System.getProperty("line.separator"); //$NON-NLS-1$
private static final String INDENT = " "; //$NON-NLS-1$
- private String location = null;
+ private final Map projectAttributes = new LinkedHashMap();
public NewProjectInfo() {
// nothing to do
@@ -50,6 +50,7 @@ public class NewProjectInfo {
*/
public final void setProjectName(String projectName) {
this.projectName = projectName;
+ setProjectAttribute("name", projectName);
}
public String toXmlString() {
@@ -59,8 +60,12 @@ public class NewProjectInfo {
StringBuffer xml = new StringBuffer();
xml.append("<newProjectModel>").append(NL); //$NON-NLS-1$
xml.append(INDENT).append("<project"); //$NON-NLS-1$
- addAttribute(xml, "name", projectName); //$NON-NLS-1$
- addAttribute(xml, "location", location); //$NON-NLS-1$
+ for (Iterator i = projectAttributes.entrySet().iterator(); i.hasNext();) {
+ Map.Entry entry = (Map.Entry) i.next();
+ addAttribute(xml, (String)entry.getKey(), (String)entry.getValue());
+ }
+// addAttribute(xml, "name", projectName); //$NON-NLS-1$
+// addAttribute(xml, "location", location); //$NON-NLS-1$
xml.append("/>").append(NL); //$NON-NLS-1$
if(otherInfo != null) {
for (Iterator i = otherInfo.values().iterator(); i.hasNext();) {
@@ -95,6 +100,10 @@ public class NewProjectInfo {
}
public void setLocation(String location) {
- this.location = location;
+ setProjectAttribute("location", location);
+ }
+
+ public void setProjectAttribute(String attributeName, String value) {
+ projectAttributes.put(attributeName, value);
}
}
diff --git a/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewProjectWizard.java b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewProjectWizard.java
index 53e2a58..09e8718 100644
--- a/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewProjectWizard.java
+++ b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewProjectWizard.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 2008 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
@@ -27,10 +27,10 @@ import org.eclipse.jet.ui.Activator;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
/**
* Implement New Project Wizard for JET2 transforms.
@@ -39,9 +39,10 @@ import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
public class NewProjectWizard extends Wizard implements INewWizard {
private static final String NEW_PROJECT_WIZARD_TX_ID = "org.eclipse.jet.transforms.newproject"; //$NON-NLS-1$
- private WizardNewProjectCreationPage projectPage;
+ private NewJETProjectPage1 projectPage;
protected final NewProjectInfo newProjectInfo = new NewProjectInfo();
+ private NewJETProjectPage2 projectPropertiesPage;
/**
*
@@ -82,6 +83,18 @@ public class NewProjectWizard extends Wizard implements INewWizard {
if(!projectPage.useDefaults()) {
newProjectInfo.setLocation(projectPage.getLocationPath().toString());
}
+ newProjectInfo.setProjectAttribute("binDir", projectPage.getJavaOutputFolder());
+ newProjectInfo.setProjectAttribute("jet2javaDir", projectPage.getJETOutputFolder());
+ newProjectInfo.setProjectAttribute("templatesDir", projectPage.getTemplateFolder());
+ newProjectInfo.setProjectAttribute("bundleName", projectPropertiesPage.getTransformName());
+ newProjectInfo.setProjectAttribute("bundleSymbolicName", projectPropertiesPage.getTransformID());
+ newProjectInfo.setProjectAttribute("dfltJavaPackage", projectPage.getDefaultJavaPackage());
+ newProjectInfo.setProjectAttribute("description", projectPropertiesPage.getTransformDescription());
+ newProjectInfo.setProjectAttribute("templateLoader", projectPropertiesPage.getTemplateLoader());
+ if(projectPropertiesPage.isExtension()) {
+ newProjectInfo.setProjectAttribute("baseID", projectPropertiesPage.getBaseTransformID());
+ }
+
return newProjectInfo.toXmlString();
}
@@ -95,10 +108,19 @@ public class NewProjectWizard extends Wizard implements INewWizard {
public void addPages() {
super.addPages();
- projectPage = new WizardNewProjectCreationPage(Messages.NewProjectWizard_MainPageTabText);
+ projectPage= new NewJETProjectPage1(Messages.NewProjectWizard_MainPageTabText);
projectPage.setTitle(Messages.NewProjectWizard_MainPageTitle);
projectPage.setDescription(Messages.NewProjectWizard_MainPageDescription);
addPage(projectPage);
+ projectPropertiesPage = new NewJETProjectPage2(Messages.NewProjectWizard_MainPageTabText);
+ projectPropertiesPage.setJETProjectPage1(projectPage);
+ addPage(projectPropertiesPage);
}
+
+ public boolean canFinish() {
+ final IWizardPage currentPage = getContainer().getCurrentPage();
+ return super.canFinish() && currentPage != projectPage;
+ }
+
}
diff --git a/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/messages.properties b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/messages.properties
new file mode 100644
index 0000000..ee11406
--- /dev/null
+++ b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/messages.properties
@@ -0,0 +1,15 @@
+
+NewJETProjectPage1Controls__groupgProjSet_text=Project Settings
+NewJETProjectPage1Controls__labellblTemplateFolder_text=&Template folder:
+NewJETProjectPage1Controls__labellblJETOutput_text=J&ET output folder
+NewJETProjectPage1Controls__labellblJavaOutput_text=J&ava output folder
+NewJETProjectPage1Controls__labellblDefJavaPackage_text=&Default Java package
+NewJETProjectPage1Controls__labellblJabaCompliance_text=Java &compliance level:
+NewJETProjectPage2Controls__groupgrpTransProps_text=Transformation (plug-in) Properties
+NewJETProjectPage2Controls__labellblID_text=Transformation &ID:
+NewJETProjectPage2Controls__labellblName_text=Transformation &Name:
+NewJETProjectPage2Controls__labellblDescription_text=Transformation &Description:
+NewJETProjectPage2Controls__labellblTemplateLoader_text=Template &Loader:
+NewJETProjectPage2Controls__groupgrpExtensions_text=Extensions
+NewJETProjectPage2Controls_cbxExtends_text=E&xtends Existing JET Transformation
+NewJETProjectPage2Controls_lblBaseTx_text=&Base Transformation:
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/SimplifiedCompiler.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/SimplifiedCompiler.java
index c6c972e..2b6b329 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/SimplifiedCompiler.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/SimplifiedCompiler.java
@@ -1,7 +1,7 @@
/**
* <copyright>
*
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2008 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
@@ -12,7 +12,7 @@
*
* </copyright>
*
- * $Id: SimplifiedCompiler.java,v 1.2 2007/05/16 16:44:13 pelder Exp $
+ * $Id: SimplifiedCompiler.java,v 1.3 2008/02/11 16:40:13 pelder Exp $
*/
package org.eclipse.jet.internal.compiler;
@@ -489,8 +489,11 @@ public final class SimplifiedCompiler implements IJETCompiler
templateLoaderClassName, uniqueNameGenerator.getPathToFQNMap());
// run the code generator
+ Map argsMap = new HashMap(2);
+ argsMap.put("args", args); //$NON-NLS-1$
+ argsMap.put("useJava5", options.get(JETCompilerOptions.OPTION_USE_JAVA5)); //$NON-NLS-1$
String code = templateRunner.generate("templates/jet2transform.jet", //$NON-NLS-1$
- Collections.singletonMap("args", args)); //$NON-NLS-1$
+ argsMap);
compilerOutput.writeOutput(outputPath(templateLoaderPackage, templateLoaderClassName),
NewLineUtil.setLineTerminator(code, NL), null);
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 8905115..c0ac206 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
@@ -23,6 +23,7 @@ public class JET2TransformGenerator implements JET2Template {
LoaderGenerationParameters parms = (LoaderGenerationParameters)context.getVariable("args"); //$NON-NLS-1$
Map templateMap = (Map) parms.getTemplateMap();;
+boolean useJava5 = context.hasVariable("useJava5") ? Boolean.valueOf((String)context.getVariable("useJava5")).booleanValue() : false;
out.write("package "); //$NON-NLS-1$
out.write( parms.getPackageName() );
@@ -113,8 +114,13 @@ Map templateMap = (Map) parms.getTemplateMap();;
out.write(" }"); //$NON-NLS-1$
out.write(NL);
out.write(NL);
+ if(useJava5) {
+ out.write(" private Map<String,TemplateFactoryMethod> pathToFactoryMap = null;"); //$NON-NLS-1$
+ out.write(NL);
+ } else {
out.write(" private Map pathToFactoryMap = null;"); //$NON-NLS-1$
out.write(NL);
+ }
out.write(" "); //$NON-NLS-1$
out.write(NL);
out.write(" private JET2TemplateLoader delegate = null;"); //$NON-NLS-1$
@@ -156,10 +162,17 @@ Map templateMap = (Map) parms.getTemplateMap();;
out.write(NL);
out.write(" private void initPathToFactoryMap() {"); //$NON-NLS-1$
out.write(NL);
+if(useJava5) {
+ out.write(" this.pathToFactoryMap = new HashMap<String,TemplateFactoryMethod>("); //$NON-NLS-1$
+ out.write( templateMap.size() );
+ out.write(");"); //$NON-NLS-1$
+ out.write(NL);
+ } else {
out.write(" this.pathToFactoryMap = new HashMap("); //$NON-NLS-1$
out.write( templateMap.size() );
out.write(");"); //$NON-NLS-1$
out.write(NL);
+ }
List templatePaths = new ArrayList(templateMap.keySet());
Collections.sort(templatePaths);
diff --git a/plugins/org.eclipse.jet/templates/jet2transform.jet b/plugins/org.eclipse.jet/templates/jet2transform.jet
index 9bb5b35..16c239e 100644
--- a/plugins/org.eclipse.jet/templates/jet2transform.jet
+++ b/plugins/org.eclipse.jet/templates/jet2transform.jet
@@ -10,6 +10,7 @@
<%
LoaderGenerationParameters parms = (LoaderGenerationParameters)context.getVariable("args"); //$NON-NLS-1$
Map templateMap = (Map) parms.getTemplateMap();;
+boolean useJava5 = context.hasVariable("useJava5") ? Boolean.valueOf((String)context.getVariable("useJava5")).booleanValue() : false;
%>
package <%= parms.getPackageName() %>;
@@ -58,7 +59,11 @@ public class <%= parms.getClassName() %> implements JET2TemplateLoader, JET2Temp
}
+<% if(useJava5) { %>
+ private Map<String,TemplateFactoryMethod> pathToFactoryMap = null;
+<% } else { %>
private Map pathToFactoryMap = null;
+<% } %>
private JET2TemplateLoader delegate = null;
@@ -80,7 +85,11 @@ public class <%= parms.getClassName() %> implements JET2TemplateLoader, JET2Temp
}
private void initPathToFactoryMap() {
+<%if(useJava5) { %>
+ this.pathToFactoryMap = new HashMap<String,TemplateFactoryMethod>(<%= templateMap.size() %>);
+<% } else { %>
this.pathToFactoryMap = new HashMap(<%= templateMap.size() %>);
+<% } %>
<%
List templatePaths = new ArrayList(templateMap.keySet());
Collections.sort(templatePaths);
diff --git a/plugins/org.eclipse.jet/transforms/plugins/org.eclipse.jet.transforms.newproject_1.0.0.jar b/plugins/org.eclipse.jet/transforms/plugins/org.eclipse.jet.transforms.newproject_1.0.0.jar
index 0b99668..7ca1d80 100644
--- a/plugins/org.eclipse.jet/transforms/plugins/org.eclipse.jet.transforms.newproject_1.0.0.jar
+++ b/plugins/org.eclipse.jet/transforms/plugins/org.eclipse.jet.transforms.newproject_1.0.0.jar
Binary files differ
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/compiler/TestSimplifiedCompiler.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/compiler/TestSimplifiedCompiler.java
index dca5dec..f02e067 100644
--- a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/compiler/TestSimplifiedCompiler.java
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/compiler/TestSimplifiedCompiler.java
@@ -208,8 +208,11 @@ public class TestSimplifiedCompiler extends TestCase {
* @throws Exception
*/
public void testFinish() throws Exception {
+ Map options = new HashMap(JETCompilerOptions.getDefaultCompilerOptions());
+ options.put(JETCompilerOptions.OPTION_USE_JAVA5, "false");
IJETCompiler compiler = new SimplifiedCompiler.Builder(JETAST.JET_SPEC_V2, baseLocation, compilerOutput)
.templateLoaderFQN("org.eclipse.jet.compiled.TemplateLoaderClass")
+ .options(options)
.build();
final String templatePath1 = "simple.v2.input.jet";
diff --git a/transforms/org.eclipse.jet.transforms.newproject/sample.xml b/transforms/org.eclipse.jet.transforms.newproject/sample.xml
index e17f4dd..62663fd 100644
--- a/transforms/org.eclipse.jet.transforms.newproject/sample.xml
+++ b/transforms/org.eclipse.jet.transforms.newproject/sample.xml
@@ -1,3 +1,3 @@
<newProjectModel>
- <project name="foo.bar" bundleName="Foo Bar Project" bundleSymbolicName="foo.bar.id"/>
+ <project name="foo.bar"/>
</newProjectModel> \ No newline at end of file
diff --git a/transforms/org.eclipse.jet.transforms.newproject/templates/createBasicProject.jet b/transforms/org.eclipse.jet.transforms.newproject/templates/createBasicProject.jet
index 2ee663d..fed661f 100644
--- a/transforms/org.eclipse.jet.transforms.newproject/templates/createBasicProject.jet
+++ b/transforms/org.eclipse.jet.transforms.newproject/templates/createBasicProject.jet
@@ -17,6 +17,7 @@
<c:if test="not($project/@bundleSymbolicName)"><c:set select="$project" name="bundleSymbolicName"><c:get select="$project/@name"/></c:set></c:if>
<c:if test="not($project/@bundleVersion)"><c:set select="$project" name="bundleVersion">1.0.0</c:set></c:if>
<c:if test="not($project/@bundleVendor)"><c:set select="$project" name="bundleVendor"></c:set></c:if>
+ <c:if test="not($project/@dfltJavaPackage)"><c:set select="$project" name="dfltJavaPackage">org.eclipse.jet.compiled</c:set></c:if>
*** Traverse the model and generate artifacts
--- Generate artifacts for the current root element
@@ -34,6 +35,7 @@
<ws:file template="templates/project/project.jet" path=".project" />
<ws:file template="templates/project/build.properties.jet" path="build.properties" />
<ws:file template="templates/project/plugin.xml.jet" path="plugin.xml" />
+ <ws:file template="templates/project/org.eclipse.jet.prefs.jet" path=".settings/org.eclipse.jet.prefs"/>
<ws:folder path="{$project/@binDir}"/>
<ws:folder path="{$project/@jet2javaDir}"/>
diff --git a/transforms/org.eclipse.jet.transforms.newproject/templates/project/manifest.mf.jet b/transforms/org.eclipse.jet.transforms.newproject/templates/project/manifest.mf.jet
index f235531..6a92ebe 100644
--- a/transforms/org.eclipse.jet.transforms.newproject/templates/project/manifest.mf.jet
+++ b/transforms/org.eclipse.jet.transforms.newproject/templates/project/manifest.mf.jet
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: <c:get select="$project/@bundleName" />
Bundle-SymbolicName: <c:get select="$project/@bundleSymbolicName" />;singleton:=true
Bundle-Version: <c:get select="$project/@bundleVersion"/>
-Bundle-Localization: plugin
+<%-- Bundle-Localization: plugin --%>
Bundle-Vendor:
Require-Bundle: org.eclipse.jet
Bundle-ClassPath: .,<c:get select="$project/@binDir"/>/
diff --git a/transforms/org.eclipse.jet.transforms.newproject/templates/project/org.eclipse.jet.prefs.jet b/transforms/org.eclipse.jet.transforms.newproject/templates/project/org.eclipse.jet.prefs.jet
new file mode 100644
index 0000000..34cfcf0
--- /dev/null
+++ b/transforms/org.eclipse.jet.transforms.newproject/templates/project/org.eclipse.jet.prefs.jet
@@ -0,0 +1,5 @@
+#<f:formatNow pattern="EEE MMM dd HH:mm:ss zzz yyyy"/>
+eclipse.preferences.version=1
+org.eclipse.jet.compiledTemplatePackage=<c:get select="$project/@dfltJavaPackage"/>
+org.eclipse.jet.compiledTemplateSrcDir=<c:get select="$project/@jet2javaDir"/>
+org.eclipse.jet.projectPrefs=true
diff --git a/transforms/org.eclipse.jet.transforms.newproject/templates/project/plugin.xml.jet b/transforms/org.eclipse.jet.transforms.newproject/templates/project/plugin.xml.jet
index 45cf3bf..cf7eb0e 100644
--- a/transforms/org.eclipse.jet.transforms.newproject/templates/project/plugin.xml.jet
+++ b/transforms/org.eclipse.jet.transforms.newproject/templates/project/plugin.xml.jet
@@ -8,8 +8,12 @@
point="org.eclipse.jet.transform">
<transform
startTemplate="<c:get select="$project/@templatesDir" />/<c:get select="$project/@startTemplate" />"
- templateLoaderClass="<c:get select="$project/@templateLoader" />" >
- <description></description>
+ templateLoaderClass="<c:get select="$project/@templateLoader" />"
+<c:if test="$project/@baseID">
+ overrides="<c:get select="$project/@baseID" />"
+</c:if>
+ >
+ <description><c:get select="$project/@description" default=""/></description>
<tagLibraries>
<importLibrary id="org.eclipse.jet.controlTags" usePrefix="c" autoImport="true"/>
<importLibrary id="org.eclipse.jet.javaTags" usePrefix="java" autoImport="true"/>

Back to the top