Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/jaxb
diff options
context:
space:
mode:
authortle2012-07-21 03:18:41 +0000
committertle2012-07-21 03:18:41 +0000
commit2ad2aa1dabd1c21ab1e111f34a5ce9cae589c390 (patch)
treecbc82755aae8102d4080a3cba35cb3a60efef1ae /jaxb
parent5f8bf631641f060fe17e25721e4092d78cc0933a (diff)
downloadwebtools.dali-2ad2aa1dabd1c21ab1e111f34a5ce9cae589c390.tar.gz
webtools.dali-2ad2aa1dabd1c21ab1e111f34a5ce9cae589c390.tar.xz
webtools.dali-2ad2aa1dabd1c21ab1e111f34a5ce9cae589c390.zip
385224 - Schema Gen doesn’t open the right generated xsd when a namespace is specified
Diffstat (limited to 'jaxb')
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/core/internal/gen/DbwsGenerator.java17
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/Main.java17
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/jpt_jaxb_core.properties4
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jpt_jaxb_core.properties1
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JptJaxbCoreMessages.java17
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/ClassesGenerator.java26
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/SchemaGenerator.java77
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/Main.java17
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/jpt_eclipselink_jaxb_core.properties4
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizard.java49
10 files changed, 109 insertions, 120 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/core/internal/gen/DbwsGenerator.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/core/internal/gen/DbwsGenerator.java
index 5726995d22..85b5a9224d 100644
--- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/core/internal/gen/DbwsGenerator.java
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/core/internal/gen/DbwsGenerator.java
@@ -38,23 +38,6 @@ public class DbwsGenerator extends AbstractJptGenerator
private final String stageDirName;
private final String driverJarList;
- // ********** static methods **********
-
- public static JptGenerator generate(
- IJavaProject javaProject,
- String builderFileName,
- String stageDirName,
- String driverJarList,
- IProgressMonitor monitor) {
- if (javaProject == null) {
- throw new NullPointerException();
- }
- return new DbwsGenerator(javaProject,
- builderFileName,
- stageDirName,
- driverJarList).generate(monitor);
- }
-
// ********** constructors **********
public DbwsGenerator(
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/Main.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/Main.java
index 30f3f39893..8bb4f2d081 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/Main.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/Main.java
@@ -1,12 +1,12 @@
/*******************************************************************************
-* Copyright (c) 2010, 2012 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
-*******************************************************************************/
+ * Copyright (c) 2010, 2012 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.schemagen;
import static java.util.logging.Level.INFO;
@@ -86,6 +86,7 @@ public class Main
Tools.logMessage(INFO, Tools.bind(JptJaxbCoreMessages.SCHEMA_NOT_CREATED, this.targetSchemaName));
System.exit(1);
}
+ System.out.flush();
}
private JAXBContext buildJaxbContext() {
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/jpt_jaxb_core.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/jpt_jaxb_core.properties
index b9112cd725..349e16f5eb 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/jpt_jaxb_core.properties
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/jpt_jaxb_core.properties
@@ -1,5 +1,5 @@
################################################################################
-# Copyright (c) 2010 Oracle. All rights reserved.
+# Copyright (c) 2010, 2012 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.
@@ -10,7 +10,7 @@
LOADING_CLASSES = loading...
GENERATING_SCHEMA = \ngenerating schema...
-SCHEMA_GENERATED = \nSchema {0} generated
+SCHEMA_GENERATED = \nSchema generated: {0}
SCHEMA_NOT_CREATED = \nSchema {0} not created
NOT_FOUND = \n\tNot found: {0}
CONTEXT_FACTORY_NOT_FOUND = \nThe JAXBContextFactory {0} \n\
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jpt_jaxb_core.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jpt_jaxb_core.properties
index 44826c38ab..90815dd583 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jpt_jaxb_core.properties
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jpt_jaxb_core.properties
@@ -20,6 +20,7 @@ JreLibraryValidator_invalidJavaFacet = The specified Java version of {0} is insu
JreLibraryValidator_invalidJavaLibrary = The configured runtime is insufficient to provide an implementation for JAXB {0}.
SchemaGenerator_creatingJAXBPropertiesFileTask = Creating jaxb.properties file
+SCHEMA_GENERATED = \nSchema generated:
UserLibraryValidator_incompatibleJavaFacet = The specified Java version of {0} provides a JAXB implementation that conflicts with JAXB version {1}. The JAXB implementation of a Java {0} runtime environment must be manually overridden by an endorsement mechanism of your choice.
UserLibraryValidator_incompatibleJavaLibrary = The configured runtime conflicts with JAXB version {0}.
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JptJaxbCoreMessages.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JptJaxbCoreMessages.java
index c207546e9e..d5bf62268e 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JptJaxbCoreMessages.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JptJaxbCoreMessages.java
@@ -1,12 +1,12 @@
/*******************************************************************************
-* Copyright (c) 2010, 2012 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
-*******************************************************************************/
+ * Copyright (c) 2010, 2012 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;
import org.eclipse.osgi.util.NLS;
@@ -31,6 +31,7 @@ public class JptJaxbCoreMessages {
public static String UserLibraryValidator_incompatibleJavaLibrary;
public static String SchemaGenerator_creatingJAXBPropertiesFileTask;
+ public static String SCHEMA_GENERATED;
public static String XML_ATTRIBUTE_DESC;
public static String XML_ELEMENT_DESC;
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/ClassesGenerator.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/ClassesGenerator.java
index c958be6936..a0feef2437 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/ClassesGenerator.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/ClassesGenerator.java
@@ -51,32 +51,6 @@ public class ClassesGenerator extends AbstractJptGenerator
private String toolsJarPath;
// ********** static methods **********
-
- public static JptGenerator generate(
- IJavaProject javaProject,
- String schemaPathOrUri,
- String outputDir,
- String targetPackage,
- String catalog,
- boolean usesMoxyGenerator,
- String[] bindingsFileNames,
- ClassesGeneratorOptions generatorOptions,
- ClassesGeneratorExtensionOptions generatorExtensionOptions,
- IProgressMonitor monitor) {
-
- if (javaProject == null) {
- throw new NullPointerException();
- }
- return new ClassesGenerator(javaProject,
- schemaPathOrUri,
- outputDir,
- targetPackage,
- catalog,
- usesMoxyGenerator,
- bindingsFileNames,
- generatorOptions,
- generatorExtensionOptions).generate(monitor);
- }
/**
* Test if the JDK Jaxb compiler is on the classpath.
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/SchemaGenerator.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/SchemaGenerator.java
index 13f32b8883..099b204b70 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/SchemaGenerator.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/SchemaGenerator.java
@@ -6,7 +6,7 @@
*
* Contributors:
* Oracle - initial API and implementation
- ******************************************************************************/
+ *******************************************************************************/
package org.eclipse.jpt.jaxb.core.internal.gen;
import java.io.BufferedReader;
@@ -18,22 +18,24 @@ import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.IStreamListener;
+import org.eclipse.debug.core.model.IStreamMonitor;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
-import org.eclipse.jpt.common.core.gen.JptGenerator;
import org.eclipse.jpt.common.core.internal.gen.AbstractJptGenerator;
import org.eclipse.jpt.common.core.internal.utility.JDTTools;
+import org.eclipse.jpt.common.utility.internal.FileTools;
import org.eclipse.jpt.jaxb.core.internal.JptJaxbCoreMessages;
/**
@@ -59,33 +61,18 @@ public class SchemaGenerator extends AbstractJptGenerator
private final String targetSchemaName;
private final String[] sourceClassNames;
- private String mainType;
- private boolean useMoxy;
+ private String mainType;
+ private boolean useMoxy;
+ private ArrayList<String> generatedNames;
- // ********** static methods **********
-
- public static JptGenerator generate(
- IJavaProject javaProject,
- String targetSchemaName,
- String[] sourceClassNames,
- boolean useMoxy,
- IProgressMonitor monitor) {
- if (javaProject == null) {
- throw new NullPointerException();
- }
- return new SchemaGenerator(javaProject,
- targetSchemaName,
- sourceClassNames,
- useMoxy).generate(monitor);
- }
// ********** constructors **********
public SchemaGenerator(
- IJavaProject javaProject,
- String targetSchemaName,
- String[] sourceClassNames,
- boolean useMoxy) {
+ IJavaProject javaProject,
+ String targetSchemaName,
+ String[] sourceClassNames,
+ boolean useMoxy) {
super(javaProject);
this.targetSchemaName = targetSchemaName;
this.sourceClassNames = sourceClassNames;
@@ -95,7 +82,7 @@ public class SchemaGenerator extends AbstractJptGenerator
JAXB_SCHEMA_GEN_CLASS;
this.initialize();
}
-
+
// ********** overrides **********
@Override
@@ -131,6 +118,21 @@ public class SchemaGenerator extends AbstractJptGenerator
}
}
+ @Override
+ protected void initialize() {
+ super.initialize();
+ this.generatedNames = new ArrayList<String>();
+ }
+
+ // ********** misc **********
+
+ /**
+ * Returns generated names without extension.
+ */
+ public Iterable<String> getGeneratedNames() {
+ return this.generatedNames;
+ }
+
// ********** Launch Configuration Setup **********
@Override
@@ -160,6 +162,14 @@ public class SchemaGenerator extends AbstractJptGenerator
this.getLaunchConfig().setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, programArguments.toString());
}
+ @Override
+ protected ILaunch saveAndLaunchConfig(IProgressMonitor monitor) {
+ ILaunch launch = super.saveAndLaunchConfig(monitor);
+
+ this.getConsoleOutputStream(launch).addListener(this.buildConsoleOutputStreamListener());
+ return launch;
+ }
+
// ********** private methods **********
private void appendClassNameArguments(StringBuffer sb) {
@@ -303,4 +313,19 @@ public class SchemaGenerator extends AbstractJptGenerator
return ! sourceClassName.contains("."); //$NON-NLS-1$
}
+ private IStreamMonitor getConsoleOutputStream(ILaunch launch) {
+ return (launch.getProcesses()[0]).getStreamsProxy().getOutputStreamMonitor();
+ }
+
+ private IStreamListener buildConsoleOutputStreamListener() {
+ return new IStreamListener() {
+ public void streamAppended(String text, IStreamMonitor monitor) {
+ if(text.indexOf(JptJaxbCoreMessages.SCHEMA_GENERATED) > -1) {
+ String[] texts = text.split(" "); //$NON-NLS-1$
+ // stripExtension to remove unwanted ending char
+ SchemaGenerator.this.generatedNames.add(FileTools.stripExtension(texts[texts.length - 1]));
+ }
+ }
+ };
+ }
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/Main.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/Main.java
index 2521f3b1a5..9b88652317 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/Main.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/Main.java
@@ -1,12 +1,12 @@
/*******************************************************************************
-* Copyright (c) 2010, 2012 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
-*******************************************************************************/
+ * Copyright (c) 2010, 2012 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.eclipselink.core.schemagen;
import static java.util.logging.Level.INFO;
@@ -87,6 +87,7 @@ public class Main
Tools.logMessage(INFO, Tools.bind(JptEclipseLinkJaxbCoreMessages.SCHEMA_NOT_CREATED, this.targetSchemaName));
this.generationFailed();
}
+ System.out.flush();
}
private JAXBContext buildJaxbContext() {
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/jpt_eclipselink_jaxb_core.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/jpt_eclipselink_jaxb_core.properties
index a9f76617fa..bf971ca302 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/jpt_eclipselink_jaxb_core.properties
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/jpt_eclipselink_jaxb_core.properties
@@ -1,5 +1,5 @@
################################################################################
-# Copyright (c) 2010 Oracle. All rights reserved.
+# Copyright (c) 2010, 2012 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.
@@ -10,7 +10,7 @@
LOADING_CLASSES = loading...
GENERATING_SCHEMA = \nMOXy generating schema...
-SCHEMA_GENERATED = \nSchema {0} generated
+SCHEMA_GENERATED = \nSchema generated: {0}
SCHEMA_NOT_CREATED = \nSchema {0} not created
NOT_FOUND = \n\tNot found: {0}
PROPERTIES_FILE_NOT_FOUND = \nEclipseLink JAXBContextFactory must be specified in the jaxb.properties file to use EclipseLink MOXy for schema generation.\n\
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizard.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizard.java
index f08b5653df..08b4df14c2 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizard.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizard.java
@@ -6,7 +6,7 @@
*
* Contributors:
* Oracle - initial API and implementation
- ******************************************************************************/
+ *******************************************************************************/
package org.eclipse.jpt.jaxb.ui.internal.wizards.schemagen;
import java.io.File;
@@ -105,16 +105,12 @@ public class SchemaGeneratorWizard extends Wizard implements INewWizard
protected void scheduleGenerateSchemaJob(String[] sourceClassNames) {
- IPath schemaPath = this.newSchemaFileWizardPage.getContainerFullPath();
- String schemaName = this.newSchemaFileWizardPage.getFileName();
-
WorkspaceJob genSchemaJob = new GenerateSchemaJob(
this.targetProject,
sourceClassNames,
- this.getTargetSchema(),
- this.usesMoxy(),
- schemaPath,
- schemaName);
+ this.getTargetSchema(),
+ this.getTargetLocation(),
+ this.usesMoxy());
genSchemaJob.schedule();
}
@@ -155,7 +151,7 @@ public class SchemaGeneratorWizard extends Wizard implements INewWizard
}
return javaProject;
}
-
+
private String getTargetSchema() {
IPath filePath = this.newSchemaFileWizardPage.getFileRelativePath();
@@ -167,6 +163,10 @@ public class SchemaGeneratorWizard extends Wizard implements INewWizard
return this.addXsdExtension(targetSchema);
}
+ private IPath getTargetLocation() {
+ return this.newSchemaFileWizardPage.getContainerFullPath();
+ }
+
private String addXsdExtension(String fileName) {
return (FileTools.extension(fileName).equalsIgnoreCase(XSD_EXTENSION)) ?
@@ -243,38 +243,39 @@ public class SchemaGeneratorWizard extends Wizard implements INewWizard
// ********** generate schema job **********
- static class GenerateSchemaJob extends AbstractJptGenerateJob {
+ private class GenerateSchemaJob extends AbstractJptGenerateJob {
private final String[] sourceClassNames;
private final String targetSchema;
+ private final IPath targetLocation;
private final boolean useMoxy;
- private final IPath schemaPath;
- private final String schemaName;
+ private SchemaGenerator generator;
// ********** constructor **********
protected GenerateSchemaJob(IJavaProject javaProject, String[] sourceClassNames, String targetSchema,
- boolean useMoxy, IPath schemaPath, String schemaName) {
+ IPath targetLocation, boolean useMoxy) {
super(JptJaxbUiMessages.SchemaGeneratorWizard_generatingSchema, javaProject);
this.sourceClassNames = sourceClassNames;
this.targetSchema = targetSchema;
+ this.targetLocation = targetLocation;
this.useMoxy = useMoxy;
- this.schemaPath = schemaPath;
- this.schemaName = schemaName;
}
// ********** overwrite AbstractJptGenerateJob **********
@Override
protected JptGenerator buildGenerator() {
- return new SchemaGenerator(this.getJavaProject(), this.targetSchema, this.sourceClassNames, this.useMoxy);
+ this.generator = new SchemaGenerator(this.getJavaProject(), this.targetSchema, this.sourceClassNames, this.useMoxy);
+ return this.generator;
}
@Override
protected void postGenerate() {
this.refreshProject();
- this.openGeneratedSchemaFile();
+ Iterable<String> schemaNames = this.generator.getGeneratedNames();
+ this.openGeneratedSchemaFiles(schemaNames);
}
@Override
@@ -289,12 +290,14 @@ public class SchemaGeneratorWizard extends Wizard implements INewWizard
// ********** internal methods **********
- private void openGeneratedSchemaFile() {
-
- IContainer container = (IContainer)ResourcesPlugin.getWorkspace().getRoot().findMember(this.schemaPath);
- IFile schemaFile = container.getFile(new Path(this.schemaName));
-
- this.openEditor(schemaFile);
+ private void openGeneratedSchemaFiles(Iterable<String> names) {
+ for(String name : names) {
+ IContainer container = (IContainer)ResourcesPlugin.getWorkspace().getRoot().findMember(this.targetLocation);
+ IPath schemaPath = new Path(SchemaGeneratorWizard.this.addXsdExtension(name));
+ IFile schemaFile = container.getFile(schemaPath);
+
+ this.openEditor(schemaFile);
+ }
}
}
} \ No newline at end of file

Back to the top