Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--jpa/features/org.eclipse.jpt.eclipselink.feature/feature.xml2
-rw-r--r--jpa/features/org.eclipse.jpt.feature/feature.xml2
-rw-r--r--jpa/plugins/org.eclipse.jpt.branding/component.xml2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/.classpath8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/.cvsignore6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/.project28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/about.html34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/build.properties20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/component.xml1
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/plugin.properties25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/plugin.xml26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/property_files/jpt_jaxb_ui.properties39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/core/internal/ClassesGenerator.java341
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/JptJaxbUiPlugin.java98
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java222
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiMessages.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/GenerateClassesAction.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/ObjectAction.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/ClassesGeneratorWizard.java127
-rw-r--r--jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/ClassesGeneratorWizardPage.java503
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/META-INF/MANIFEST.MF2
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/META-INF/MANIFEST.MF4
24 files changed, 1663 insertions, 6 deletions
diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/feature.xml b/jpa/features/org.eclipse.jpt.eclipselink.feature/feature.xml
index a763c62080..ff9898bfa5 100644
--- a/jpa/features/org.eclipse.jpt.eclipselink.feature/feature.xml
+++ b/jpa/features/org.eclipse.jpt.eclipselink.feature/feature.xml
@@ -43,7 +43,7 @@
unpack="false"/>
<plugin
- id="org.eclipse.jpt.eclipselink.ui.jaxb"
+ id="org.eclipse.jpt.eclipselink.jaxb.ui"
download-size="0"
install-size="0"
version="0.0.0"
diff --git a/jpa/features/org.eclipse.jpt.feature/feature.xml b/jpa/features/org.eclipse.jpt.feature/feature.xml
index 3073b1e58c..3da7cbd234 100644
--- a/jpa/features/org.eclipse.jpt.feature/feature.xml
+++ b/jpa/features/org.eclipse.jpt.feature/feature.xml
@@ -73,7 +73,7 @@
unpack="false"/>
<plugin
- id="org.eclipse.jpt.ui.jaxb"
+ id="org.eclipse.jpt.jaxb.ui"
download-size="0"
install-size="0"
version="0.0.0"
diff --git a/jpa/plugins/org.eclipse.jpt.branding/component.xml b/jpa/plugins/org.eclipse.jpt.branding/component.xml
index 0d935f1cb8..622c26c9a9 100644
--- a/jpa/plugins/org.eclipse.jpt.branding/component.xml
+++ b/jpa/plugins/org.eclipse.jpt.branding/component.xml
@@ -8,6 +8,6 @@
<plugin id="org.eclipse.jpt.db.ui" fragment="false"/>
<plugin id="org.eclipse.jpt.gen" fragment="false"/>
<plugin id="org.eclipse.jpt.ui" fragment="false"/>
-<plugin id="org.eclipse.jpt.ui.jaxb" fragment="false"/>
+<plugin id="org.eclipse.jpt.jaxb.ui" fragment="false"/>
<plugin id="org.eclipse.jpt.utility" fragment="false"/>
</component> \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/.classpath b/jpa/plugins/org.eclipse.jpt.jaxb.ui/.classpath
new file mode 100644
index 0000000000..a1d4f10a15
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="property_files"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/.cvsignore b/jpa/plugins/org.eclipse.jpt.jaxb.ui/.cvsignore
new file mode 100644
index 0000000000..a196dd7686
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/.cvsignore
@@ -0,0 +1,6 @@
+bin
+@dot
+temp.folder
+build.xml
+javaCompiler...args
+javaCompiler...args.* \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/.project b/jpa/plugins/org.eclipse.jpt.jaxb.ui/.project
new file mode 100644
index 0000000000..67371280df
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jpt.jaxb.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/.settings/org.eclipse.jdt.core.prefs b/jpa/plugins/org.eclipse.jpt.jaxb.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..7e50a8f1f3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Mon Feb 08 18:48:37 EST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..13c5b084d5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,26 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-Vendor: %providerName
+Bundle-SymbolicName: org.eclipse.jpt.jaxb.ui;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)",
+ org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
+ org.eclipse.debug.core;bundle-version="[3.4.0,4.0.0)",
+ org.eclipse.jdt.core;bundle-version="[3.4.0,4.0.0)",
+ org.eclipse.jdt.launching;bundle-version="[3.4.0,4.0.0)",
+ org.eclipse.jpt.core;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.jpt.ui;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.jpt.utility;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.ui;bundle-version="[3.4.0,4.0.0)"
+Export-Package: org.eclipse.jpt.jaxb.core.internal,
+ org.eclipse.jpt.jaxb.ui;x-internal:=true,
+ org.eclipse.jpt.jaxb.ui.internal;x-internal:=true,
+ org.eclipse.jpt.jaxb.ui.internal.actions;x-internal:=true,
+ org.eclipse.jpt.jaxb.ui.internal.wizards;x-internal:=true
+Import-Package: com.ibm.icu.text;version="4.0.1"
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/about.html b/jpa/plugins/org.eclipse.jpt.jaxb.ui/about.html
new file mode 100644
index 0000000000..be534ba44f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/about.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</head>
+
+<BODY lang="EN-US">
+
+<H3>About This Content</H3>
+
+<P>May 02, 2008</P>
+
+<H3>License</H3>
+
+<P>The Eclipse Foundation makes available all content in this plug-in
+("Content"). Unless otherwise indicated below, the Content is provided to you
+under the terms and conditions of the Eclipse Public License Version 1.0
+("EPL"). A copy of the EPL is available at
+<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
+For purposes of the EPL, "Program" will mean the Content.</P>
+
+<P>If you did not receive this Content directly from the Eclipse Foundation, the
+Content is being redistributed by another party ("Redistributor") and different
+terms and conditions may apply to your use of any object code in the Content.
+Check the Redistributor's license that was provided with the Content. If no such
+license exists, contact the Redistributor. Unless otherwise indicated below, the
+terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at
+<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P>
+
+</BODY>
+</HTML>
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/build.properties b/jpa/plugins/org.eclipse.jpt.jaxb.ui/build.properties
new file mode 100644
index 0000000000..26a9ace4df
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/build.properties
@@ -0,0 +1,20 @@
+################################################################################
+# 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
+################################################################################
+javacSource = 1.5
+javacTarget = 1.5
+source.. = src/,\
+ property_files/
+output.. = bin/
+bin.includes = .,\
+ META-INF/,\
+ about.html,\
+ plugin.xml,\
+ plugin.properties
+jars.compile.order = .
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/component.xml b/jpa/plugins/org.eclipse.jpt.jaxb.ui/component.xml
new file mode 100644
index 0000000000..04957fe9b2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/component.xml
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><component xmlns="http://eclipse.org/wtp/releng/tools/component-model" name="org.eclipse.jpt.jaxb.ui"><description url=""></description><component-depends unrestricted="true"></component-depends><plugin id="org.eclipse.jpt.jaxb.ui" fragment="false"/></component> \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/plugin.properties b/jpa/plugins/org.eclipse.jpt.jaxb.ui/plugin.properties
new file mode 100644
index 0000000000..929c959f5d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/plugin.properties
@@ -0,0 +1,25 @@
+###############################################################################
+# 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
+###############################################################################
+
+# ====================================================================
+# To code developer:
+# Do NOT change the properties between this line and the
+# "%%% END OF TRANSLATED PROPERTIES %%%" line.
+# Make a new property name, append to the end of the file and change
+# the code to use the new property.
+# ====================================================================
+
+# ====================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# ====================================================================
+pluginName= Dali Java Persistence Tools - JAXB Support - UI
+providerName=Eclipse Web Tools Platform
+
+generateJaxbClasses = JAXB Classes... \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/plugin.xml b/jpa/plugins/org.eclipse.jpt.jaxb.ui/plugin.xml
new file mode 100644
index 0000000000..745b7b300e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/plugin.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.popupMenus">
+
+ <!-- contributions to the "Generate" submenu -->
+ <objectContribution
+ id="org.eclipse.jpt.ui.xsdFileActions"
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="*.xsd">
+ <filter
+ name="projectNature"
+ value="org.eclipse.jdt.core.javanature">
+ </filter>
+ <action
+ id="org.eclipse.jpt.jaxb.ui.generateJaxbClasses"
+ label="%generateJaxbClasses"
+ menubarPath="generateMenuId/GenerateXML"
+ class="org.eclipse.jpt.jaxb.ui.internal.actions.GenerateClassesAction">
+ </action>
+ </objectContribution>
+ </extension>
+
+</plugin>
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
new file mode 100644
index 0000000000..70ff79c2b4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/property_files/jpt_jaxb_ui.properties
@@ -0,0 +1,39 @@
+################################################################################
+# 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
+################################################################################
+
+ClassesGeneratorWizard_title = JAXB
+
+ClassesGeneratorWizard_errorDialogTitle = Generate Classes Failed
+ClassesGeneratorWizard_couldNotCreate = Could not create {0}
+
+ClassesGeneratorWizardPage_title = Generate classes from: {0}
+ClassesGeneratorWizardPage_desc = Enter a target folder name
+
+ClassesGeneratorWizardPage_usesMoxyImplementation = Use EclipseLink MOXy as the JAXB implementation
+
+ClassesGeneratorWizardPage_settingsGroupTitle = JAXB Settings
+ClassesGeneratorWizardPage_targetFolder = Target folder:
+ClassesGeneratorWizardPage_targetPackage = Target package:
+ClassesGeneratorWizardPage_catalog = Catalog:
+ClassesGeneratorWizardPage_bindingsFiles = Bindings files:
+ClassesGeneratorWizardPage_addButton = Add
+ClassesGeneratorWizardPage_removeButton = Remove
+ClassesGeneratorWizardPage_chooseABindingsFile = Choose an external bindings file
+
+ClassesGeneratorWizardPage_targetFolderCannotBeEmpty = Target folder cannot be empty.
+
+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.
+
+ClassesGeneratorWizardPage_moxyLibrariesNotAvailable = \
+ The classpath for this project does not appear to contain the necessary libraries to proceed with class generation.\
+ \nPlease insure that EclipseLink MOXy 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
new file mode 100644
index 0000000000..38f9edeb64
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/core/internal/ClassesGenerator.java
@@ -0,0 +1,341 @@
+/*******************************************************************************
+* 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;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.ILaunchesListener2;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jpt.core.JpaProject;
+import org.eclipse.jpt.utility.internal.StringTools;
+
+/**
+ * ClassesGenerator
+ */
+public class ClassesGenerator
+{
+ static public String LAUNCH_CONFIG_NAME = "JAXB Run Config"; //$NON-NLS-1$
+ static public String JAXB_GENERIC_GEN_CLASS = "com.sun.tools.xjc.XJCFacade"; //$NON-NLS-1$
+ static public String JAXB_ECLIPSELINK_GEN_CLASS = "org.eclipse.persistence.jaxb.xjc.MOXyXJC"; //$NON-NLS-1$
+
+ private IVMInstall jre;
+ private ILaunchConfigurationWorkingCopy launchConfig;
+ private ILaunch launch;
+
+ private final JpaProject jpaProject;
+ private final String xmlSchemaName;
+ private final String outputDir;
+ private final String targetPackage;
+ private final String catalog;
+ private final String[] bindingsFileNames;
+ private final String mainType;
+ private final boolean isDebug = false;
+
+ // ********** static methods **********
+
+ public static void generate(
+ JpaProject project,
+ String xmlSchemaName,
+ String outputDir,
+ String targetPackage,
+ String catalog,
+ boolean useMoxyGenerator,
+ String[] bindingsFileNames,
+ IProgressMonitor monitor) {
+ if (project == null) {
+ throw new NullPointerException();
+ }
+ new ClassesGenerator(project,
+ xmlSchemaName,
+ outputDir,
+ targetPackage,
+ catalog,
+ useMoxyGenerator,
+ bindingsFileNames,
+ monitor).generate();
+ }
+
+ // ********** constructors **********
+
+ protected ClassesGenerator(
+ JpaProject jpaProject,
+ String xmlSchemaName,
+ String outputDir,
+ String targetPackage,
+ String catalog,
+ boolean useMoxyGenerator,
+ String[] bindingsFileNames,
+ @SuppressWarnings("unused") IProgressMonitor monitor) {
+ super();
+ this.jpaProject = jpaProject;
+ 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.initialize();
+ }
+
+ // ********** behavior **********
+
+ protected void initialize() {
+ try {
+ this.jre = this.getProjectJRE();
+ if (this.jre == null) {
+ String message = "Could not identify the VM."; //$NON-NLS-1$
+ throw new RuntimeException(message);
+ }
+ this.launchConfig = this.buildLaunchConfiguration();
+ }
+ catch (CoreException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected void generate() {
+ String projectLocation = this.jpaProject.getProject().getLocation().toString();
+
+ this.initializeLaunchConfiguration(projectLocation);
+
+ this.addLaunchListener();
+ this.launch = this.saveAndLaunchConfig();
+ }
+
+ private void initializeLaunchConfiguration(String projectLocation) {
+
+ this.specifyJRE(this.jre.getName(), this.jre.getVMInstallType().getId());
+
+ this.specifyProject(this.getJpaProject().getProject().getName());
+ this.specifyMainType(this.mainType);
+
+ this.specifyProgramArguments(
+ this.xmlSchemaName,
+ this.outputDir,
+ this.targetPackage,
+ this.catalog,
+ this.bindingsFileNames); // -d -p
+ this.specifyWorkingDir(projectLocation);
+
+ this.specifyClasspathProperties(this.getJpaProject());
+ }
+
+ protected void postGenerate() {
+ try {
+ if ( ! this.isDebug) {
+ this.removeLaunchConfiguration(LAUNCH_CONFIG_NAME);
+ }
+ }
+ catch (CoreException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ // ********** Launch Configuration Setup **********
+
+ private void specifyClasspathProperties(JpaProject project) {
+ List<String> classpath = new ArrayList<String>();
+ try {
+ // Default Project classpath
+ classpath.add(this.getDefaultProjectClasspathEntry(project.getJavaProject()).getMemento());
+ // System Library
+ classpath.add(this.getSystemLibraryClasspathEntry().getMemento());
+ }
+ catch (CoreException e) {
+ throw new RuntimeException("An error occurs generating a memento", e);
+ }
+ this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, classpath);
+ this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false);
+ }
+
+ private void specifyJRE(String jreName, String vmId) {
+
+ this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, jreName);
+ this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, vmId);
+ }
+
+ private void specifyProject(String projectName) {
+
+ this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName);
+ }
+
+ private void specifyMainType(String mainType) {
+
+ this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, mainType);
+ }
+
+ private void specifyProgramArguments(
+ String xmlSchemaName,
+ String outputDir,
+ String targetPackage,
+ String catalog,
+ String[] bindingsFileNames) {
+
+ StringBuffer programArguments = new StringBuffer();
+ // options
+ programArguments.append("-d "); //$NON-NLS-1$
+ programArguments.append(outputDir);
+ if( ! StringTools.stringIsEmpty(targetPackage)) {
+ programArguments.append(" -p "); //$NON-NLS-1$
+ programArguments.append(targetPackage);
+ }
+ if( ! StringTools.stringIsEmpty(catalog)) {
+ programArguments.append(" -catalog "); //$NON-NLS-1$
+ programArguments.append(catalog);
+ }
+ // schema
+ programArguments.append(" "); //$NON-NLS-1$
+ programArguments.append(xmlSchemaName);
+
+ // bindings
+ if( bindingsFileNames.length > 0) {
+ for(String bindingsFileName: bindingsFileNames) {
+ programArguments.append(" -b "); //$NON-NLS-1$
+ programArguments.append(bindingsFileName);
+ }
+ }
+ this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, programArguments.toString());
+ }
+
+ private void specifyWorkingDir(String projectLocation) {
+
+ File workingDir = new Path(projectLocation).toFile();
+ this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, workingDir.getAbsolutePath());
+ }
+
+ // ********** LaunchConfig **********
+
+ private ILaunchConfigurationWorkingCopy buildLaunchConfiguration() throws CoreException {
+ ILaunchConfigurationWorkingCopy launchConfig = null;
+ this.removeLaunchConfiguration(LAUNCH_CONFIG_NAME);
+
+ ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType type = manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
+
+ launchConfig = type.newInstance(null, LAUNCH_CONFIG_NAME);
+ return launchConfig;
+ }
+
+ private void removeLaunchConfiguration(String launchConfigurationName) throws CoreException {
+
+ ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType type = manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
+
+ ILaunchConfiguration[] configurations = manager.getLaunchConfigurations(type);
+ for (int i = 0; i < configurations.length; i++) {
+ ILaunchConfiguration configuration = configurations[i];
+ if (configuration.getName().equals(launchConfigurationName)) {
+ configuration.delete();
+ break;
+ }
+ }
+ }
+
+ private ILaunch saveAndLaunchConfig() {
+ ILaunchConfiguration configuration = null;
+ ILaunch result = null;
+ try {
+ configuration = this.launchConfig.doSave();
+ }
+ catch (CoreException saveException) {
+ throw new RuntimeException("Could not save LaunchConfig", saveException);
+ }
+ try {
+ result = configuration.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor());
+ }
+ catch (CoreException lauchException) {
+ throw new RuntimeException("An error occured during launch", lauchException);
+ }
+ return result;
+ }
+
+ private void addLaunchListener() {
+
+ this.getLaunchManager().addLaunchListener(this.buildLaunchListener());
+ }
+
+ private ILaunchesListener2 buildLaunchListener() {
+ return new ILaunchesListener2() {
+
+ public void launchesTerminated(ILaunch[] launches) {
+ for (int i = 0; i < launches.length; i++) {
+ ILaunch launch = launches[i];
+ if (launch.equals(ClassesGenerator.this.getLaunch())) {
+
+ ClassesGenerator.this.postGenerate();
+ return;
+ }
+ }
+ }
+
+ public void launchesAdded(ILaunch[] launches) {
+ // not interested to this event
+ }
+
+ public void launchesChanged(ILaunch[] launches) {
+ // not interested to this event
+ }
+
+ public void launchesRemoved(ILaunch[] launches) {
+ // not interested to this event
+ }
+ };
+ }
+
+ // ********** Queries **********
+
+ private IRuntimeClasspathEntry getSystemLibraryClasspathEntry() throws CoreException {
+
+ IPath systemLibsPath = new Path(JavaRuntime.JRE_CONTAINER);
+ return JavaRuntime.newRuntimeContainerClasspathEntry(systemLibsPath, IRuntimeClasspathEntry.STANDARD_CLASSES);
+ }
+
+ private IRuntimeClasspathEntry getDefaultProjectClasspathEntry(IJavaProject project) {
+
+ IRuntimeClasspathEntry projectEntry = JavaRuntime.newDefaultProjectClasspathEntry(project);
+ projectEntry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES);
+
+ return projectEntry;
+ }
+
+ protected JpaProject getJpaProject() {
+ return this.jpaProject;
+ }
+
+ private IVMInstall getProjectJRE() throws CoreException {
+ return JavaRuntime.getVMInstall(this.getJpaProject().getJavaProject());
+ }
+
+ protected ILaunch getLaunch() {
+ return this.launch;
+ }
+
+ protected ILaunchManager getLaunchManager() {
+ return DebugPlugin.getDefault().getLaunchManager();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/JptJaxbUiPlugin.java b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/JptJaxbUiPlugin.java
new file mode 100644
index 0000000000..611ecedcdc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/JptJaxbUiPlugin.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+* 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;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ *
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public class JptJaxbUiPlugin extends AbstractUIPlugin
+{
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.jpt.jaxb.ui"; //$NON-NLS-1$
+
+
+ // ********** singleton **********
+ private static JptJaxbUiPlugin INSTANCE;
+
+ /**
+ * Returns the singleton Plugin
+ */
+ public static JptJaxbUiPlugin instance() {
+ return INSTANCE;
+ }
+
+ public static void log(IStatus status) {
+ INSTANCE.getLog().log(status);
+ }
+
+ public static void log(String msg) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null));
+ }
+
+ public static void log(Throwable throwable) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, throwable.getLocalizedMessage(), throwable));
+ }
+
+ // ********** Image API **********
+ /**
+ * This gets a .gif from the icons folder.
+ */
+ public static ImageDescriptor getImageDescriptor(String key) {
+ if (! key.startsWith("icons/")) {
+ key = "icons/" + key;
+ }
+ if (! key.endsWith(".gif")) {
+ key = key + ".gif";
+ }
+ return imageDescriptorFromPlugin(PLUGIN_ID, key);
+ }
+
+ /**
+ * This returns an image for a .gif from the icons folder
+ */
+ public static Image getImage(String key) {
+ ImageDescriptor desc = getImageDescriptor(key);
+ return (desc == null) ? null : desc.createImage();
+ }
+
+
+
+ // ********** constructors **********
+ public JptJaxbUiPlugin() {
+ super();
+ INSTANCE = this;
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ INSTANCE = this;
+ }
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ INSTANCE = null;
+ super.stop(context);
+ }
+}
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
new file mode 100644
index 0000000000..b8ca74c426
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java
@@ -0,0 +1,222 @@
+/*******************************************************************************
+* 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;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jpt.core.JpaProject;
+import org.eclipse.jpt.core.JptCorePlugin;
+import org.eclipse.jpt.jaxb.core.internal.ClassesGenerator;
+import org.eclipse.jpt.jaxb.ui.internal.wizards.ClassesGeneratorWizard;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * ClassesGeneratorUi
+ */
+public class ClassesGeneratorUi {
+ private final JpaProject project;
+ private final String xmlSchemaName;
+
+ // ********** static methods **********
+
+ public static void generate(IFile xsdFile) {
+ JpaProject jpaProject = JptCorePlugin.getJpaProject(xsdFile.getProject());
+ if (jpaProject == null) {
+ return;
+ }
+ IPath xmlSchema = xsdFile.getProjectRelativePath();
+
+ new ClassesGeneratorUi(jpaProject, xmlSchema.toOSString()).generate();
+ }
+
+ // ********** constructors **********
+ private ClassesGeneratorUi(JpaProject project, String xmlSchemaName) {
+ super();
+ if (project == null || StringTools.stringIsEmpty(xmlSchemaName)) {
+ throw new NullPointerException();
+ }
+ this.project = project;
+ this.xmlSchemaName = xmlSchemaName;
+ }
+
+ // ********** generate **********
+ /**
+ * prompt the user with a wizard
+ */
+ protected void generate() {
+
+ ClassesGeneratorWizard wizard = new ClassesGeneratorWizard(this.project, this.xmlSchemaName);
+ WizardDialog dialog = new WizardDialog(this.getCurrentShell(), wizard);
+ dialog.create();
+ int returnCode = dialog.open();
+ if (returnCode != Window.OK) {
+ return;
+ }
+ String outputDir = wizard.getDestinationFolder();
+ String targetPackage = wizard.getTargetPackage();
+ String catalog = wizard.getCatalog();
+ boolean useMoxy = wizard.getUseMoxy();
+ String[] bindingsFileNames = wizard.getBindingsFileNames();
+
+ this.run(outputDir, targetPackage, catalog, useMoxy, bindingsFileNames);
+ }
+
+ // ********** internal methods **********
+
+ private void run(
+ String outputDir,
+ String targetPackage,
+ String catalog,
+ boolean useMoxyGenerator,
+ String[] bindingsFileNames) {
+
+ IWorkspaceRunnable runnable = this.buildGenerateEntitiesRunnable(
+ this.project,
+ this.xmlSchemaName,
+ outputDir,
+ targetPackage,
+ catalog,
+ useMoxyGenerator,
+ bindingsFileNames);
+ try {
+ ResourcesPlugin.getWorkspace().run(runnable, new NullProgressMonitor());
+ }
+ catch (CoreException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ private IWorkspaceRunnable buildGenerateEntitiesRunnable(
+ JpaProject project,
+ String xmlSchemaName,
+ String outputDir,
+ String targetPackage,
+ String catalog,
+ boolean useMoxyGenerator,
+ String[] bindingsFileNames) {
+
+ return new GenerateEntitiesRunnable(project, xmlSchemaName, outputDir, targetPackage, catalog, useMoxyGenerator, bindingsFileNames);
+ }
+
+ private Shell getCurrentShell() {
+ return Display.getCurrent().getActiveShell();
+ }
+
+ // ********** Runnable Class **********
+
+ private static class GenerateEntitiesRunnable implements IWorkspaceRunnable {
+ private final JpaProject project;
+ private final String xmlSchemaName;
+ private final String outputDir;
+ private final String targetPackage;
+ private final String catalog;
+ private final boolean useMoxyGenerator;
+ private final String[] bindingsFileNames;
+
+ // ********** constructors **********
+
+ public GenerateEntitiesRunnable(
+ JpaProject project,
+ String xmlSchemaName,
+ String outputDir,
+ String targetPackage,
+ String catalog,
+ boolean useMoxyGenerator,
+ String[] bindingsFileNames) {
+
+ super();
+ this.project = project;
+ this.xmlSchemaName = xmlSchemaName;
+ this.outputDir = outputDir;
+ this.targetPackage = targetPackage;
+ this.catalog = catalog;
+ this.useMoxyGenerator = useMoxyGenerator;
+ this.bindingsFileNames = bindingsFileNames;
+ }
+
+ public void run(IProgressMonitor monitor) {
+ try {
+ this.entitiesGeneratorGenerate(this.project,
+ this.xmlSchemaName,
+ this.outputDir,
+ this.targetPackage,
+ this.catalog,
+ this.useMoxyGenerator,
+ this.bindingsFileNames,
+ monitor);
+ }
+ catch (OperationCanceledException e) {
+ return;
+ // fall through and tell monitor we are done
+ }
+ catch (RuntimeException re) {
+ String msg = re.getMessage();
+ String message = (msg == null) ? re.toString() : msg;
+
+ this.logError(message);
+ throw new RuntimeException(re);
+ }
+ }
+
+ private void entitiesGeneratorGenerate(JpaProject project,
+ String xmlSchemaName,
+ String outputDir,
+ String targetPackage,
+ String catalog,
+ boolean useMoxyGenerator,
+ String[] bindingsFileNames,
+ IProgressMonitor monitor) {
+
+ ClassesGenerator.generate(project,
+ xmlSchemaName,
+ outputDir,
+ targetPackage,
+ catalog,
+ useMoxyGenerator,
+ bindingsFileNames,
+ monitor);
+ return;
+ }
+
+ private void logError(String message) {
+ this.displayError(message);
+ }
+
+ private void displayError(String message) {
+ MessageDialog.openError(
+ this.getShell(),
+ JptJaxbUiMessages.ClassesGeneratorWizard_errorDialogTitle,
+ message
+ );
+ }
+
+ private Shell getShell() {
+ Display display = Display.getCurrent();
+ Shell shell = (display == null) ? null : display.getActiveShell();
+ if (shell == null && display != null) {
+ Shell[] shells = display.getShells();
+ if (shells.length > 0)
+ shell = shells[0];
+ }
+ return shell;
+ }
+ }
+}
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
new file mode 100644
index 0000000000..882186ad5d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiMessages.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+* 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;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Localized messages used by Dali JAXB UI.
+ *
+ * @version 2.3
+ */
+public class JptJaxbUiMessages {
+
+ public static String ClassesGeneratorWizard_title;
+ public static String ClassesGeneratorWizard_errorDialogTitle;
+ public static String ClassesGeneratorWizard_couldNotCreate;
+
+ public static String ClassesGeneratorWizardPage_title;
+ public static String ClassesGeneratorWizardPage_desc;
+
+ public static String ClassesGeneratorWizardPage_usesMoxyImplementation;
+
+ public static String ClassesGeneratorWizardPage_settingsGroupTitle;
+ public static String ClassesGeneratorWizardPage_targetFolder;
+ public static String ClassesGeneratorWizardPage_targetPackage;
+ public static String ClassesGeneratorWizardPage_catalog;
+ public static String ClassesGeneratorWizardPage_bindingsFiles;
+ public static String ClassesGeneratorWizardPage_addButton;
+ public static String ClassesGeneratorWizardPage_removeButton;
+ public static String ClassesGeneratorWizardPage_chooseABindingsFile;
+
+ public static String ClassesGeneratorWizardPage_targetFolderCannotBeEmpty;
+
+ public static String ClassesGeneratorWizardPage_jaxbLibrariesNotAvailable;
+
+ public static String ClassesGeneratorWizardPage_moxyLibrariesNotAvailable;
+
+ private static final String BUNDLE_NAME = "jpt_jaxb_ui"; //$NON-NLS-1$
+ private static final Class<?> BUNDLE_CLASS = JptJaxbUiMessages.class;
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, BUNDLE_CLASS);
+ }
+
+ private JptJaxbUiMessages() {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/GenerateClassesAction.java b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/GenerateClassesAction.java
new file mode 100644
index 0000000000..526fd69580
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/GenerateClassesAction.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+* 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.actions;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jpt.jaxb.ui.internal.ClassesGeneratorUi;
+
+/**
+ * GenerateClassesAction
+ */
+public class GenerateClassesAction extends ObjectAction
+{
+
+ @Override
+ protected void execute(IFile xsdFile) {
+
+ ClassesGeneratorUi.generate(xsdFile);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/ObjectAction.java b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/ObjectAction.java
new file mode 100644
index 0000000000..6146578fa8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/ObjectAction.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+* 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.actions;
+
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.actions.ActionDelegate;
+
+/**
+ * GenerateEntitiesAction
+ */
+public abstract class ObjectAction extends ActionDelegate implements IObjectActionDelegate
+{
+ private ISelection currentSelection;
+
+ public ObjectAction() {
+ super();
+ }
+
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ // do nothing
+ }
+
+ @Override
+ public void selectionChanged(IAction action, ISelection selection) {
+ this.currentSelection = selection;
+ }
+
+ @Override
+ public void run(IAction action) {
+ if (this.currentSelection instanceof ITreeSelection) {
+ for (Iterator stream = ((ITreeSelection) this.currentSelection).iterator(); stream.hasNext(); ) {
+ this.execute(stream.next());
+ }
+ }
+ }
+
+ protected void execute(Object selection) {
+
+ if(selection instanceof IFile) {
+ this.execute((IFile)selection);
+ }
+ }
+
+ @SuppressWarnings("unused")
+ protected void execute(IFile file) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/ClassesGeneratorWizard.java b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/ClassesGeneratorWizard.java
new file mode 100644
index 0000000000..d13063e3ce
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/ClassesGeneratorWizard.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+* 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;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jpt.core.JpaProject;
+import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * ClassesGeneratorWizard
+ */
+public class ClassesGeneratorWizard extends Wizard {
+
+ private final JpaProject jpaProject;
+ private final String xmlSchemaName;
+
+ private String destinationFolder;
+ private String targetPackage;
+ private String catalog;
+ private boolean useMoxy;
+ private String[] bindingsFileNames;
+
+ private ClassesGeneratorWizardPage generatorSettingsPage;
+
+ // ********** constructor **********
+
+ public ClassesGeneratorWizard(JpaProject jpaProject, String xmlSchemaName) {
+ super();
+ this.jpaProject = jpaProject;
+ this.xmlSchemaName = xmlSchemaName;
+ this.setWindowTitle(JptJaxbUiMessages.ClassesGeneratorWizard_title);
+ }
+
+ // ********** overrides **********
+
+ @Override
+ public void addPages() {
+ super.addPages();
+
+ this.generatorSettingsPage = this.buildClassesGeneratorPage();
+
+ this.addPage(this.generatorSettingsPage);
+ }
+
+ @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();
+
+ IFolder folder = this.jpaProject.getProject().getFolder(this.destinationFolder);
+ this.createFolderIfNotExist(folder);
+ return true;
+ }
+
+ @Override
+ public boolean canFinish() {
+ return this.generatorSettingsPage.isPageComplete();
+ }
+
+ // ********** public methods **********
+
+ public String getDestinationFolder() {
+ return this.destinationFolder;
+ }
+
+ public String getTargetPackage() {
+ return this.targetPackage;
+ }
+
+ public String getCatalog() {
+ return this.catalog;
+ }
+
+ public boolean getUseMoxy() {
+ return this.useMoxy;
+ }
+
+ public String[] getBindingsFileNames() {
+ return this.bindingsFileNames;
+ }
+
+ // ********** internal methods **********
+
+ private ClassesGeneratorWizardPage buildClassesGeneratorPage() {
+ return new ClassesGeneratorWizardPage(this.jpaProject, this.xmlSchemaName);
+ }
+
+ private void createFolderIfNotExist(IFolder folder) {
+ if( folder.exists()) {
+ return;
+ }
+ try {
+ folder.create(true, true, null);
+ }
+ catch (CoreException e) {
+ this.logError(NLS.bind(
+ JptJaxbUiMessages.ClassesGeneratorWizard_couldNotCreate,
+ folder.getProjectRelativePath().toOSString()));
+ }
+ }
+
+ protected void logError(String message) {
+ this.displayError(message);
+ }
+
+ private void displayError(String message) {
+ MessageDialog.openError(
+ this.getShell(),
+ JptJaxbUiMessages.ClassesGeneratorWizard_errorDialogTitle,
+ message
+ );
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/ClassesGeneratorWizardPage.java b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/ClassesGeneratorWizardPage.java
new file mode 100644
index 0000000000..9336d43bd8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/ClassesGeneratorWizardPage.java
@@ -0,0 +1,503 @@
+/*******************************************************************************
+* 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;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.jpt.core.JpaProject;
+import org.eclipse.jpt.jaxb.core.internal.ClassesGenerator;
+import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages;
+import org.eclipse.jpt.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.ui.internal.util.TableLayoutComposite;
+import org.eclipse.jpt.utility.internal.ArrayTools;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+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.FileDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.osgi.framework.Bundle;
+
+/**
+ * ClassesGeneratorWizardPage
+ */
+public class ClassesGeneratorWizardPage extends WizardPage {
+ static public String JPT_JAXB_ECLIPSELINK_UI_PLUGIN_ID = "org.eclipse.jpt.eclipselink.jaxb.ui"; //$NON-NLS-1$
+
+ private final JpaProject jpaProject;
+
+ private SettingsGroup settingsGroup;
+
+ private Button usesMoxyCheckBox;
+ private boolean usesMoxy = true; // always use Moxy when jaxb.eclipselink plugin is present
+
+ // ********** constructor **********
+
+ public ClassesGeneratorWizardPage(JpaProject jpaProject, String xmlSchemaName) {
+ super("Classes Generator"); //$NON-NLS-1$
+ if (jpaProject == null) {
+ throw new NullPointerException();
+ }
+ this.jpaProject = jpaProject;
+ this.setTitle(NLS.bind(JptJaxbUiMessages.ClassesGeneratorWizardPage_title, xmlSchemaName));
+ this.setDescription(JptJaxbUiMessages.ClassesGeneratorWizardPage_desc);
+ }
+
+ // ********** UI components **********
+
+ public void createControl(Composite parent) {
+ this.setPageComplete(false);
+ this.setControl(this.buildTopLevelControl(parent));
+ }
+
+ private Control buildTopLevelControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setLayout(new GridLayout());
+
+ this.settingsGroup = new SettingsGroup(composite);
+
+ // add checkbox only if jaxb.eclipselink plugin not present
+ if( ! jptEclipseLinkJaxbBundleExists()) {
+ this.usesMoxyCheckBox = this.buildUsesMoxyCheckBox(composite);
+ }
+
+ this.validateProjectClasspath();
+
+ Dialog.applyDialogFont(parent);
+ return composite;
+ }
+
+ private Button buildUsesMoxyCheckBox(Composite parent) {
+
+ Button checkBox = new Button(parent, SWT.CHECK);
+ checkBox.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_usesMoxyImplementation);
+ this.setUsesMoxy(false);
+ checkBox.setSelection(this.usesMoxy());
+ checkBox.addSelectionListener(this.buildUsesMoxySelectionListener());
+
+ return checkBox;
+ }
+
+ private SelectionListener buildUsesMoxySelectionListener() {
+ return new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent event) {
+ this.widgetSelected(event);
+ }
+
+ public void widgetSelected(SelectionEvent event) {
+ setUsesMoxy(usesMoxyCheckBox.getSelection());
+ validateProjectClasspath();
+ }
+ };
+ }
+
+ // ********** intra-wizard methods **********
+
+ protected String getTargetFolder() {
+ return this.settingsGroup.getTargetFolder();
+ }
+
+ protected String getTargetPackage() {
+ return this.settingsGroup.getTargetPackage();
+ }
+
+ protected String getCatalog() {
+ return this.settingsGroup.getCatalog();
+ }
+
+ protected String[] getBindingsFileNames() {
+ return this.settingsGroup.getBindingsFileNames();
+ }
+
+ protected Boolean usesMoxy() {
+ return this.usesMoxy;
+ }
+
+ protected void setUsesMoxy(boolean usesMoxy){
+ this.usesMoxy = usesMoxy;
+ }
+
+ // ********** internal methods **********
+
+ private boolean jptEclipseLinkJaxbBundleExists() {
+ return (this.getJptEclipseLinkJaxbBundle() != null);
+ }
+
+ private Bundle getJptEclipseLinkJaxbBundle() {
+ return Platform.getBundle(JPT_JAXB_ECLIPSELINK_UI_PLUGIN_ID); // Cannot reference directly EL plugin.
+ }
+
+ private void validateProjectClasspath() {
+ this.setMessage(null);
+ if(this.usesMoxy()) {
+ if(this.projectJreIs15OrLess()) {
+ if( ! this.genericJaxbIsOnClasspath() || ! this.moxyIsOnClasspath()) {
+ this.displayWarning(JptJaxbUiMessages.ClassesGeneratorWizardPage_moxyLibrariesNotAvailable);
+ }
+ }
+ else {
+ if( ! this.moxyIsOnClasspath()) {
+ this.displayWarning(JptJaxbUiMessages.ClassesGeneratorWizardPage_moxyLibrariesNotAvailable);
+ }
+ }
+ }
+ else {
+ if(this.projectJreIs15OrLess() && ! this.genericJaxbIsOnClasspath()) {
+ this.displayWarning(JptJaxbUiMessages.ClassesGeneratorWizardPage_jaxbLibrariesNotAvailable);
+ }
+ }
+ }
+
+ private void displayWarning(String message) {
+ this.setMessage(message, WARNING);
+ }
+
+ private void displayError(String message) {
+ this.setMessage(message, ERROR);
+ }
+
+ /**
+ * Test if the Jaxb compiler is on the classpath.
+ */
+ private boolean genericJaxbIsOnClasspath() {
+ try {
+ String className = ClassesGenerator.JAXB_GENERIC_GEN_CLASS;
+ IType genClass = this.jpaProject.getJavaProject().findType(className);
+ return (genClass != null);
+ }
+ catch (JavaModelException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ /**
+ * Test if the EclipseLink Jaxb compiler is on the classpath.
+ */
+ private boolean moxyIsOnClasspath() {
+ try {
+ String className = ClassesGenerator.JAXB_ECLIPSELINK_GEN_CLASS;
+ IType genClass = this.jpaProject.getJavaProject().findType(className);
+ return (genClass != null);
+ }
+ catch (JavaModelException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Test if the project's JDK version is 1.5 or less..
+ */
+ private boolean projectJreIs15OrLess() {
+ IVMInstall vm;
+ try {
+ vm = JavaRuntime.getVMInstall(this.jpaProject.getJavaProject());
+ }
+ catch (CoreException e) {
+ throw new RuntimeException(e);
+ }
+ String vmName = vm.getName(); // format: jdk1.5.0_18
+ return (vmName.startsWith("jdk1.4") || vmName.startsWith("jdk1.5")); //$NON-NLS-1$
+ }
+
+ // ********** SettingsGroup class **********
+
+ private class SettingsGroup {
+
+ private final Text targetFolderText;
+ private final Text targetPackageText;
+ private final Text catalogText;
+
+ private final ArrayList<String> bindingsFileNames;
+
+ // ********** constructor **********
+
+ private SettingsGroup(Composite composite) {
+ super();
+ Group group = new Group(composite, SWT.NONE);
+ group.setLayout(new GridLayout(3, false)); // false = do not make columns equal width
+ group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ group.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_settingsGroupTitle);
+ // TODO PlatformUI.getWorkbench().getHelpSystem().setHelp(this.group, JpaHelpContextIds.XXX);
+
+ // Destination folder
+ this.buildLabel(group, 1, JptJaxbUiMessages.ClassesGeneratorWizardPage_targetFolder);
+ this.targetFolderText = this.buildTargetFolderText(group);
+ // Target package
+ this.buildLabel(group, 1, JptJaxbUiMessages.ClassesGeneratorWizardPage_targetPackage);
+ this.targetPackageText = this.buildText(group);
+ // Catalog
+ this.buildLabel(group, 1, JptJaxbUiMessages.ClassesGeneratorWizardPage_catalog);
+ this.catalogText = this.buildText(group);
+
+ // Bindings files
+ this.bindingsFileNames = new ArrayList<String>();
+ this.buildLabel(group, 1, JptJaxbUiMessages.ClassesGeneratorWizardPage_bindingsFiles);
+ this.buildBindingsFileTable(group);
+ }
+
+ // ********** intra-wizard methods **********
+
+ protected String getTargetFolder() {
+ return this.targetFolderText.getText();
+ }
+
+ protected String getTargetPackage() {
+ return this.targetPackageText.getText();
+ }
+
+ protected String getCatalog() {
+ return this.catalogText.getText();
+ }
+
+ protected String[] getBindingsFileNames() {
+ return ArrayTools.array(this.bindingsFileNames.iterator(), new String[0]);
+ }
+
+ // ********** UI components **********
+
+ private Label buildLabel(Composite parent, int span, String text) {
+ Label label = new Label(parent, SWT.NONE);
+ label.setText(text);
+ GridData gd = new GridData();
+ gd.horizontalSpan = span;
+ label.setLayoutData(gd);
+ return label;
+ }
+
+ private Text buildText(Composite parent) {
+
+ Text text = new Text(parent, SWT.BORDER);
+ text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ //Filler column
+ new Label(parent, SWT.NONE);
+ return text;
+ }
+
+ private Text buildTargetFolderText(Composite parent) {
+
+ Text text = new Text(parent, SWT.BORDER);
+ text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ text.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ if(validateTargetFolderText()) {
+ validateProjectClasspath();
+ setPageComplete(true);
+ }
+ else {
+ displayError(JptJaxbUiMessages.ClassesGeneratorWizardPage_targetFolderCannotBeEmpty);
+ setPageComplete(false);
+ }
+ }
+ });
+ //Filler column
+ new Label(parent, SWT.NONE);
+ return text;
+ }
+
+ private TableViewer buildBindingsFileTable(Composite parent) {
+
+ TableViewer tableViewer = this.buildTableViewer(parent, this.bindingsFileNames);
+
+ this.buildAddRemoveButtons(parent, tableViewer, this.bindingsFileNames);
+ return tableViewer;
+ }
+
+ private TableViewer buildTableViewer(Composite parent, ArrayList<String> tableDataModel) {
+
+ TableLayoutComposite tableLayout = new TableLayoutComposite(parent, SWT.NONE);
+ this.addColumnsData(tableLayout);
+
+ final Table table = new Table(tableLayout, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);
+ table.setLinesVisible(false);
+
+ TableColumn column = new TableColumn(table, SWT.NONE, 0);
+ column.setResizable(true);
+
+ GridData gridData= new GridData(GridData.FILL_BOTH);
+ gridData.heightHint= SWTUtil.getTableHeightHint(table, 3);
+ gridData.widthHint = 300;
+ tableLayout.setLayoutData(gridData);
+
+ TableViewer tableViewer = new TableViewer(table);
+ tableViewer.setUseHashlookup(true);
+ tableViewer.setLabelProvider(this.buildLabelProvider());
+ tableViewer.setContentProvider(this.buildContentProvider());
+
+ tableViewer.setInput(tableDataModel);
+ return tableViewer;
+ }
+
+ private void buildAddRemoveButtons(Composite parent, final TableViewer tableViewer, final ArrayList<String> tableDataModel) {
+
+ Composite buttonComposite = new Composite(parent, SWT.NULL);
+ GridLayout buttonLayout = new GridLayout(1, false);
+ buttonComposite.setLayout(buttonLayout);
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.verticalAlignment = GridData.BEGINNING;
+ buttonComposite.setLayoutData(gridData);
+ // Add buttons
+ Button addButton = new Button(buttonComposite, SWT.PUSH);
+ addButton.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_addButton);
+ gridData = new GridData();
+ gridData.horizontalAlignment = GridData.FILL;
+ addButton.setLayoutData(gridData);
+ addButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {}
+
+ public void widgetSelected(SelectionEvent e) {
+
+ String fileName = promptFile();
+ if( ! StringTools.stringIsEmpty(fileName)) {
+
+ tableDataModel.add(makeRelativeToProjectPath(fileName));
+ tableViewer.refresh();
+ }
+ }
+ });
+ // Remove buttons
+ Button removeButton = new Button(buttonComposite, SWT.PUSH);
+ removeButton.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_removeButton);
+ gridData = new GridData();
+ gridData.horizontalAlignment = GridData.FILL;
+ removeButton.setLayoutData(gridData);
+ removeButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {}
+
+ public void widgetSelected(SelectionEvent e) {
+ StructuredSelection selection = (StructuredSelection)tableViewer.getSelection();
+ if(selection.isEmpty()) {
+ return;
+ }
+ String bindingsFileName = (String)selection.getFirstElement();
+ removeBindingsFileName(bindingsFileName);
+
+ tableViewer.refresh();
+ }
+ });
+ addButton.setFocus();
+ }
+
+ // ********** internal methods **********
+
+ private String makeRelativeToProjectPath(String filePath) {
+ Path path = new Path(filePath);
+ IPath relativePath = path.makeRelativeTo(jpaProject.getProject().getLocation());
+ return relativePath.toOSString();
+ }
+
+ private void removeBindingsFileName(String bindingsName) {
+ String name = this.getBindingsFileName(bindingsName);
+ this.bindingsFileNames.remove(name);
+ }
+
+ private String getBindingsFileName(String bindingsName) {
+ for(String name: this.bindingsFileNames) {
+ if(name.equals(bindingsName)) {
+ return name;
+ }
+ }
+ return null;
+ }
+
+ private IBaseLabelProvider buildLabelProvider() {
+ return new TableLabelProvider();
+ }
+
+ private IContentProvider buildContentProvider() {
+ return new TableContentProvider();
+ }
+
+ /**
+ * The Add button was clicked, its action invokes this action which should
+ * prompt the user to select a file and return it.
+ */
+ private String promptFile() {
+ String projectPath= jpaProject.getProject().getLocation().toString();
+
+ FileDialog dialog = new FileDialog(getShell());
+ dialog.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_chooseABindingsFile);
+ dialog.setFilterPath(projectPath);
+ dialog.setFilterExtensions(new String[] {"*.xjb"}); //$NON-NLS-1$
+ String filePath = dialog.open();
+
+ return (filePath != null) ? filePath : null;
+ }
+
+ private void addColumnsData(TableLayoutComposite layout) {
+ layout.addColumnData(new ColumnWeightData(50, true));
+ }
+
+ private boolean validateTargetFolderText() {
+
+ return ! StringTools.stringIsEmpty(getTargetFolder());
+ }
+ }
+
+ // ********** inner class **********
+ private class TableLabelProvider extends LabelProvider implements ITableLabelProvider {
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ return (String)element;
+ }
+ }
+
+ private class TableContentProvider implements IStructuredContentProvider {
+
+ TableContentProvider() {
+ super();
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
+
+ public void dispose() {}
+
+ public Object[] getElements(Object inputElement) {
+ return ((Collection<?>) inputElement).toArray();
+ }
+ }
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.ui/META-INF/MANIFEST.MF
index 41da830120..9678830154 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/META-INF/MANIFEST.MF
+++ b/jpa/plugins/org.eclipse.jpt.ui/META-INF/MANIFEST.MF
@@ -76,7 +76,7 @@ Export-Package: org.eclipse.jpt.ui,
org.eclipse.jpt.ui.internal.structure;x-internal:=true,
org.eclipse.jpt.ui.internal.swt;x-internal:=true,
org.eclipse.jpt.ui.internal.util;
- x-friends:="org.eclipse.jpt.ui.jaxb",
+ x-friends:="org.eclipse.jpt.jaxb.ui",
org.eclipse.jpt.ui.internal.utility;x-internal:=true,
org.eclipse.jpt.ui.internal.utility.swt;x-internal:=true,
org.eclipse.jpt.ui.internal.views;x-internal:=true,
diff --git a/jpa/plugins/org.eclipse.jpt.utility/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.utility/META-INF/MANIFEST.MF
index ea514d9637..941972f1af 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/META-INF/MANIFEST.MF
+++ b/jpa/plugins/org.eclipse.jpt.utility/META-INF/MANIFEST.MF
@@ -12,8 +12,8 @@ Export-Package: org.eclipse.jpt.utility,
org.eclipse.jpt.db,
org.eclipse.jpt.db.ui,
org.eclipse.jpt.gen,
- org.eclipse.jpt.ui,
- org.eclipse.jpt.ui.jaxb",
+ org.eclipse.jpt.jaxb.ui,
+ org.eclipse.jpt.ui",
org.eclipse.jpt.utility.internal.enumerations;
x-friends:="org.eclipse.jpt.core,
org.eclipse.jpt.db,

Back to the top