Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortle2010-08-05 01:13:50 +0000
committertle2010-08-05 01:13:50 +0000
commit342cf4898f59c2fc8d11809f3454e9280c05f714 (patch)
tree05e4cdb933e6b9fb6c6a73481d1a96ea3f9a7cbe
parent5ad7da32f067cee11b817150ee5df983d2afe222 (diff)
downloadwebtools.dali-342cf4898f59c2fc8d11809f3454e9280c05f714.tar.gz
webtools.dali-342cf4898f59c2fc8d11809f3454e9280c05f714.tar.xz
webtools.dali-342cf4898f59c2fc8d11809f3454e9280c05f714.zip
316342 - JAXB Class Gen Wizard - Would be nice to add checkboxes for some compiler arguments
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/property_files/jpt_jaxb_ui.properties29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/core/internal/ClassesGenerator.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/core/internal/ClassesGeneratorExtensionOptions.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/core/internal/ClassesGeneratorOptions.java173
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiMessages.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorExtensionOptionsWizardPage.java186
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorOptionsWizardPage.java754
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java93
9 files changed, 1426 insertions, 33 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/property_files/jpt_jaxb_ui.properties b/jpa/plugins/org.eclipse.jpt.jaxb.ui/property_files/jpt_jaxb_ui.properties
index 18f577a714..a610587ff6 100644
--- a/jpa/plugins/org.eclipse.jpt.jaxb.ui/property_files/jpt_jaxb_ui.properties
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/property_files/jpt_jaxb_ui.properties
@@ -27,6 +27,35 @@ ClassesGeneratorWizardPage_removeButton = Remove
ClassesGeneratorWizardPage_chooseABindingsFile = External Bindings File Selection
ClassesGeneratorWizardPage_chooseACatalog = Catalog File Selection
+ClassesGeneratorOptionsWizardPage_title = Classes Generator Options
+ClassesGeneratorOptionsWizardPage_desc = Configure JAXB compiler options.
+
+ClassesGeneratorOptionsWizardPage_proxy = Proxy:
+ClassesGeneratorOptionsWizardPage_proxyFile = Proxy file:
+
+ClassesGeneratorOptionsWizardPage_useStrictValidation = Use strict validation
+ClassesGeneratorOptionsWizardPage_makeReadOnly = Generate read-only files
+ClassesGeneratorOptionsWizardPage_suppressPackageInfoGen = Suppress package-info generation
+ClassesGeneratorOptionsWizardPage_suppressesHeaderGen = Suppress generation of file header
+ClassesGeneratorOptionsWizardPage_target = Target XJC 2.0
+ClassesGeneratorOptionsWizardPage_verbose = Verbose
+ClassesGeneratorOptionsWizardPage_quiet = Suppress compiler output
+
+ClassesGeneratorOptionsWizardPage_treatsAsXmlSchema = Treat input as XML schema
+ClassesGeneratorOptionsWizardPage_treatsAsRelaxNg = Treat input as RELAX NG
+ClassesGeneratorOptionsWizardPage_treatsAsRelaxNgCompact = Treat input as RELAX NG compact syntax
+ClassesGeneratorOptionsWizardPage_treatsAsDtd = Treat input as XML DTD
+ClassesGeneratorOptionsWizardPage_treatsAsWsdl = Treat input as WSDL and compile schema inside it
+ClassesGeneratorOptionsWizardPage_showsVersion = Show version
+ClassesGeneratorOptionsWizardPage_showsHelp = Show help
+
+ClassesGeneratorExtensionOptionsWizardPage_title = Classes Generator Extension Configuration
+ClassesGeneratorExtensionOptionsWizardPage_desc = Configure JAXB compiler vendor extensions.
+
+ClassesGeneratorExtensionOptionsWizardPage_allowExtensions = Allow vendor extensions
+ClassesGeneratorExtensionOptionsWizardPage_classpath = Classpath:
+ClassesGeneratorExtensionOptionsWizardPage_additionalArguments = Additional arguments:
+
ClassesGeneratorWizardPage_jaxbLibrariesNotAvailable = \
The classpath for this project does not appear to contain the necessary libraries to proceed with class generation.\
\nPlease insure that a JAXB implementation is available on the classpath.
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/core/internal/ClassesGenerator.java b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/core/internal/ClassesGenerator.java
index 1bf7fa6edc..2625e54105 100644
--- a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/core/internal/ClassesGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/core/internal/ClassesGenerator.java
@@ -40,6 +40,8 @@ public class ClassesGenerator extends AbstractJptGenerator
private final String targetPackage;
private final String catalog;
private final String[] bindingsFileNames;
+ private final ClassesGeneratorOptions generatorOptions;
+ private final ClassesGeneratorExtensionOptions generatorExtensionOptions;
private final String mainType;
// ********** static methods **********
@@ -50,8 +52,10 @@ public class ClassesGenerator extends AbstractJptGenerator
String outputDir,
String targetPackage,
String catalog,
- boolean useMoxyGenerator,
+ boolean usesMoxyGenerator,
String[] bindingsFileNames,
+ ClassesGeneratorOptions generatorOptions,
+ ClassesGeneratorExtensionOptions generatorExtensionOptions,
IProgressMonitor monitor) {
if (javaProject == null) {
throw new NullPointerException();
@@ -61,8 +65,10 @@ public class ClassesGenerator extends AbstractJptGenerator
outputDir,
targetPackage,
catalog,
- useMoxyGenerator,
- bindingsFileNames).generate(monitor);
+ usesMoxyGenerator,
+ bindingsFileNames,
+ generatorOptions,
+ generatorExtensionOptions).generate(monitor);
}
// ********** constructors **********
@@ -73,15 +79,19 @@ public class ClassesGenerator extends AbstractJptGenerator
String outputDir,
String targetPackage,
String catalog,
- boolean useMoxyGenerator,
- String[] bindingsFileNames) {
+ boolean usesMoxyGenerator,
+ String[] bindingsFileNames,
+ ClassesGeneratorOptions generatorOptions,
+ ClassesGeneratorExtensionOptions generatorExtensionOptions) {
super(javaProject);
this.xmlSchemaName = xmlSchemaName;
this.outputDir = outputDir;
this.targetPackage = targetPackage;
this.catalog = catalog;
this.bindingsFileNames = bindingsFileNames;
- this.mainType = (useMoxyGenerator) ? JAXB_ECLIPSELINK_GEN_CLASS : JAXB_GENERIC_GEN_CLASS;
+ this.generatorOptions = generatorOptions;
+ this.generatorExtensionOptions = generatorExtensionOptions;
+ this.mainType = (usesMoxyGenerator) ? JAXB_ECLIPSELINK_GEN_CLASS : JAXB_GENERIC_GEN_CLASS;
}
@Override
@@ -132,8 +142,11 @@ public class ClassesGenerator extends AbstractJptGenerator
@Override
protected void specifyProgramArguments() {
StringBuffer programArguments = new StringBuffer();
- // options
+
programArguments.append("-d "); //$NON-NLS-1$
+ if(StringTools.stringIsEmpty(this.outputDir)) {
+ throw new RuntimeException("Output directory cannot be empty"); //$NON-NLS-1$
+ }
programArguments.append(this.outputDir);
if( ! StringTools.stringIsEmpty(this.targetPackage)) {
programArguments.append(" -p "); //$NON-NLS-1$
@@ -143,6 +156,74 @@ public class ClassesGenerator extends AbstractJptGenerator
programArguments.append(" -catalog "); //$NON-NLS-1$
programArguments.append(this.catalog);
}
+
+ // Options
+ if( ! StringTools.stringIsEmpty(this.generatorOptions.getProxy())) {
+ programArguments.append(" -httpproxy "); //$NON-NLS-1$
+ programArguments.append(this.generatorOptions.getProxy());
+ }
+ if( ! StringTools.stringIsEmpty(this.generatorOptions.getProxyFile())) {
+ programArguments.append(" -httpproxyfile "); //$NON-NLS-1$
+ programArguments.append(this.generatorOptions.getProxyFile());
+ }
+
+ if( ! this.generatorOptions.usesStrictValidation()) {
+ programArguments.append(" -nv"); //$NON-NLS-1$
+ }
+ if(this.generatorOptions.makesReadOnly()) {
+ programArguments.append(" -readOnly"); //$NON-NLS-1$
+ }
+ if(this.generatorOptions.suppressesPackageInfoGen()) {
+ programArguments.append(" -npa"); //$NON-NLS-1$
+ }
+ if(this.generatorOptions.suppressesHeaderGen()) {
+ programArguments.append(" -no-header"); //$NON-NLS-1$
+ }
+ if(this.generatorOptions.targetIs20()) {
+ programArguments.append(" -target 2.0"); //$NON-NLS-1$
+ }
+ if(this.generatorOptions.isVerbose()) {
+ programArguments.append(" -verbose"); //$NON-NLS-1$
+ }
+ if(this.generatorOptions.isQuiet()) {
+ programArguments.append(" -quiet"); //$NON-NLS-1$
+ }
+
+ if(this.generatorOptions.treatsAsXmlSchema()) {
+ programArguments.append(" -xmlschema"); //$NON-NLS-1$
+ }
+ if(this.generatorOptions.treatsAsRelaxNg()) {
+ programArguments.append(" -relaxng"); //$NON-NLS-1$
+ }
+ if(this.generatorOptions.treatsAsRelaxNgCompact()) {
+ programArguments.append(" -relaxng-compact"); //$NON-NLS-1$
+ }
+ if(this.generatorOptions.treatsAsDtd()) {
+ programArguments.append(" -dtd"); //$NON-NLS-1$
+ }
+ if(this.generatorOptions.treatsAsWsdl()) {
+ programArguments.append(" -wsdl"); //$NON-NLS-1$
+ }
+ if(this.generatorOptions.showsVersion()) {
+ programArguments.append(" -version"); //$NON-NLS-1$
+ }
+ if(this.generatorOptions.showsHelp()) {
+ programArguments.append(" -help"); //$NON-NLS-1$
+ }
+
+ // Extension Options
+ if(this.generatorExtensionOptions.allowsExtensions()) {
+ programArguments.append(" -extension"); //$NON-NLS-1$
+ }
+ if( ! StringTools.stringIsEmpty(this.generatorExtensionOptions.getClasspath())) {
+ programArguments.append(" -classpath "); //$NON-NLS-1$
+ programArguments.append(this.generatorExtensionOptions.getClasspath());
+ }
+ if( ! StringTools.stringIsEmpty(this.generatorExtensionOptions.getAdditionalArgs())) {
+ programArguments.append(' ');
+ programArguments.append(this.generatorExtensionOptions.getAdditionalArgs());
+ }
+
// schema
programArguments.append(' ');
programArguments.append(this.xmlSchemaName);
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/core/internal/ClassesGeneratorExtensionOptions.java b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/core/internal/ClassesGeneratorExtensionOptions.java
new file mode 100644
index 0000000000..1c5d3beda3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/core/internal/ClassesGeneratorExtensionOptions.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+* Copyright (c) 2010 Oracle. 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:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal;
+
+/**
+ * ClassesGeneratorExtensionOptions
+ */
+public class ClassesGeneratorExtensionOptions
+{
+ private String classpath;
+ private boolean allowsExtensions;
+
+ private String additionalArgs;
+
+ // ********** constructor **********
+
+ public ClassesGeneratorExtensionOptions() {
+ super();
+ }
+
+ // ********** getters/setters *********
+
+ public boolean allowsExtensions() {
+ return this.allowsExtensions;
+ }
+
+ public void setAllowsExtensions(boolean allowsExtensions) {
+ this.allowsExtensions = allowsExtensions;
+ }
+
+ public String getClasspath() {
+ return this.classpath;
+ }
+
+ public void setClasspath(String classpath){
+ this.classpath = classpath;
+ }
+
+ public String getAdditionalArgs() {
+ return this.additionalArgs;
+ }
+
+ public void setAdditionalArgs(String additionalArgs){
+ this.additionalArgs = additionalArgs;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/core/internal/ClassesGeneratorOptions.java b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/core/internal/ClassesGeneratorOptions.java
new file mode 100644
index 0000000000..eda66a9dec
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/core/internal/ClassesGeneratorOptions.java
@@ -0,0 +1,173 @@
+/*******************************************************************************
+* Copyright (c) 2010 Oracle. 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:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal;
+
+
+/**
+ * ClassesGeneratorOptions
+ */
+public class ClassesGeneratorOptions
+{
+ private String proxy;
+ private String proxyFile;
+
+ private boolean usesStrictValidation;
+ private boolean makesReadOnly;
+ private boolean suppressesPackageInfoGen;
+ private boolean suppressesHeaderGen;
+ private boolean targetIs20;
+ private boolean isVerbose;
+ private boolean isQuiet;
+
+ private boolean treatsAsXmlSchema;
+ private boolean treatsAsRelaxNg;
+ private boolean treatsAsRelaxNgCompact;
+ private boolean treatsAsDtd;
+ private boolean treatsAsWsdl;
+ private boolean showsVersion;
+ private boolean showsHelp;
+
+ // ********** constructor **********
+
+ public ClassesGeneratorOptions() {
+ super();
+ }
+
+ // ********** getters/setters *********
+
+ public String getProxy() {
+ return this.proxy;
+ }
+
+ public void setProxy(String proxy){
+ this.proxy = proxy;
+ }
+
+ public String getProxyFile() {
+ return this.proxyFile;
+ }
+
+ public void setProxyFile(String proxyFile){
+ this.proxyFile = proxyFile;
+ }
+
+ public boolean suppressesPackageInfoGen() {
+ return this.suppressesPackageInfoGen;
+ }
+
+ public void setSuppressesPackageInfoGen(boolean suppressesPackageInfoGen) {
+ this.suppressesPackageInfoGen = suppressesPackageInfoGen;
+ }
+
+ public boolean usesStrictValidation() {
+ return this.usesStrictValidation;
+ }
+
+ public void setUsesStrictValidation(boolean usesStrictValidation) {
+ this.usesStrictValidation = usesStrictValidation;
+ }
+
+ public boolean makesReadOnly() {
+ return this.makesReadOnly;
+ }
+
+ public void setMakesReadOnly(boolean makesReadOnly) {
+ this.makesReadOnly = makesReadOnly;
+ }
+
+ public boolean suppressesHeaderGen() {
+ return this.suppressesHeaderGen;
+ }
+
+ public void setSuppressesHeaderGen(boolean suppressesHeaderGen){
+ this.suppressesHeaderGen = suppressesHeaderGen;
+ }
+
+ public boolean targetIs20() {
+ return this.targetIs20;
+ }
+
+ public void setTargetIs20(boolean targetIs20){
+ this.targetIs20 = targetIs20;
+ }
+
+ public boolean isVerbose() {
+ return this.isVerbose;
+ }
+
+ public void setIsVerbose(boolean isVerbose){
+ this.isVerbose = isVerbose;
+ }
+
+ public boolean isQuiet() {
+ return this.isQuiet;
+ }
+
+ public void setIsQuiet(boolean isQuiet){
+ this.isQuiet = isQuiet;
+ }
+
+ public boolean treatsAsXmlSchema() {
+ return this.treatsAsXmlSchema;
+ }
+
+ public void setTreatsAsXmlSchema(boolean treatsAsXmlSchema){
+ this.treatsAsXmlSchema = treatsAsXmlSchema;
+ }
+
+ public boolean treatsAsRelaxNg() {
+ return this.treatsAsRelaxNg;
+ }
+
+ public void setTreatsAsRelaxNg(boolean treatsAsRelaxNg){
+ this.treatsAsRelaxNg = treatsAsRelaxNg;
+ }
+
+ public boolean treatsAsRelaxNgCompact() {
+ return this.treatsAsRelaxNgCompact;
+ }
+
+ public void setTreatsAsRelaxNgCompact(boolean treatsAsRelaxNgCompact){
+ this.treatsAsRelaxNgCompact = treatsAsRelaxNgCompact;
+ }
+
+ public boolean treatsAsDtd() {
+ return this.treatsAsDtd;
+ }
+
+ public void setTreatsAsDtd(boolean treatsAsDtd){
+ this.treatsAsDtd = treatsAsDtd;
+ }
+
+ public boolean treatsAsWsdl() {
+ return this.treatsAsWsdl;
+ }
+
+ public void setTreatsAsWsdl(boolean treatsAsWsdl){
+ this.treatsAsWsdl = treatsAsWsdl;
+ }
+
+ public boolean showsVersion() {
+ return this.showsVersion;
+ }
+
+ public void setShowsVersion(boolean showsVersion){
+ this.showsVersion = showsVersion;
+ }
+
+ public boolean showsHelp() {
+ return this.showsHelp;
+ }
+
+ public void setShowsHelp(boolean showsHelp){
+ this.showsHelp = showsHelp;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java
index b2999765d0..fb515919b4 100644
--- a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java
@@ -25,6 +25,8 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jpt.jaxb.core.internal.ClassesGenerator;
+import org.eclipse.jpt.jaxb.core.internal.ClassesGeneratorExtensionOptions;
+import org.eclipse.jpt.jaxb.core.internal.ClassesGeneratorOptions;
import org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen.ClassesGeneratorWizard;
import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.swt.widgets.Display;
@@ -74,11 +76,13 @@ public class ClassesGeneratorUi {
String outputDir = wizard.getDestinationFolder();
String targetPackage = wizard.getTargetPackage();
String catalog = wizard.getCatalog();
- boolean useMoxy = wizard.getUseMoxy();
+ boolean usesMoxy = wizard.usesMoxy();
String[] bindingsFileNames = wizard.getBindingsFileNames();
+ ClassesGeneratorOptions generatorOptions = wizard.getGeneratorOptions();
+ ClassesGeneratorExtensionOptions generatorExtensionOptions = wizard.getGeneratorExtensionOptions();
if(this.displayGeneratingClassesWarning()) {
- this.run(outputDir, targetPackage, catalog, useMoxy, bindingsFileNames);
+ this.run(outputDir, targetPackage, catalog, usesMoxy, bindingsFileNames, generatorOptions, generatorExtensionOptions);
}
}
@@ -88,8 +92,10 @@ public class ClassesGeneratorUi {
String outputDir,
String targetPackage,
String catalog,
- boolean useMoxyGenerator,
- String[] bindingsFileNames) {
+ boolean usesMoxyGenerator,
+ String[] bindingsFileNames,
+ ClassesGeneratorOptions generatorOptions,
+ ClassesGeneratorExtensionOptions generatorExtensionOptions) {
WorkspaceJob job = new GenerateEntitiesJob(
this.javaProject,
@@ -97,8 +103,10 @@ public class ClassesGeneratorUi {
outputDir,
targetPackage,
catalog,
- useMoxyGenerator,
- bindingsFileNames);
+ usesMoxyGenerator,
+ bindingsFileNames,
+ generatorOptions,
+ generatorExtensionOptions);
job.schedule();
}
@@ -122,8 +130,10 @@ public class ClassesGeneratorUi {
private final String outputDir;
private final String targetPackage;
private final String catalog;
- private final boolean useMoxyGenerator;
+ private final boolean usesMoxyGenerator;
private final String[] bindingsFileNames;
+ private final ClassesGeneratorOptions generatorOptions;
+ private final ClassesGeneratorExtensionOptions generatorExtensionOptions;
// ********** constructors **********
@@ -133,8 +143,10 @@ public class ClassesGeneratorUi {
String outputDir,
String targetPackage,
String catalog,
- boolean useMoxyGenerator,
- String[] bindingsFileNames) {
+ boolean usesMoxyGenerator,
+ String[] bindingsFileNames,
+ ClassesGeneratorOptions generatorOptions,
+ ClassesGeneratorExtensionOptions generatorExtensionOptions) {
super(JptJaxbUiMessages.ClassesGeneratorUi_generatingEntities);
this.javaProject = javaProject;
@@ -142,8 +154,10 @@ public class ClassesGeneratorUi {
this.outputDir = outputDir;
this.targetPackage = targetPackage;
this.catalog = catalog;
- this.useMoxyGenerator = useMoxyGenerator;
+ this.usesMoxyGenerator = usesMoxyGenerator;
this.bindingsFileNames = bindingsFileNames;
+ this.generatorOptions = generatorOptions;
+ this.generatorExtensionOptions = generatorExtensionOptions;
this.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(this.javaProject.getProject()));
}
@@ -156,8 +170,10 @@ public class ClassesGeneratorUi {
this.outputDir,
this.targetPackage,
this.catalog,
- this.useMoxyGenerator,
+ this.usesMoxyGenerator,
this.bindingsFileNames,
+ this.generatorOptions,
+ this.generatorExtensionOptions,
sm.newChild(1));
}
catch (OperationCanceledException e) {
@@ -179,8 +195,10 @@ public class ClassesGeneratorUi {
String outputDir,
String targetPackage,
String catalog,
- boolean useMoxyGenerator,
+ boolean usesMoxyGenerator,
String[] bindingsFileNames,
+ ClassesGeneratorOptions generatorOptions,
+ ClassesGeneratorExtensionOptions generatorExtensionOptions,
IProgressMonitor monitor) {
ClassesGenerator.generate(javaProject,
@@ -188,8 +206,10 @@ public class ClassesGeneratorUi {
outputDir,
targetPackage,
catalog,
- useMoxyGenerator,
+ usesMoxyGenerator,
bindingsFileNames,
+ generatorOptions,
+ generatorExtensionOptions,
monitor);
return;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiMessages.java b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiMessages.java
index a8e556d1f1..096fb5ba70 100644
--- a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiMessages.java
@@ -35,7 +35,36 @@ public class JptJaxbUiMessages {
public static String ClassesGeneratorWizardPage_removeButton;
public static String ClassesGeneratorWizardPage_chooseABindingsFile;
public static String ClassesGeneratorWizardPage_chooseACatalog;
+
+ public static String ClassesGeneratorOptionsWizardPage_title;
+ public static String ClassesGeneratorOptionsWizardPage_desc;
+
+ public static String ClassesGeneratorOptionsWizardPage_proxy;
+ public static String ClassesGeneratorOptionsWizardPage_proxyFile;
+
+ public static String ClassesGeneratorOptionsWizardPage_useStrictValidation;
+ public static String ClassesGeneratorOptionsWizardPage_makeReadOnly;
+ public static String ClassesGeneratorOptionsWizardPage_suppressPackageInfoGen;
+ public static String ClassesGeneratorOptionsWizardPage_suppressesHeaderGen;
+ public static String ClassesGeneratorOptionsWizardPage_target;
+ public static String ClassesGeneratorOptionsWizardPage_verbose;
+ public static String ClassesGeneratorOptionsWizardPage_quiet;
+
+ public static String ClassesGeneratorOptionsWizardPage_treatsAsXmlSchema;
+ public static String ClassesGeneratorOptionsWizardPage_treatsAsRelaxNg;
+ public static String ClassesGeneratorOptionsWizardPage_treatsAsRelaxNgCompact;
+ public static String ClassesGeneratorOptionsWizardPage_treatsAsDtd;
+ public static String ClassesGeneratorOptionsWizardPage_treatsAsWsdl;
+ public static String ClassesGeneratorOptionsWizardPage_showsVersion;
+ public static String ClassesGeneratorOptionsWizardPage_showsHelp;
+
+ public static String ClassesGeneratorExtensionOptionsWizardPage_title;
+ public static String ClassesGeneratorExtensionOptionsWizardPage_desc;
+ public static String ClassesGeneratorExtensionOptionsWizardPage_allowExtensions;
+ public static String ClassesGeneratorExtensionOptionsWizardPage_classpath;
+ public static String ClassesGeneratorExtensionOptionsWizardPage_additionalArguments;
+
public static String ClassesGeneratorWizardPage_jaxbLibrariesNotAvailable;
public static String ClassesGeneratorWizardPage_moxyLibrariesNotAvailable;
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorExtensionOptionsWizardPage.java b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorExtensionOptionsWizardPage.java
new file mode 100644
index 0000000000..1e867a57d9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorExtensionOptionsWizardPage.java
@@ -0,0 +1,186 @@
+/*******************************************************************************
+* Copyright (c) 2010 Oracle. 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:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * ClassesGeneratorExtensionOptionsWizardPage
+ */
+public class ClassesGeneratorExtensionOptionsWizardPage extends WizardPage
+{
+
+ private ExtensionOptionsComposite additionalArgsComposite;
+
+ // ********** constructor **********
+
+ protected ClassesGeneratorExtensionOptionsWizardPage() {
+ super("Classes Generator Extension Options"); //$NON-NLS-1$
+
+ this.initialize();
+ }
+
+ protected void initialize() {
+ this.setTitle(JptJaxbUiMessages.ClassesGeneratorExtensionOptionsWizardPage_title);
+ this.setDescription(JptJaxbUiMessages.ClassesGeneratorExtensionOptionsWizardPage_desc);
+ }
+
+ // ********** UI components **********
+
+ public void createControl(Composite parent) {
+ this.setPageComplete(true);
+ this.setControl(this.buildTopLevelControl(parent));
+ }
+
+ private Control buildTopLevelControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setLayout(new GridLayout());
+
+ this.additionalArgsComposite = new ExtensionOptionsComposite(composite);
+
+ return composite;
+ }
+
+ // ********** intra-wizard methods **********
+
+ protected boolean allowsExtensions() {
+ return this.additionalArgsComposite.allowsExtensions();
+ }
+
+ protected String getClasspath() {
+ return this.additionalArgsComposite.getClasspath();
+ }
+
+ protected String getAdditionalArgs() {
+ return this.additionalArgsComposite.getAdditionalArgs();
+ }
+
+ // ********** AdditionalArgsComposite **********
+
+ class ExtensionOptionsComposite {
+
+ private boolean allowsExtensions;
+ private final Text classpathText;
+ private final Button allowsExtensionsCheckBox;
+
+ private final Text additionalArgsText;
+
+ // ********** constructor **********
+
+ private ExtensionOptionsComposite(Composite parent) {
+ super();
+ this.allowsExtensions = false;
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ // TODO PlatformUI.getWorkbench().getHelpSystem().setHelp(this.group, JpaHelpContextIds.XXX);
+
+ this.allowsExtensionsCheckBox = this.buildAllowsExtensionsCheckBox(composite, this.buildAllowsExtensionsSelectionListener());
+
+ // Classpath
+ Label classpathLabel = new Label(composite, SWT.NONE);
+ classpathLabel.setText(JptJaxbUiMessages.ClassesGeneratorExtensionOptionsWizardPage_classpath);
+ GridData gridData = new GridData();
+ gridData.verticalIndent = 5;
+ classpathLabel.setLayoutData(gridData);
+ this.classpathText = this.buildClasspathText(composite);
+
+ Label additionalArgsLabel = new Label(composite, SWT.NONE);
+ additionalArgsLabel.setText(JptJaxbUiMessages.ClassesGeneratorExtensionOptionsWizardPage_additionalArguments);
+ gridData = new GridData();
+ gridData.verticalIndent = 5;
+ additionalArgsLabel.setLayoutData(gridData);
+ this.additionalArgsText = this.buildAdditionalArgsText(composite);
+ }
+
+ // ********** UI components **********
+
+ private Button buildAllowsExtensionsCheckBox(Composite parent, SelectionListener listener) {
+ Button checkBox = new Button(parent, SWT.CHECK);
+ GridData gridData = new GridData();
+ gridData.verticalIndent = 5;
+ checkBox.setLayoutData(gridData);
+ checkBox.setText(JptJaxbUiMessages.ClassesGeneratorExtensionOptionsWizardPage_allowExtensions);
+ checkBox.setSelection(this.allowsExtensions());
+ checkBox.addSelectionListener(listener);
+ return checkBox;
+ }
+
+ private Text buildClasspathText(Composite parent) {
+ Text text = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.horizontalSpan = 1;
+ gridData.verticalIndent = 1;
+ gridData.heightHint = text.getLineHeight() * 3;
+ gridData.grabExcessHorizontalSpace = true;
+ text.setLayoutData(gridData);
+ return text;
+ }
+
+ private Text buildAdditionalArgsText(Composite parent) {
+ Text text = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.horizontalSpan = 1;
+ gridData.verticalIndent = 1;
+ gridData.heightHint = text.getLineHeight() * 10;
+ gridData.grabExcessHorizontalSpace = true;
+ text.setLayoutData(gridData);
+ return text;
+ }
+
+ // ********** listeners **********
+
+ private SelectionListener buildAllowsExtensionsSelectionListener() {
+ return new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent event) {
+ this.widgetSelected(event);
+ }
+ public void widgetSelected(SelectionEvent event) {
+ ExtensionOptionsComposite.this.setAllowsExtensions(
+ ExtensionOptionsComposite.this.allowsExtensionsCheckBox.getSelection());
+ }
+ };
+ }
+
+ // ********** intra-wizard methods **********
+
+ protected boolean allowsExtensions() {
+ return this.allowsExtensions;
+ }
+
+ protected void setAllowsExtensions(boolean allowsExtensions){
+ this.allowsExtensions = allowsExtensions;
+ }
+
+ protected String getClasspath() {
+ return this.classpathText.getText();
+ }
+
+ protected String getAdditionalArgs() {
+ return this.additionalArgsText.getText();
+ }
+
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorOptionsWizardPage.java b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorOptionsWizardPage.java
new file mode 100644
index 0000000000..098501ad69
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorOptionsWizardPage.java
@@ -0,0 +1,754 @@
+/*******************************************************************************
+* Copyright (c) 2010 Oracle. 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:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * ClassesGeneratorOptionsWizardPage
+ */
+public class ClassesGeneratorOptionsWizardPage extends WizardPage
+{
+ private ProxyOptionsComposite proxyOptionsComposite;
+ private Options1Composite options1Composite;
+ private Options2Composite options2Composite;
+
+ // ********** constructor **********
+
+ protected ClassesGeneratorOptionsWizardPage() {
+ super("Classes Generator Options"); //$NON-NLS-1$
+
+ this.initialize();
+ }
+
+ protected void initialize() {
+ this.setTitle(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_title);
+ this.setDescription(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_desc);
+ }
+
+ // ********** UI components **********
+
+ public void createControl(Composite parent) {
+ this.setPageComplete(true);
+ this.setControl(this.buildTopLevelControl(parent));
+ }
+
+ private Control buildTopLevelControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setLayout(new GridLayout());
+
+ this.proxyOptionsComposite = new ProxyOptionsComposite(composite);
+
+ this.buildOptionsComposites(composite);
+
+ return composite;
+ }
+
+ private void buildOptionsComposites(Composite parent) {
+
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setLayout(new GridLayout(2, true));
+
+ this.options1Composite = new Options1Composite(composite);
+
+ this.options2Composite = new Options2Composite(composite);
+ }
+
+ // ********** intra-wizard methods **********
+
+ protected String getProxy() {
+ return this.proxyOptionsComposite.getProxy();
+ }
+
+ protected String getProxyFile() {
+ return this.proxyOptionsComposite.getProxyFile();
+ }
+
+ protected boolean usesStrictValidation() {
+ return this.options1Composite.usesStrictValidation();
+ }
+
+ protected boolean makesReadOnly() {
+ return this.options1Composite.makesReadOnly();
+ }
+
+ protected boolean suppressesPackageInfoGen() {
+ return this.options1Composite.suppressesPackageInfoGen();
+ }
+
+ protected boolean suppressesHeaderGen() {
+ return this.options1Composite.suppressesHeaderGen();
+ }
+
+ protected boolean getTarget() {
+ return this.options1Composite.targetIs20();
+ }
+
+ protected boolean isVerbose() {
+ return this.options1Composite.isVerbose();
+ }
+
+ protected boolean isQuiet() {
+ return this.options1Composite.isQuiet();
+ }
+
+ protected boolean treatsAsXmlSchema() {
+ return this.options2Composite.treatsAsXmlSchema();
+ }
+
+ protected boolean treatsAsRelaxNg() {
+ return this.options2Composite.treatsAsRelaxNg();
+ }
+
+ protected boolean treatsAsRelaxNgCompact() {
+ return this.options2Composite.treatsAsRelaxNgCompact();
+ }
+
+ protected boolean treatsAsDtd() {
+ return this.options2Composite.treatsAsDtd();
+ }
+
+ protected boolean treatsAsWsdl() {
+ return this.options2Composite.treatsAsWsdl();
+ }
+
+ protected boolean showsVersion() {
+ return this.options2Composite.showsVersion();
+ }
+
+ protected boolean showsHelp() {
+ return this.options2Composite.showsHelp();
+ }
+
+
+ // ********** ProxyOptionsComposite **********
+
+ class ProxyOptionsComposite {
+
+ private final Text proxyText;
+ private final Text proxyFileText;
+
+ // ********** constructor **********
+
+ private ProxyOptionsComposite(Composite parent) {
+ super();
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(3, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ // TODO PlatformUI.getWorkbench().getHelpSystem().setHelp(this.group, JpaHelpContextIds.XXX);
+
+ // Proxy
+ Label proxyLabel = new Label(composite, SWT.NONE);
+ proxyLabel.setText(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_proxy);
+ GridData gridData = new GridData();
+ gridData.verticalIndent = 5;
+ proxyLabel.setLayoutData(gridData);
+ this.proxyText = this.buildProxyText(composite);
+
+ // ProxyFile
+ Label proxyFileLabel = new Label(composite, SWT.NONE);
+ proxyFileLabel.setText(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_proxyFile);
+ gridData = new GridData();
+ gridData.verticalIndent = 5;
+ proxyFileLabel.setLayoutData(gridData);
+ this.proxyFileText = this.buildProxyFileText(composite);
+ }
+
+ // ********** UI components **********
+
+ private Text buildProxyText(Composite parent) {
+ Text text = new Text(parent, SWT.BORDER);
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.horizontalSpan = 2;
+ gridData.verticalIndent = 5;
+ text.setLayoutData(gridData);
+ return text;
+ }
+
+ private Text buildProxyFileText(Composite parent) {
+ Text text = new Text(parent, SWT.BORDER);
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.horizontalSpan = 2;
+ gridData.verticalIndent = 5;
+ text.setLayoutData(gridData);
+ return text;
+ }
+
+ // ********** intra-wizard methods **********
+
+ protected String getProxy() {
+ return this.proxyText.getText();
+ }
+
+ protected String getProxyFile() {
+ return this.proxyFileText.getText();
+ }
+ }
+
+ // ********** Options1Composite **********
+
+ class Options1Composite {
+
+ private boolean usesStrictValidation;
+ private final Button usesStrictValidationCheckBox;
+
+ private boolean makesReadOnly;
+ private final Button makesReadOnlyCheckBox;
+
+ private boolean suppressesPackageInfoGen;
+ private final Button suppressesPackageInfoGenCheckBox;
+
+ private boolean suppressesHeaderGen;
+ private final Button suppressesHeaderGenCheckBox;
+
+ private boolean target;
+ private final Button targetCheckBox;
+
+ private boolean isVerbose;
+ private final Button isVerboseCheckBox;
+
+ private boolean isQuiet;
+ private final Button isQuietCheckBox;
+
+ // ********** constructor **********
+
+ Options1Composite(Composite parent) {
+ super();
+ this.usesStrictValidation = true;
+ this.makesReadOnly = false;
+ this.suppressesPackageInfoGen = false;
+ this.suppressesHeaderGen = false;
+ this.target = false;
+ this.isVerbose = false;
+ this.isQuiet = false;
+
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setLayout(new GridLayout());
+
+ this.usesStrictValidationCheckBox = this.buildUsesStrictValidationCheckBox(composite, this.buildUsesStrictValidationSelectionListener());
+ this.makesReadOnlyCheckBox = this.buildMakesReadOnlyCheckBox(composite, this.buildMakesReadOnlySelectionListener());
+ this.suppressesPackageInfoGenCheckBox = this.buildSuppressesPackageInfoGenCheckBox(composite, this.buildSuppressesPackageInfoGenSelectionListener());
+ this.suppressesHeaderGenCheckBox = this.buildSuppressesHeaderGenCheckBox(composite, this.buildSuppressesHeaderGenSelectionListener());
+ this.targetCheckBox = this.buildTargetCheckBox(composite, this.buildTargetSelectionListener());
+ this.isVerboseCheckBox = this.buildIsVerboseCheckBox(composite, this.buildIsVerboseSelectionListener());
+ this.isQuietCheckBox = this.buildIsQuietCheckBox(composite, this.buildIsQuietSelectionListener());
+ }
+
+ // ********** UI components **********
+
+ private Button buildUsesStrictValidationCheckBox(Composite parent, SelectionListener listener) {
+ Button checkBox = new Button(parent, SWT.CHECK);
+ GridData gridData = new GridData();
+ gridData.verticalIndent = 5;
+ checkBox.setLayoutData(gridData);
+ checkBox.setText(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_useStrictValidation);
+ checkBox.setSelection(this.usesStrictValidation());
+ checkBox.addSelectionListener(listener);
+ return checkBox;
+ }
+
+ private Button buildMakesReadOnlyCheckBox(Composite parent, SelectionListener listener) {
+ Button checkBox = new Button(parent, SWT.CHECK);
+ GridData gridData = new GridData();
+ gridData.verticalIndent = 5;
+ checkBox.setLayoutData(gridData);
+ checkBox.setText(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_makeReadOnly);
+ checkBox.setSelection(this.makesReadOnly());
+ checkBox.addSelectionListener(listener);
+ return checkBox;
+ }
+
+ private Button buildSuppressesPackageInfoGenCheckBox(Composite parent, SelectionListener listener) {
+ Button checkBox = new Button(parent, SWT.CHECK);
+ GridData gridData = new GridData();
+ gridData.verticalIndent = 5;
+ checkBox.setLayoutData(gridData);
+ checkBox.setText(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_suppressPackageInfoGen);
+ checkBox.setSelection(this.suppressesPackageInfoGen());
+ checkBox.addSelectionListener(listener);
+ return checkBox;
+ }
+
+ private Button buildSuppressesHeaderGenCheckBox(Composite parent, SelectionListener listener) {
+ Button checkBox = new Button(parent, SWT.CHECK);
+ GridData gridData = new GridData();
+ gridData.verticalIndent = 5;
+ checkBox.setLayoutData(gridData);
+ checkBox.setText(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_suppressesHeaderGen);
+ checkBox.setSelection(this.suppressesHeaderGen());
+ checkBox.addSelectionListener(listener);
+ return checkBox;
+ }
+
+ private Button buildTargetCheckBox(Composite parent, SelectionListener listener) {
+ Button checkBox = new Button(parent, SWT.CHECK);
+ GridData gridData = new GridData();
+ gridData.verticalIndent = 5;
+ checkBox.setLayoutData(gridData);
+ checkBox.setText(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_target);
+ checkBox.setSelection(this.targetIs20());
+ checkBox.addSelectionListener(listener);
+ return checkBox;
+ }
+
+ private Button buildIsVerboseCheckBox(Composite parent, SelectionListener listener) {
+ Button checkBox = new Button(parent, SWT.CHECK);
+ GridData gridData = new GridData();
+ gridData.verticalIndent = 5;
+ checkBox.setLayoutData(gridData);
+ checkBox.setText(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_verbose);
+ checkBox.setSelection(this.isVerbose());
+ checkBox.addSelectionListener(listener);
+ return checkBox;
+ }
+
+ private Button buildIsQuietCheckBox(Composite parent, SelectionListener listener) {
+ Button checkBox = new Button(parent, SWT.CHECK);
+ GridData gridData = new GridData();
+ gridData.verticalIndent = 5;
+ checkBox.setLayoutData(gridData);
+ checkBox.setText(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_quiet);
+ checkBox.setSelection(this.isQuiet());
+ checkBox.addSelectionListener(listener);
+ return checkBox;
+ }
+
+ // ********** listeners **********
+
+ private SelectionListener buildUsesStrictValidationSelectionListener() {
+ return new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent event) {
+ this.widgetSelected(event);
+ }
+ public void widgetSelected(SelectionEvent event) {
+ Options1Composite.this.setUsesStrictValidation(
+ Options1Composite.this.usesStrictValidationCheckBox.getSelection());
+ }
+ };
+ }
+
+ private SelectionListener buildMakesReadOnlySelectionListener() {
+ return new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent event) {
+ this.widgetSelected(event);
+ }
+ public void widgetSelected(SelectionEvent event) {
+ Options1Composite.this.setMakesReadOnly(
+ Options1Composite.this.makesReadOnlyCheckBox.getSelection());
+ }
+ };
+ }
+
+ private SelectionListener buildSuppressesPackageInfoGenSelectionListener() {
+ return new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent event) {
+ this.widgetSelected(event);
+ }
+ public void widgetSelected(SelectionEvent event) {
+ Options1Composite.this.setSuppressesPackageInfoGen(
+ Options1Composite.this.suppressesPackageInfoGenCheckBox.getSelection());
+ }
+ };
+ }
+
+ private SelectionListener buildSuppressesHeaderGenSelectionListener() {
+ return new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent event) {
+ this.widgetSelected(event);
+ }
+ public void widgetSelected(SelectionEvent event) {
+ Options1Composite.this.setSuppressesHeaderGen(
+ Options1Composite.this.suppressesHeaderGenCheckBox.getSelection());
+ }
+ };
+ }
+
+ private SelectionListener buildTargetSelectionListener() {
+ return new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent event) {
+ this.widgetSelected(event);
+ }
+ public void widgetSelected(SelectionEvent event) {
+ Options1Composite.this.setTargetIs20(
+ Options1Composite.this.targetCheckBox.getSelection());
+ }
+ };
+ }
+
+ private SelectionListener buildIsVerboseSelectionListener() {
+ return new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent event) {
+ this.widgetSelected(event);
+ }
+ public void widgetSelected(SelectionEvent event) {
+ Options1Composite.this.setIsVerbose(
+ Options1Composite.this.isVerboseCheckBox.getSelection());
+ }
+ };
+ }
+
+ private SelectionListener buildIsQuietSelectionListener() {
+ return new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent event) {
+ this.widgetSelected(event);
+ }
+ public void widgetSelected(SelectionEvent event) {
+ Options1Composite.this.setIsQuiet(
+ Options1Composite.this.isQuietCheckBox.getSelection());
+ }
+ };
+ }
+
+ // ********** getters/setters *********
+
+ protected boolean usesStrictValidation() {
+ return this.usesStrictValidation;
+ }
+
+ protected void setUsesStrictValidation(boolean usesStrictValidation){
+ this.usesStrictValidation = usesStrictValidation;
+ }
+
+ protected boolean makesReadOnly() {
+ return this.makesReadOnly;
+ }
+
+ protected void setMakesReadOnly(boolean makesReadOnly){
+ this.makesReadOnly = makesReadOnly;
+ }
+
+ protected boolean suppressesPackageInfoGen() {
+ return this.suppressesPackageInfoGen;
+ }
+
+ protected void setSuppressesPackageInfoGen(boolean suppressesPackageInfoGen){
+ this.suppressesPackageInfoGen = suppressesPackageInfoGen;
+ }
+
+ protected boolean suppressesHeaderGen() {
+ return this.suppressesHeaderGen;
+ }
+
+ protected void setSuppressesHeaderGen(boolean suppressesHeaderGen){
+ this.suppressesHeaderGen = suppressesHeaderGen;
+ }
+
+ protected boolean targetIs20() {
+ return this.target;
+ }
+
+ protected void setTargetIs20(boolean targetIs20){
+ this.target = targetIs20;
+ }
+
+ protected boolean isVerbose() {
+ return this.isVerbose;
+ }
+
+ protected void setIsVerbose(boolean isVerbose){
+ this.isVerbose = isVerbose;
+ }
+
+ protected boolean isQuiet() {
+ return this.isQuiet;
+ }
+
+ protected void setIsQuiet(boolean isQuiet){
+ this.isQuiet = isQuiet;
+ }
+
+ }
+
+ // ********** Options2Composite **********
+
+ class Options2Composite {
+
+ private boolean treatsAsXmlSchema;
+ private final Button treatsAsXmlSchemaCheckBox;
+
+ private boolean treatsAsRelaxNg;
+ private final Button treatsAsRelaxNgCheckBox;
+
+ private boolean treatsAsRelaxNgCompact;
+ private final Button treatsAsRelaxNgCompactCheckBox;
+
+ private boolean treatsAsDtd;
+ private final Button treatsAsDtdCheckBox;
+
+ private boolean treatsAsWsdl;
+ private final Button treatsAsWsdlCheckBox;
+
+ private boolean showsVersion;
+ private final Button showsVersionCheckBox;
+
+ private boolean showsHelp;
+ private final Button showsHelpCheckBox;
+
+ // ********** constructor **********
+
+ Options2Composite(Composite parent) {
+ super();
+ this.treatsAsXmlSchema = false;
+ this.treatsAsRelaxNg = false;
+ this.treatsAsRelaxNgCompact = false;
+ this.treatsAsDtd = false;
+ this.treatsAsWsdl = false;
+ this.showsVersion = false;
+ this.showsHelp = false;
+
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setLayout(new GridLayout());
+
+ this.treatsAsXmlSchemaCheckBox = this.buildTreatsAsXmlSchemaCheckBox(composite, this.buildTreatsAsXmlSchemaSelectionListener());
+ this.treatsAsRelaxNgCheckBox = this.buildTreatsAsRelaxNgCheckBox(composite, this.buildTreatsAsRelaxNgSelectionListener());
+ this.treatsAsRelaxNgCompactCheckBox = this.buildTreatsAsRelaxNgCompactCheckBox(composite, this.buildTreatsAsRelaxNgCompactSelectionListener());
+ this.treatsAsDtdCheckBox = this.buildTreatsAsDtdCheckBox(composite, this.buildTreatsAsDtdSelectionListener());
+ this.treatsAsWsdlCheckBox = this.buildTreatsAsWsdlCheckBox(composite, this.buildTreatsAsWsdlSelectionListener());
+ this.showsVersionCheckBox = this.buildVersionCheckBox(composite, this.buildVersionSelectionListener());
+ this.showsHelpCheckBox = this.buildHelpCheckBox(composite, this.buildHelpSelectionListener());
+ }
+
+ // ********** UI components **********
+
+ private Button buildTreatsAsXmlSchemaCheckBox(Composite parent, SelectionListener listener) {
+ Button checkBox = new Button(parent, SWT.CHECK);
+ GridData gridData = new GridData();
+ gridData.verticalIndent = 5;
+ checkBox.setLayoutData(gridData);
+ checkBox.setText(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_treatsAsXmlSchema);
+ checkBox.setSelection(this.treatsAsXmlSchema());
+ checkBox.addSelectionListener(listener);
+ return checkBox;
+ }
+
+ private Button buildTreatsAsRelaxNgCheckBox(Composite parent, SelectionListener listener) {
+ Button checkBox = new Button(parent, SWT.CHECK);
+ GridData gridData = new GridData();
+ gridData.verticalIndent = 5;
+ checkBox.setLayoutData(gridData);
+ checkBox.setText(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_treatsAsRelaxNg);
+ checkBox.setSelection(this.treatsAsRelaxNg());
+ checkBox.addSelectionListener(listener);
+ return checkBox;
+ }
+ private Button buildTreatsAsRelaxNgCompactCheckBox(Composite parent, SelectionListener listener) {
+ Button checkBox = new Button(parent, SWT.CHECK);
+ GridData gridData = new GridData();
+ gridData.verticalIndent = 5;
+ checkBox.setLayoutData(gridData);
+ checkBox.setText(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_treatsAsRelaxNgCompact);
+ checkBox.setSelection(this.treatsAsRelaxNgCompact());
+ checkBox.addSelectionListener(listener);
+ return checkBox;
+ }
+
+ private Button buildTreatsAsDtdCheckBox(Composite parent, SelectionListener listener) {
+ Button checkBox = new Button(parent, SWT.CHECK);
+ GridData gridData = new GridData();
+ gridData.verticalIndent = 5;
+ checkBox.setLayoutData(gridData);
+ checkBox.setText(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_treatsAsDtd);
+ checkBox.setSelection(this.treatsAsDtd());
+ checkBox.addSelectionListener(listener);
+ return checkBox;
+ }
+
+ private Button buildTreatsAsWsdlCheckBox(Composite parent, SelectionListener listener) {
+ Button checkBox = new Button(parent, SWT.CHECK);
+ GridData gridData = new GridData();
+ gridData.verticalIndent = 5;
+ checkBox.setLayoutData(gridData);
+ checkBox.setText(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_treatsAsWsdl);
+ checkBox.setSelection(this.treatsAsWsdl());
+ checkBox.addSelectionListener(listener);
+ return checkBox;
+ }
+
+ private Button buildVersionCheckBox(Composite parent, SelectionListener listener) {
+ Button checkBox = new Button(parent, SWT.CHECK);
+ GridData gridData = new GridData();
+ gridData.verticalIndent = 5;
+ checkBox.setLayoutData(gridData);
+ checkBox.setText(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_showsVersion);
+ checkBox.setSelection(this.showsVersion());
+ checkBox.addSelectionListener(listener);
+ return checkBox;
+ }
+
+ private Button buildHelpCheckBox(Composite parent, SelectionListener listener) {
+ Button checkBox = new Button(parent, SWT.CHECK);
+ GridData gridData = new GridData();
+ gridData.verticalIndent = 5;
+ checkBox.setLayoutData(gridData);
+ checkBox.setText(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_showsHelp);
+ checkBox.setSelection(this.showsHelp());
+ checkBox.addSelectionListener(listener);
+ return checkBox;
+ }
+
+ // ********** listeners **********
+
+ private SelectionListener buildTreatsAsXmlSchemaSelectionListener() {
+ return new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent event) {
+ this.widgetSelected(event);
+ }
+ public void widgetSelected(SelectionEvent event) {
+ Options2Composite.this.setTreatsAsXmlSchema(
+ Options2Composite.this.treatsAsXmlSchemaCheckBox.getSelection());
+ }
+ };
+ }
+
+ private SelectionListener buildTreatsAsRelaxNgSelectionListener() {
+ return new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent event) {
+ this.widgetSelected(event);
+ }
+ public void widgetSelected(SelectionEvent event) {
+ Options2Composite.this.setTreatsAsRelaxNg(
+ Options2Composite.this.treatsAsRelaxNgCheckBox.getSelection());
+ }
+ };
+ }
+
+ private SelectionListener buildTreatsAsRelaxNgCompactSelectionListener() {
+ return new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent event) {
+ this.widgetSelected(event);
+ }
+ public void widgetSelected(SelectionEvent event) {
+ Options2Composite.this.setTreatsAsRelaxNgCompact(
+ Options2Composite.this.treatsAsRelaxNgCompactCheckBox.getSelection());
+ }
+ };
+ }
+
+ private SelectionListener buildTreatsAsDtdSelectionListener() {
+ return new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent event) {
+ this.widgetSelected(event);
+ }
+ public void widgetSelected(SelectionEvent event) {
+ Options2Composite.this.setTreatsAsDtd(
+ Options2Composite.this.treatsAsDtdCheckBox.getSelection());
+ }
+ };
+ }
+
+ private SelectionListener buildTreatsAsWsdlSelectionListener() {
+ return new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent event) {
+ this.widgetSelected(event);
+ }
+ public void widgetSelected(SelectionEvent event) {
+ Options2Composite.this.setTreatsAsWsdl(
+ Options2Composite.this.treatsAsWsdlCheckBox.getSelection());
+ }
+ };
+ }
+
+ private SelectionListener buildVersionSelectionListener() {
+ return new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent event) {
+ this.widgetSelected(event);
+ }
+ public void widgetSelected(SelectionEvent event) {
+ Options2Composite.this.setShowsVersion(
+ Options2Composite.this.showsVersionCheckBox.getSelection());
+ }
+ };
+ }
+
+ private SelectionListener buildHelpSelectionListener() {
+ return new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent event) {
+ this.widgetSelected(event);
+ }
+ public void widgetSelected(SelectionEvent event) {
+ Options2Composite.this.setShowsHelp(
+ Options2Composite.this.showsHelpCheckBox.getSelection());
+ }
+ };
+ }
+
+ // ********** getter/setter *********
+
+ protected boolean treatsAsXmlSchema() {
+ return this.treatsAsXmlSchema;
+ }
+
+ protected void setTreatsAsXmlSchema(boolean treatsAsXmlSchema){
+ this.treatsAsXmlSchema = treatsAsXmlSchema;
+ }
+
+ protected boolean treatsAsRelaxNg() {
+ return this.treatsAsRelaxNg;
+ }
+
+ protected void setTreatsAsRelaxNg(boolean treatsAsRelaxNg){
+ this.treatsAsRelaxNg = treatsAsRelaxNg;
+ }
+
+ protected boolean treatsAsRelaxNgCompact() {
+ return this.treatsAsRelaxNgCompact;
+ }
+
+ protected void setTreatsAsRelaxNgCompact(boolean treatsAsRelaxNgCompact){
+ this.treatsAsRelaxNgCompact = treatsAsRelaxNgCompact;
+ }
+
+ protected boolean treatsAsDtd() {
+ return this.treatsAsDtd;
+ }
+
+ protected void setTreatsAsDtd(boolean treatsAsDtd){
+ this.treatsAsDtd = treatsAsDtd;
+ }
+
+ protected boolean treatsAsWsdl() {
+ return this.treatsAsWsdl;
+ }
+
+ protected void setTreatsAsWsdl(boolean treatsAsWsdl){
+ this.treatsAsWsdl = treatsAsWsdl;
+ }
+
+ protected boolean showsVersion() {
+ return this.showsVersion;
+ }
+
+ protected void setShowsVersion(boolean showsVersion){
+ this.showsVersion = showsVersion;
+ }
+
+ protected boolean showsHelp() {
+ return this.showsHelp;
+ }
+
+ protected void setShowsHelp(boolean showsHelp){
+ this.showsHelp = showsHelp;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java
index 195aa0021c..92eb73c7c6 100644
--- a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java
@@ -14,6 +14,8 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jpt.jaxb.core.internal.ClassesGeneratorExtensionOptions;
+import org.eclipse.jpt.jaxb.core.internal.ClassesGeneratorOptions;
import org.eclipse.jpt.jaxb.ui.JptJaxbUiIcons;
import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages;
@@ -30,10 +32,14 @@ public class ClassesGeneratorWizard extends Wizard {
private String destinationFolder;
private String targetPackage;
private String catalog;
- private boolean useMoxy;
+ private boolean usesMoxy;
private String[] bindingsFileNames;
+ private ClassesGeneratorOptions generatorOptions;
+ private ClassesGeneratorExtensionOptions generatorExtensionOptions;
- private ClassesGeneratorWizardPage generatorSettingsPage;
+ private ClassesGeneratorWizardPage settingsPage;
+ private ClassesGeneratorOptionsWizardPage optionsPage;
+ private ClassesGeneratorExtensionOptionsWizardPage extensionOptionsPage;
// ********** constructor **********
@@ -53,27 +59,72 @@ public class ClassesGeneratorWizard extends Wizard {
public void addPages() {
super.addPages();
- this.generatorSettingsPage = this.buildClassesGeneratorPage();
+ this.settingsPage = this.buildClassesGeneratorPage();
+ this.optionsPage = this.buildClassesGeneratorOptionsPage();
+ this.extensionOptionsPage = this.buildExtensionOptionsPage();
- this.addPage(this.generatorSettingsPage);
+ this.addPage(this.settingsPage);
+ this.addPage(this.optionsPage);
+ this.addPage(this.extensionOptionsPage);
}
@Override
public boolean performFinish() {
- this.destinationFolder = this.generatorSettingsPage.getTargetFolder();
- this.targetPackage = this.generatorSettingsPage.getTargetPackage();
- this.catalog = this.generatorSettingsPage.getCatalog();
- this.useMoxy = this.generatorSettingsPage.usesMoxy();
- this.bindingsFileNames = this.generatorSettingsPage.getBindingsFileNames();
+
+ this.initializeGeneratorSettings();
+
+ this.initializeGeneratorOptions();
+ this.initializeGeneratorExtensionOptions();
+
IFolder folder = this.javaProject.getProject().getFolder(this.destinationFolder);
this.createFolderIfNotExist(folder);
return true;
}
+ private void initializeGeneratorSettings() {
+ this.destinationFolder = this.settingsPage.getTargetFolder();
+ this.targetPackage = this.settingsPage.getTargetPackage();
+ this.catalog = this.settingsPage.getCatalog();
+ this.usesMoxy = this.settingsPage.usesMoxy();
+ this.bindingsFileNames = this.settingsPage.getBindingsFileNames();
+ }
+
+ private void initializeGeneratorOptions() {
+ this.generatorOptions = new ClassesGeneratorOptions();
+
+ this.generatorOptions.setProxy(this.optionsPage.getProxy());
+ this.generatorOptions.setProxyFile(this.optionsPage.getProxyFile());
+
+ this.generatorOptions.setUsesStrictValidation(this.optionsPage.usesStrictValidation());
+ this.generatorOptions.setMakesReadOnly(this.optionsPage.makesReadOnly());
+ this.generatorOptions.setSuppressesPackageInfoGen(this.optionsPage.suppressesPackageInfoGen());
+ this.generatorOptions.setSuppressesHeaderGen(this.optionsPage.suppressesHeaderGen());
+ this.generatorOptions.setTargetIs20(this.optionsPage.getTarget());
+ this.generatorOptions.setIsVerbose(this.optionsPage.isVerbose());
+ this.generatorOptions.setIsQuiet(this.optionsPage.isQuiet());
+
+ this.generatorOptions.setTreatsAsXmlSchema(this.optionsPage.treatsAsXmlSchema());
+ this.generatorOptions.setTreatsAsRelaxNg(this.optionsPage.treatsAsRelaxNg());
+ this.generatorOptions.setTreatsAsRelaxNgCompact(this.optionsPage.treatsAsRelaxNgCompact());
+ this.generatorOptions.setTreatsAsDtd(this.optionsPage.treatsAsDtd());
+ this.generatorOptions.setTreatsAsWsdl(this.optionsPage.treatsAsWsdl());
+ this.generatorOptions.setShowsVersion(this.optionsPage.showsVersion());
+ this.generatorOptions.setShowsHelp(this.optionsPage.showsHelp());
+ }
+
+ private void initializeGeneratorExtensionOptions() {
+
+ this.generatorExtensionOptions = new ClassesGeneratorExtensionOptions();
+
+ this.generatorExtensionOptions.setAllowsExtensions(this.extensionOptionsPage.allowsExtensions());
+ this.generatorExtensionOptions.setClasspath(this.extensionOptionsPage.getClasspath());
+ this.generatorExtensionOptions.setAdditionalArgs(this.extensionOptionsPage.getAdditionalArgs());
+ }
+
@Override
public boolean canFinish() {
- return this.generatorSettingsPage.isPageComplete();
+ return this.settingsPage.isPageComplete();
}
// ********** public methods **********
@@ -90,20 +141,36 @@ public class ClassesGeneratorWizard extends Wizard {
return this.catalog;
}
- public boolean getUseMoxy() {
- return this.useMoxy;
+ public boolean usesMoxy() {
+ return this.usesMoxy;
}
public String[] getBindingsFileNames() {
return this.bindingsFileNames;
}
-
+
+ public ClassesGeneratorOptions getGeneratorOptions() {
+ return this.generatorOptions;
+ }
+
+ public ClassesGeneratorExtensionOptions getGeneratorExtensionOptions() {
+ return this.generatorExtensionOptions;
+ }
+
// ********** internal methods **********
private ClassesGeneratorWizardPage buildClassesGeneratorPage() {
return new ClassesGeneratorWizardPage(this.javaProject, this.xmlSchemaName);
}
+ private ClassesGeneratorOptionsWizardPage buildClassesGeneratorOptionsPage() {
+ return new ClassesGeneratorOptionsWizardPage();
+ }
+
+ private ClassesGeneratorExtensionOptionsWizardPage buildExtensionOptionsPage() {
+ return new ClassesGeneratorExtensionOptionsWizardPage();
+ }
+
private void createFolderIfNotExist(IFolder folder) {
if( folder.exists()) {
return;

Back to the top