diff options
Diffstat (limited to 'jaxb/plugins')
270 files changed, 0 insertions, 17677 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/.cvsignore b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/.cvsignore deleted file mode 100644 index c14487ceac..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -build.xml diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/.project b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/.project deleted file mode 100644 index de731ab893..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/.project +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jpt.dbws.eclipselink.branding</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <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> - </natures> -</projectDescription> diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/META-INF/MANIFEST.MF deleted file mode 100644 index c6c16f392a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/META-INF/MANIFEST.MF +++ /dev/null @@ -1,7 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.jpt.dbws.eclipselink.branding;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-Localization: plugin -Bundle-Vendor: %providerName diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.html b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.html deleted file mode 100644 index ca606b1bb5..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.html +++ /dev/null @@ -1,34 +0,0 @@ -<!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>June 06, 2007</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>
\ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.ini b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.ini deleted file mode 100644 index 6c107d466d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.ini +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2011 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 -############################################################################### - -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=icons/WTP_icon_x32_v2.png - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -# optional - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional - -# Property "tipsAndTricksHref" contains the Help topic href to a tips and tricks page -# optional -tipsAndTricksHref=/org.eclipse.jpt.doc.user/tips_and_tricks.htm - - diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.mappings b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.mappings deleted file mode 100644 index bddaab4310..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.mappings +++ /dev/null @@ -1,6 +0,0 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -0=@build@
\ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.properties b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.properties deleted file mode 100644 index 7ed9bf2fc2..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.properties +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################### -# Copyright (c) 2011 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 -############################################################################### - -# about.properties -# contains externalized strings for about.ini -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# fill-ins are supplied by about.mappings -# This file should be translated. - -blurb=Dali Java Persistence Tools - EclipseLink DBWS Support\n\ -\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -(c) Copyright Oracle contributors and others 2011. All rights reserved.\n\ -Visit http://www.eclipse.org/webtools diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/build.properties b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/build.properties deleted file mode 100644 index 6c20e3b027..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/build.properties +++ /dev/null @@ -1,17 +0,0 @@ -############################################################################### -# Copyright (c) 2010, 2011 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 -############################################################################### -bin.includes = META-INF/,\ - about.ini,\ - about.html,\ - about.mappings,\ - about.properties,\ - icons/,\ - plugin.properties diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/component.xml b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/component.xml deleted file mode 100644 index 434ae90d00..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/component.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<component xmlns="http://eclipse.org/wtp/releng/tools/component-model" name="org.eclipse.jpt.dbws.eclipselink.branding"> -<description url=""></description> -<component-depends unrestricted="true"></component-depends> -<plugin id="org.eclipse.jpt.dbws.eclipselink.branding" fragment="false"/> -<plugin id="org.eclipse.jpt.common.utility" fragment="false"/> -<plugin id="org.eclipse.jpt.common.core" fragment="false"/> -<plugin id="org.eclipse.jpt.common.ui" fragment="false"/> -<plugin id="org.eclipse.jpt.dbws.eclipselink.ui" fragment="false"/> -</component>
\ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/icons/WTP_icon_x32_v2.png b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/icons/WTP_icon_x32_v2.png Binary files differdeleted file mode 100644 index 6f09c2a700..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/icons/WTP_icon_x32_v2.png +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/plugin.properties b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/plugin.properties deleted file mode 100644 index cdf657e329..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2010, 2011 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 -############################################################################### - -pluginName = Dali Java Persistence Tools - EclipseLink DBWS Support -providerName = Eclipse Web Tools Platform diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.classpath b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.classpath deleted file mode 100644 index 64c5e31b7a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?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="output" path="bin"/> -</classpath> diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.cvsignore b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.cvsignore deleted file mode 100644 index ba077a4031..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.project b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.project deleted file mode 100644 index 4c657b1ec5..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jpt.dbws.eclipselink.core.gen</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/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.settings/org.eclipse.jdt.core.prefs b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 7fd88b1dd7..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Tue Mar 08 12:07:03 EST 2011 -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.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -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/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/META-INF/MANIFEST.MF deleted file mode 100644 index be182acf00..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/META-INF/MANIFEST.MF +++ /dev/null @@ -1,13 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.dbws.eclipselink.core.gen;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: org.eclipse.persistence.dbws.builder;bundle-version="[2.3.0,3.0.0)", - javax.wsdl;bundle-version="[1.6.2,2.0.0)" -Export-Package: org.eclipse.jpt.dbws.eclipselink.core.gen, - org.eclipse.jpt.dbws.eclipselink.core.gen.internal;x-internal:=true -Import-Package: org.eclipse.persistence.oxm diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/about.html b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/about.html deleted file mode 100644 index 071f586b21..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/about.html +++ /dev/null @@ -1,47 +0,0 @@ -<!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"> - -<H2>About This Content</H2> - -<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> - -<h3>Third Party Content</h3> -<p>The Content includes items that have been sourced from third parties as set - out below. If you did not receive this Content directly from the Eclipse Foundation, - the following is provided for informational purposes only, and you should look - to the Redistributor’s license for terms and conditions of use.</p> - -<h4><a name="JPA" id="JPA"></a>Java Persistence API (JPA) v1.0</h4> - -<blockquote> - <p>The Java Persistence API (JPA) which is distributed under <a href="https://glassfish.dev.java.net/public/CDDLv1.0.html">CDDL - v1.0</a> is required by the Dali Java Persistence Tools Project in order - to support this standard.</p> -</blockquote> -</BODY> -</HTML> diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/build.properties b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/build.properties deleted file mode 100644 index 5a838ab2cc..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/build.properties +++ /dev/null @@ -1,16 +0,0 @@ -################################################################################ -# Copyright (c) 2010, 2011 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 -################################################################################ -source.. = src/ -output.. = bin/ -bin.includes = .,\ - META-INF/,\ - about.html,\ - plugin.properties -jars.compile.order = . diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/plugin.properties b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/plugin.properties deleted file mode 100644 index 5d537fcf12..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/plugin.properties +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2008 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 - DBWS Support - Web Services Generation -providerName = Eclipse Web Tools Platform diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/Main.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/Main.java deleted file mode 100644 index 4f6f4451a6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/Main.java +++ /dev/null @@ -1,241 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 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.dbws.eclipselink.core.gen; - -import static java.util.logging.Level.INFO; -import static java.util.logging.Level.SEVERE; -import static org.eclipse.persistence.tools.dbws.DBWSPackager.ArchiveUse.ignore; - -import java.io.File; -import java.util.logging.Level; - -import javax.wsdl.WSDLException; - -import org.eclipse.jpt.dbws.eclipselink.core.gen.internal.JptDbwsCoreMessages; -import org.eclipse.jpt.dbws.eclipselink.core.gen.internal.Tools; -import org.eclipse.persistence.oxm.XMLContext; -import org.eclipse.persistence.oxm.XMLUnmarshaller; -import org.eclipse.persistence.tools.dbws.DBWSBuilder; -import org.eclipse.persistence.tools.dbws.DBWSBuilderModel; -import org.eclipse.persistence.tools.dbws.DBWSBuilderModelProject; -import org.eclipse.persistence.tools.dbws.DBWSPackager; -import org.eclipse.persistence.tools.dbws.EclipsePackager; - -/** - * Generate DBWS content - * - * Current command-line arguments: - * [-builderFile dbws-builder.xml] - specifies source builder file - * [-stageDir .\Output_Dir] - specifies destination directory - * [-packageAs eclipse] - specifies the source package - */ -public class Main -{ - private String builderFile; - private String stageDir; - private String packageAs; - @SuppressWarnings("unused") - private boolean isDebugMode; - - // ********** static methods ********** - - public static void main(String[] args) { - new Main().execute(args); - } - - // ********** constructors ********** - - private Main() { - super(); - } - - // ********** behavior ********** - - protected void execute(String[] args) { - - this.initializeWith(args); - - this.generate(); - } - - private void generate() { - - DBWSBuilder builder = new DBWSBuilder(); - - DBWSBuilderModel model = this.buildBuilderModel(this.builderFile); - if(model == null) { - this.logMessage(INFO, JptDbwsCoreMessages.NO_GENERATION_PERFORMED); - return; - } - - builder.setProperties(model.properties); - builder.setOperations(model.operations); - - if( ! this.jdbcDriverIsOnClasspath(builder.getDriver())) { - return; - } - - DBWSPackager packager = this.buildEclipsePackager(); - - this.initializePackager(packager, builder, this.buildStageDir(this.stageDir)); - builder.setPackager(packager); - - try { - builder.start(); - } - catch(WSDLException e) { - this.logMessage(SEVERE, JptDbwsCoreMessages.WSDL_EXCEPTION, e.getMessage()); - return; - } - catch(Exception e) { - //TODO Clean-up Stage dir. ? - this.logMessage(SEVERE, JptDbwsCoreMessages.GENERATION_FAILED, e.getMessage()); - e.printStackTrace(); - return; - } - this.logMessage(INFO, JptDbwsCoreMessages.GENERATION_COMPLETED); - return; - - } - - // ********** internal methods ********** - - private void initializeWith(String[] args) { - - this.builderFile = this.getArgumentBuilderFile(args); - this.stageDir = this.getArgumentStageDir(args); - this.packageAs = this.getArgumentPackageAs(args); - - this.isDebugMode = this.getArgumentDebugMode(args); - } - - private void initializePackager(DBWSPackager packager, DBWSBuilder builder, File stageDir) { - - packager.setDBWSBuilder(builder); - packager.setArchiveUse(ignore); - packager.setAdditionalArgs(null); - packager.setStageDir(stageDir); - packager.setSessionsFileName(builder.getSessionsFileName()); - } - - private DBWSBuilderModel buildBuilderModel(String builderFileName) { - - File builderFile = this.getBuilderFile(builderFileName); - return this.unmarshal(builderFile); - } - - private DBWSBuilderModel unmarshal(File builderFile) { - if((builderFile == null) || ( ! builderFile.exists())) { - return null; - } - XMLContext context = new XMLContext(new DBWSBuilderModelProject()); - XMLUnmarshaller unmarshaller = context.createUnmarshaller(); - - DBWSBuilderModel model = (DBWSBuilderModel)unmarshaller.unmarshal(builderFile); - if(model.properties.size() == 0) { - this.logMessage(SEVERE, JptDbwsCoreMessages.NO_OPERATIONS_SPECIFIED); - return null; - } - return model; - } - - private File getBuilderFile(String builderFileName) { - - File builderFile = new File(builderFileName); - if( ! (builderFile.exists() && builderFile.isFile())) { - this.logMessage(SEVERE, - JptDbwsCoreMessages.UNABLE_TO_LOCATE_BUILDER_XML, builderFileName); //$NON-NLS-1$ - return null; - } - return builderFile; - } - - private File buildStageDir(String stageDirName) { - File dir = new File(stageDirName); - if(( ! dir.exists()) || ( ! dir.isDirectory())) { - dir = Tools.buildDirectory(stageDirName); - } - return dir; - } - - private EclipsePackager buildEclipsePackager() { - return new EclipsePackager() { - @Override - public void start() { - // no need to check for the existence of stageDir, everything is in-memory - } - }; - } - - private boolean jdbcDriverIsOnClasspath(String jdbcDriverName) { - try { - Class.forName(jdbcDriverName); - } - catch (ClassNotFoundException cnfe) { - this.logMessage(SEVERE, JptDbwsCoreMessages.DRIVER_NOT_ON_CLASSPATH, jdbcDriverName); - return false; - } - return true; - } - - private void logMessage(Level level, String key, Object argument) { - Tools.logMessage(level, Tools.bind(key, argument)); - } - - private void logMessage(Level level, String key) { - Tools.logMessage(level, Tools.getString(key)); - } - - // ********** argument queries ********** - - private String getArgumentBuilderFile(String[] args) { - - return this.getArgumentValue("-builderFile", args); //$NON-NLS-1$ - } - - private String getArgumentStageDir(String[] args) { - - return this.getArgumentValue("-stageDir", args); //$NON-NLS-1$ - } - - private String getArgumentPackageAs(String[] args) { - - return this.getArgumentValue("-packageAs", args); //$NON-NLS-1$ - } - - private boolean getArgumentDebugMode(String[] args) { - - return this.argumentExists("-debug", args); //$NON-NLS-1$ - } - - private String getArgumentValue(String argName, String[] args) { - for (int i = 0; i < args.length; i++) { - String arg = args[i]; - if (arg.equals(argName)) { - int j = i + 1; - if (j < args.length) { - return args[j]; - } - } - } - return null; - } - - private boolean argumentExists(String argName, String[] args) { - for (int i = 0; i < args.length; i++) { - String arg = args[i]; - if (arg.toLowerCase().equals(argName)) { - return true; - } - } - return false; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/JptDbwsCoreMessages.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/JptDbwsCoreMessages.java deleted file mode 100644 index ff3fa9b9fb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/JptDbwsCoreMessages.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 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.dbws.eclipselink.core.gen.internal; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/** - * Localized messages used by Dali DBWS generation core. - */ -public class JptDbwsCoreMessages -{ - - public static final String GENERATION_COMPLETED = "GENERATION_COMPLETED"; - public static final String GENERATION_FAILED = "GENERATION_FAILED"; - public static final String NO_GENERATION_PERFORMED = "NO_GENERATION_PERFORMED"; - public static final String WSDL_EXCEPTION = "WSDL_EXCEPTION"; - public static final String NO_OPERATIONS_SPECIFIED = "NO_OPERATIONS_SPECIFIED"; - public static final String UNABLE_TO_LOCATE_BUILDER_XML = "UNABLE_TO_LOCATE_BUILDER_XML"; - public static final String DRIVER_NOT_ON_CLASSPATH = "DRIVER_NOT_ON_CLASSPATH"; - - - private static final String BUNDLE_NAME = "org.eclipse.jpt.dbws.eclipselink.core.gen.internal.jpt_dbws_core"; //$NON-NLS-1$ - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); - - private JptDbwsCoreMessages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } - catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -}
\ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/Tools.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/Tools.java deleted file mode 100644 index 7a49d7aaae..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/Tools.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 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.dbws.eclipselink.core.gen.internal; - -import static java.util.logging.Level.SEVERE; - -import java.io.File; -import java.text.MessageFormat; -import java.util.logging.Level; - -/** - * Tools - */ -public final class Tools -{ - /** empty string */ - public static final String EMPTY_STRING = ""; //$NON-NLS-1$ - - private static final String USER_DIRECTORY = System.getProperty("user.dir"); //$NON-NLS-1$ - - // ********** queries ********** - - /** - * Return whether the specified string is null, empty, or contains - * only whitespace characters. - */ - public static boolean stringIsEmpty(String string) { - if (string == null) { - return true; - } - int len = string.length(); - if (len == 0) { - return true; - } - return stringIsEmpty_(string.toCharArray(), len); - } - - private static boolean stringIsEmpty_(char[] s, int len) { - for (int i = len; i-- > 0; ) { - if ( ! Character.isWhitespace(s[i])) { - return false; - } - } - return true; - } - - // ********** short name manipulation ********** - - - public static File buildDirectory(String dirName) { - File currentDir = currentWorkingDirectory(); - File dir = new File(currentDir, dirName); - dir.mkdir(); - return dir; - } - - /** - * Return a file representing the current working directory. - */ - public static File currentWorkingDirectory() { - return new File(USER_DIRECTORY); //$NON-NLS-1$ - } - - /** - * Strip the extension from the specified file name - * and return the result. If the file name has no - * extension, it is returned unchanged - * File#basePath() - */ - public static String stripExtension(String fileName) { - int index = fileName.lastIndexOf('.'); - if (index == -1) { - return fileName; - } - return fileName.substring(0, index); - } - - public static String extractDirectory(String path) { - if( ! path.contains(File.separator)) { - return EMPTY_STRING; - } - return path.substring(0, path.lastIndexOf(File.separator)); - } - - public static void logMessage(Level level, String message) { - if(level == SEVERE) { - System.err.println('\n' + message); - } - else { - System.out.println('\n' + message); - } - } - - // ********** NLS utilities ********** - - public static String getString(String key) { - return JptDbwsCoreMessages.getString(key); - } - - public static String bind(String key, Object argument) { - return MessageFormat.format(getString(key), argument); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/jpt_dbws_core.properties b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/jpt_dbws_core.properties deleted file mode 100644 index c49d70feb4..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/jpt_dbws_core.properties +++ /dev/null @@ -1,17 +0,0 @@ -################################################################################ -# Copyright (c) 2010, 2011 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 -################################################################################ - -GENERATION_COMPLETED = DBWSBuilder generation completed -GENERATION_FAILED = DBWSBuilder generation failed: {0} -NO_GENERATION_PERFORMED = DBWSBuilder no generation performed -WSDL_EXCEPTION = WSDLException: {0} -NO_OPERATIONS_SPECIFIED = No operations specified -UNABLE_TO_LOCATE_BUILDER_XML = DBWSBuilder unable to locate builder XML file: {0} -DRIVER_NOT_ON_CLASSPATH = JDBC driver not on classpath: {0} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.classpath b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.classpath deleted file mode 100644 index 76f5da81fa..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.classpath +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="src" path="property_files"/> - <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"> - <accessrules> - <accessrule kind="accessible" pattern="org/eclipse/jpt/common/ui/**"/> - <accessrule kind="accessible" pattern="org/eclipse/jpt/common/utility/**"/> - <accessrule kind="accessible" pattern="org/eclipse/jst/**"/> - <accessrule kind="accessible" pattern="org/eclipse/wst/**"/> - </accessrules> - </classpathentry> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.cvsignore b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.cvsignore deleted file mode 100644 index ba077a4031..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.project b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.project deleted file mode 100644 index 7d3b57f9f6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jpt.dbws.eclipselink.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/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.settings/org.eclipse.jdt.core.prefs b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 3fa75e2387..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Tue Mar 08 12:07:08 EST 2011 -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.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -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/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/META-INF/MANIFEST.MF deleted file mode 100644 index 8e3e367e5d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/META-INF/MANIFEST.MF +++ /dev/null @@ -1,31 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.dbws.eclipselink.ui;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-Activator: org.eclipse.jpt.dbws.eclipselink.ui.JptDbwsUiPlugin -Bundle-ActivationPolicy: lazy -Bundle-ClassPath: . -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: 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.common.core;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jpt.common.ui;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)", - org.eclipse.jpt.dbws.eclipselink.core.gen;bundle-version="[1.0.0,2.0.0)", - org.eclipse.persistence.core;bundle-version="[2.3.0,3.0.0)", - org.eclipse.persistence.dbws.builder;bundle-version="[2.3.0,3.0.0)", - org.eclipse.wst.common.modulecore;bundle-version="[1.1.200,2.0.0)", - org.eclipse.wst.common.project.facet.ui;bundle-version="[1.3.0,2.0.0)", - org.eclipse.wst.common.ui;bundle-version="[1.1.500,2.0.0)", - org.eclipse.wst.common.uriresolver;bundle-version="[1.1.401,2.0.0)", - org.eclipse.wst.xml.core;bundle-version="[1.1.500,2.0.0)" -Export-Package: org.eclipse.jpt.dbws.eclipselink.core.internal.gen;x-internal:=true, - org.eclipse.jpt.dbws.eclipselink.ui, - org.eclipse.jpt.dbws.eclipselink.ui.internal;x-internal:=true, - org.eclipse.jpt.dbws.eclipselink.ui.internal.actions;x-internal:=true, - org.eclipse.jpt.dbws.eclipselink.ui.internal.wizards.gen;x-internal:=true -Import-Package: com.ibm.icu.text;version="4.0.1" diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/about.html b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/about.html deleted file mode 100644 index be534ba44f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/about.html +++ /dev/null @@ -1,34 +0,0 @@ -<!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/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/build.properties b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/build.properties deleted file mode 100644 index 377eb5ce7a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/build.properties +++ /dev/null @@ -1,18 +0,0 @@ -################################################################################ -# Copyright (c) 2010, 2011 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 -################################################################################ -source.. = src/,\ - property_files/ -output.. = bin/ -bin.includes = .,\ - META-INF/,\ - about.html,\ - plugin.xml,\ - plugin.properties -jars.compile.order = . diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/component.xml b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/component.xml deleted file mode 100644 index 4bf2db832f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/component.xml +++ /dev/null @@ -1 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?><component xmlns="http://eclipse.org/wtp/releng/tools/component-model" name="org.eclipse.jpt.dbws.eclipselink.ui"><description url=""></description><component-depends unrestricted="true"></component-depends><plugin id="org.eclipse.jpt.dbws.eclipselink.ui" fragment="false"/></component>
\ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/etool16/newclient_webserv_wiz.gif b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/etool16/newclient_webserv_wiz.gif Binary files differdeleted file mode 100644 index 1ee05fa2e5..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/etool16/newclient_webserv_wiz.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/obj16/XSDFile.gif b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/obj16/XSDFile.gif Binary files differdeleted file mode 100644 index cc0eeb7196..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/obj16/XSDFile.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/obj16/dtdfile.gif b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/obj16/dtdfile.gif Binary files differdeleted file mode 100644 index 3c0acadd2d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/obj16/dtdfile.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/obj16/text.gif b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/obj16/text.gif Binary files differdeleted file mode 100644 index efa7a38014..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/obj16/text.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/ovr16/error_ovr.gif b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/ovr16/error_ovr.gif Binary files differdeleted file mode 100644 index 119dcccd5a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/ovr16/error_ovr.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/wizban/webservicesclient_wiz.gif b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/wizban/webservicesclient_wiz.gif Binary files differdeleted file mode 100644 index 77c16a0f87..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/icons/full/wizban/webservicesclient_wiz.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/plugin.properties b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/plugin.properties deleted file mode 100644 index efab1b2e17..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/plugin.properties +++ /dev/null @@ -1,31 +0,0 @@ -############################################################################### -# Copyright (c) 2011 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 - DBWS UI -providerName=Eclipse Web Tools Platform - -generateDBWS = Generate Database Web Services - -dbwsWizardCategoryName = Database Web Services - -generateDbwsFromXmlName = Web Services from Builder XML -generateDbwsFromXmlDesc = Generate Web Services from Builder XML - diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/plugin.xml b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/plugin.xml deleted file mode 100644 index 5c52d864fe..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/plugin.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.2"?> -<!-- - Copyright (c) 2010, 2011 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 - --> - -<plugin> - - <extension - point="org.eclipse.ui.menus"> - - <!-- contributions for any popup --> - <menuContribution - locationURI="popup:org.eclipse.ui.popup.any"> - - <menu - id="org.eclipse.jpt.dbws.ui.menu.WebServices" - label="%dbwsWizardCategoryName"> - </menu> - </menuContribution> - - </extension> - - - <extension - point="org.eclipse.ui.newWizards"> - - <category - id="org.eclipse.jpt.dbws" - name="%dbwsWizardCategoryName"/> - - <wizard - id="org.eclipse.jpt.dbws.ui.wizard.generateDbws" - name="%generateDbwsFromXmlName" - category="org.eclipse.jpt.dbws" - class="org.eclipse.jpt.dbws.eclipselink.ui.internal.wizards.gen.DbwsGeneratorWizard" - icon="icons/full/etool16/newclient_webserv_wiz.gif"> - <description>%generateDbwsFromXmlDesc</description> - </wizard> - - </extension> - - - <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="*builder.xml"> - - <filter - name="projectNature" - value="org.eclipse.jdt.core.javanature"> - </filter> - <enablement> - <test property="org.eclipse.wst.common.project.facet.core.projectFacet" value="jst.web"/> - </enablement> - <action - id="org.eclipse.jpt.dbws.ui.generateDbws" - label="%generateDBWS" - menubarPath="org.eclipse.jpt.dbws.ui.menu.WebServices/content" - class="org.eclipse.jpt.dbws.eclipselink.ui.internal.actions.GenerateDbwsAction"> - </action> - </objectContribution> - - </extension> - - -</plugin> diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/property_files/jpt_dbws_ui.properties b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/property_files/jpt_dbws_ui.properties deleted file mode 100644 index 0d62c677d0..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/property_files/jpt_dbws_ui.properties +++ /dev/null @@ -1,49 +0,0 @@ -################################################################################ -# Copyright (c) 2011 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 -################################################################################ - - -# DbwsGenerator -DbwsGeneratorWizard_title = New Database Web Services from Builder XML -DbwsGeneratorWizard_generatingDbws = Generating Database Web Services - -WebDynamicProjectWizardPage_title = Web Dynamic Project -WebDynamicProjectWizardPage_desc = Specify project for Database Web Services -WebDynamicProjectWizardPage_destinationProject = Select destination project: - -BuilderXmlWizardPage_title = Select Builder XML File -BuilderXmlWizardPage_desc = Specify XML file to generate Database Web Services from - -BuilderXmlWizardPage_errorUriCannotBeLocated = The selected catalog entry specifies a URI that can not be located. - -JdbcDriverWizardPage_title = Driver files -JdbcDriverWizardPage_desc = Specify driver JAR files - -JdbcDriverWizardPage_driverFiles = Driver files: - -JdbcDriverWizardPage_addButton = Add... -JdbcDriverWizardPage_removeButton = Remove - -JdbcDriverWizardPage_chooseADriverFile = Driver File Selection - -DbwsGeneratorUi_runningDbwsWarningTitle = Generating Database Web Services -DbwsGeneratorUi_runningDbwsWarningMessage = \ - Warning: Running DBWS Builder will overwrite existing files in your project.\ - \n\nAre you sure you want to continue? - -DbwsGeneratorUi_dbwsNotOnClasspathMessage = \ - Warning: DBWS Builder is not on your project classpath.\ - \n\nAre you sure you want to continue? - -DbwsGeneratorUi_notJavaProject = Not a java project -DbwsGeneratorUi_notWebDynamicProject = Not a WebDynamic project - -BuilderXmlWizardPage_xmlCatalogTableTitle = XML Catalog -BuilderXmlWizardPage_xmlCatalogKeyColumn = Key -BuilderXmlWizardPage_xmlCatalogUriColumn = URI
\ No newline at end of file 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 deleted file mode 100644 index 16c1e6c586..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/core/internal/gen/DbwsGenerator.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 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.dbws.eclipselink.core.internal.gen; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IResource; -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.jdt.core.IJavaProject; -import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; -import org.eclipse.jdt.launching.IRuntimeClasspathEntry; -import org.eclipse.jpt.common.core.internal.gen.AbstractJptGenerator; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * DbwsGenerator - */ -public class DbwsGenerator extends AbstractJptGenerator -{ - static public String LAUNCH_CONFIG_NAME = "DBWS Gen Run Config"; //$NON-NLS-1$ - static public String DBWS_GEN_PACKAGE_NAME = "org.eclipse.jpt.dbws.eclipselink.core.gen"; //$NON-NLS-1$ - static public String DBWS_GEN_CLASS = DBWS_GEN_PACKAGE_NAME + ".Main"; //$NON-NLS-1$ - - static public String DBWS_GEN_JAR_PREFIX = DBWS_GEN_PACKAGE_NAME + "_"; //$NON-NLS-1$ - - private final String builderFileName; - private final String stageDirName; - private final String driverJarList; - - // ********** static methods ********** - - public static void generate( - IJavaProject javaProject, - String builderFileName, - String stageDirName, - String driverJarList, - IProgressMonitor monitor) { - if (javaProject == null) { - throw new NullPointerException(); - } - new DbwsGenerator(javaProject, - builderFileName, - stageDirName, - driverJarList).generate(monitor); - } - - // ********** constructors ********** - - private DbwsGenerator( - IJavaProject javaProject, - String builderFileName, - String stageDirName, - String driverJarList) { - super(javaProject); - this.builderFileName = builderFileName; - this.stageDirName = stageDirName; - this.driverJarList = driverJarList; - } - - // ********** overrides ********** - - @Override - protected String getMainType() { - return DBWS_GEN_CLASS; - } - - @Override - protected String getLaunchConfigName() { - return LAUNCH_CONFIG_NAME; - } - - @Override - protected String getBootstrapJarPrefix() { - return DBWS_GEN_JAR_PREFIX; - } - - @Override - protected void preGenerate(IProgressMonitor monitor) { - // do nothing - - } - - @Override - protected void postGenerate() { - super.postGenerate(); - try { - this.getProject().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); - } - catch (CoreException e) { - throw new RuntimeException(e); - } - } - - // ********** Launch Configuration Setup ********** - - @Override - protected List<String> buildClasspath() throws CoreException { - List<String> classpath = new ArrayList<String>(); - // DBWS_Gen jar - classpath.add(this.getBootstrapJarClasspathEntry().getMemento()); - // Default Project classpath - classpath.add(this.getDefaultProjectClasspathEntry().getMemento()); - // JDBC jar - if( ! StringTools.stringIsEmpty(this.driverJarList)) { - classpath.add(this.getJdbcJarClasspathEntry().getMemento()); - } - // System Library - classpath.add(this.getSystemLibraryClasspathEntry().getMemento()); - return classpath; - } - - @Override - protected void specifyProgramArguments() { - - StringBuffer programArguments = new StringBuffer(); - - // builderFile - programArguments.append(" -builderFile \""); //$NON-NLS-1$ - programArguments.append(this.builderFileName); - programArguments.append('"'); - - // stageDir - programArguments.append(" -stageDir \""); //$NON-NLS-1$ - programArguments.append(this.stageDirName); - programArguments.append('"'); - - // packageAs - programArguments.append(" -packageAs eclipse"); //$NON-NLS-1$ - - this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, programArguments.toString()); - } - - // ********** private methods ********** - - private IRuntimeClasspathEntry getJdbcJarClasspathEntry() { - return getArchiveClasspathEntry(this.buildJdbcJarPath()); - } - - private IPath buildJdbcJarPath() { - return new Path(this.driverJarList); - } - - -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/JptDbwsUiPlugin.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/JptDbwsUiPlugin.java deleted file mode 100644 index 25b0f74546..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/JptDbwsUiPlugin.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2011 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.dbws.eclipselink.ui; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.eclipse.wst.xml.core.internal.XMLCorePlugin; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog; - -/** - * 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. - */ -@SuppressWarnings("nls") -public class JptDbwsUiPlugin extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.jpt.dbws.eclipselink.ui"; //$NON-NLS-1$ - - public static final String USER_CATALOG_ID = XMLCorePlugin.USER_CATALOG_ID; //$NON-NLS-1$ - public static final String DEFAULT_CATALOG_ID = XMLCorePlugin.DEFAULT_CATALOG_ID; //$NON-NLS-1$ - public static final String SYSTEM_CATALOG_ID = XMLCorePlugin.SYSTEM_CATALOG_ID; //$NON-NLS-1$ - - // ********** singleton ********** - private static JptDbwsUiPlugin INSTANCE; - - /** - * Returns the singleton Plugin - */ - public static JptDbwsUiPlugin 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 - */ - //TODO we are using the ImageRegistry here and storing all our icons for the life of the plugin, - //which means until the workspace is closed. This is better than before where we constantly - //created new images. Bug 306437 is about cleaning this up and using Local Resource Managers - //on our views so that closing the JPA perspective would mean our icons are disposed. - public static Image getImage(String key) { - ImageRegistry imageRegistry = instance().getImageRegistry(); - Image image = imageRegistry.get(key); - if (image == null) { - imageRegistry.put(key, getImageDescriptor(key)); - image = imageRegistry.get(key); - } - return image; - } - - - // ********** XMLCorePlugin API ********** - - public ICatalog getDefaultXMLCatalog() { - return XMLCorePlugin.getDefault().getDefaultXMLCatalog(); - } - - - // ********** constructors ********** - - public JptDbwsUiPlugin() { - super(); - if(INSTANCE != null) { - throw new IllegalStateException(); - } - INSTANCE = this; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/DbwsGeneratorUi.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/DbwsGeneratorUi.java deleted file mode 100644 index 8000bf3b6c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/DbwsGeneratorUi.java +++ /dev/null @@ -1,275 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 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.dbws.eclipselink.ui.internal; - -import java.io.File; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.WorkspaceJob; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.jpt.dbws.eclipselink.core.internal.gen.DbwsGenerator; -import org.eclipse.jpt.dbws.eclipselink.ui.internal.wizards.gen.DbwsGeneratorWizard; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.persistence.oxm.XMLContext; -import org.eclipse.persistence.oxm.XMLUnmarshaller; -import org.eclipse.persistence.tools.dbws.DBWSBuilderModel; -import org.eclipse.persistence.tools.dbws.DBWSBuilderModelProject; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IProjectFacet; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; - -/** - * DbwsGeneratorUi - */ -public class DbwsGeneratorUi -{ - private final IJavaProject javaProject; - private final String builderXmlFile; - - private static final String WEB_FACET_ID = "jst.web"; //$NON-NLS-1$ - private static final String DRIVER_PROPERTY = "driver"; //$NON-NLS-1$ - private static final String DBWS_BUILDER_CLASS_NAME = "org.eclipse.persistence.tools.dbws.DBWSBuilder"; //$NON-NLS-1$ - - // ********** static methods ********** - - public static void generate(IFile xmlFile) { - IProject project = xmlFile.getProject(); - - if( ! projectIsWebDynamic(project)) { - throw new RuntimeException(JptDbwsUiMessages.DbwsGeneratorUi_notWebDynamicProject); - } - IPath xmlPath = xmlFile.getProjectRelativePath(); - - new DbwsGeneratorUi(project, xmlPath.toOSString()).generate(); - } - - public static boolean projectIsWebDynamic(IProject project) { - - IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet(WEB_FACET_ID); - IFacetedProject facetedProject = null; - try { - facetedProject = ProjectFacetsManager.create(project); - } - catch (CoreException e) { - return false; - } - return (facetedProject == null) ? false : facetedProject.hasProjectFacet(projectFacet); - } - - public static IPath getWebContentPath(IProject project){ - IVirtualComponent component = ComponentCore.createComponent(project); - IPath modulePath = component.getRootFolder().getProjectRelativePath(); - return modulePath; - } - - public static boolean displayDBWSNotOnClasspathWarning(Shell shell) { - - String msg = JptDbwsUiMessages.DbwsGeneratorUi_dbwsNotOnClasspathMessage; - - return MessageDialog.openQuestion( - shell, - JptDbwsUiMessages.DbwsGeneratorUi_runningDbwsWarningTitle, - msg); - } - - public static boolean displayOverridingWebContentWarning(Shell shell) { - - String msg = JptDbwsUiMessages.DbwsGeneratorUi_runningDbwsWarningMessage; - - return MessageDialog.openQuestion( - shell, - JptDbwsUiMessages.DbwsGeneratorUi_runningDbwsWarningTitle, - msg); - } - - // ********** constructors ********** - - private DbwsGeneratorUi(IProject webProject, String builderXmlFile) { - super(); - if(webProject == null || StringTools.stringIsEmpty(builderXmlFile)) { - throw new NullPointerException(); - } - this.javaProject = this.getJavaProjectFrom(webProject); - if(this.javaProject == null) { - throw new RuntimeException(JptDbwsUiMessages.DbwsGeneratorUi_notJavaProject); - } - this.builderXmlFile = builderXmlFile; - } - - // ********** generate ********** - /** - * prompt the user with a wizard - */ - protected void generate() { - - if( ! this.dbwsIsOnClasspath()) { - if( ! displayDBWSNotOnClasspathWarning(this.getCurrentShell())) { - return; - } - } - if(this.classIsOnProjectsClasspath( - this.getDriverNameFrom(this.builderXmlFile))) { - - if(displayOverridingWebContentWarning(this.getCurrentShell())) { - this.scheduleGenerateDbwsJob(); - } - return; - } - this.openWizardDialog(); - return; - } - - // ********** internal methods ********** - - private void openWizardDialog() { - - DbwsGeneratorWizard wizard = new DbwsGeneratorWizard(this.javaProject, this.builderXmlFile); - wizard.setWindowTitle(JptDbwsUiMessages.DbwsGeneratorWizard_title); - WizardDialog dialog = new WizardDialog(this.getCurrentShell(), wizard); - dialog.create(); - int returnCode = dialog.open(); - if(returnCode != Window.OK) { - return; - } - } - - private String getDriverNameFrom(String builderXmlFile) { - try { - DBWSBuilderModel model = this.buildBuilderModel(builderXmlFile); - Map<String, String> properties = model.getProperties(); - return properties.get(DRIVER_PROPERTY); - } - catch(Exception e) { - return null; - } - } - - private DBWSBuilderModel buildBuilderModel(String builderFileName) { - String projectDirName = this.javaProject.getProject().getLocation().toOSString(); - File builderFile = this.getBuilderFile(projectDirName + File.separator + builderFileName); - return this.unmarshal(builderFile); - } - - private DBWSBuilderModel unmarshal(File builderFile) { - if((builderFile == null) || ( ! builderFile.exists())) { - return null; - } - XMLContext context = new XMLContext(new DBWSBuilderModelProject()); - XMLUnmarshaller unmarshaller = context.createUnmarshaller(); - - DBWSBuilderModel model = (DBWSBuilderModel)unmarshaller.unmarshal(builderFile); - if(model == null || model.properties.size() == 0) { - return null; - } - return model; - } - - private File getBuilderFile(String builderFileName) { - - File builderFile = new File(builderFileName); - if( ! (builderFile.exists() && builderFile.isFile())) { - return null; - } - return builderFile; - } - - /** - * Test if the given class is on the project's classpath. - */ - private boolean classIsOnProjectsClasspath(String driverName) { - try { - if(StringTools.stringIsEmpty(driverName)) { - return false; - } - IType genClass = this.javaProject.findType(driverName); - return (genClass != null); - } - catch (JavaModelException e) { - throw new RuntimeException(e); - } - } - - /** - * Test if the DBWS builder is on the project's classpath. - */ - private boolean dbwsIsOnClasspath() { - try { - IType genClass = this.javaProject.findType(DBWS_BUILDER_CLASS_NAME); - return (genClass != null); - } - catch (JavaModelException e) { - throw new RuntimeException(e); - } - } - - private IJavaProject getJavaProjectFrom(IProject project) { - return (IJavaProject)((IJavaElement)((IAdaptable)project).getAdapter(IJavaElement.class)); - } - - private Shell getCurrentShell() { - return Display.getCurrent().getActiveShell(); - } - - private void scheduleGenerateDbwsJob() { - - String stageDirName = this.javaProject.getProject().getLocation().toOSString(); - - WorkspaceJob generateJob = new GenerateDbwsJob( - this.javaProject, - this.builderXmlFile, - stageDirName, - null // driverJarList - ); - generateJob.schedule(); - } - - // ********** generate DBWS job ********** - - public static class GenerateDbwsJob extends WorkspaceJob { - private final IJavaProject project; - final String builderFileName; - final String stageDirName; - final String driverJarList; - - public GenerateDbwsJob(IJavaProject project, String builderFileName, String stageDirName, String driverJarList) { - super(JptDbwsUiMessages.DbwsGeneratorWizard_generatingDbws); - - this.project = project ; - this.builderFileName = builderFileName; - this.stageDirName = stageDirName; - this.driverJarList = driverJarList; - } - - @Override - public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { - DbwsGenerator.generate(this.project, this.builderFileName, this.stageDirName, this.driverJarList, monitor); - return Status.OK_STATUS; - } - - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/JptDbwsUiIcons.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/JptDbwsUiIcons.java deleted file mode 100644 index 38beda8da7..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/JptDbwsUiIcons.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2011 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.dbws.eclipselink.ui.internal; - -@SuppressWarnings("nls") -public class JptDbwsUiIcons -{ - // **************** Wizard icons ******************************************* - - public static final String DBWS_GEN_WIZ_BANNER = "full/wizban/webservicesclient_wiz"; -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/JptDbwsUiMessages.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/JptDbwsUiMessages.java deleted file mode 100644 index 1610eac2a3..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/JptDbwsUiMessages.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 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.dbws.eclipselink.ui.internal; - -import org.eclipse.osgi.util.NLS; - -/** - * Localized messages used by Dali DBWS UI. - * - * @version 2.3 - */ -public class JptDbwsUiMessages { - - // DbwsGenerator - public static String DbwsGeneratorWizard_title; - public static String DbwsGeneratorWizard_generatingDbws; - - public static String WebDynamicProjectWizardPage_title; - public static String WebDynamicProjectWizardPage_desc; - public static String WebDynamicProjectWizardPage_destinationProject; - - public static String BuilderXmlWizardPage_title; - public static String BuilderXmlWizardPage_desc; - - public static String BuilderXmlWizardPage_errorUriCannotBeLocated; - - public static String JdbcDriverWizardPage_title; - public static String JdbcDriverWizardPage_desc; - - public static String JdbcDriverWizardPage_driverFiles; - - public static String JdbcDriverWizardPage_addButton; - public static String JdbcDriverWizardPage_removeButton; - - public static String JdbcDriverWizardPage_chooseADriverFile; - - public static String DbwsGeneratorUi_runningDbwsWarningTitle; - public static String DbwsGeneratorUi_runningDbwsWarningMessage; - public static String DbwsGeneratorUi_dbwsNotOnClasspathMessage; - - public static String DbwsGeneratorUi_notJavaProject; - public static String DbwsGeneratorUi_notWebDynamicProject; - - public static String BuilderXmlWizardPage_xmlCatalogTableTitle; - public static String BuilderXmlWizardPage_xmlCatalogKeyColumn; - public static String BuilderXmlWizardPage_xmlCatalogUriColumn; - - - - - private static final String BUNDLE_NAME = "jpt_dbws_ui"; //$NON-NLS-1$ - private static final Class<?> BUNDLE_CLASS = JptDbwsUiMessages.class; - static { - NLS.initializeMessages(BUNDLE_NAME, BUNDLE_CLASS); - } - - private JptDbwsUiMessages() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/actions/GenerateDbwsAction.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/actions/GenerateDbwsAction.java deleted file mode 100644 index 1dfee6b4b4..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/actions/GenerateDbwsAction.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* -* 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.dbws.eclipselink.ui.internal.actions; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jpt.dbws.eclipselink.ui.internal.DbwsGeneratorUi; - -/** - * GenerateDbwsAction - */ -public class GenerateDbwsAction extends ObjectAction -{ - - @Override - protected void execute(IFile xmlFile) { - - DbwsGeneratorUi.generate(xmlFile); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/actions/ObjectAction.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/actions/ObjectAction.java deleted file mode 100644 index 5c90f1e584..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/actions/ObjectAction.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* -* 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.dbws.eclipselink.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/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/BuilderXmlWizardPage.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/BuilderXmlWizardPage.java deleted file mode 100644 index 5eb23fc72e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/BuilderXmlWizardPage.java +++ /dev/null @@ -1,186 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2011 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.dbws.eclipselink.ui.internal.wizards.gen; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.jpt.common.ui.internal.wizards.JavaProjectWizardPage; -import org.eclipse.jpt.dbws.eclipselink.ui.internal.JptDbwsUiMessages; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.wst.common.uriresolver.internal.util.URIHelper; - -/** - * BuilderXmlWizardPage - */ -public class BuilderXmlWizardPage extends WizardPage { - - private final IStructuredSelection initialSelection; - private IProject targetProject; - - protected SelectFileOrXMLCatalogIdPanel selectSourcePanel; - - protected static final String[] browseXMLFilterExtensions = {".xml"}; //$NON-NLS-1$ - - // ********** static method ********** - - public static IFile getBuilderXmlFromSelection(IStructuredSelection selection) { - Object firstElement = selection.getFirstElement(); - if(firstElement instanceof IFile) { - String elementExtension = ((IFile)firstElement).getFileExtension(); - if(elementExtension != null) { - if(browseXMLFilterExtensions[0].endsWith(elementExtension)) { - return ((IFile)firstElement); - } - } - } - return null; - } - - // ********** constructor ********** - - BuilderXmlWizardPage(IStructuredSelection selection) { - super("BuilderXmlWizardPage"); //$NON-NLS-1$ - - this.initialSelection = selection; - } - - // ********** IDialogPage implementation ********** - - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); -// PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, HELP_CONTEXT_ID); - composite.setLayout(new GridLayout()); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - this.setControl(composite); - - this.selectSourcePanel = new SelectFileOrXMLCatalogIdPanel(composite, this.initialSelection); - this.selectSourcePanel.setLayoutData(new GridData(GridData.FILL_BOTH)); - - SelectFileOrXMLCatalogIdPanel.PanelListener listener = new SelectFileOrXMLCatalogIdPanel.PanelListener() { - public void completionStateChanged() { - selectFileOrXMLCatalogIdPanelChanged(); - } - }; - this.selectSourcePanel.setListener(listener); - Dialog.applyDialogFont(parent); - } - - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if(visible) { - - if(this.getBuilderXml() != null) { - this.selectSourcePanel.setSingleFileViewDefaultSelection(new StructuredSelection(this.getBuilderXml())); - } - else { - this.updateTargetProject(); - IFile schema = getBuilderXmlFromSelection(this.initialSelection); - if(schema != null) { - this.selectSourcePanel.setSingleFileViewDefaultSelection(new StructuredSelection(schema)); - } - else { - this.selectSourcePanel.setSingleFileViewDefaultSelection(new StructuredSelection(this.targetProject)); - } - } - this.selectSourcePanel.update(); - - this.setTitle(JptDbwsUiMessages.BuilderXmlWizardPage_title); - this.setDescription(JptDbwsUiMessages.BuilderXmlWizardPage_desc); - this.selectSourcePanel.setFilterExtensions(browseXMLFilterExtensions); - } - this.selectSourcePanel.setVisibleHelper(visible); - } - - // ********** IWizardPage implementation ********** - - @Override - public boolean isPageComplete() { - - return this.schemaOrUriSelected() && (this.getErrorMessage() == null); - } - - // ********** intra-wizard methods ********** - - public IFile getBuilderXml() { - return this.selectSourcePanel.getFile(); - } - - public String getSourceURI() { - String uri = this.selectSourcePanel.getXMLCatalogURI(); - if(uri == null) { - IFile file = this.selectSourcePanel.getFile(); - if(file != null) { - uri = URIHelper.getPlatformURI(file); - } - } - return uri; - } - - // ********** internal methods ********** - - private void updateTargetProject() { - IWizardPage previousPage = this.getPreviousPage(); - - if(previousPage instanceof JavaProjectWizardPage) { - // get project from previousPage - this.targetProject = (((JavaProjectWizardPage)previousPage).getJavaProject()).getProject(); - } - else if(initialSelection != null && ! this.initialSelection.isEmpty()) { - // no previousPage - get project from initialSelection - this.targetProject = this.getProjectFromInitialSelection(); - } - } - - private IProject getProjectFromInitialSelection() { - Object firstElement = initialSelection.getFirstElement(); - if(firstElement instanceof IProject) { - return (IProject)firstElement; - } - else if(firstElement instanceof IResource) { - return ((IResource) firstElement).getProject(); - } - else if(firstElement instanceof IJavaElement) { - return ((IJavaElement)firstElement).getJavaProject().getProject(); - } - return null; - } - - private boolean schemaOrUriSelected() { - return ((this.getBuilderXml() != null) || (this.getSourceURI() != null)); - } - - private String computeErrorMessage() { - String errorMessage = null; - String uri = this.getSourceURI(); - if(uri != null) { - if( ! URIHelper.isReadableURI(uri, false)) { - errorMessage = JptDbwsUiMessages.BuilderXmlWizardPage_errorUriCannotBeLocated; - } - } - return errorMessage; - } - - private void selectFileOrXMLCatalogIdPanelChanged() { - String errorMessage = this.computeErrorMessage(); - this.setErrorMessage(errorMessage); - this.setPageComplete(this.isPageComplete()); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/DbwsGeneratorWizard.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/DbwsGeneratorWizard.java deleted file mode 100644 index a0c798a854..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/DbwsGeneratorWizard.java +++ /dev/null @@ -1,216 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 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.dbws.eclipselink.ui.internal.wizards.gen; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.WorkspaceJob; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.jpt.dbws.eclipselink.ui.JptDbwsUiPlugin; -import org.eclipse.jpt.dbws.eclipselink.ui.internal.DbwsGeneratorUi; -import org.eclipse.jpt.dbws.eclipselink.ui.internal.JptDbwsUiIcons; -import org.eclipse.jpt.dbws.eclipselink.ui.internal.JptDbwsUiMessages; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWizard; - -/** - * DbwsGeneratorWizard - */ -public class DbwsGeneratorWizard extends Wizard implements IWorkbenchWizard { - - private IJavaProject javaProject; - private String builderXmlFile; - private IStructuredSelection selection; - - private WebDynamicProjectWizardPage projectWizardPage; - private BuilderXmlWizardPage builderXmlWizardPage; - - // Dialog store id constant - private static final String WIZARD_NAME = DbwsGeneratorWizard.class.getName(); - private static final String DBWS_SECTION_NAME = "DbwsSettings"; //$NON-NLS-1$ - - private JdbcDriverWizardPage jdbcDriversPage; - - // ********** constructor ********** - - public DbwsGeneratorWizard() { - super(); - - this.initialize(); - } - - public DbwsGeneratorWizard(IJavaProject javaProject, String builderXmlFile) { - super(); - - this.javaProject = javaProject; - this.builderXmlFile = builderXmlFile; - - this.initialize(); - } - - private void initialize() { - if(this.getDialogSettings() == null) { - IDialogSettings dbwsSettings = JptDbwsUiPlugin.instance().getDialogSettings(); - IDialogSettings wizardSettings = dbwsSettings.getSection(DBWS_SECTION_NAME); - if(wizardSettings == null) { - wizardSettings = dbwsSettings.addNewSection(DBWS_SECTION_NAME); - } - this.setDialogSettings(wizardSettings); - } - } - - // ********** IWorkbenchWizard implementation ********** - - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.selection = selection; - - this.setWindowTitle(JptDbwsUiMessages.DbwsGeneratorWizard_title); - - this.setDefaultPageImageDescriptor(JptDbwsUiPlugin.getImageDescriptor(JptDbwsUiIcons.DBWS_GEN_WIZ_BANNER)); - this.setNeedsProgressMonitor(true); - } - - // ********** IWizard implementation ********** - - @Override - public void addPages() { - super.addPages(); - - if(this.selection != null) { - // WebDynamicProjectWizardPage - this.javaProject = this.getJavaProjectFromSelection(this.selection); - - this.projectWizardPage = this.buildWebDynamicProjectPage(this.javaProject); - this.addPage(this.projectWizardPage); - - // BuilderXmlWizardPage - IFile builderXmlSelected = BuilderXmlWizardPage.getBuilderXmlFromSelection(this.selection); - if(builderXmlSelected == null) { - this.builderXmlWizardPage = this.buildBuilderXmlPage(this.selection); - this.addPage(this.builderXmlWizardPage); - } - else { - this.builderXmlFile = this.makeRelativeToProjectPath(builderXmlSelected.getFullPath()); - } - } - // JdbcDriverWizardPage - this.jdbcDriversPage = this.buildJdbcDriversPage(); - this.addPage(this.jdbcDriversPage); - } - - @Override - public boolean performFinish() { - - WizardPage currentPage = (WizardPage)getContainer().getCurrentPage(); - if(currentPage != null) { - if( ! currentPage.isPageComplete()) { - return false; - } - } - - String driverJarList = this.jdbcDriversPage.getDriverJarList(); - this.jdbcDriversPage.finish(); // persist settings - - if(DbwsGeneratorUi.displayOverridingWebContentWarning(this.getShell())) { - this.generateDbws(driverJarList); - } - return true; - } - - // ********** intra-wizard methods ********** - - public IJavaProject getJavaProject() { - if(this.projectWizardPage != null) { - this.javaProject = this.projectWizardPage.getJavaProject(); - } - return this.javaProject; - } - - public String getBuilderXmlPathOrUri() { - if(this.builderXmlWizardPage != null) { - IFile xmlFile = this.builderXmlWizardPage.getBuilderXml(); - if(xmlFile != null) { - return this.makeRelativeToProjectPath(xmlFile.getFullPath()); - } - else { - return this.builderXmlWizardPage.getSourceURI(); - } - } - return this.builderXmlFile; - } - - // ********** internal methods ********** - - private WebDynamicProjectWizardPage buildWebDynamicProjectPage(IJavaProject javaProject) { - - WebDynamicProjectWizardPage projectWizardPage = new WebDynamicProjectWizardPage(javaProject); - projectWizardPage.setTitle(JptDbwsUiMessages.WebDynamicProjectWizardPage_title); - projectWizardPage.setDescription(JptDbwsUiMessages.WebDynamicProjectWizardPage_desc); - projectWizardPage.setDestinationLabel(JptDbwsUiMessages.WebDynamicProjectWizardPage_destinationProject); - - return projectWizardPage; - } - - private BuilderXmlWizardPage buildBuilderXmlPage(IStructuredSelection selection) { - return new BuilderXmlWizardPage(selection); - } - - private JdbcDriverWizardPage buildJdbcDriversPage() { - return new JdbcDriverWizardPage(WIZARD_NAME); - } - - private String makeRelativeToProjectPath(IPath path) { - IPath relativePath = path.makeRelativeTo(this.getJavaProject().getProject().getFullPath()); - return relativePath.toOSString(); - } - - private void generateDbws(String driverJarList) { - - String stageDirName = this.getJavaProject().getProject().getLocation().toOSString(); - - WorkspaceJob generateJob = new DbwsGeneratorUi.GenerateDbwsJob( - this.getJavaProject(), - this.getBuilderXmlPathOrUri(), - stageDirName, - driverJarList - ); - generateJob.schedule(); - } - - private IJavaProject getJavaProjectFromSelection(IStructuredSelection selection) { - if(selection == null) { - return null; - } - Object firstElement = selection.getFirstElement(); - if(firstElement instanceof IJavaProject) { - return (IJavaProject)firstElement; - } - else if(firstElement instanceof IResource) { - IProject project = ((IResource) firstElement).getProject(); - return getJavaProjectFrom(project); - } - else if(firstElement instanceof IJavaElement) { - return ((IJavaElement)firstElement).getJavaProject(); - } - return null; - } - - private IJavaProject getJavaProjectFrom(IProject project) { - return (IJavaProject)((IJavaElement)((IAdaptable)project).getAdapter(IJavaElement.class)); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/JdbcDriverWizardPage.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/JdbcDriverWizardPage.java deleted file mode 100644 index 8f5c9d1f07..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/JdbcDriverWizardPage.java +++ /dev/null @@ -1,355 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 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.dbws.eclipselink.ui.internal.wizards.gen; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collection; - -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jface.dialogs.IDialogSettings; -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.IWizard; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.jpt.common.ui.internal.util.SWTUtil; -import org.eclipse.jpt.common.ui.internal.util.TableLayoutComposite; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.dbws.eclipselink.ui.JptDbwsUiPlugin; -import org.eclipse.jpt.dbws.eclipselink.ui.internal.JptDbwsUiIcons; -import org.eclipse.jpt.dbws.eclipselink.ui.internal.JptDbwsUiMessages; -import org.eclipse.swt.SWT; -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.Label; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; - -/** - * JdbcDriversWizardPage - */ -public class JdbcDriverWizardPage extends WizardPage -{ - private final String storedDriverClasspathId; - private ArrayList<String> jarPaths; - - public static String BINDINGS_FILE_FILTER = "*.jar;*.zip"; //$NON-NLS-1$ - // dialog store id constants - private static final String PAGE_ID = "DRIVER_CLASSPATH_ID"; //$NON-NLS-1$ - private static final String PATH_SEPARATOR = System.getProperty("path.separator"); //$NON-NLS-1$ - - // ********** constructor ********** - - protected JdbcDriverWizardPage(String wizardName) { - super("Jdbc Driver"); //$NON-NLS-1$ - - this.initialize(); - - this.jarPaths = new ArrayList<String>(); - this.storedDriverClasspathId = wizardName + "." + PAGE_ID; //$NON-NLS-1$ - } - - protected void initialize() { - this.setTitle(JptDbwsUiMessages.JdbcDriverWizardPage_title); - this.setDescription(JptDbwsUiMessages.JdbcDriverWizardPage_desc); - this.setImageDescriptor(JptDbwsUiPlugin.getImageDescriptor(JptDbwsUiIcons.DBWS_GEN_WIZ_BANNER)); - } - - // ********** intra-wizard methods ********** - - public void finish() { - this.saveWidgetValues(); - } - - public String getDriverJarList() { - return this.buildDriverJarListString(); - } - - // ********** internal methods ********** - - /** - * Initializes the JAR package from last used wizard page values. - */ - private void initializeJarPaths() { - IDialogSettings settings= this.getDialogSettings(); - if(settings != null) { - // destination - String[] driverPaths = settings.getArray(this.storedDriverClasspathId); - if(driverPaths == null) { - return; // ie.- no settings stored - } - this.jarPaths = new ArrayList<String>(); - - CollectionTools.addAll(this.jarPaths, driverPaths); - } - } - - private void saveWidgetValues() { - IDialogSettings settings= this.getDialogSettings(); - - if(settings != null) { - String[] driverPaths = this.jarPaths.toArray(new String[0]); - settings.put(this.storedDriverClasspathId, driverPaths); - } - } - - private String buildDriverJarListString() { - if(this.jarPaths.isEmpty()) { - return StringTools.EMPTY_STRING; - } - StringBuffer result = new StringBuffer(); - for(String jar : this.jarPaths) { - result.append(jar).append(PATH_SEPARATOR); - } - result.deleteCharAt(result.length() - 1); // remove last separator - return result.toString(); - } - - // ********** UI components ********** - - public void createControl(Composite parent) { - this.initializeJarPaths(); - this.setPageComplete(true); - this.setControl(this.buildTopLevelControl(parent)); - } - - private Control buildTopLevelControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayout(new GridLayout()); - - new JarsGroup(composite); - - return composite; - } - - // ********** private methods ********** - - private void removeJarFile(String filePath) { - this.jarPaths.remove(filePath); - } - - private void addJarFile(String filePath) { - if( ! this.jarPaths.contains(filePath)) { - this.jarPaths.add(filePath); - } - } - - // ********** JarsGroup class ********** - - private class JarsGroup { - - - // ********** constructor ********** - - private JarsGroup(Composite parent) { - super(); - Composite composite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(2, false); //must be 4 for the package controls - layout.marginHeight = 0; - layout.marginWidth = 0; - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - // TODO PlatformUI.getWorkbench().getHelpSystem().setHelp(this.group, HELP_CONTEXT_ID); - - this.buildLabel(composite, 2, JptDbwsUiMessages.JdbcDriverWizardPage_driverFiles); - - this.buildDriverFilesTable(composite); - } - - // ********** intra-wizard methods ********** - - public IJavaProject getJavaProject() { - IWizard wizard = getWizard(); - - if( ! (wizard instanceof DbwsGeneratorWizard)) { - throw new NullPointerException(); - } - return ((DbwsGeneratorWizard)wizard).getJavaProject(); - } - - private ArrayList<String> getJarPaths() { - return jarPaths; - } - - // ********** private methods ********** - - private TableViewer buildDriverFilesTable(Composite parent) { - - TableViewer tableViewer = this.buildTableViewer(parent, this.getJarPaths()); - - this.buildAddRemoveButtons(parent, tableViewer); - 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.horizontalSpan = 1; - gridData.heightHint= SWTUtil.getTableHeightHint(table, 7); - tableLayout.setLayoutData(gridData); - - TableViewer tableViewer = new TableViewer(table); - tableViewer.setUseHashlookup(true); - tableViewer.setLabelProvider(this.buildLabelProvider()); - tableViewer.setContentProvider(this.buildContentProvider()); - - tableViewer.setInput(tableDataModel); - tableViewer.refresh(); - return tableViewer; - } - - private void buildAddRemoveButtons(Composite parent, final TableViewer tableViewer) { - - 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(JptDbwsUiMessages.JdbcDriverWizardPage_addButton); - gridData = new GridData(); - gridData.horizontalAlignment = GridData.FILL; - gridData.grabExcessHorizontalSpace= true; - addButton.setLayoutData(gridData); - addButton.addSelectionListener(new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) {} - - public void widgetSelected(SelectionEvent e) { - - ArrayList<String> jarFiles = promptJarFiles(); - for(String jarFile : jarFiles) { - addJarFile(jarFile); - } - tableViewer.refresh(); - } - }); - // Remove buttons - Button removeButton = new Button(buttonComposite, SWT.PUSH); - removeButton.setText(JptDbwsUiMessages.JdbcDriverWizardPage_removeButton); - gridData = new GridData(); - gridData.horizontalAlignment = GridData.FILL; - gridData.grabExcessHorizontalSpace= true; - 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 jarFile = (String)selection.getFirstElement(); - removeJarFile(jarFile); - - tableViewer.refresh(); - } - }); - addButton.setFocus(); - } - - private IBaseLabelProvider buildLabelProvider() { - return new TableLabelProvider(); - } - - private IContentProvider buildContentProvider() { - return new TableContentProvider(); - } - - private ArrayList<String> promptJarFiles() { - String projectPath= this.getJavaProject().getProject().getLocation().toString(); - - FileDialog dialog = new FileDialog(getShell(), SWT.MULTI); - dialog.setText(JptDbwsUiMessages.JdbcDriverWizardPage_chooseADriverFile); - dialog.setFilterPath(projectPath); - dialog.setFilterExtensions(new String[] {BINDINGS_FILE_FILTER}); - - dialog.open(); - String path = dialog.getFilterPath(); - String[] fileNames = dialog.getFileNames(); - ArrayList<String> results = new ArrayList<String>(fileNames.length); - for(String fileName : fileNames) { - results.add(path + File.separator + fileName); - } - return results; - } - - private void addColumnsData(TableLayoutComposite layout) { - layout.addColumnData(new ColumnWeightData(50, true)); - } - - /** - * Build and return a label - */ - 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; - } - - // ********** 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/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectFileOrXMLCatalogIdPanel.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectFileOrXMLCatalogIdPanel.java deleted file mode 100644 index 7f36cc306f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectFileOrXMLCatalogIdPanel.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Code originate from org.eclipse.wst.xml.ui.internal.dialogs - *******************************************************************************/ -package org.eclipse.jpt.dbws.eclipselink.ui.internal.wizards.gen; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jpt.dbws.eclipselink.ui.JptDbwsUiPlugin; -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.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.ui.part.PageBook; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog; - - -public class SelectFileOrXMLCatalogIdPanel extends Composite implements SelectionListener { - - public interface PanelListener { - void completionStateChanged(); - } - - protected PanelListener listener; - protected PageBook pageBook; - - protected SelectFilePanel selectFilePanel; - protected SelectXMLCatalogIdPanel selectXMLCatalogIdPanel; - - // ********** constructor ********** - - public SelectFileOrXMLCatalogIdPanel(Composite parent, IStructuredSelection selection) { - super(parent, SWT.NONE); - - // container group - setLayout(new GridLayout()); - GridData gd = new GridData(GridData.FILL_BOTH); - gd.heightHint = 400; - gd.widthHint = 400; - setLayoutData(gd); - - pageBook = new PageBook(this, SWT.NONE); - pageBook.setLayoutData(new GridData(GridData.FILL_BOTH)); - - selectFilePanel = new SelectFilePanel(pageBook, selection); - this.setSingleFileViewDefaultSelection(selection); - - // Catalog - ICatalog xmlCatalog = JptDbwsUiPlugin.instance().getDefaultXMLCatalog(); - selectXMLCatalogIdPanel = new SelectXMLCatalogIdPanel(pageBook, xmlCatalog); - selectXMLCatalogIdPanel.getTableViewer().addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - updateCompletionStateChange(); - } - }); - Dialog.applyDialogFont(parent); - pageBook.showPage(selectFilePanel.getControl()); - } - - public void setSingleFileViewDefaultSelection(ISelection selection) { - this.selectFilePanel.setDefaultSelection(selection); - } - - public IFile getFile() { - return selectFilePanel.getFile(); - } - - public String getXMLCatalogURI() { - return null; // XMLCatalog not supported - } - - public void setCatalogEntryType(int catalogEntryType) { - selectXMLCatalogIdPanel.setCatalogEntryType(catalogEntryType); - } - - public void setFilterExtensions(String[] filterExtensions) { - selectFilePanel.resetFilters(); - selectFilePanel.addFilterExtensions(filterExtensions); - - selectXMLCatalogIdPanel.getTableViewer().setFilterExtensions(filterExtensions); - } - - public void setListener(PanelListener listener) { - this.listener = listener; - } - - public void setVisibleHelper(boolean isVisible) { - selectFilePanel.setVisibleHelper(isVisible); - } - - public void updateCompletionStateChange() { - if (listener != null) { - listener.completionStateChanged(); - } - } - - public void widgetDefaultSelected(SelectionEvent e) { - } - - public void widgetSelected(SelectionEvent e) { - pageBook.showPage(selectFilePanel.getControl()); - - updateCompletionStateChange(); - } - - // ********** inner class ********** - - protected class SelectFilePanel extends SelectSingleFileViewFacade implements SelectSingleFileViewFacade.Listener { - protected Control control; - - public SelectFilePanel(Composite parent, IStructuredSelection selection) { - super(selection, true); - // String[] ext = {".dtd"}; - // addFilterExtensions(ext); - control = createControl(parent); - control.setLayoutData(new GridData(GridData.FILL_BOTH)); - SelectFilePanel.this.setListener(this); - } - - public Control getControl() { - return control; - } - - public void setControlComplete(boolean isComplete) { - updateCompletionStateChange(); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectSingleFileViewFacade.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectSingleFileViewFacade.java deleted file mode 100644 index c5363d54e6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectSingleFileViewFacade.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* -* 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.dbws.eclipselink.ui.internal.wizards.gen; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.widgets.Composite; - -/** - * SelectSingleFileView - * - * Façade class to change accessibility of SelectSingleFileView. - */ -@SuppressWarnings("restriction") -public class SelectSingleFileViewFacade extends org.eclipse.wst.common.ui.internal.viewers.SelectSingleFileView { - - public static interface Listener extends org.eclipse.wst.common.ui.internal.viewers.SelectSingleFileView.Listener - {} - - public SelectSingleFileViewFacade(IStructuredSelection selection, boolean isFileMandatory) { - super(selection, isFileMandatory); - } - - public void addFilterExtensions(String[] filterExtensions) { - super.addFilterExtensions(filterExtensions); - } - - public Composite createControl(Composite parent) { - return super.createControl(parent); - } - - public IFile getFile() { - return super.getFile(); - } - - public void resetFilters() { - super.resetFilters(); - } - - public void setVisibleHelper(boolean isVisible) { - super.setVisibleHelper(isVisible); - } - - public void setDefaultSelection(ISelection selection) { - super.setDefaultSelection(selection); - } - - public void setListener(Listener listener) { - super.setListener(listener); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectXMLCatalogIdPanel.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectXMLCatalogIdPanel.java deleted file mode 100644 index 3e1ec46a64..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectXMLCatalogIdPanel.java +++ /dev/null @@ -1,146 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Code originate from org.eclipse.wst.xml.ui.internal.dialogs - *******************************************************************************/ -package org.eclipse.jpt.dbws.eclipselink.ui.internal.wizards.gen; - -import java.util.Collection; -import java.util.List; -import java.util.Vector; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jpt.dbws.eclipselink.ui.JptDbwsUiPlugin; -import org.eclipse.jpt.dbws.eclipselink.ui.internal.JptDbwsUiMessages; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry; -import org.eclipse.wst.xml.core.internal.catalog.provisional.INextCatalog; - - -public class SelectXMLCatalogIdPanel extends Composite { - protected int catalogEntryType; - protected boolean doTableSizeHack = false; - - protected XMLCatalogTableViewer tableViewer; - protected ICatalog fXmlCatalog; - - public SelectXMLCatalogIdPanel(Composite parent, ICatalog xmlCatalog) { - super(parent, SWT.NONE); - this.fXmlCatalog = xmlCatalog; - - GridLayout gridLayout = new GridLayout(); - this.setLayout(gridLayout); - GridData gd = new GridData(GridData.FILL_BOTH); - gd.heightHint = 200; - gd.widthHint = 700; - this.setLayoutData(gd); - - Label label = new Label(this, SWT.NONE); - label.setText(JptDbwsUiMessages.BuilderXmlWizardPage_xmlCatalogTableTitle); - - tableViewer = createTableViewer(this); - tableViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - tableViewer.setInput("dummy"); //$NON-NLS-1$ - } - - protected XMLCatalogTableViewer createTableViewer(Composite parent) { - String headings[] = new String[2]; - headings[0] = JptDbwsUiMessages.BuilderXmlWizardPage_xmlCatalogKeyColumn; - headings[1] = JptDbwsUiMessages.BuilderXmlWizardPage_xmlCatalogUriColumn; - - XMLCatalogTableViewer theTableViewer = new XMLCatalogTableViewer(parent, headings) { - - protected void addXMLCatalogEntries(List list, ICatalogEntry[] entries) { - for (int i = 0; i < entries.length; i++) { - ICatalogEntry entry = entries[i]; - if (catalogEntryType == 0) { - list.add(entry); - } - else if (catalogEntryType == entry.getEntryType()) { - list.add(entry); - } - } - } - - public Collection getXMLCatalogEntries() { - List result = null; - - if ((fXmlCatalog == null) || doTableSizeHack) { - // this lets us create a table with an initial height of - // 10 rows - // otherwise we get stuck with 0 row heigh table... that's - // too small - doTableSizeHack = false; - result = new Vector(); - for (int i = 0; i < 6; i++) { - result.add(""); //$NON-NLS-1$ - } - } - else { - result = new Vector(); - INextCatalog[] nextCatalogs = fXmlCatalog.getNextCatalogs(); - for (int i = 0; i < nextCatalogs.length; i++) { - INextCatalog catalog = nextCatalogs[i]; - ICatalog referencedCatalog = catalog.getReferencedCatalog(); - if (referencedCatalog != null) { - if (JptDbwsUiPlugin.SYSTEM_CATALOG_ID.equals(referencedCatalog.getId())) { - ICatalog systemCatalog = referencedCatalog; - addXMLCatalogEntries(result, systemCatalog.getCatalogEntries()); - - } - else if (JptDbwsUiPlugin.USER_CATALOG_ID.equals(referencedCatalog.getId())) { - ICatalog userCatalog = referencedCatalog; - addXMLCatalogEntries(result, userCatalog.getCatalogEntries()); - - } - } - } - } - return result; - } - }; - return theTableViewer; - } - - - public String getId() { - ICatalogEntry entry = getXMLCatalogEntry(); - return entry != null ? entry.getKey() : null; - } - - public XMLCatalogTableViewer getTableViewer() { - return tableViewer; - } - - public String getURI() { - ICatalogEntry entry = getXMLCatalogEntry(); - return entry != null ? entry.getURI() : null; - } - - public ICatalogEntry getXMLCatalogEntry() { - ICatalogEntry result = null; - ISelection selection = tableViewer.getSelection(); - Object selectedObject = (selection instanceof IStructuredSelection) ? ((IStructuredSelection) selection).getFirstElement() : null; - if (selectedObject instanceof ICatalogEntry) { - result = (ICatalogEntry) selectedObject; - } - return result; - } - - public void setCatalogEntryType(int catalogEntryType) { - this.catalogEntryType = catalogEntryType; - tableViewer.refresh(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/WebDynamicProjectWizardPage.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/WebDynamicProjectWizardPage.java deleted file mode 100644 index 0e32bfda55..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/WebDynamicProjectWizardPage.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2011 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.dbws.eclipselink.ui.internal.wizards.gen; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jpt.common.ui.internal.wizards.JavaProjectWizardPage; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.dbws.eclipselink.ui.internal.DbwsGeneratorUi; - -/** - * WebDynamicProjectWizardPage - */ -public class WebDynamicProjectWizardPage extends JavaProjectWizardPage { - - public WebDynamicProjectWizardPage(IJavaProject javaProject) { - super(javaProject); - } - - @Override - protected Iterable<IProject> getJavaProjects() { - return new FilteringIterable<IProject>(CollectionTools.collection(this.getProjects())) { - @Override - protected boolean accept(IProject next) { - return DbwsGeneratorUi.projectIsWebDynamic(next); - } - }; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/XMLCatalogTableViewer.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/XMLCatalogTableViewer.java deleted file mode 100644 index c556561adf..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/XMLCatalogTableViewer.java +++ /dev/null @@ -1,195 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Code originate from org.eclipse.wst.xml.ui.internal.dialogs - *******************************************************************************/ -package org.eclipse.jpt.dbws.eclipselink.ui.internal.wizards.gen; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Comparator; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.jpt.dbws.eclipselink.ui.JptDbwsUiPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.wst.common.uriresolver.internal.util.URIHelper; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry; - -import com.ibm.icu.text.Collator; - -public class XMLCatalogTableViewer extends TableViewer { - - protected static String ERROR_STATE_KEY = "errorstatekey"; //$NON-NLS-1$ - - protected static Image dtdFileImage = JptDbwsUiPlugin.getImage("icons/full/obj16/dtdfile.gif"); //$NON-NLS-1$ - protected static Image unknownFileImage = JptDbwsUiPlugin.getImage("icons/full/obj16/text.gif"); //$NON-NLS-1$ - protected static Image xsdFileImage = JptDbwsUiPlugin.getImage("icons/full/obj16/XSDFile.gif"); //$NON-NLS-1$ - protected static Image errorImage = JptDbwsUiPlugin.getImage("icons/full/ovr16/error_ovr.gif"); //$NON-NLS-1$ - - // ********** constructor ********** - - public XMLCatalogTableViewer(Composite parent, String[] columnProperties) { - super(parent, SWT.FULL_SELECTION); - - Table table = getTable(); - table.setLinesVisible(true); - table.setHeaderVisible(true); - table.setLinesVisible(true); - - TableLayout layout = new TableLayout(); - for (int i = 0; i < columnProperties.length; i++) { - TableColumn column = new TableColumn(table, i); - column.setText(columnProperties[i]); - column.setAlignment(SWT.LEFT); - layout.addColumnData(new ColumnWeightData(50, true)); - } - table.setLayout(layout); - table.setLinesVisible(false); - - setColumnProperties(columnProperties); - - setContentProvider(new CatalogEntryContentProvider()); - setLabelProvider(new CatalogEntryLabelProvider()); - } - - public Collection getXMLCatalogEntries() { - return null; - } - - public void menuAboutToShow(IMenuManager menuManager) { - Action action = new Action("hello") { //$NON-NLS-1$ - public void run() { - System.out.println("run!"); //$NON-NLS-1$ - } - }; - menuManager.add(action); - } - - public void setFilterExtensions(String[] extensions) { - resetFilters(); - addFilter(new XMLCatalogTableViewerFilter(extensions)); - } - - // ********** inner class ********** - - public class CatalogEntryContentProvider implements IStructuredContentProvider { - - public void dispose() { - } - - public Object[] getElements(Object element) { - Object[] array = getXMLCatalogEntries().toArray(); - Comparator comparator = new Comparator() { - public int compare(Object o1, Object o2) { - int result = 0; - if ((o1 instanceof ICatalogEntry) && (o2 instanceof ICatalogEntry)) { - ICatalogEntry mappingInfo1 = (ICatalogEntry) o1; - ICatalogEntry mappingInfo2 = (ICatalogEntry) o2; - result = Collator.getInstance().compare(mappingInfo1.getKey(), mappingInfo2.getKey()); - } - return result; - } - }; - Arrays.sort(array, comparator); - return array; - } - - public void inputChanged(Viewer viewer, Object old, Object newobj) { - } - - public boolean isDeleted(Object object) { - return false; - } - } - - public class CatalogEntryLabelProvider extends LabelProvider implements ITableLabelProvider { - - public Image getColumnImage(Object object, int columnIndex) { - Image result = null; - if (columnIndex == 0) { - Image base = null; - if (object instanceof ICatalogEntry) { - ICatalogEntry catalogEntry = (ICatalogEntry) object; - String uri = catalogEntry.getURI(); - if (uri.endsWith("dtd")) { //$NON-NLS-1$ - base = dtdFileImage; - } - else if (uri.endsWith("xsd")) { //$NON-NLS-1$ - base = xsdFileImage; - } - else { - base = unknownFileImage; - } - - if (base != null) { - if (URIHelper.isReadableURI(uri, false)) { - result = base; - } - else { - // TODO... SSE port - result = base;// imageFactory.createCompositeImage(base, - // errorImage, - // ImageFactory.BOTTOM_LEFT); - } - } - } - } - return result; - } - - public String getColumnText(Object object, int columnIndex) { - String result = null; - if (object instanceof ICatalogEntry) { - ICatalogEntry catalogEntry = (ICatalogEntry) object; - result = columnIndex == 0 ? catalogEntry.getKey() : catalogEntry.getURI(); - result = URIHelper.removePlatformResourceProtocol(result); - } - return result != null ? result : ""; //$NON-NLS-1$ - } - } - - class XMLCatalogTableViewerFilter extends ViewerFilter { - protected String[] extensions; - - public XMLCatalogTableViewerFilter(String[] extensions) { - this.extensions = extensions; - } - - public boolean isFilterProperty(Object element, Object property) { - return false; - } - - public boolean select(Viewer viewer, Object parent, Object element) { - boolean result = false; - if (element instanceof ICatalogEntry) { - ICatalogEntry catalogEntry = (ICatalogEntry) element; - for (int i = 0; i < extensions.length; i++) { - if (catalogEntry.getURI().endsWith(extensions[i])) { - result = true; - break; - } - } - } - return result; - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/.cvsignore b/jaxb/plugins/org.eclipse.jpt.jaxb.branding/.cvsignore deleted file mode 100644 index c14487ceac..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -build.xml diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/.project b/jaxb/plugins/org.eclipse.jpt.jaxb.branding/.project deleted file mode 100644 index 98560920c2..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/.project +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jpt.jaxb.branding</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <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> - </natures> -</projectDescription> diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.jaxb.branding/META-INF/MANIFEST.MF deleted file mode 100644 index 1eae124537..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/META-INF/MANIFEST.MF +++ /dev/null @@ -1,7 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.jpt.jaxb.branding;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-Localization: plugin -Bundle-Vendor: %providerName diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.html b/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.html deleted file mode 100644 index ca606b1bb5..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.html +++ /dev/null @@ -1,34 +0,0 @@ -<!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>June 06, 2007</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>
\ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.ini b/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.ini deleted file mode 100644 index 7d88b9d396..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.ini +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2009 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 -############################################################################### - -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=icons/WTP_icon_x32_v2.png - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -# optional - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional - -# Property "tipsAndTricksHref" contains the Help topic href to a tips and tricks page -# optional -tipsAndTricksHref=/org.eclipse.jpt.doc.user/tips_and_tricks.htm - - diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.mappings b/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.mappings deleted file mode 100644 index bddaab4310..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.mappings +++ /dev/null @@ -1,6 +0,0 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -0=@build@
\ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.properties deleted file mode 100644 index 9bd22c769c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.properties +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################### -# 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 -############################################################################### - -# about.properties -# contains externalized strings for about.ini -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# fill-ins are supplied by about.mappings -# This file should be translated. - -blurb=Dali Java Persistence Tools - JAXB Support\n\ -\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -(c) Copyright Oracle contributors and others 2010, 2011. All rights reserved.\n\ -Visit http://www.eclipse.org/webtools diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/build.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.branding/build.properties deleted file mode 100644 index 11a4e44db6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/build.properties +++ /dev/null @@ -1,18 +0,0 @@ -############################################################################### -# 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 -############################################################################### -bin.includes = META-INF/,\ - about.ini,\ - about.html,\ - about.mappings,\ - about.properties,\ - icons/,\ - plugin.properties,\ - component.xml diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/component.xml b/jaxb/plugins/org.eclipse.jpt.jaxb.branding/component.xml deleted file mode 100644 index bc275a758e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/component.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<component xmlns="http://eclipse.org/wtp/releng/tools/component-model" name="org.eclipse.jpt.jaxb.branding"> -<description url=""></description> -<component-depends unrestricted="true"></component-depends> -<plugin id="org.eclipse.jpt.jaxb.branding" fragment="false"/> -<plugin id="org.eclipse.jpt.common.utility" fragment="false"/> -<plugin id="org.eclipse.jpt.common.core" fragment="false"/> -<plugin id="org.eclipse.jpt.common.ui" fragment="false"/> -<plugin id="org.eclipse.jpt.jaxb.core" fragment="false"/> -<plugin id="org.eclipse.jpt.jaxb.ui" fragment="false"/> -</component>
\ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/icons/WTP_icon_x32_v2.png b/jaxb/plugins/org.eclipse.jpt.jaxb.branding/icons/WTP_icon_x32_v2.png Binary files differdeleted file mode 100644 index 6f09c2a700..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/icons/WTP_icon_x32_v2.png +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/plugin.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.branding/plugin.properties deleted file mode 100644 index fbe477feb2..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# 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 -############################################################################### - -pluginName = Dali Java Persistence Tools - JAXB Support -providerName = Eclipse Web Tools Platform diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.classpath b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.classpath deleted file mode 100644 index 304e86186a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <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="output" path="bin"/> -</classpath> diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.cvsignore b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.cvsignore deleted file mode 100644 index ba077a4031..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.project b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.project deleted file mode 100644 index 025cb3b6fa..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jpt.jaxb.core.schemagen</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/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.settings/org.eclipse.jdt.core.prefs b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index b92672fdf6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Tue Mar 08 12:07:29 EST 2011 -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.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -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/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/META-INF/MANIFEST.MF deleted file mode 100644 index 74056248bf..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/META-INF/MANIFEST.MF +++ /dev/null @@ -1,11 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.jaxb.core.schemagen;singleton:=true -Bundle-Version: 1.0.100.qualifier -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Import-Package: javax.xml.bind -Export-Package: org.eclipse.jpt.jaxb.core.schemagen, - org.eclipse.jpt.jaxb.core.schemagen.internal;x-internal:=true diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/about.html b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/about.html deleted file mode 100644 index 071f586b21..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/about.html +++ /dev/null @@ -1,47 +0,0 @@ -<!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"> - -<H2>About This Content</H2> - -<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> - -<h3>Third Party Content</h3> -<p>The Content includes items that have been sourced from third parties as set - out below. If you did not receive this Content directly from the Eclipse Foundation, - the following is provided for informational purposes only, and you should look - to the Redistributor’s license for terms and conditions of use.</p> - -<h4><a name="JPA" id="JPA"></a>Java Persistence API (JPA) v1.0</h4> - -<blockquote> - <p>The Java Persistence API (JPA) which is distributed under <a href="https://glassfish.dev.java.net/public/CDDLv1.0.html">CDDL - v1.0</a> is required by the Dali Java Persistence Tools Project in order - to support this standard.</p> -</blockquote> -</BODY> -</HTML> diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/build.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/build.properties deleted file mode 100644 index d535c6112b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/build.properties +++ /dev/null @@ -1,17 +0,0 @@ -############################################################################### -# Copyright (c) 2010, 2011 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 -############################################################################### -source.. = src/ -output.. = bin/ -bin.includes = .,\ - META-INF/,\ - about.html,\ - plugin.properties -jars.compile.order = . diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/plugin.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/plugin.properties deleted file mode 100644 index 2e7dfca4c9..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/plugin.properties +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2008 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 - Schema Generation -providerName = Eclipse Web Tools Platform 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 deleted file mode 100644 index 9f6a922785..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/Main.java +++ /dev/null @@ -1,287 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 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 java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.SchemaOutputResolver; -import javax.xml.transform.Result; -import javax.xml.transform.stream.StreamResult; - -import org.eclipse.jpt.jaxb.core.schemagen.internal.JptJaxbCoreMessages; -import org.eclipse.jpt.jaxb.core.schemagen.internal.Tools; - -/** - * Generate a JAXB Schema - * - * Current command-line arguments: - * [-s schema.xsd] - specifies the target schema - * [-c className] - specifies the fully qualified class name - * - * [-p packageName] - specifies the source package // @deprecated - */ -public class Main -{ - private String[] sourceClassNames; - private String targetSchemaName; - @SuppressWarnings("unused") - private boolean isDebugMode; - - static public String NO_FACTORY_CLASS = "doesnt contain ObjectFactory.class"; //$NON-NLS-1$ - - // ********** static methods ********** - - public static void main(String[] args) { - new Main().execute(args); - } - - // ********** constructors ********** - - private Main() { - super(); - } - - // ********** behavior ********** - - protected void execute(String[] args) { - - this.initializeWith(args); - - this.generate(); - } - - // ********** internal methods ********** - - private void initializeWith(String[] args) { - this.sourceClassNames = this.getSourceClassNames(args); - this.targetSchemaName = this.getTargetSchemaName(args); - - this.isDebugMode = this.getDebugMode(args); - } - - private void generate() { - // Create the JAXBContext - JAXBContext jaxbContext = this.buildJaxbContext(); - - // Generate an XML Schema - if(jaxbContext != null) { - this.generateSchema(jaxbContext); - } - else { - System.out.println(Tools.bind(JptJaxbCoreMessages.SCHEMA_NOT_CREATED, this.targetSchemaName)); - } - } - - private JAXBContext buildJaxbContext() { - System.out.println(Tools.getString(JptJaxbCoreMessages.LOADING_CLASSES)); - JAXBContext jaxbContext = null; - try { - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - - Class[] sourceClasses = this.buildSourceClasses(this.sourceClassNames, loader); - - jaxbContext = JAXBContext.newInstance(sourceClasses); - } - catch(JAXBException ex) { - this.handleException(ex); - } - return jaxbContext; - } - - private void generateSchema(JAXBContext jaxbContext) { - System.out.println(Tools.getString(JptJaxbCoreMessages.GENERATING_SCHEMA)); - System.out.flush(); - - SchemaOutputResolver schemaOutputResolver = - new JptSchemaOutputResolver(this.targetSchemaName); - - try { - jaxbContext.generateSchema(schemaOutputResolver); - } - catch (IOException e) { - e.printStackTrace(); - } - } - - private Class[] buildSourceClasses(String[] classNames, ClassLoader loader) { - - ArrayList<Class> sourceClasses = new ArrayList<Class>(classNames.length); - for(String className: classNames) { - try { - sourceClasses.add(loader.loadClass(className)); - System.out.println(className); - } - catch (ClassNotFoundException e) { - System.err.println(Tools.bind(JptJaxbCoreMessages.NOT_FOUND, className)); - } - } - System.out.flush(); - return sourceClasses.toArray(new Class[0]); - } - - private void handleException(JAXBException ex) { - String message = ex.getMessage(); - Throwable linkedEx = ex.getLinkedException(); - if(message != null && message.indexOf(NO_FACTORY_CLASS) > -1) { - System.err.println(message); - } - else if(linkedEx != null && linkedEx instanceof ClassNotFoundException) { - String errorMessage = Tools.bind(JptJaxbCoreMessages.CONTEXT_FACTORY_NOT_FOUND, linkedEx.getMessage()); - System.err.println(errorMessage); - } - else { - ex.printStackTrace(); - } - } - - // ********** argument queries ********** - - private String[] getSourceClassNames(String[] args) { - - return this.getAllArgumentValue("-c", args); //$NON-NLS-1$ - } - - private String getTargetSchemaName(String[] args) { - - return this.getArgumentValue("-s", args); //$NON-NLS-1$ - } - - private boolean getDebugMode(String[] args) { - - return this.argumentExists("-debug", args); //$NON-NLS-1$ - } - - // ********** private methods ********** - - private String getArgumentValue(String argName, String[] args) { - for (int i = 0; i < args.length; i++) { - String arg = args[i]; - if (arg.toLowerCase().equals(argName)) { - int j = i + 1; - if (j < args.length) { - return args[j]; - } - } - } - return null; - } - - private String[] getAllArgumentValue(String argName, String[] args) { - List<String> argValues = new ArrayList<String>(); - for (int i = 0; i < args.length; i++) { - String arg = args[i]; - if (arg.toLowerCase().equals(argName)) { - int j = i + 1; - if (j < args.length) { - argValues.add(args[j]); - i++; - } - } - } - return argValues.toArray(new String[0]); - } - - private boolean argumentExists(String argName, String[] args) { - for (int i = 0; i < args.length; i++) { - String arg = args[i]; - if (arg.toLowerCase().equals(argName)) { - return true; - } - } - return false; - } - -} - -// ********** inner class ********** - -class JptSchemaOutputResolver extends SchemaOutputResolver { - - private final String defaultSchemaName; - - // ********** constructor ********** - - protected JptSchemaOutputResolver(String defaultSchemaName) { - this.defaultSchemaName = defaultSchemaName; - } - - // ********** overrides ********** - - @Override - public Result createOutput(String namespaceURI, String suggestedFileName) throws IOException { - - String filePath = (Tools.stringIsEmpty(namespaceURI)) ? - this.buildFileNameFrom(this.defaultSchemaName, suggestedFileName) : - this.modifyFileName(namespaceURI); - - filePath = this.canonicalFileName(filePath); - File file = new File(filePath); - StreamResult result = new StreamResult(file); - result.setSystemId(file.toURL().toExternalForm()); - - System.out.print(Tools.bind(JptJaxbCoreMessages.SCHEMA_GENERATED, file)); - return result; - } - - // ********** private methods ********** - - private String buildFileNameFrom(String fileName, String suggestedFileName) { - - fileName = Tools.stripExtension(fileName); - - if(Tools.stringIsEmpty(fileName)) { - return suggestedFileName; - } - String number = Tools.extractFileNumber(suggestedFileName); - - fileName = this.buildFileName(fileName, number); - return Tools.appendXsdExtension(fileName); - } - - private String buildFileName(String fileName, String number) { - - if(Tools.stringIsEmpty(number)) { - return fileName; - } - return (number.equals("0")) ? fileName : fileName + number; //$NON-NLS-1$ - } - - private String modifyFileName(String namespaceURI) throws IOException { - - String dir = Tools.extractDirectory(this.defaultSchemaName); - - String fileName = Tools.stripProtocol(namespaceURI); - fileName = fileName.replaceAll("/", "_"); //$NON-NLS-1$ - fileName = Tools.appendXsdExtension(fileName); - - String result = (Tools.stringIsEmpty(dir)) ? fileName : dir + File.separator + fileName; - - return result; - } - - private String canonicalFileName(String fileName) { - return this.canonicalFile(new File(fileName)).getAbsolutePath(); - } - - private File canonicalFile(File file) { - try { - return file.getCanonicalFile(); - } - catch (IOException ioexception) { - return file.getAbsoluteFile(); - } - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/JptJaxbCoreMessages.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/JptJaxbCoreMessages.java deleted file mode 100644 index 49170533dd..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/JptJaxbCoreMessages.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* -* 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.schemagen.internal; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/** - * Localized messages used by Dali JAXB core. - */ -public class JptJaxbCoreMessages -{ - - public static final String LOADING_CLASSES = "LOADING_CLASSES"; - public static final String GENERATING_SCHEMA = "GENERATING_SCHEMA"; - public static final String SCHEMA_GENERATED = "SCHEMA_GENERATED"; - public static final String SCHEMA_NOT_CREATED = "SCHEMA_NOT_CREATED"; - public static final String NOT_FOUND = "NOT_FOUND"; - public static final String CONTEXT_FACTORY_NOT_FOUND = "CONTEXT_FACTORY_NOT_FOUND"; - - - private static final String BUNDLE_NAME = "org.eclipse.jpt.jaxb.core.schemagen.internal.jpt_jaxb_core"; //$NON-NLS-1$ - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); - - private JptJaxbCoreMessages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } - catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -}
\ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/Tools.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/Tools.java deleted file mode 100644 index 6427661dcd..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/Tools.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* -* 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.schemagen.internal; - -import java.io.File; -import java.text.MessageFormat; - -/** - * Tools - */ -public final class Tools -{ - /** default file name used by the schemagen */ - static public String GEN_DEFAULT_NAME = "schema"; //$NON-NLS-1$ - - /** empty string */ - public static final String EMPTY_STRING = ""; //$NON-NLS-1$ - - // ********** queries ********** - - /** - * Return whether the specified string is null, empty, or contains - * only whitespace characters. - */ - public static boolean stringIsEmpty(String string) { - if (string == null) { - return true; - } - int len = string.length(); - if (len == 0) { - return true; - } - return stringIsEmpty_(string.toCharArray(), len); - } - - private static boolean stringIsEmpty_(char[] s, int len) { - for (int i = len; i-- > 0; ) { - if ( ! Character.isWhitespace(s[i])) { - return false; - } - } - return true; - } - - // ********** short name manipulation ********** - - /** - * Strip the extension from the specified file name - * and return the result. If the file name has no - * extension, it is returned unchanged - * File#basePath() - */ - public static String stripExtension(String fileName) { - int index = fileName.lastIndexOf('.'); - if (index == -1) { - return fileName; - } - return fileName.substring(0, index); - } - - public static String stripProtocol(String uri) { - - return uri.replaceFirst("http://", EMPTY_STRING); - } - - - public static String appendXsdExtension(String name) { - - return name + ".xsd"; //$NON-NLS-1$ - } - - public static String extractFileNumber(String fileName) { - - String result = stripExtension(fileName); - if(Tools.stringIsEmpty(result)) { - return EMPTY_STRING; - } - return result.replaceFirst(GEN_DEFAULT_NAME, EMPTY_STRING); - } - - public static String extractDirectory(String path) { - if( ! path.contains(File.separator)) { - return EMPTY_STRING; - } - return path.substring(0, path.lastIndexOf(File.separator)); - } - - // ********** NLS utilities ********** - - public static String getString(String key) { - return JptJaxbCoreMessages.getString(key); - } - - public static String bind(String key, Object argument) { - return MessageFormat.format(getString(key), argument); - } -} 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 deleted file mode 100644 index b9112cd725..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/jpt_jaxb_core.properties +++ /dev/null @@ -1,19 +0,0 @@ -################################################################################ -# 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 -################################################################################ - -LOADING_CLASSES = loading... -GENERATING_SCHEMA = \ngenerating schema... -SCHEMA_GENERATED = \nSchema {0} generated -SCHEMA_NOT_CREATED = \nSchema {0} not created -NOT_FOUND = \n\tNot found: {0} -CONTEXT_FACTORY_NOT_FOUND = \nThe JAXBContextFactory {0} \n\ -specified in the jaxb.properties file could not be located on the project classpath. \n\ -The JAXB provider that defines this factory should be added to the project classpath, \n\ -or the jaxb.properties file should be removed to use the default provider. diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/.cvsignore b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/.cvsignore deleted file mode 100644 index c14487ceac..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -build.xml diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/.project b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/.project deleted file mode 100644 index d123fb8513..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/.project +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jpt.jaxb.eclipselink.branding</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <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> - </natures> -</projectDescription> diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/META-INF/MANIFEST.MF deleted file mode 100644 index 0eb6ebdab2..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/META-INF/MANIFEST.MF +++ /dev/null @@ -1,7 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.jpt.jaxb.eclipselink.branding;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-Localization: plugin -Bundle-Vendor: %providerName diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.html b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.html deleted file mode 100644 index ca606b1bb5..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.html +++ /dev/null @@ -1,34 +0,0 @@ -<!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>June 06, 2007</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>
\ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.ini b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.ini deleted file mode 100644 index 7d88b9d396..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.ini +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2009 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 -############################################################################### - -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=icons/WTP_icon_x32_v2.png - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -# optional - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional - -# Property "tipsAndTricksHref" contains the Help topic href to a tips and tricks page -# optional -tipsAndTricksHref=/org.eclipse.jpt.doc.user/tips_and_tricks.htm - - diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.mappings b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.mappings deleted file mode 100644 index bddaab4310..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.mappings +++ /dev/null @@ -1,6 +0,0 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -0=@build@
\ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.properties deleted file mode 100644 index f38c7c0a88..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.properties +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################### -# 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 -############################################################################### - -# about.properties -# contains externalized strings for about.ini -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# fill-ins are supplied by about.mappings -# This file should be translated. - -blurb=Dali Java Persistence Tools - EclipseLink JAXB Support\n\ -\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -(c) Copyright Oracle contributors and others 2010, 2011. All rights reserved.\n\ -Visit http://www.eclipse.org/webtools diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/build.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/build.properties deleted file mode 100644 index d6bd03a94b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/build.properties +++ /dev/null @@ -1,17 +0,0 @@ -############################################################################### -# 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 -############################################################################### -bin.includes = META-INF/,\ - about.ini,\ - about.html,\ - about.mappings,\ - about.properties,\ - icons/,\ - plugin.properties diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/component.xml b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/component.xml deleted file mode 100644 index a2db2d1b9b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/component.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<component xmlns="http://eclipse.org/wtp/releng/tools/component-model" name="org.eclipse.jpt.jaxb.eclipselink.branding"> -<description url=""></description> -<component-depends unrestricted="true"></component-depends> -<plugin id="org.eclipse.jpt.jaxb.eclipselink.branding" fragment="false"/> -<plugin id="org.eclipse.jpt.common.utility" fragment="false"/> -<plugin id="org.eclipse.jpt.common.core" fragment="false"/> -<plugin id="org.eclipse.jpt.common.eclipselink.core" fragment="false"/> -<plugin id="org.eclipse.jpt.common.ui" fragment="false"/> -<plugin id="org.eclipse.jpt.jaxb.eclipselink.core" fragment="false"/> -<plugin id="org.eclipse.jpt.jaxb.eclipselink.ui" fragment="false"/> -</component>
\ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/icons/WTP_icon_x32_v2.png b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/icons/WTP_icon_x32_v2.png Binary files differdeleted file mode 100644 index 6f09c2a700..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/icons/WTP_icon_x32_v2.png +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/plugin.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/plugin.properties deleted file mode 100644 index d3fad8a20b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# 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 -############################################################################### - -pluginName = Dali Java Persistence Tools - EclipseLink MOXy (JAXB) Support -providerName = Eclipse Web Tools Platform diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.classpath b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.classpath deleted file mode 100644 index 304e86186a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <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="output" path="bin"/> -</classpath> diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.cvsignore b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.cvsignore deleted file mode 100644 index ba077a4031..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.project b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.project deleted file mode 100644 index a482c34f48..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jpt.jaxb.eclipselink.core.schemagen</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/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.settings/org.eclipse.jdt.core.prefs b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 4204445996..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Tue Mar 08 12:07:53 EST 2011 -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.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -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/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/META-INF/MANIFEST.MF deleted file mode 100644 index 6094e17a01..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/META-INF/MANIFEST.MF +++ /dev/null @@ -1,12 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.jaxb.eclipselink.core.schemagen;singleton:=true -Bundle-Version: 1.1.0.qualifier -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Import-Package: javax.xml.bind, - org.eclipse.persistence.jaxb -Export-Package: org.eclipse.jpt.jaxb.eclipselink.core.schemagen, - org.eclipse.jpt.jaxb.eclipselink.core.schemagen.internal;x-internal:=true diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/about.html b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/about.html deleted file mode 100644 index 071f586b21..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/about.html +++ /dev/null @@ -1,47 +0,0 @@ -<!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"> - -<H2>About This Content</H2> - -<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> - -<h3>Third Party Content</h3> -<p>The Content includes items that have been sourced from third parties as set - out below. If you did not receive this Content directly from the Eclipse Foundation, - the following is provided for informational purposes only, and you should look - to the Redistributor’s license for terms and conditions of use.</p> - -<h4><a name="JPA" id="JPA"></a>Java Persistence API (JPA) v1.0</h4> - -<blockquote> - <p>The Java Persistence API (JPA) which is distributed under <a href="https://glassfish.dev.java.net/public/CDDLv1.0.html">CDDL - v1.0</a> is required by the Dali Java Persistence Tools Project in order - to support this standard.</p> -</blockquote> -</BODY> -</HTML> diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/build.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/build.properties deleted file mode 100644 index d535c6112b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/build.properties +++ /dev/null @@ -1,17 +0,0 @@ -############################################################################### -# Copyright (c) 2010, 2011 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 -############################################################################### -source.. = src/ -output.. = bin/ -bin.includes = .,\ - META-INF/,\ - about.html,\ - plugin.properties -jars.compile.order = . diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/plugin.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/plugin.properties deleted file mode 100644 index c05741163a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/plugin.properties +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2008 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 - EclipseLink JAXB Support - Schema Generation -providerName = Eclipse Web Tools Platform 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 deleted file mode 100644 index 0ae05f139f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/Main.java +++ /dev/null @@ -1,290 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 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 java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.xml.bind.JAXBException; -import javax.xml.bind.SchemaOutputResolver; -import javax.xml.transform.Result; -import javax.xml.transform.stream.StreamResult; - -import org.eclipse.jpt.jaxb.eclipselink.core.schemagen.internal.JptEclipseLinkJaxbCoreMessages; -import org.eclipse.jpt.jaxb.eclipselink.core.schemagen.internal.Tools; -import org.eclipse.persistence.jaxb.JAXBContext; -import org.eclipse.persistence.jaxb.JAXBContextFactory; - -/** - * Generate a EclipseLink JAXB Schema - * - * Current command-line arguments: - * [-s schema.xsd] - specifies the target schema - * [-c className] - specifies the fully qualified class name - */ -public class Main -{ - private String[] sourceClassNames; - private String targetSchemaName; - @SuppressWarnings("unused") - private boolean isDebugMode; - - static public String NO_FACTORY_CLASS = "doesnt contain ObjectFactory.class"; //$NON-NLS-1$ - static public String CANNOT_BE_CAST_TO_JAXBCONTEXT = "cannot be cast to org.eclipse.persistence.jaxb.JAXBContext"; //$NON-NLS-1$ - - // ********** static methods ********** - - public static void main(String[] args) { - new Main().execute(args); - } - - // ********** constructors ********** - - private Main() { - super(); - } - - // ********** behavior ********** - - protected void execute(String[] args) { - - this.initializeWith(args); - - this.generate(); - } - - // ********** internal methods ********** - - private void initializeWith(String[] args) { - this.sourceClassNames = this.getSourceClassNames(args); - this.targetSchemaName = this.getTargetSchemaName(args); - - this.isDebugMode = this.getDebugMode(args); - } - - private void generate() { - // Create the JAXBContext - JAXBContext jaxbContext = this.buildJaxbContext(); - - // Generate an XML Schema - if(jaxbContext != null) { - this.generateSchema(jaxbContext); - } - else { - Tools.bind(JptEclipseLinkJaxbCoreMessages.SCHEMA_NOT_CREATED, this.targetSchemaName); - } - } - - private JAXBContext buildJaxbContext() { - System.out.println(Tools.getString(JptEclipseLinkJaxbCoreMessages.LOADING_CLASSES)); - JAXBContext jaxbContext = null; - try { - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - - Class[] sourceClasses = this.buildSourceClasses(this.sourceClassNames, loader); - - //call MOXy JAXBContextFactory directly. This eliminates the need to have the JAXB properties file in place - //in time for the generation. - jaxbContext = (JAXBContext)JAXBContextFactory.createContext(sourceClasses, Collections.<String,Object>emptyMap()); - } - catch (JAXBException ex) { - this.handleJaxbException(ex); - } - catch (ClassCastException ex) { - this.handleClassCastException(ex); - } - return jaxbContext; - } - - private void generateSchema(JAXBContext jaxbContext) { - System.out.println(Tools.getString(JptEclipseLinkJaxbCoreMessages.GENERATING_SCHEMA)); - System.out.flush(); - - SchemaOutputResolver schemaOutputResolver = - new JptSchemaOutputResolver(this.targetSchemaName); - - try { - jaxbContext.generateSchema(schemaOutputResolver); - } - catch(Exception e) { - e.printStackTrace(); - } - } - - private Class[] buildSourceClasses(String[] classNames, ClassLoader loader) { - - ArrayList<Class> sourceClasses = new ArrayList<Class>(classNames.length); - for(String className: classNames) { - try { - sourceClasses.add(loader.loadClass(className)); - System.out.println(className); - } - catch (ClassNotFoundException e) { - System.err.println(Tools.bind(JptEclipseLinkJaxbCoreMessages.NOT_FOUND, className)); - } - } - System.out.flush(); - return sourceClasses.toArray(new Class[0]); - } - - private void handleJaxbException(JAXBException ex) { - String message = ex.getMessage(); - Throwable linkedEx = ex.getLinkedException(); - if(message != null && message.indexOf(NO_FACTORY_CLASS) > -1) { - System.err.println(message); - } - else if(linkedEx != null && linkedEx instanceof ClassNotFoundException) { - String errorMessage = Tools.bind( - JptEclipseLinkJaxbCoreMessages.CONTEXT_FACTORY_NOT_FOUND, linkedEx.getMessage()); - System.err.println(errorMessage); - } - else { - ex.printStackTrace(); - } - } - - private void handleClassCastException(ClassCastException ex) { - String message = ex.getMessage(); - if(message != null && message.indexOf(CANNOT_BE_CAST_TO_JAXBCONTEXT) > -1) { - System.err.println(Tools.getString(JptEclipseLinkJaxbCoreMessages.PROPERTIES_FILE_NOT_FOUND)); - } - else { - ex.printStackTrace(); - } - } - - // ********** argument queries ********** - - private String[] getSourceClassNames(String[] args) { - - return this.getAllArgumentValues("-c", args); //$NON-NLS-1$ - } - - private String getTargetSchemaName(String[] args) { - - return this.getArgumentValue("-s", args); //$NON-NLS-1$ - } - - private boolean getDebugMode(String[] args) { - - return this.argumentExists("-debug", args); //$NON-NLS-1$ - } - - // ********** private methods ********** - - private String getArgumentValue(String argName, String[] args) { - for (int i = 0; i < args.length; i++) { - String arg = args[i]; - if (arg.toLowerCase().equals(argName)) { - int j = i + 1; - if (j < args.length) { - return args[j]; - } - } - } - return null; - } - - private String[] getAllArgumentValues(String argName, String[] args) { - List<String> argValues = new ArrayList<String>(); - for (int i = 0; i < args.length; i++) { - String arg = args[i]; - if (arg.toLowerCase().equals(argName)) { - int j = i + 1; - if (j < args.length) { - argValues.add(args[j]); - i++; - } - } - } - return argValues.toArray(new String[0]); - } - - private boolean argumentExists(String argName, String[] args) { - for (int i = 0; i < args.length; i++) { - String arg = args[i]; - if (arg.toLowerCase().equals(argName)) { - return true; - } - } - return false; - } - -} - -// ********** inner class ********** - -class JptSchemaOutputResolver extends SchemaOutputResolver { - - private String defaultSchemaName; - - // ********** constructor ********** - - protected JptSchemaOutputResolver(String defaultSchemaName) { - this.defaultSchemaName = defaultSchemaName; - } - - // ********** overrides ********** - - @Override - public Result createOutput(String namespaceURI, String suggestedFileName) throws IOException { - - String filePath = (Tools.stringIsEmpty(namespaceURI)) ? - this.buildFileNameFrom(this.defaultSchemaName, suggestedFileName) : - this.modifyFileName(namespaceURI); - - File file = new File(filePath); - StreamResult result = new StreamResult(file); - result.setSystemId(file.toURI().toURL().toString()); - - System.out.print(Tools.bind(JptEclipseLinkJaxbCoreMessages.SCHEMA_GENERATED, file)); - return result; - } - - // ********** private methods ********** - - private String buildFileNameFrom(String fileName, String suggestedFileName) { - - fileName = Tools.stripExtension(fileName); - - if(Tools.stringIsEmpty(fileName)) { - return suggestedFileName; - } - String number = Tools.extractFileNumber(suggestedFileName); - - fileName = this.buildFileName(fileName, number); - return Tools.appendXsdExtension(fileName); - } - - private String buildFileName(String fileName, String number) { - - if(Tools.stringIsEmpty(number)) { - return fileName; - } - return (number.equals("0")) ? fileName : fileName + number; //$NON-NLS-1$ - } - - private String modifyFileName(String namespaceURI) throws IOException { - - String dir = Tools.extractDirectory(this.defaultSchemaName); - - String fileName = Tools.stripProtocol(namespaceURI); - fileName = fileName.replaceAll("/", "_"); //$NON-NLS-1$ - fileName = Tools.appendXsdExtension(fileName); - - String result = (Tools.stringIsEmpty(dir)) ? fileName : dir + File.separator + fileName; - - return result; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/JptEclipseLinkJaxbCoreMessages.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/JptEclipseLinkJaxbCoreMessages.java deleted file mode 100644 index 65a9e2eee8..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/JptEclipseLinkJaxbCoreMessages.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* -* 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.eclipselink.core.schemagen.internal; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/** - * Localized messages used by Dali EclipseLink JAXB core. - */ -public class JptEclipseLinkJaxbCoreMessages -{ - public static final String LOADING_CLASSES = "LOADING_CLASSES"; - public static final String GENERATING_SCHEMA = "GENERATING_SCHEMA"; - public static final String SCHEMA_GENERATED = "SCHEMA_GENERATED"; - public static final String SCHEMA_NOT_CREATED = "SCHEMA_NOT_CREATED"; - public static final String NOT_FOUND = "NOT_FOUND"; - public static final String CONTEXT_FACTORY_NOT_FOUND = "CONTEXT_FACTORY_NOT_FOUND"; - public static final String PROPERTIES_FILE_NOT_FOUND = "PROPERTIES_FILE_NOT_FOUND"; - - - private static final String BUNDLE_NAME = "org.eclipse.jpt.jaxb.eclipselink.core.schemagen.internal.jpt_eclipselink_jaxb_core"; //$NON-NLS-1$ - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); - - private JptEclipseLinkJaxbCoreMessages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } - catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -}
\ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/Tools.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/Tools.java deleted file mode 100644 index 5a32e4c09c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/Tools.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* -* 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.eclipselink.core.schemagen.internal; - -import java.io.File; -import java.text.MessageFormat; - -/** - * Tools - */ -public final class Tools -{ - /** default file name used by the schemagen */ - static public String GEN_DEFAULT_NAME = "schema"; //$NON-NLS-1$ - - /** empty string */ - public static final String EMPTY_STRING = ""; //$NON-NLS-1$ - - // ********** queries ********** - - /** - * Return whether the specified string is null, empty, or contains - * only whitespace characters. - */ - public static boolean stringIsEmpty(String string) { - if (string == null) { - return true; - } - int len = string.length(); - if (len == 0) { - return true; - } - return stringIsEmpty_(string.toCharArray(), len); - } - - private static boolean stringIsEmpty_(char[] s, int len) { - for (int i = len; i-- > 0; ) { - if ( ! Character.isWhitespace(s[i])) { - return false; - } - } - return true; - } - - // ********** short name manipulation ********** - - /** - * Strip the extension from the specified file name - * and return the result. If the file name has no - * extension, it is returned unchanged - * File#basePath() - */ - public static String stripExtension(String fileName) { - int index = fileName.lastIndexOf('.'); - if (index == -1) { - return fileName; - } - return fileName.substring(0, index); - } - - public static String stripProtocol(String uri) { - - return uri.replaceFirst("http://", EMPTY_STRING); - } - - - public static String appendXsdExtension(String name) { - - return name + ".xsd"; //$NON-NLS-1$ - } - - public static String extractFileNumber(String fileName) { - - String result = stripExtension(fileName); - if(Tools.stringIsEmpty(result)) { - return EMPTY_STRING; - } - return result.replaceFirst(GEN_DEFAULT_NAME, EMPTY_STRING); - } - - public static String extractDirectory(String path) { - if( ! path.contains(File.separator)) { - return EMPTY_STRING; - } - return path.substring(0, path.lastIndexOf(File.separator)); - } - - // ********** NLS utilities ********** - - public static String getString(String key) { - return JptEclipseLinkJaxbCoreMessages.getString(key); - } - - public static String bind(String key, Object argument) { - return MessageFormat.format(getString(key), argument); - } -} 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 deleted file mode 100644 index a9f76617fa..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/jpt_eclipselink_jaxb_core.properties +++ /dev/null @@ -1,21 +0,0 @@ -################################################################################ -# 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 -################################################################################ - -LOADING_CLASSES = loading... -GENERATING_SCHEMA = \nMOXy generating schema... -SCHEMA_GENERATED = \nSchema {0} generated -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\ -javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory -CONTEXT_FACTORY_NOT_FOUND = \nThe JAXBContextFactory {0} \n\ -specified in the jaxb.properties file could not be located on the project classpath. \n\ -The JAXB provider that defines this factory should be added to the project classpath, \n\ -or the jaxb.properties file should be removed to use the default provider. diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/.classpath b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/.classpath deleted file mode 100644 index 0232fe5ec9..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/.classpath +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="src" path="property_files"/> - <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"> - <accessrules> - <accessrule kind="accessible" pattern="org/eclipse/jpt/jaxb/core/**"/> - <accessrule kind="accessible" pattern="org/eclipse/jpt/common/core/**"/> - <accessrule kind="accessible" pattern="org/eclipse/jpt/common/utility/**"/> - <accessrule kind="accessible" pattern="org/eclipse/wst/**"/> - </accessrules> - </classpathentry> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/.cvsignore b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/.cvsignore deleted file mode 100644 index ba077a4031..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/.project b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/.project deleted file mode 100644 index d899a36e49..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jpt.jaxb.eclipselink.core</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/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/.settings/org.eclipse.jdt.core.prefs b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 30eb0fcac5..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Tue Mar 08 12:07:45 EST 2011 -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.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -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/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/META-INF/MANIFEST.MF deleted file mode 100644 index b34828cc73..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/META-INF/MANIFEST.MF +++ /dev/null @@ -1,31 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.jaxb.eclipselink.core;singleton:=true -Bundle-Version: 1.1.0.qualifier -Bundle-Activator: org.eclipse.jpt.jaxb.eclipselink.core.JptJaxbEclipseLinkCorePlugin -Bundle-ActivationPolicy: lazy -Bundle-ClassPath: . -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: org.eclipse.core.resources;bundle-version="[3.7.100,4.0.0)", - org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)", - org.eclipse.jdt.core;bundle-version="[3.7.0,4.0.0)", - org.eclipse.jpt.common.core;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jpt.common.eclipselink.core;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)", - org.eclipse.jpt.jaxb.core;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jst.common.project.facet.core;bundle-version="[1.4.200,2.0.0)", - org.eclipse.jst.j2ee;bundle-version="[1.1.500,2.0.0)", - org.eclipse.wst.validation;bundle-version="[1.2.300,2.0.0)" -Export-Package: org.eclipse.jpt.jaxb.eclipselink.core, - org.eclipse.jpt.jaxb.eclipselink.core.internal.context, - org.eclipse.jpt.jaxb.eclipselink.core.internal.libval;x-internal:=true, - org.eclipse.jpt.jaxb.eclipselink.core.internal.resource.java.binary, - org.eclipse.jpt.jaxb.eclipselink.core.internal.resource.java.source, - org.eclipse.jpt.jaxb.eclipselink.core.internal.v2_1;x-internal:=true, - org.eclipse.jpt.jaxb.eclipselink.core.internal.v2_2;x-internal:=true, - org.eclipse.jpt.jaxb.eclipselink.core.internal.v2_3;x-internal:=true, - org.eclipse.jpt.jaxb.eclipselink.core.internal.validation, - org.eclipse.jpt.jaxb.eclipselink.core.resource.java diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/about.html b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/about.html deleted file mode 100644 index be534ba44f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/about.html +++ /dev/null @@ -1,34 +0,0 @@ -<!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/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/build.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/build.properties deleted file mode 100644 index b7fe1216e1..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/build.properties +++ /dev/null @@ -1,18 +0,0 @@ -################################################################################ -# Copyright (c) 2011 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 -################################################################################ -source.. = src/,\ - property_files/ -output.. = bin/ -bin.includes = .,\ - META-INF/,\ - about.html,\ - plugin.xml,\ - plugin.properties -jars.compile.order = . diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/plugin.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/plugin.properties deleted file mode 100644 index 98d631a019..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/plugin.properties +++ /dev/null @@ -1,28 +0,0 @@ -################################################################################ -# Copyright (c) 2011 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 - EclipseLink JAXB Support - Core -providerName = Eclipse Web Tools Platform - -ECLIPSELINK_PLATFORM_GROUP_LABEL = EclipseLink -ECLIPSELINK_2_1_PLATFORM_LABEL = EclipseLink 2.1.x -ECLIPSELINK_2_2_PLATFORM_LABEL = EclipseLink 2.2.x -ECLIPSELINK_2_3_PLATFORM_LABEL = EclipseLink 2.3.x diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/plugin.xml b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/plugin.xml deleted file mode 100644 index 43993445b9..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/plugin.xml +++ /dev/null @@ -1,69 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.2"?> -<!-- - Copyright (c) 2011 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 - --> - -<plugin> - - <extension - point="org.eclipse.jpt.jaxb.core.jaxbPlatforms"> - - <jaxbPlatformGroup - id="eclipselink" - label="%ECLIPSELINK_PLATFORM_GROUP_LABEL"/> - - <jaxbPlatform - id="eclipselink_2_1" - label="%ECLIPSELINK_2_1_PLATFORM_LABEL" - factoryClass="org.eclipse.jpt.jaxb.eclipselink.core.internal.v2_1.ELJaxb_2_1_PlatformDefinitionFactory" - group="eclipselink" - jaxbFacetVersion="2.1" - default="false"/> - - <jaxbPlatform - id="eclipselink_2_2" - label="%ECLIPSELINK_2_2_PLATFORM_LABEL" - factoryClass="org.eclipse.jpt.jaxb.eclipselink.core.internal.v2_2.ELJaxb_2_2_PlatformDefinitionFactory" - group="eclipselink" - jaxbFacetVersion="2.2" - default="false"/> - - <jaxbPlatform - id="eclipselink_2_3" - label="%ECLIPSELINK_2_3_PLATFORM_LABEL" - factoryClass="org.eclipse.jpt.jaxb.eclipselink.core.internal.v2_3.ELJaxb_2_3_PlatformDefinitionFactory" - group="eclipselink" - jaxbFacetVersion="2.2" - default="false"/> - - </extension> - - - <extension - point="org.eclipse.jpt.common.core.libraryValidators"> - - <libraryValidator - id="eclipselinkUserLibraryValidator" - class="org.eclipse.jpt.jaxb.eclipselink.core.internal.libval.ELJaxbUserLibraryValidator"> - <enablement> - <and> - <with variable="libraryProvider"> - <test property="org.eclipse.jpt.common.core.extendsId" value="jaxb-user-library-provider"/> - </with> - <with variable="config"> - <test property="org.eclipse.jpt.jaxb.core.jaxbPlatformGroup" value="eclipselink"/> - </with> - </and> - </enablement> - </libraryValidator> - - </extension> - -</plugin> diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/property_files/el_jaxb_validation.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/property_files/el_jaxb_validation.properties deleted file mode 100644 index cd71550835..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/property_files/el_jaxb_validation.properties +++ /dev/null @@ -1,11 +0,0 @@ -############################################################################### -# Copyright (c) 2011 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 -############################################################################### - -PROJECT_MISSING_ECLIPSELINK_JAXB_CONTEXT_FACTORY = Project is missing a jaxb.properties file specifying the EclipseLink JAXB context factory
\ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/ELJaxbMappingKeys.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/ELJaxbMappingKeys.java deleted file mode 100644 index d42f183721..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/ELJaxbMappingKeys.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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; - -/** - * 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. - * - * @version 3.0 - * @since 3.0 - */ -public interface ELJaxbMappingKeys { - - String XML_INVERSE_REFERENCE_ATTRIBUTE_MAPPING_KEY = "xml-inverse-reference"; - String XML_TRANSFORMATION_ATTRIBUTE_MAPPING_KEY = "xml-transformation"; -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/ELJaxbPlatform.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/ELJaxbPlatform.java deleted file mode 100644 index b37ded3cc6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/ELJaxbPlatform.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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; - -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformGroupDescription; - - -public class ELJaxbPlatform { - - public static final JaxbPlatformGroupDescription GROUP - = JptJaxbCorePlugin.getJaxbPlatformManager().getJaxbPlatformGroup("eclipselink"); //$NON-NLS-1$ - - public static final JaxbPlatformDescription VERSION_2_1 - = JptJaxbCorePlugin.getJaxbPlatformManager().getJaxbPlatform("eclipselink_2_1"); //$NON-NLS-1$ - - public static final JaxbPlatformDescription VERSION_2_2 - = JptJaxbCorePlugin.getJaxbPlatformManager().getJaxbPlatform("eclipselink_2_2"); //$NON-NLS-1$ - - public static final JaxbPlatformDescription VERSION_2_3 - = JptJaxbCorePlugin.getJaxbPlatformManager().getJaxbPlatform("eclipselink_2_3"); //$NON-NLS-1$ - - - /** - * Not for instantiation - */ - private ELJaxbPlatform() {} -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/JptJaxbEclipseLinkCorePlugin.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/JptJaxbEclipseLinkCorePlugin.java deleted file mode 100644 index e69681806f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/JptJaxbEclipseLinkCorePlugin.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Status; -import org.osgi.framework.BundleContext; - -public class JptJaxbEclipseLinkCorePlugin - extends Plugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.jpt.jaxb.eclipselink.core"; //$NON-NLS-1$ - - - // ********** singleton ********** - private static JptJaxbEclipseLinkCorePlugin INSTANCE; - - /** - * Return the singleton JPT EclipseLink plug-in. - */ - public static JptJaxbEclipseLinkCorePlugin instance() { - return INSTANCE; - } - - /** - * Log the specified status. - */ - public static void log(IStatus status) { - INSTANCE.getLog().log(status); - } - - /** - * Log the specified message. - */ - public static void log(String msg) { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null)); - } - - /** - * Log the specified exception or error. - */ - public static void log(Throwable throwable) { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, throwable.getLocalizedMessage(), throwable)); - } - - - // ********** plug-in implementation ********** - - public JptJaxbEclipseLinkCorePlugin() { - super(); - } - - @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/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/AbstractELJaxbPlatformDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/AbstractELJaxbPlatformDefinition.java deleted file mode 100644 index 965951125e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/AbstractELJaxbPlatformDefinition.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.internal; - -import org.eclipse.jpt.jaxb.core.internal.AbstractJaxbPlatformDefinition; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinition; - - -public abstract class AbstractELJaxbPlatformDefinition - extends AbstractJaxbPlatformDefinition { - - protected AbstractELJaxbPlatformDefinition() { - super(); - } - - - protected abstract JaxbPlatformDefinition getGenericJaxbPlatformDefinition(); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/ELJaxbContextRoot.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/ELJaxbContextRoot.java deleted file mode 100644 index b162386a60..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/ELJaxbContextRoot.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.internal.context; - -import java.util.List; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.context.JaxbPackage; -import org.eclipse.jpt.jaxb.core.internal.context.AbstractJaxbContextRoot; -import org.eclipse.jpt.jaxb.core.resource.jaxbprops.JaxbPropertiesResource; -import org.eclipse.jpt.jaxb.eclipselink.core.internal.validation.ELJaxbValidationMessageBuilder; -import org.eclipse.jpt.jaxb.eclipselink.core.internal.validation.ELJaxbValidationMessages; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - - -public class ELJaxbContextRoot - extends AbstractJaxbContextRoot { - - - public ELJaxbContextRoot(JaxbProject jaxbProject) { - super(jaxbProject); - } - - - // **************** validation ******************************************** - - @Override - public void validate(List<IMessage> messages, IReporter reporter) { - super.validate(messages, reporter); - - validateJaxbProperties(messages, reporter); - } - - protected void validateJaxbProperties(List<IMessage> messages, IReporter reporter) { - String factoryProp = "javax.xml.bind.context.factory"; - String factoryPropValue = "org.eclipse.persistence.jaxb.JAXBContextFactory"; - - for (JaxbPackage jp : getPackages()) { - String pn = jp.getName(); - JaxbPropertiesResource jpr = getJaxbProject().getJaxbPropertiesResource(pn); - if (jpr != null && StringTools.stringsAreEqual(jpr.getProperty(factoryProp), factoryPropValue)) { - return; - } - } - - messages.add( - ELJaxbValidationMessageBuilder.buildMessage( - IMessage.HIGH_SEVERITY, - ELJaxbValidationMessages.PROJECT_MISSING_ECLIPSELINK_JAXB_CONTEXT_FACTORY, - getJaxbProject())); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlInverseReferenceMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlInverseReferenceMapping.java deleted file mode 100644 index 3683391644..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlInverseReferenceMapping.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.internal.context.java; - -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.internal.context.java.AbstractJavaAttributeMapping; -import org.eclipse.jpt.jaxb.eclipselink.core.ELJaxbMappingKeys; -import org.eclipse.jpt.jaxb.eclipselink.core.resource.java.ELJaxb; -import org.eclipse.jpt.jaxb.eclipselink.core.resource.java.XmlInverseReferenceAnnotation; - - -public class ELJavaXmlInverseReferenceMapping - extends AbstractJavaAttributeMapping<XmlInverseReferenceAnnotation> { - - public ELJavaXmlInverseReferenceMapping(JaxbPersistentAttribute parent) { - super(parent); - } - - - public String getKey() { - return ELJaxbMappingKeys.XML_INVERSE_REFERENCE_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return ELJaxb.XML_INVERSE_REFERENCE; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlInverseReferenceMappingDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlInverseReferenceMappingDefinition.java deleted file mode 100644 index a62e305ea0..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlInverseReferenceMappingDefinition.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.eclipse.jpt.jaxb.eclipselink.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jaxb.core.JaxbFactory; -import org.eclipse.jpt.jaxb.core.context.JaxbAttributeMapping; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jaxb.core.internal.context.java.AbstractJavaAttributeMappingDefinition; -import org.eclipse.jpt.jaxb.eclipselink.core.ELJaxbMappingKeys; -import org.eclipse.jpt.jaxb.eclipselink.core.resource.java.ELJaxb; - - -public class ELJavaXmlInverseReferenceMappingDefinition - extends AbstractJavaAttributeMappingDefinition { - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new ELJavaXmlInverseReferenceMappingDefinition(); - - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private ELJavaXmlInverseReferenceMappingDefinition() { - super(); - } - - - public String getKey() { - return ELJaxbMappingKeys.XML_INVERSE_REFERENCE_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return ELJaxb.XML_INVERSE_REFERENCE; - } - - public Iterable<String> getSupportingAnnotationNames() { - return EmptyIterable.instance(); - } - - public JaxbAttributeMapping buildMapping(JaxbPersistentAttribute parent, JaxbFactory factory) { - // TODO: move to factory once API opens up again - return new ELJavaXmlInverseReferenceMapping(parent); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlTransformationMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlTransformationMapping.java deleted file mode 100644 index 036908cb6c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlTransformationMapping.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.internal.context.java; - -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.internal.context.java.AbstractJavaAttributeMapping; -import org.eclipse.jpt.jaxb.eclipselink.core.ELJaxbMappingKeys; -import org.eclipse.jpt.jaxb.eclipselink.core.resource.java.ELJaxb; -import org.eclipse.jpt.jaxb.eclipselink.core.resource.java.XmlTransformationAnnotation; - - -public class ELJavaXmlTransformationMapping - extends AbstractJavaAttributeMapping<XmlTransformationAnnotation> { - - public ELJavaXmlTransformationMapping(JaxbPersistentAttribute parent) { - super(parent); - } - - - public String getKey() { - return ELJaxbMappingKeys.XML_TRANSFORMATION_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return ELJaxb.XML_TRANSFORMATION; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlTransformationMappingDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlTransformationMappingDefinition.java deleted file mode 100644 index 852c0810d0..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/context/java/ELJavaXmlTransformationMappingDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jaxb.core.JaxbFactory; -import org.eclipse.jpt.jaxb.core.context.JaxbAttributeMapping; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jaxb.core.internal.context.java.AbstractJavaAttributeMappingDefinition; -import org.eclipse.jpt.jaxb.eclipselink.core.ELJaxbMappingKeys; -import org.eclipse.jpt.jaxb.eclipselink.core.resource.java.ELJaxb; - - -public class ELJavaXmlTransformationMappingDefinition - extends AbstractJavaAttributeMappingDefinition { - - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new ELJavaXmlTransformationMappingDefinition(); - - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private ELJavaXmlTransformationMappingDefinition() { - super(); - } - - - public String getKey() { - return ELJaxbMappingKeys.XML_TRANSFORMATION_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return ELJaxb.XML_TRANSFORMATION; - } - - public Iterable<String> getSupportingAnnotationNames() { - return EmptyIterable.instance(); - } - - public JaxbAttributeMapping buildMapping(JaxbPersistentAttribute parent, JaxbFactory factory) { - // TODO: move to factory once API opens up again - return new ELJavaXmlTransformationMapping(parent); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/libval/ELJaxbUserLibraryValidator.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/libval/ELJaxbUserLibraryValidator.java deleted file mode 100644 index a927430df8..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/libval/ELJaxbUserLibraryValidator.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.internal.libval; - -import java.util.HashSet; -import java.util.Set; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jpt.common.core.internal.libval.LibValUtil; -import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.common.core.libval.LibraryValidator; -import org.eclipse.jpt.common.eclipselink.core.internal.JptCommonEclipseLinkCoreMessages; -import org.eclipse.jpt.common.eclipselink.core.internal.libval.EclipseLinkLibValUtil; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.internal.libprov.JaxbUserLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.eclipselink.core.ELJaxbPlatform; -import org.eclipse.osgi.service.resolver.VersionRange; - - -/** - * Library validator for EclipseLink JAXB user libraries. - * - * In order to validate that the correct eclipselink.jar is present in the user library, the version - * class which appears in standard EclipseLink libraries will be examined and compared against the - * union of calculated version ranges, depending on the platform specified in the config. - */ -public class ELJaxbUserLibraryValidator - implements LibraryValidator { - - public IStatus validate(JptLibraryProviderInstallOperationConfig config) { - JaxbUserLibraryProviderInstallOperationConfig jaxbConfig - = (JaxbUserLibraryProviderInstallOperationConfig) config; - JaxbPlatformDescription platform = jaxbConfig.getJaxbPlatform(); - Set<VersionRange> versionRanges = new HashSet<VersionRange>(); - - if (ELJaxbPlatform.VERSION_2_1.equals(platform)) { - versionRanges.add(new VersionRange("[2.1, 3.0)")); //$NON-NLS-1$ - } - else if (ELJaxbPlatform.VERSION_2_2.equals(platform)) { - versionRanges.add(new VersionRange("[2.2, 3.0)")); //$NON-NLS-1$ - } - else if (ELJaxbPlatform.VERSION_2_3.equals(platform)) { - versionRanges.add(new VersionRange("[2.3, 3.0)")); //$NON-NLS-1$ - } - - IStatus status = EclipseLinkLibValUtil.validate(jaxbConfig.resolve(), versionRanges); - - if (! status.isOK()) { - return status; - } - - // finally look for xjc classes - - Set<String> classNames = new HashSet<String>(); - - classNames.add("com.sun.tools.xjc.XJCFacade"); //$NON-NLS-1$ - classNames.add("com.sun.xml.bind.Util"); //$NON-NLS-1$ - - Iterable<IPath> libraryPaths = - new TransformationIterable<IClasspathEntry, IPath>(jaxbConfig.resolve()) { - @Override - protected IPath transform(IClasspathEntry o) { - return o.getPath(); - } - }; - - status = LibValUtil.validate(libraryPaths, classNames); - - if (! status.isOK()) { - return new Status(IStatus.WARNING, JptJaxbCorePlugin.PLUGIN_ID, JptCommonEclipseLinkCoreMessages.ELJaxbUserLibraryValidator_noXjcClasses); - } - - return Status.OK_STATUS; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/XmlInverseReferenceAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/XmlInverseReferenceAnnotationDefinition.java deleted file mode 100644 index 305d19ea16..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/XmlInverseReferenceAnnotationDefinition.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jaxb.eclipselink.core.internal.resource.java.binary.BinaryXmlInverseReferenceAnnotation; -import org.eclipse.jpt.jaxb.eclipselink.core.internal.resource.java.source.SourceXmlInverseReferenceAnnotation; -import org.eclipse.jpt.jaxb.eclipselink.core.resource.java.ELJaxb; - - -public class XmlInverseReferenceAnnotationDefinition - implements AnnotationDefinition { - - // singleton - private static final AnnotationDefinition INSTANCE = new XmlInverseReferenceAnnotationDefinition(); - - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - - /** - * Ensure single instance. - */ - private XmlInverseReferenceAnnotationDefinition() { - super(); - } - - - public String getAnnotationName() { - return ELJaxb.XML_INVERSE_REFERENCE; - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlInverseReferenceAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlInverseReferenceAnnotation(parent, jdtAnnotation); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/XmlTransformationAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/XmlTransformationAnnotationDefinition.java deleted file mode 100644 index a8e219f317..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/XmlTransformationAnnotationDefinition.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jaxb.eclipselink.core.internal.resource.java.binary.BinaryXmlTransformationAnnotation; -import org.eclipse.jpt.jaxb.eclipselink.core.internal.resource.java.source.SourceXmlTransformationAnnotation; -import org.eclipse.jpt.jaxb.eclipselink.core.resource.java.ELJaxb; - - -public class XmlTransformationAnnotationDefinition - implements AnnotationDefinition { - - // singleton - private static final AnnotationDefinition INSTANCE = new XmlTransformationAnnotationDefinition(); - - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - - /** - * Ensure single instance. - */ - private XmlTransformationAnnotationDefinition() { - super(); - } - - - public String getAnnotationName() { - return ELJaxb.XML_TRANSFORMATION; - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlTransformationAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlTransformationAnnotation(parent, jdtAnnotation); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlInverseReferenceAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlInverseReferenceAnnotation.java deleted file mode 100644 index b92cc05254..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlInverseReferenceAnnotation.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.eclipselink.core.resource.java.ELJaxb; -import org.eclipse.jpt.jaxb.eclipselink.core.resource.java.XmlInverseReferenceAnnotation; - - -public class BinaryXmlInverseReferenceAnnotation - extends BinaryAnnotation - implements XmlInverseReferenceAnnotation { - - private String mappedBy; - - - public BinaryXmlInverseReferenceAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.mappedBy = buildMappedBy(); - } - - - public String getAnnotationName() { - return ELJaxb.XML_INVERSE_REFERENCE; - } - - @Override - public void update() { - super.update(); - setMappedBy_(buildMappedBy()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.mappedBy); - } - - - // ***** mappedBy - - public String getMappedBy() { - return this.mappedBy; - } - - public void setMappedBy(String mappedBy) { - throw new UnsupportedOperationException(); - } - - private void setMappedBy_(String mappedBy) { - String old = this.mappedBy; - this.mappedBy = mappedBy; - this.firePropertyChanged(MAPPED_BY_PROPERTY, old, mappedBy); - } - - private String buildMappedBy() { - return (String) this.getJdtMemberValue(ELJaxb.XML_INVERSE_REFERENCE__MAPPED_BY); - } - - public TextRange getMappedByTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlTransformationAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlTransformationAnnotation.java deleted file mode 100644 index 7b9d0e60f4..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/binary/BinaryXmlTransformationAnnotation.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.eclipselink.core.resource.java.ELJaxb; -import org.eclipse.jpt.jaxb.eclipselink.core.resource.java.XmlTransformationAnnotation; - - -public class BinaryXmlTransformationAnnotation - extends BinaryAnnotation - implements XmlTransformationAnnotation { - - private Boolean optional; - - - public BinaryXmlTransformationAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.optional = buildOptional(); - } - - - public String getAnnotationName() { - return ELJaxb.XML_TRANSFORMATION; - } - - @Override - public void update() { - super.update(); - setOptional_(buildOptional()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.optional); - } - - - // ***** optional - - public Boolean getOptional() { - return this.optional; - } - - public void setOptional(Boolean optional) { - throw new UnsupportedOperationException(); - } - - private void setOptional_(Boolean optional) { - Boolean old = this.optional; - this.optional = optional; - this.firePropertyChanged(OPTIONAL_PROPERTY, old, optional); - } - - private Boolean buildOptional() { - return (Boolean) this.getJdtMemberValue(ELJaxb.XML_TRANSFORMATION__OPTIONAL); - } - - public TextRange getOptionalTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlInverseReferenceAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlInverseReferenceAnnotation.java deleted file mode 100644 index 35f34eaacb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlInverseReferenceAnnotation.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.StringExpressionConverter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jaxb.eclipselink.core.resource.java.ELJaxb; -import org.eclipse.jpt.jaxb.eclipselink.core.resource.java.XmlInverseReferenceAnnotation; - - -public class SourceXmlInverseReferenceAnnotation - extends SourceAnnotation - implements XmlInverseReferenceAnnotation { - - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ELJaxb.XML_INVERSE_REFERENCE); - - private final DeclarationAnnotationElementAdapter<String> mappedByDeclarationAdapter; - private final AnnotationElementAdapter<String> mappedByAdapter; - private String mappedBy; - - - public SourceXmlInverseReferenceAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { - this(parent, element, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(element, DECLARATION_ANNOTATION_ADAPTER)); - } - - public SourceXmlInverseReferenceAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { - super(parent, element, daa, annotationAdapter); - this.mappedByDeclarationAdapter = buildMappedByDeclarationAdapter(daa); - this.mappedByAdapter = buildMappedByAdapter(this.mappedByDeclarationAdapter); - } - - - private DeclarationAnnotationElementAdapter<String> buildMappedByDeclarationAdapter(DeclarationAnnotationAdapter daa) { - return new ConversionDeclarationAnnotationElementAdapter<String>(daa, ELJaxb.XML_INVERSE_REFERENCE__MAPPED_BY, StringExpressionConverter.instance()); - } - - private AnnotationElementAdapter<String> buildMappedByAdapter(DeclarationAnnotationElementAdapter<String> daea) { - return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ELJaxb.XML_INVERSE_REFERENCE; - } - - public void initialize(CompilationUnit astRoot) { - this.mappedBy = buildMappedBy(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncMappedBy(buildMappedBy(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.mappedBy); - } - - - // ********** mappedBy - - public String getMappedBy() { - return this.mappedBy; - } - - public void setMappedBy(String mappedBy) { - if (attributeValueHasChanged(this.mappedBy, mappedBy)) { - this.mappedBy = mappedBy; - this.mappedByAdapter.setValue(mappedBy); - } - } - - private void syncMappedBy(String astMappedBy) { - String old = this.mappedBy; - this.mappedBy = astMappedBy; - this.firePropertyChanged(MAPPED_BY_PROPERTY, old, this.mappedBy); - } - - private String buildMappedBy(CompilationUnit astRoot) { - return this.mappedByAdapter.getValue(astRoot); - } - - public TextRange getMappedByTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.mappedByDeclarationAdapter, astRoot); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlTransformationAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlTransformationAnnotation.java deleted file mode 100644 index 3cdb791d02..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/resource/java/source/SourceXmlTransformationAnnotation.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jaxb.eclipselink.core.resource.java.ELJaxb; -import org.eclipse.jpt.jaxb.eclipselink.core.resource.java.XmlTransformationAnnotation; - - -public class SourceXmlTransformationAnnotation - extends SourceAnnotation - implements XmlTransformationAnnotation { - - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ELJaxb.XML_TRANSFORMATION); - - private final DeclarationAnnotationElementAdapter<Boolean> optionalDeclarationAdapter; - private final AnnotationElementAdapter<Boolean> optionalAdapter; - private Boolean optional; - - - public SourceXmlTransformationAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) { - this(parent, element, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(element, DECLARATION_ANNOTATION_ADAPTER)); - } - - public SourceXmlTransformationAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { - super(parent, element, daa, annotationAdapter); - this.optionalDeclarationAdapter = buildOptionalDeclarationAdapter(daa); - this.optionalAdapter = buildShortCircuitBooleanElementAdapter(this.optionalDeclarationAdapter); - } - - - private DeclarationAnnotationElementAdapter<Boolean> buildOptionalDeclarationAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, ELJaxb.XML_TRANSFORMATION__OPTIONAL); - } - - private AnnotationElementAdapter<Boolean> buildShortCircuitBooleanElementAdapter(DeclarationAnnotationElementAdapter<Boolean> daea) { - return new AnnotatedElementAnnotationElementAdapter<Boolean>(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ELJaxb.XML_TRANSFORMATION; - } - - public void initialize(CompilationUnit astRoot) { - this.optional = buildOptional(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncOptional(buildOptional(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.optional); - } - - - // ********** optional - - public Boolean getOptional() { - return this.optional; - } - - public void setOptional(Boolean optional) { - if (attributeValueHasChanged(this.optional, optional)) { - this.optional = optional; - this.optionalAdapter.setValue(optional); - } - } - - private void syncOptional(Boolean astOptional) { - Boolean old = this.optional; - this.optional = astOptional; - this.firePropertyChanged(OPTIONAL_PROPERTY, old, this.optional); - } - - private Boolean buildOptional(CompilationUnit astRoot) { - return this.optionalAdapter.getValue(astRoot); - } - - public TextRange getOptionalTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.optionalDeclarationAdapter, astRoot); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/v2_1/ELJaxb_2_1_Factory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/v2_1/ELJaxb_2_1_Factory.java deleted file mode 100644 index ec3de10173..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/v2_1/ELJaxb_2_1_Factory.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.internal.v2_1; - -import org.eclipse.jpt.jaxb.core.JaxbFactory; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.internal.AbstractJaxbFactory; -import org.eclipse.jpt.jaxb.eclipselink.core.internal.context.ELJaxbContextRoot; - - -public class ELJaxb_2_1_Factory - extends AbstractJaxbFactory { - - // singleton - private static final JaxbFactory INSTANCE = new ELJaxb_2_1_Factory(); - - - /** - * Return the singleton. - */ - public static JaxbFactory instance() { - return INSTANCE; - } - - - /** - * Ensure single instance. - */ - private ELJaxb_2_1_Factory() { - super(); - } - - - @Override - public JaxbContextRoot buildContextRoot(JaxbProject parent) { - return new ELJaxbContextRoot(parent); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/v2_1/ELJaxb_2_1_PlatformDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/v2_1/ELJaxb_2_1_PlatformDefinition.java deleted file mode 100644 index e0edbf94ba..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/v2_1/ELJaxb_2_1_PlatformDefinition.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.internal.v2_1; - -import java.util.ArrayList; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jaxb.core.JaxbFactory; -import org.eclipse.jpt.jaxb.core.JaxbResourceModelProvider; -import org.eclipse.jpt.jaxb.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jaxb.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jaxb.core.internal.jaxb21.GenericJaxb_2_1_PlatformDefinition; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinition; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.eclipselink.core.ELJaxbPlatform; -import org.eclipse.jpt.jaxb.eclipselink.core.internal.AbstractELJaxbPlatformDefinition; -import org.eclipse.jpt.jaxb.eclipselink.core.internal.context.java.ELJavaXmlInverseReferenceMappingDefinition; -import org.eclipse.jpt.jaxb.eclipselink.core.internal.resource.java.XmlInverseReferenceAnnotationDefinition; -import org.eclipse.jpt.jaxb.eclipselink.core.internal.resource.java.XmlTransformationAnnotationDefinition; - - -public class ELJaxb_2_1_PlatformDefinition - extends AbstractELJaxbPlatformDefinition { - - // singleton - private static final JaxbPlatformDefinition INSTANCE = new ELJaxb_2_1_PlatformDefinition(); - - /** - * Return the singleton. - */ - public static JaxbPlatformDefinition instance() { - return INSTANCE; - } - - - protected ELJaxb_2_1_PlatformDefinition() { - super(); - } - - - @Override - protected JaxbPlatformDefinition getGenericJaxbPlatformDefinition() { - return GenericJaxb_2_1_PlatformDefinition.instance(); - } - - public JaxbPlatformDescription getDescription() { - return ELJaxbPlatform.VERSION_2_1; - } - - public JaxbFactory getFactory() { - return ELJaxb_2_1_Factory.instance(); - } - - @Override - protected JaxbResourceModelProvider[] buildResourceModelProviders() { - return ArrayTools.array( - getGenericJaxbPlatformDefinition().getResourceModelProviders(), - new JaxbResourceModelProvider[0]); - - } - - public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) { - return getGenericJaxbPlatformDefinition().getMostRecentSupportedResourceType(contentType); - } - - @Override - protected AnnotationDefinition[] buildAnnotationDefinitions() { - return ArrayTools.addAll( - getGenericJaxbPlatformDefinition().getAnnotationDefinitions(), - XmlInverseReferenceAnnotationDefinition.instance(), - XmlTransformationAnnotationDefinition.instance()); - } - - @Override - protected NestableAnnotationDefinition[] buildNestableAnnotationDefinitions() { - return getGenericJaxbPlatformDefinition().getNestableAnnotationDefinitions(); - } - - @Override - protected void addDefaultJavaAttributeMappingDefinitionsTo( - ArrayList<DefaultJavaAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, getGenericJaxbPlatformDefinition().getDefaultJavaAttributeMappingDefinitions()); - } - - @Override - protected void addSpecifiedJavaAttributeMappingDefinitionsTo( - ArrayList<JavaAttributeMappingDefinition> definitions) { - CollectionTools.addAll(definitions, getGenericJaxbPlatformDefinition().getSpecifiedJavaAttributeMappingDefinitions()); - CollectionTools.addAll(definitions, ELJavaXmlInverseReferenceMappingDefinition.instance()); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/v2_1/ELJaxb_2_1_PlatformDefinitionFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/v2_1/ELJaxb_2_1_PlatformDefinitionFactory.java deleted file mode 100644 index 61bc504659..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/v2_1/ELJaxb_2_1_PlatformDefinitionFactory.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.internal.v2_1; - -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinition; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinitionFactory; - - -public class ELJaxb_2_1_PlatformDefinitionFactory - implements JaxbPlatformDefinitionFactory { - - public JaxbPlatformDefinition buildJaxbPlatformDefinition() { - return ELJaxb_2_1_PlatformDefinition.instance(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/v2_2/ELJaxb_2_2_PlatformDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/v2_2/ELJaxb_2_2_PlatformDefinition.java deleted file mode 100644 index 16d15f20fc..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/v2_2/ELJaxb_2_2_PlatformDefinition.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.internal.v2_2; - -import java.util.ArrayList; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jaxb.core.JaxbFactory; -import org.eclipse.jpt.jaxb.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jaxb.core.internal.jaxb22.GenericJaxb_2_2_PlatformDefinition; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinition; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.eclipselink.core.ELJaxbPlatform; -import org.eclipse.jpt.jaxb.eclipselink.core.internal.context.java.ELJavaXmlTransformationMappingDefinition; -import org.eclipse.jpt.jaxb.eclipselink.core.internal.v2_1.ELJaxb_2_1_Factory; -import org.eclipse.jpt.jaxb.eclipselink.core.internal.v2_1.ELJaxb_2_1_PlatformDefinition; - - -public class ELJaxb_2_2_PlatformDefinition - extends ELJaxb_2_1_PlatformDefinition { - - // singleton - private static final JaxbPlatformDefinition INSTANCE = new ELJaxb_2_2_PlatformDefinition(); - - - /** - * Return the singleton. - */ - public static JaxbPlatformDefinition instance() { - return INSTANCE; - } - - - protected ELJaxb_2_2_PlatformDefinition() { - super(); - } - - - @Override - public JaxbPlatformDescription getDescription() { - return ELJaxbPlatform.VERSION_2_2; - } - - @Override - public JaxbFactory getFactory() { - return ELJaxb_2_1_Factory.instance(); - } - - @Override - protected JaxbPlatformDefinition getGenericJaxbPlatformDefinition() { - return GenericJaxb_2_2_PlatformDefinition.instance(); - } - - @Override - protected void addSpecifiedJavaAttributeMappingDefinitionsTo( - ArrayList<JavaAttributeMappingDefinition> definitions) { - super.addSpecifiedJavaAttributeMappingDefinitionsTo(definitions); - CollectionTools.addAll(definitions, ELJavaXmlTransformationMappingDefinition.instance()); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/v2_2/ELJaxb_2_2_PlatformDefinitionFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/v2_2/ELJaxb_2_2_PlatformDefinitionFactory.java deleted file mode 100644 index d1844d766b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/v2_2/ELJaxb_2_2_PlatformDefinitionFactory.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.internal.v2_2; - -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinition; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinitionFactory; - - -public class ELJaxb_2_2_PlatformDefinitionFactory - implements JaxbPlatformDefinitionFactory { - - public JaxbPlatformDefinition buildJaxbPlatformDefinition() { - return ELJaxb_2_2_PlatformDefinition.instance(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/v2_3/ELJaxb_2_3_PlatformDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/v2_3/ELJaxb_2_3_PlatformDefinition.java deleted file mode 100644 index 1a9faca9c5..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/v2_3/ELJaxb_2_3_PlatformDefinition.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.internal.v2_3; - -import org.eclipse.jpt.jaxb.core.JaxbFactory; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinition; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.eclipselink.core.ELJaxbPlatform; -import org.eclipse.jpt.jaxb.eclipselink.core.internal.v2_1.ELJaxb_2_1_Factory; -import org.eclipse.jpt.jaxb.eclipselink.core.internal.v2_2.ELJaxb_2_2_PlatformDefinition; - - -public class ELJaxb_2_3_PlatformDefinition - extends ELJaxb_2_2_PlatformDefinition { - - // singleton - private static final JaxbPlatformDefinition INSTANCE = new ELJaxb_2_3_PlatformDefinition(); - - /** - * Return the singleton. - */ - public static JaxbPlatformDefinition instance() { - return INSTANCE; - } - - - protected ELJaxb_2_3_PlatformDefinition() { - super(); - } - - - @Override - public JaxbPlatformDescription getDescription() { - return ELJaxbPlatform.VERSION_2_3; - } - - @Override - public JaxbFactory getFactory() { - return ELJaxb_2_1_Factory.instance(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/v2_3/ELJaxb_2_3_PlatformDefinitionFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/v2_3/ELJaxb_2_3_PlatformDefinitionFactory.java deleted file mode 100644 index 9dfc64c4e1..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/v2_3/ELJaxb_2_3_PlatformDefinitionFactory.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.internal.v2_3; - -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinition; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinitionFactory; - - -public class ELJaxb_2_3_PlatformDefinitionFactory - implements JaxbPlatformDefinitionFactory { - - public JaxbPlatformDefinition buildJaxbPlatformDefinition() { - return ELJaxb_2_3_PlatformDefinition.instance(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/validation/ELJaxbValidationMessageBuilder.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/validation/ELJaxbValidationMessageBuilder.java deleted file mode 100644 index 839c0fb38b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/validation/ELJaxbValidationMessageBuilder.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.internal.validation; - -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.eclipselink.core.JptJaxbEclipseLinkCorePlugin; -import org.eclipse.wst.validation.internal.core.Message; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class ELJaxbValidationMessageBuilder { - - private static String[] DEFAULT_PARMS = new String[0]; - private static TextRange DEFAULT_TEXT_RANGE = TextRange.Empty.instance(); - - public static IMessage buildMessage( - int severity, String messageId, Object targetObject) { - return buildMessage(severity, messageId, DEFAULT_PARMS, targetObject); - } - - public static IMessage buildMessage( - int severity, String messageId, String[] parms, Object targetObject) { - return buildMessage(severity, messageId, parms, targetObject, DEFAULT_TEXT_RANGE); - } - - public static IMessage buildMessage( - int severity, String messageId, Object targetObject, TextRange textRange) { - return buildMessage(severity, messageId, DEFAULT_PARMS, targetObject, textRange); - } - - public static IMessage buildMessage( - int severity, String messageId, String[] parms, Object targetObject, TextRange textRange) { - IMessage message = new ELJaxbValidationMessage(ELJaxbValidationMessages.BUNDLE_NAME, severity, messageId, parms, targetObject); - message.setMarkerId(JptJaxbCorePlugin.VALIDATION_MARKER_ID); //TODO do we need an 'EclipseLink' problem marker? - if (textRange == null) { - //log an exception and then continue without setting location information - //At least the user will still get the validation message and will - //be able to see other validation messages with valid textRanges - JptJaxbEclipseLinkCorePlugin.log(new IllegalArgumentException("Null text range for message ID: " + messageId)); //$NON-NLS-1$ - } - else { - message.setLineNo(textRange.getLineNumber()); - message.setOffset(textRange.getOffset()); - message.setLength(textRange.getLength()); - } - return message; - } - - - private ELJaxbValidationMessageBuilder() { - super(); - throw new UnsupportedOperationException(); - } - - /** - * Used so that we can find the resource bundle using this classLoader. - * Otherwise the wst validation message attempts to use the ClassLoader - * of the generic jaxb validator which is in the org.eclipse.jpt.jaxb.core plugin. - */ - private static class ELJaxbValidationMessage - extends Message { - - public ELJaxbValidationMessage(String aBundleName, int aSeverity, String anId, String[] aParams, Object aTargetObject) { - super(aBundleName, aSeverity, anId, aParams, aTargetObject); - } - - @Override - public ResourceBundle getBundle(Locale locale, ClassLoader classLoader) { - ResourceBundle bundle = null; - try { - bundle = ResourceBundle.getBundle(getBundleName(), locale, getClass().getClassLoader()); - } catch (MissingResourceException e) { - return super.getBundle(locale, classLoader); - } - return bundle; - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/validation/ELJaxbValidationMessages.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/validation/ELJaxbValidationMessages.java deleted file mode 100644 index 51a0d4addc..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/validation/ELJaxbValidationMessages.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.internal.validation; - -@SuppressWarnings("nls") -public interface ELJaxbValidationMessages { - - // bundle name - String BUNDLE_NAME = "el_jaxb_validation"; - - - // validation on project - String PROJECT_MISSING_ECLIPSELINK_JAXB_CONTEXT_FACTORY = "PROJECT_MISSING_ECLIPSELINK_JAXB_CONTEXT_FACTORY"; -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/ELJaxb.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/ELJaxb.java deleted file mode 100644 index 74b85352aa..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/ELJaxb.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.resource.java; - -/** - * EclipseLink JAXB Java-related stuff (annotations etc.) - * <p> - * 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. - * - * @version 3.0 - * @since 3.0 - */ -@SuppressWarnings("nls") -public interface ELJaxb { - - // EclipseLink annotations package - - String PACKAGE = "org.eclipse.persistence.oxm.annotations"; - String PACKAGE_ = PACKAGE + '.'; - - - // Annotations - - String XML_INVERSE_REFERENCE = PACKAGE_ + "XmlInverseReference"; - String XML_INVERSE_REFERENCE__MAPPED_BY = "mappedBy"; - - String XML_TRANSFORMATION = PACKAGE_ + "XmlTransformation"; - String XML_TRANSFORMATION__OPTIONAL = "optional"; -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlInverseReferenceAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlInverseReferenceAnnotation.java deleted file mode 100644 index a53de2e2cb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlInverseReferenceAnnotation.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.utility.TextRange; - - -public interface XmlInverseReferenceAnnotation - extends Annotation { - - /** - * String associated with change events to the 'mappedBy' property - */ - String MAPPED_BY_PROPERTY = "mappedBy"; //$NON-NLS-1$ - - /** - * Corresponds to the 'mappedBy' element of the XmlInverseReference annotation. - * Return null if the element does not exist in Java. - */ - String getMappedBy(); - - /** - * Corresponds to the 'mappedBy' element of the XmlInverseReference annotation. - * Set to null to remove the element. - */ - void setMappedBy(String mappedBy); - - /** - * Return the text range associated with the 'mappedBy' element. - * Return the text range of this annotation if the element is absent. - */ - TextRange getMappedByTextRange(CompilationUnit astRoot); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlTransformationAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlTransformationAnnotation.java deleted file mode 100644 index df7071765e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/resource/java/XmlTransformationAnnotation.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.resource.java.Annotation; -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Corresponds to the EclipseLink annotation - * org.eclipse.persistence.oxm.annotations.XmlTransformation - * - * 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. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlTransformationAnnotation - extends Annotation { - - /** - * String associated with change events to the 'optional' property - */ - String OPTIONAL_PROPERTY = "optional"; //$NON-NLS-1$ - - /** - * Corresponds to the 'optional' element of the XmlTransformation annotation. - * Return null if the element does not exist in Java. - */ - Boolean getOptional(); - - /** - * Corresponds to the 'optional' element of the XmlTransformation annotation. - * Set to null to remove the element. - */ - void setOptional(Boolean optional); - - /** - * Return the text range associated with the 'optional' element. - * Return the text range of this annotation if the element is absent. - */ - TextRange getOptionalTextRange(CompilationUnit astRoot); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/.classpath b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/.classpath deleted file mode 100644 index 783ee1e9ed..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/.classpath +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <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"> - <accessrules> - <accessrule kind="accessible" pattern="org/eclipse/jpt/jaxb/ui/**"/> - <accessrule kind="accessible" pattern="org/eclipse/jpt/common/ui/**"/> - <accessrule kind="accessible" pattern="org/eclipse/jpt/common/utility/**"/> - </accessrules> - </classpathentry> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/.cvsignore b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/.cvsignore deleted file mode 100644 index ba077a4031..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/.project b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/.project deleted file mode 100644 index d5a24d6f79..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.jpt.jaxb.eclipselink.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/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/.settings/org.eclipse.jdt.core.prefs b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index ca38fa9a1c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Tue Mar 08 12:08:04 EST 2011 -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.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -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/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/META-INF/MANIFEST.MF deleted file mode 100644 index 37a68afd9f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/META-INF/MANIFEST.MF +++ /dev/null @@ -1,25 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.jaxb.eclipselink.ui;singleton:=true -Bundle-Version: 1.1.0.qualifier -Bundle-Activator: org.eclipse.jpt.jaxb.eclipselink.ui.JptJaxbEclipseLinkUiPlugin -Bundle-ActivationPolicy: lazy -Bundle-ClassPath: . -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)", - org.eclipse.jface;bundle-version="[3.7.0,4.0.0)", - org.eclipse.jpt.common.core;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jpt.common.ui;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)", - org.eclipse.jpt.jaxb.core;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jpt.jaxb.eclipselink.core;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jpt.jaxb.ui;bundle-version="[1.1.0,2.0.0)", - org.eclipse.swt;bundle-version="[3.7.0,4.0.0)", - org.eclipse.ui.workbench;bundle-version="[3.7.0,4.0.0)" -Export-Package: org.eclipse.jpt.jaxb.eclipselink.ui, - org.eclipse.jpt.jaxb.eclipselink.ui.internal.v2_1;x-internal:=true, - org.eclipse.jpt.jaxb.eclipselink.ui.internal.v2_2;x-internal:=true, - org.eclipse.jpt.jaxb.eclipselink.ui.internal.v2_3;x-internal:=true diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/about.html b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/about.html deleted file mode 100644 index be534ba44f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/about.html +++ /dev/null @@ -1,34 +0,0 @@ -<!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/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/build.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/build.properties deleted file mode 100644 index 08bc038360..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/build.properties +++ /dev/null @@ -1,18 +0,0 @@ -################################################################################ -# Copyright (c) 2011 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 -################################################################################ -source.. = src/ -output.. = bin/ -bin.includes = .,\ - META-INF/,\ - about.html,\ - icons/,\ - plugin.xml,\ - plugin.properties -jars.compile.order = . diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/icons/full/obj16/xml-inverse-reference.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/icons/full/obj16/xml-inverse-reference.gif Binary files differdeleted file mode 100644 index ce55b84284..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/icons/full/obj16/xml-inverse-reference.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/icons/full/obj16/xml-transformation.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/icons/full/obj16/xml-transformation.gif Binary files differdeleted file mode 100644 index fecf9e54c3..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/icons/full/obj16/xml-transformation.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/plugin.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/plugin.properties deleted file mode 100644 index 0720b7bd33..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/plugin.properties +++ /dev/null @@ -1,23 +0,0 @@ -############################################################################### -# Copyright (c) 2011 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 - EclipseLink MOXy Support - UI -providerName=Eclipse Web Tools Platform diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/plugin.xml b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/plugin.xml deleted file mode 100644 index e833f512f0..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/plugin.xml +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.2"?> -<!-- - Copyright (c) 2007, 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 - --> - -<plugin> - - <extension - point="org.eclipse.jpt.jaxb.ui.jaxbPlatformUis"> - - <jaxbPlatformUi - id="eclipselink_2_1.ui" - jaxbPlatform="eclipselink_2_1" - class="org.eclipse.jpt.jaxb.eclipselink.ui.internal.v2_1.ELJaxb_2_1_PlatformUi"/> - - <jaxbPlatformUi - id="eclipselink_2_2.ui" - jaxbPlatform="eclipselink_2_2" - class="org.eclipse.jpt.jaxb.eclipselink.ui.internal.v2_2.ELJaxb_2_2_PlatformUi"/> - - <jaxbPlatformUi - id="eclipselink_2_3.ui" - jaxbPlatform="eclipselink_2_3" - class="org.eclipse.jpt.jaxb.eclipselink.ui.internal.v2_3.ELJaxb_2_3_PlatformUi"/> - - </extension> - -</plugin> diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/Activator.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/Activator.java deleted file mode 100644 index 39e81583dd..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/Activator.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.eclipse.jpt.jaxb.eclipselink.ui; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; - -public class Activator implements BundleActivator { - - private static BundleContext context; - - static BundleContext getContext() { - return context; - } - - /* - * (non-Javadoc) - * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext bundleContext) throws Exception { - Activator.context = bundleContext; - } - - /* - * (non-Javadoc) - * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext bundleContext) throws Exception { - Activator.context = null; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/JptJaxbEclipseLinkUiPlugin.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/JptJaxbEclipseLinkUiPlugin.java deleted file mode 100644 index 23b5d76ee8..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/JptJaxbEclipseLinkUiPlugin.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.ui; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.plugin.AbstractUIPlugin; - -/** - * 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. - */ -@SuppressWarnings("nls") -public class JptJaxbEclipseLinkUiPlugin - extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.jpt.jaxb.eclipselink.ui"; - - - // ********** singleton ********** - - private static JptJaxbEclipseLinkUiPlugin INSTANCE; - - /** - * Returns the singleton Plugin - */ - public static JptJaxbEclipseLinkUiPlugin instance() { - return INSTANCE; - } - - - // ********** error logging ********** - - 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 - */ - //TODO we are using the ImageRegistry here and storing all our icons for the life of the plugin, - //which means until the workspace is closed. This is better than before where we constantly - //created new images. Bug 306437 is about cleaning this up and using Local Resource Managers - //on our views so that closing the JPA perspective would mean our icons are disposed. - public static Image getImage(String key) { - ImageRegistry imageRegistry = instance().getImageRegistry(); - Image image = imageRegistry.get(key); - if (image == null) { - imageRegistry.put(key, getImageDescriptor(key)); - image = imageRegistry.get(key); - } - return image; - } - - - // ********** constructors ********** - - public JptJaxbEclipseLinkUiPlugin() { - super(); - if (INSTANCE != null) { - throw new IllegalStateException(); - } - INSTANCE = this; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbMappingImageHelper.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbMappingImageHelper.java deleted file mode 100644 index 91fa343855..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbMappingImageHelper.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.ui.internal; - -import org.eclipse.jpt.jaxb.eclipselink.core.ELJaxbMappingKeys; -import org.eclipse.jpt.jaxb.eclipselink.ui.JptJaxbEclipseLinkUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JaxbMappingImageHelper; -import org.eclipse.swt.graphics.Image; - - -public class ELJaxbMappingImageHelper { - - public static Image imageForAttributeMapping(String mappingKey) { - String iconKey = iconKeyForAttributeMapping(mappingKey); - return (iconKey == null) ? - JaxbMappingImageHelper.imageForAttributeMapping(mappingKey) - : JptJaxbEclipseLinkUiPlugin.getImage(iconKey); - } - - public static String iconKeyForAttributeMapping(String mappingKey) { - if (ELJaxbMappingKeys.XML_INVERSE_REFERENCE_ATTRIBUTE_MAPPING_KEY == mappingKey) { - return JptJaxbEclipseLinkUiIcons.XML_INVERSE_REFERENCE; - } - else if (ELJaxbMappingKeys.XML_TRANSFORMATION_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) { - return JptJaxbEclipseLinkUiIcons.XML_TRANSFORMATION; - } - - return null; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbNavigatorItemLabelProviderFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbNavigatorItemLabelProviderFactory.java deleted file mode 100644 index 547c390161..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbNavigatorItemLabelProviderFactory.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.ui.internal; - -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.ui.jface.ItemLabelProvider; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.ui.internal.jaxb21.GenericJaxb_2_1_NavigatorItemLabelProviderFactory; - - -public class ELJaxbNavigatorItemLabelProviderFactory - extends GenericJaxb_2_1_NavigatorItemLabelProviderFactory { - - private static ELJaxbNavigatorItemLabelProviderFactory INSTANCE = new ELJaxbNavigatorItemLabelProviderFactory(); - - - public static GenericJaxb_2_1_NavigatorItemLabelProviderFactory instance() { - return INSTANCE; - } - - - private ELJaxbNavigatorItemLabelProviderFactory() { - super(); - } - - - @Override - public ItemLabelProvider buildItemLabelProvider( - Object item, - DelegatingContentAndLabelProvider contentAndLabelProvider) { - - if (item instanceof JaxbPersistentAttribute) { - return new ELJaxbPersistentAttributeItemLabelProvider((JaxbPersistentAttribute) item, contentAndLabelProvider); - } - - return super.buildItemLabelProvider(item, contentAndLabelProvider); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbNavigatorUi.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbNavigatorUi.java deleted file mode 100644 index e8a1573b48..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbNavigatorUi.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.ui.internal; - -import org.eclipse.jpt.common.ui.jface.ItemLabelProviderFactory; -import org.eclipse.jpt.jaxb.ui.internal.jaxb21.GenericJaxb_2_1_NavigatorUi; - - -public class ELJaxbNavigatorUi - extends GenericJaxb_2_1_NavigatorUi { - - private static ELJaxbNavigatorUi INSTANCE = new ELJaxbNavigatorUi(); - - - public static ELJaxbNavigatorUi instance() { - return INSTANCE; - } - - - private ELJaxbNavigatorUi() { - super(); - } - - - @Override - public ItemLabelProviderFactory getItemLabelProviderFactory() { - return ELJaxbNavigatorItemLabelProviderFactory.instance(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbPersistentAttributeItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbPersistentAttributeItemLabelProvider.java deleted file mode 100644 index 00999326b7..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbPersistentAttributeItemLabelProvider.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.ui.internal; - -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.ui.internal.jaxb21.JaxbPersistentAttributeItemLabelProvider; -import org.eclipse.swt.graphics.Image; - - -public class ELJaxbPersistentAttributeItemLabelProvider - extends JaxbPersistentAttributeItemLabelProvider { - - public ELJaxbPersistentAttributeItemLabelProvider( - JaxbPersistentAttribute attribute, DelegatingContentAndLabelProvider labelProvider) { - super(attribute, labelProvider); - } - - - @Override - protected PropertyValueModel<Image> buildImageModel() { - - return new PropertyAspectAdapter<JaxbPersistentAttribute, Image>( - new String[] {JaxbPersistentAttribute.DEFAULT_MAPPING_KEY_PROPERTY, JaxbPersistentAttribute.MAPPING_PROPERTY}, - getModel()) { - - @Override - protected Image buildValue_() { - return ELJaxbMappingImageHelper.imageForAttributeMapping(this.subject.getMappingKey()); - } - }; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/JptJaxbEclipseLinkUiIcons.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/JptJaxbEclipseLinkUiIcons.java deleted file mode 100644 index 148333842e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/JptJaxbEclipseLinkUiIcons.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.ui.internal; - - -public class JptJaxbEclipseLinkUiIcons { - - public static final String XML_INVERSE_REFERENCE = "full/obj16/xml-inverse-reference"; - public static final String XML_TRANSFORMATION = "full/obj16/xml-transformation"; -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/v2_1/ELJaxb_2_1_PlatformUi.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/v2_1/ELJaxb_2_1_PlatformUi.java deleted file mode 100644 index cdaa30c23f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/v2_1/ELJaxb_2_1_PlatformUi.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.ui.internal.v2_1; - -import org.eclipse.jpt.jaxb.ui.internal.jaxb21.GenericJaxb_2_1_NavigatorUi; -import org.eclipse.jpt.jaxb.ui.navigator.JaxbNavigatorUi; -import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi; - - -public class ELJaxb_2_1_PlatformUi - implements JaxbPlatformUi { - - public JaxbNavigatorUi getNavigatorUi() { - return GenericJaxb_2_1_NavigatorUi.instance(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/v2_2/ELJaxb_2_2_PlatformUi.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/v2_2/ELJaxb_2_2_PlatformUi.java deleted file mode 100644 index 2737982fd4..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/v2_2/ELJaxb_2_2_PlatformUi.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.ui.internal.v2_2; - -import org.eclipse.jpt.jaxb.eclipselink.ui.internal.ELJaxbNavigatorUi; -import org.eclipse.jpt.jaxb.ui.navigator.JaxbNavigatorUi; -import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi; - - -public class ELJaxb_2_2_PlatformUi - implements JaxbPlatformUi { - - public JaxbNavigatorUi getNavigatorUi() { - return ELJaxbNavigatorUi.instance(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/v2_3/ELJaxb_2_3_PlatformUi.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/v2_3/ELJaxb_2_3_PlatformUi.java deleted file mode 100644 index dbc9c4f31e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/v2_3/ELJaxb_2_3_PlatformUi.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.ui.internal.v2_3; - -import org.eclipse.jpt.jaxb.eclipselink.ui.internal.ELJaxbNavigatorUi; -import org.eclipse.jpt.jaxb.ui.navigator.JaxbNavigatorUi; -import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi; - - -public class ELJaxb_2_3_PlatformUi - implements JaxbPlatformUi { - - public JaxbNavigatorUi getNavigatorUi() { - return ELJaxbNavigatorUi.instance(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.classpath b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.classpath deleted file mode 100644 index 934fb38085..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.classpath +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="src" path="property_files"/> - <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"> - <accessrules> - <accessrule kind="accessible" pattern="org/eclipse/jst/**"/> - <accessrule kind="accessible" pattern="org/eclipse/wst/**"/> - </accessrules> - </classpathentry> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.cvsignore b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.cvsignore deleted file mode 100644 index ba077a4031..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.project b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.project deleted file mode 100644 index 67371280df..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?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/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.settings/org.eclipse.jdt.core.prefs b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 38cf57c08a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Tue Mar 08 12:08:10 EST 2011 -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.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -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/jaxb/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF deleted file mode 100644 index bc7feec391..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF +++ /dev/null @@ -1,51 +0,0 @@ -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.2.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.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.jdt.ui;bundle-version="[3.4.0,4.0.0)", - org.eclipse.jface.text;bundle-version="[3.7.0,4.0.0)", - org.eclipse.jpt.common.core;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jpt.common.ui;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)", - org.eclipse.jpt.jaxb.core;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jst.common.project.facet.core;bundle-version="[1.4.200,2.0.0)", - org.eclipse.jst.common.project.facet.ui;bundle-version="[1.4.200,2.0.0)", - org.eclipse.ui.ide;bundle-version="[3.4.0,4.0.0)", - org.eclipse.ui.navigator;bundle-version="[3.5.0,4.0.0)", - org.eclipse.wst.common.frameworks.ui;bundle-version="[1.2.0,2.0.0)", - org.eclipse.wst.common.modulecore;bundle-version="[1.2.100,2.0.0)", - org.eclipse.wst.common.project.facet.ui;bundle-version="[1.4.200,2.0.0)", - org.eclipse.wst.common.ui;bundle-version="[1.1.500,2.0.0)", - org.eclipse.wst.common.uriresolver;bundle-version="[1.1.401,2.0.0)", - org.eclipse.wst.web.ui;bundle-version="[1.1.400,2.0.0)", - org.eclipse.wst.xml.core;bundle-version="[1.1.500,2.0.0)", - org.eclipse.wst.xsd.core;bundle-version="[1.1.600,2.0.0)", - org.eclipse.xsd;bundle-version="[2.6.0,3.0.0)" -Export-Package: org.eclipse.jpt.jaxb.ui, - 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.filters;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.jaxb21;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.jaxb22;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.navigator;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.platform;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.properties;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.wizards;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.wizards.facet;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.wizards.proj;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.wizards.proj.model;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.wizards.schemagen;x-internal:=true, - org.eclipse.jpt.jaxb.ui.navigator, - org.eclipse.jpt.jaxb.ui.platform -Import-Package: com.ibm.icu.text;version="4.0.1" diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/about.html b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/about.html deleted file mode 100644 index be534ba44f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/about.html +++ /dev/null @@ -1,34 +0,0 @@ -<!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/jaxb/plugins/org.eclipse.jpt.jaxb.ui/build.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/build.properties deleted file mode 100644 index 0a95eca8b7..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/build.properties +++ /dev/null @@ -1,21 +0,0 @@ -################################################################################ -# Copyright (c) 2010, 2011 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 -################################################################################ -source.. = src/,\ - property_files/ -output.. = bin/ -bin.includes = .,\ - META-INF/,\ - about.html,\ - icons/,\ - plugin.xml,\ - plugin.properties -jars.compile.order = . -src.includes = schema/ -
\ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/component.xml b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/component.xml deleted file mode 100644 index 04957fe9b2..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/component.xml +++ /dev/null @@ -1 +0,0 @@ -<?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/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/NewXSD.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/NewXSD.gif Binary files differdeleted file mode 100644 index b6efdd3d86..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/NewXSD.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/jaxb_facet.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/jaxb_facet.gif Binary files differdeleted file mode 100644 index e75a17c2d0..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/jaxb_facet.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/new_jaxb_project_wiz.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/new_jaxb_project_wiz.gif Binary files differdeleted file mode 100644 index b547717598..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/new_jaxb_project_wiz.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/newclass_wiz.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/newclass_wiz.gif Binary files differdeleted file mode 100644 index a1c6545cd6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/newclass_wiz.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/XSDFile.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/XSDFile.gif Binary files differdeleted file mode 100644 index cc0eeb7196..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/XSDFile.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/dtdfile.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/dtdfile.gif Binary files differdeleted file mode 100644 index 3c0acadd2d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/dtdfile.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/enum_constant.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/enum_constant.gif Binary files differdeleted file mode 100644 index d4cb4254d9..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/enum_constant.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/jaxb_content.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/jaxb_content.gif Binary files differdeleted file mode 100644 index e75a17c2d0..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/jaxb_content.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/null-attribute-mapping.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/null-attribute-mapping.gif Binary files differdeleted file mode 100644 index 70a9c23541..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/null-attribute-mapping.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/package.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/package.gif Binary files differdeleted file mode 100644 index 6989b8df73..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/package.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_class.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_class.gif Binary files differdeleted file mode 100644 index baac236770..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_class.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_enum.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_enum.gif Binary files differdeleted file mode 100644 index c73ed28e70..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_enum.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_field.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_field.gif Binary files differdeleted file mode 100644 index d4cb4254d9..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_field.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_property.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_property.gif Binary files differdeleted file mode 100644 index 7d24707ee8..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_property.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/registry.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/registry.gif Binary files differdeleted file mode 100644 index 719e6057b3..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/registry.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/text.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/text.gif Binary files differdeleted file mode 100644 index efa7a38014..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/text.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/transient_class.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/transient_class.gif Binary files differdeleted file mode 100644 index 066461be61..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/transient_class.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-any-attribute.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-any-attribute.gif Binary files differdeleted file mode 100644 index a5d9fb0dd6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-any-attribute.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-any-element.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-any-element.gif Binary files differdeleted file mode 100644 index f73d02bf43..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-any-element.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-attribute.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-attribute.gif Binary files differdeleted file mode 100644 index 851ee72391..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-attribute.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-element-ref.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-element-ref.gif Binary files differdeleted file mode 100644 index 3220052c41..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-element-ref.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-element-refs.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-element-refs.gif Binary files differdeleted file mode 100644 index 77e4d6a8bd..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-element-refs.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-element.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-element.gif Binary files differdeleted file mode 100644 index 8c953dc928..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-element.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-elements.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-elements.gif Binary files differdeleted file mode 100644 index cb6aad6b16..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-elements.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-transient.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-transient.gif Binary files differdeleted file mode 100644 index 3fd90cf828..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-transient.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-value.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-value.gif Binary files differdeleted file mode 100644 index 7145d6de8e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-value.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/ovr16/error_ovr.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/ovr16/error_ovr.gif Binary files differdeleted file mode 100644 index 119dcccd5a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/ovr16/error_ovr.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/NewXSD.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/NewXSD.gif Binary files differdeleted file mode 100644 index 390f48216a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/NewXSD.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/new_jaxb_prj_wiz.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/new_jaxb_prj_wiz.gif Binary files differdeleted file mode 100644 index d1873a1a51..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/new_jaxb_prj_wiz.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/newclass_wiz.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/newclass_wiz.gif Binary files differdeleted file mode 100644 index 0ac0ee8635..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/newclass_wiz.gif +++ /dev/null diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.properties deleted file mode 100644 index 704b484070..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.properties +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################### -# Copyright (c) 2010, 2011 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 UI -providerName=Eclipse Web Tools Platform - -jaxbPlatformUi = JAXB Platform UI - -jaxbWizardCategoryName = JAXB - -generateSchemaFromClassesName = Schema from JAXB Classes -generateSchemaFromClassesDesc = Generate a Schema from JAXB classes - -generateClassesFromSchemaName = JAXB Classes from Schema -generateClassesFromSchemaDesc = Generate JAXB Classes from a Schema - -newJaxbProjectWizardName = JAXB Project -newJaxbProjectWizardDesc = Create a JAXB project - -jaxbCompletionProposals = JAXB Proposals -jaxbCompletionProposalComputer = JAXB Proposal Computer - -jaxbNavigatorContent=JAXB Content -generateJaxbClasses = JAXB Classes... - -jaxbNode = JAXB -jaxbSchemas = Schemas diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.xml b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.xml deleted file mode 100644 index 65970846fd..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.xml +++ /dev/null @@ -1,301 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.2"?>
<!-- - Copyright (c) 2010, 2011 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 - --> - -<plugin> - - <extension-point - id="jaxbPlatformUis" - name="%jaxbPlatformUi" - schema="schema/jaxbPlatformUis.exsd"/> - - - <extension - point="org.eclipse.ui.newWizards"> - - <category - id="org.eclipse.jpt.jaxb" - name="%jaxbWizardCategoryName"/> - - <wizard - id="org.eclipse.jpt.jaxb.ui.wizard.generateSchemaFromClasses" - name="%generateSchemaFromClassesName" - category="org.eclipse.jpt.jaxb" - class="org.eclipse.jpt.jaxb.ui.internal.wizards.schemagen.SchemaGeneratorWizard" - icon="icons/full/etool16/NewXSD.gif"> - <description>%generateSchemaFromClassesDesc</description> - <selection class="org.eclipse.core.resources.IResource"/> - </wizard> - - <wizard - id="org.eclipse.jpt.jaxb.ui.wizard.generateJAXBClasses" - name="%generateClassesFromSchemaName" - category="org.eclipse.jpt.jaxb" - class="org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen.ClassesGeneratorWizard" - icon="icons/full/etool16/newclass_wiz.gif"> - <description>%generateClassesFromSchemaDesc</description> - </wizard> - - <!-- will need to specify a final perspective once we have a jaxb perspective --> - <wizard - id="org.eclipse.jpt.jaxb.ui.wizard.newJaxbProject" - name="%newJaxbProjectWizardName" - icon="icons/full/etool16/new_jaxb_project_wiz.gif" - category="org.eclipse.jpt.jaxb" - project="true"> - <description>%newJaxbProjectWizardDesc</description> - <class class="org.eclipse.jpt.jaxb.ui.internal.wizards.proj.JaxbProjectWizard"> - <parameter name="menuIndex" value="35"/> - </class> - </wizard> - - </extension> - - - <extension - point="org.eclipse.jdt.ui.javaCompletionProposalComputer" - id="jaxbCompletionProposals" - name="%jaxbCompletionProposals"> - - <proposalCategory icon="icons/full/etool16/jaxb_facet.gif"/> - - </extension> - - - <extension - point="org.eclipse.jdt.ui.javaCompletionProposalComputer" - id="jaxbCompletionProposalComputer" - name="%jaxbCompletionProposalComputer"> - - <javaCompletionProposalComputer - class="org.eclipse.jpt.jaxb.ui.internal.JaxbJavaCompletionProposalComputer" - categoryId="org.eclipse.jpt.jaxb.ui.jaxbCompletionProposals" - activate="true"> - <partition type="__dftl_partition_content_type"/> - <partition type="__java_string"/> - </javaCompletionProposalComputer> - - </extension> - - - <extension - point="org.eclipse.jpt.jaxb.ui.jaxbPlatformUis"> - - <jaxbPlatformUi - id="generic_2_1.ui" - jaxbPlatform="generic_2_1" - class="org.eclipse.jpt.jaxb.ui.internal.jaxb21.GenericJaxb_2_1_PlatformUi"/> - - <jaxbPlatformUi - id="generic_2_2.ui" - jaxbPlatform="generic_2_2" - class="org.eclipse.jpt.jaxb.ui.internal.jaxb22.GenericJaxb_2_2_PlatformUi"/> - - </extension> - - - <extension - point="org.eclipse.jst.common.project.facet.ui.libraryProviderActionPanels"> - - <panel - provider="jaxb-jre-library-provider" - class="org.eclipse.jst.common.project.facet.ui.libprov.SimpleMessageLibraryProviderInstallPanel"/> - - </extension> - - - <extension - point="org.eclipse.ui.navigator.navigatorContent"> - - <navigatorContent - id="org.eclipse.jpt.jaxb.ui.jaxbNavigatorContent" - name="%jaxbNavigatorContent" - priority="higher" - appearsBefore="org.eclipse.jst.servlet.ui.EnhancedJavaRendering" - icon="icons/full/obj16/jaxb_content.gif" - activeByDefault="true" - contentProvider="org.eclipse.jpt.jaxb.ui.internal.navigator.JaxbNavigatorContentProvider" - labelProvider="org.eclipse.jpt.jaxb.ui.internal.navigator.JaxbNavigatorLabelProvider"> - - <triggerPoints> - <or> - <instanceof - value="org.eclipse.jpt.jaxb.core.context.JaxbContextNode"/> - <and> - <adapt type="org.eclipse.core.resources.IProject"> - <test - forcePluginActivation="true" - property="org.eclipse.wst.common.project.facet.core.projectFacet" - value="jpt.jaxb" /> - </adapt> - </and> - </or> - </triggerPoints>x - - <possibleChildren> - <instanceof - value="org.eclipse.jpt.jaxb.core.context.JaxbContextNode"/> - </possibleChildren> - - <actionProvider - class="org.eclipse.jpt.jaxb.ui.internal.navigator.JaxbNavigatorActionProvider" - id="org.eclipse.jpt.jaxb.ui.jaxbActionProvider"> - <enablement> - <and> - <instanceof - value="org.eclipse.jpt.jaxb.core.context.JaxbContextNode"/> - </and> - </enablement> - </actionProvider> - - <!-- - <commonSorter - id="org.eclipse.jst.j2ee.navigator.internal.J2EEViewerSorter" - class="org.eclipse.jst.j2ee.navigator.internal.J2EEViewerSorter" /> - --> - - </navigatorContent> - - </extension> - - - <extension - point="org.eclipse.ui.navigator.viewer"> - - <viewerContentBinding - viewerId="org.eclipse.ui.navigator.ProjectExplorer"> - <includes> - <contentExtension pattern="org.eclipse.jpt.jaxb.ui.*"/> - </includes> - </viewerContentBinding> - - </extension> - - - <extension - point="org.eclipse.ui.popupMenus"> - - <!-- contributions to the "Generate" submenu --> - <objectContribution - id="org.eclipse.jpt.jpa.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> - - - <extension - point="org.eclipse.ui.preferencePages"> - - <!-- no actual preferences yet - <page - id="org.eclipse.jpt.jaxb.ui.jaxbPreferences" - category="org.eclipse.jpt.jpa.ui.preferences" - class="org.eclipse.jpt.jaxb.ui.internal.preferences.JaxbPreferencesPage" - name="%jaxbNode"/> - --> - - <!-- - <page - id="org.eclipse.jpt.jaxb.ui.jaxbProblemSeveritiesPreferences" - category="org.eclipse.jpt.jaxb.ui.jaxbPreferences" - class="org.eclipse.jpt.jaxb.ui.internal.preferences.JaxbProblemSeveritiesPage" - name="%jaxbProblemSeveritiesNode"> - </page> - --> - - </extension> - - - <extension - point="org.eclipse.ui.propertyPages"> - - <page - id="org.eclipse.jpt.jaxb.ui.jaxbProjectProperties" - name="%jaxbNode" - class="org.eclipse.jpt.jaxb.ui.internal.properties.JaxbProjectPropertiesPage"> - <enabledWhen> - <adapt type="org.eclipse.core.resources.IProject"> - <test - forcePluginActivation="true" - property="org.eclipse.wst.common.project.facet.core.projectFacet" - value="jpt.jaxb"/> - </adapt> - </enabledWhen> - </page> - - <page - id="org.eclipse.jpt.jaxb.ui.jaxbSchemasProperties" - name="%jaxbSchemas" - category="org.eclipse.jpt.jaxb.ui.jaxbProjectProperties" - class="org.eclipse.jpt.jaxb.ui.internal.properties.JaxbSchemasPropertiesPage"> - <enabledWhen> - <adapt type="org.eclipse.core.resources.IProject"> - <test - forcePluginActivation="true" - property="org.eclipse.wst.common.project.facet.core.projectFacet" - value="jpt.jaxb"/> - </adapt> - </enabledWhen> - </page> - - <!-- - <page - id="org.eclipse.jpt.jpa.ui.jaxbProblemSeveritiesProperties" - name="%jaxbProblemSeveritiesNode" - category="org.eclipse.jpt.jaxb.ui.jaxbProjectProperties" - class="org.eclipse.jpt.jaxb.ui.internal.preferences.JaxbProblemSeveritiesPage"> - <enabledWhen> - <adapt type="org.eclipse.core.resources.IProject"> - <test - forcePluginActivation="true" - property="org.eclipse.wst.common.project.facet.core.projectFacet" - value="jpt.jaxb"/> - </adapt> - </enabledWhen> - </page> - --> - - </extension> - - - <extension - point="org.eclipse.wst.common.project.facet.ui.images"> - - <image facet="jpt.jaxb" path="icons/full/etool16/jaxb_facet.gif"/> - - </extension> - - - <extension - point="org.eclipse.wst.common.project.facet.ui.wizardPages"> - - <wizard-pages action="jpt.jaxb.install"> - <page class="org.eclipse.jpt.jaxb.ui.internal.wizards.facet.JaxbFacetInstallPage"/> - </wizard-pages> - - <wizard-pages action="jpt.jaxb.version-change"> - <page class="org.eclipse.jpt.jaxb.ui.internal.wizards.facet.JaxbFacetVersionChangePage"/> - </wizard-pages> - - </extension> - -</plugin> diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/property_files/jpt_jaxb_ui.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/property_files/jpt_jaxb_ui.properties deleted file mode 100644 index b974d28445..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/property_files/jpt_jaxb_ui.properties +++ /dev/null @@ -1,173 +0,0 @@ -################################################################################ -# 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 -################################################################################ - -JavaProjectWizardPage_project = Project: -JavaProjectWizardPage_destinationProject = Select destination project: - -# ClassesGenerator -ClassesGeneratorProjectWizardPage_title = Java Project -ClassesGeneratorProjectWizardPage_desc = Specify project for the new classes. - -ClassesGeneratorWizard_title = New JAXB Classes from schema - -ClassesGeneratorWizard_errorDialogTitle = Generate Classes Failed -ClassesGeneratorWizard_couldNotCreate = Could not create {0} - -Error_openingEditor=Error Opening Editor - -JaxbContent_label=JAXB Content - -SchemasPage_description = Configure JAXB schemas used for validation and content assist -SchemasPage_revert = &Revert -SchemasPage_schemas = &Schema namespaces and locations: -SchemasPage_namespaceColumnLabel = Namespace -SchemasPage_locationColumnLabel = Location -SchemasPage_addButtonLabel = &Add ... -SchemasPage_editButtonLabel = &Edit ... -SchemasPage_removeButtonLabel = Re&move -SchemasPage_addSchemaMessage = Enter a new schema namespace and the location where it can be found. -SchemasPage_editSchemaMessage = Edit an existing schema namespace and the location where it can be found. -SchemasPage_addSchemaDialogTitle = Add Schema Location -SchemasPage_editSchemaDialogTitle = Edit Schema Location -SchemasPage_addSchemaTitle = Add a new schema location -SchemasPage_editSchemaTitle = Edit an existing schema location -SchemasPage_locationLabel = &Location: -SchemasPage_browseButtonLabel = &Browse ... -SchemasPage_namespaceLabel = &Namespace: -SchemasPage_noNamespaceText = <no namespace> -SchemasPage_schemaUnresolvedMessage = Could not resolve chosen schema location. -SchemasPage_duplicateNamespaceMessage = That namespace is already in use. -SchemasPage_noLocationMessage = You must specify a location. -SchemasPage_chooseLocationTitle = Select Schema Location - -SchemaWizardPage_title = Select Schema -SchemaWizardPage_desc = Specify schema to generate the classes from - -SchemaWizardPage_xmlCatalogTableTitle = XML Catalog -SchemaWizardPage_xmlCatalogKeyColumn = Key -SchemaWizardPage_xmlCatalogUriColumn = URI - -SchemaWizardPage_errorUriCannotBeLocated = The selected catalog entry specifies a URI that can not be located. - -SelectFileOrXMLCatalogIdPanel_fileFromWorkspace = Select file from Work&space -SelectFileOrXMLCatalogIdPanel_xmlCatalogEntry = Select XML Catalo&g entry -SelectFileOrXMLCatalogIdPanel_importButton = &Import Files... - -ClassesGeneratorWizardPage_title = Generate Classes from Schema: {0} -ClassesGeneratorWizardPage_desc = Configure JAXB class generation. - -ClassesGeneratorWizardPage_usesMoxyImplementation = Use EclipseLink MO&Xy as the JAXB implementation - -ClassesGeneratorWizardPage_catalog = Catalo&g: -ClassesGeneratorWizardPage_bindingsFiles = B&indings files: -ClassesGeneratorWizardPage_browseButton = Brow&se... -ClassesGeneratorWizardPage_addButton = &Add... -ClassesGeneratorWizardPage_removeButton = Re&move -ClassesGeneratorWizardPage_chooseABindingsFile = External Bindings File Selection -ClassesGeneratorWizardPage_chooseACatalog = Catalog File Selection - -ClassesGeneratorWizardPage_sourceFolderSelectionDialog_title = Source Folder Selection -ClassesGeneratorWizardPage_chooseSourceFolderDialog_desc = &Choose a source folder: - -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. - -ClassesGeneratorOptionsWizardPage_title = Classes Generator Options -ClassesGeneratorOptionsWizardPage_desc = Configure JAXB compiler options. - -ClassesGeneratorOptionsWizardPage_proxyGroup = Proxy -ClassesGeneratorOptionsWizardPage_noProxy = N&o proxy -ClassesGeneratorOptionsWizardPage_proxy = &Proxy: -ClassesGeneratorOptionsWizardPage_proxyFile = Prox&y file: -ClassesGeneratorOptionsWizardPage_chooseAProxyFile = Proxy File Selection - -ClassesGeneratorOptionsWizardPage_useStrictValidation = Use strict v&alidation -ClassesGeneratorOptionsWizardPage_makeReadOnly = Generate &read-only files -ClassesGeneratorOptionsWizardPage_suppressPackageInfoGen = Suppress pac&kage-info generation -ClassesGeneratorOptionsWizardPage_suppressesHeaderGen = Suppress generation of file &header -ClassesGeneratorOptionsWizardPage_target = Target X&JC 2.0 -ClassesGeneratorOptionsWizardPage_verbose = &Verbose -ClassesGeneratorOptionsWizardPage_quiet = Suppress compiler outp&ut - -ClassesGeneratorOptionsWizardPage_treatsAsXmlSchema = Treat input as &XML schema -ClassesGeneratorOptionsWizardPage_treatsAsRelaxNg = Treat input as RELAX N&G -ClassesGeneratorOptionsWizardPage_treatsAsRelaxNgCompact = Treat input as RELAX NG &compact syntax -ClassesGeneratorOptionsWizardPage_treatsAsDtd = Treat input as XML D&TD -ClassesGeneratorOptionsWizardPage_treatsAsWsdl = Treat input as WS&DL and compile schema inside it -ClassesGeneratorOptionsWizardPage_showsVersion = Show vers&ion -ClassesGeneratorOptionsWizardPage_showsHelp = Show h&elp - -ClassesGeneratorExtensionOptionsWizardPage_title = Classes Generator Extension Configuration -ClassesGeneratorExtensionOptionsWizardPage_desc = Configure JAXB compiler vendor extensions. - -ClassesGeneratorExtensionOptionsWizardPage_allowExtensions = Allow vendor &extensions -ClassesGeneratorExtensionOptionsWizardPage_classpath = Class&path: -ClassesGeneratorExtensionOptionsWizardPage_additionalArguments = Additional ar&guments: - -ClassesGeneratorUi_generatingEntities = Generating JAXB Classes from Schema -ClassesGeneratorUi_generatingEntitiesTask = Generating classes - -ClassesGeneratorUi_generatingClassesWarningTitle = Generating JAXB Classes -ClassesGeneratorUi_generatingClassesWarningMessage = \ - Warning: Generating classes will overwrite existing files in your project.\ - \n\nAre you sure you want to continue? - -# SchemaGenerator -SchemaGeneratorWizard_title = New JAXB Schema File - -SchemaGeneratorWizard_generatingSchema = Generating JAXB Schema - -SchemaGeneratorProjectWizardPage_title = JAXB schema file -SchemaGeneratorProjectWizardPage_desc = Specify default file name and location - -SchemaGeneratorWizardPage_title = Generate Schema from Classes -SchemaGeneratorWizardPage_desc = Select classes to include. - -SchemaGeneratorWizardPage_shemaLocation = Schema file: -SchemaGeneratorWizardPage_shema = Schema name: -SchemaGeneratorWizardPage_packages = Select classes to include in schema: -SchemaGeneratorWizardPage_browse = Browse... - -SchemaGeneratorWizardPage_chooseSchemaDialogTitle = Select Schema File - -SchemaGeneratorWizardPage_errorNoSchema = Schema name cannot be empty -SchemaGeneratorWizardPage_errorNoPackage = No classes included - -SchemaGeneratorWizardPage_jaxbLibrariesNotAvailable = \ - The classpath for this project does not appear to contain the necessary libraries to proceed with schema generation.\ - \nPlease insure that a JAXB implementation is available on the classpath. - -SchemaGeneratorWizardPage_moxyLibrariesNotAvailable = \ - The classpath for this project does not appear to contain the necessary libraries to proceed with schema generation.\ - \nPlease insure that EclipseLink MOXy is available on the classpath. - -SchemaGeneratorWizard_generateSchemaTask = Generating schema {0} - -#NewSchemaFileWizardPage - -NewSchemaFileWizardPage_errorNotJavaProject = Not a Java project -NewSchemaFileWizardPage_overwriteExistingSchemas = Schema generation may overwrite existing schemas in the specified directory. - - -JaxbProjectWizard_title = New JAXB Project - -JaxbProjectWizard_firstPage_title = JAXB Project -JaxbProjectWizard_firstPage_desc = Configure JAXB project settings. - -JaxbFacetWizardPage_title = JAXB Facet -JaxbFacetWizardPage_desc = Configure JAXB settings. -JaxbFacetWizardPage_platformLabel = &Platform -JaxbFacetWizardPage_facetsPageLink = <a>Change JAXB version ...</a> -JaxbFacetWizardPage_jaxbImplementationLabel = JAXB implementation diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/schema/jaxbPlatformUis.exsd b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/schema/jaxbPlatformUis.exsd deleted file mode 100644 index dc152bc93b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/schema/jaxbPlatformUis.exsd +++ /dev/null @@ -1,139 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- Schema file written by PDE --> -<schema targetNamespace="org.eclipse.jpt.jaxb.ui" xmlns="http://www.w3.org/2001/XMLSchema"> -<annotation> - <appinfo> - <meta.schema plugin="org.eclipse.jpt.jaxb.ui" id="jpaPlatforms" name="JAXB Platform UIs"/> - </appinfo> - <documentation> - [Enter description of this extension point.] - </documentation> - </annotation> - - <element name="extension"> - <annotation> - <appinfo> - <meta.element /> - </appinfo> - </annotation> - <complexType> - <sequence> - <element ref="jaxbPlatformUi" minOccurs="1" maxOccurs="unbounded"/> - </sequence> - <attribute name="point" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="id" type="string"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="name" type="string"> - <annotation> - <documentation> - - </documentation> - <appinfo> - <meta.attribute translatable="true"/> - </appinfo> - </annotation> - </attribute> - </complexType> - </element> - - <element name="jaxbPlatformUi"> - <annotation> - <documentation> - Extenders of the org.eclipse.jpt.jaxb.core.jaxbPlatforms extension point may also use this point to insert UI into the workbench for that platform. The jaxbPlatform must match the id of a jaxbPlatform extension. - </documentation> - </annotation> - <complexType> - <attribute name="id" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="jaxbPlatform" type="string" use="required"> - <annotation> - <documentation> - The jaxbPlatform must match a corresponding org.eclipse.jpt.jaxb.core.jaxbPlatform extension id. - </documentation> - </annotation> - </attribute> - <attribute name="class" type="string" use="required"> - <annotation> - <documentation> - The instantiable class that implements <samp>org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi</samp>. - </documentation> - <appinfo> - <meta.attribute kind="java" basedOn=":org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi"/> - </appinfo> - </annotation> - </attribute> - </complexType> - </element> - - <annotation> - <appinfo> - <meta.section type="since"/> - </appinfo> - <documentation> - 3.0 - </documentation> - </annotation> - - <annotation> - <appinfo> - <meta.section type="examples"/> - </appinfo> - <documentation> - [Enter extension point usage example here.] - </documentation> - </annotation> - - <annotation> - <appinfo> - <meta.section type="apiinfo"/> - </appinfo> - <documentation> - 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. - </documentation> - </annotation> - - <annotation> - <appinfo> - <meta.section type="implementation"/> - </appinfo> - <documentation> - [Enter information about supplied implementation of this extension point.] - </documentation> - </annotation> - - <annotation> - <appinfo> - <meta.section type="copyright"/> - </appinfo> - <documentation> - 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 - </documentation> - </annotation> - -</schema> diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/JptJaxbUiPlugin.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/JptJaxbUiPlugin.java deleted file mode 100644 index 824a4d7507..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/JptJaxbUiPlugin.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* -* 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.jface.resource.ImageRegistry; -import org.eclipse.jpt.jaxb.ui.internal.platform.JaxbPlatformUiManagerImpl; -import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUiManager; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.eclipse.wst.xml.core.internal.XMLCorePlugin; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog; - -/** - * 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. - */ -@SuppressWarnings("nls") -public class JptJaxbUiPlugin extends AbstractUIPlugin -{ - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.jpt.jaxb.ui"; - public static final String PLUGIN_ID_ = PLUGIN_ID + '.'; - - public static final String USER_CATALOG_ID = XMLCorePlugin.USER_CATALOG_ID; //$NON-NLS-1$ - public static final String DEFAULT_CATALOG_ID = XMLCorePlugin.DEFAULT_CATALOG_ID; //$NON-NLS-1$ - public static final String SYSTEM_CATALOG_ID = XMLCorePlugin.SYSTEM_CATALOG_ID; //$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 - */ - //TODO we are using the ImageRegistry here and storing all our icons for the life of the plugin, - //which means until the workspace is closed. This is better than before where we constantly - //created new images. Bug 306437 is about cleaning this up and using Local Resource Managers - //on our views so that closing the JPA perspective would mean our icons are disposed. - public static Image getImage(String key) { - ImageRegistry imageRegistry = instance().getImageRegistry(); - Image image = imageRegistry.get(key); - if (image == null) { - imageRegistry.put(key, getImageDescriptor(key)); - image = imageRegistry.get(key); - } - return image; - } - - - public static JaxbPlatformUiManager getJaxbPlatformUiManager() { - return JaxbPlatformUiManagerImpl.instance(); - } - - - // ********** XMLCorePlugin API ********** - - public ICatalog getDefaultXMLCatalog() { - return XMLCorePlugin.getDefault().getDefaultXMLCatalog(); - } - - // ********** constructors ********** - public JptJaxbUiPlugin() { - super(); - if (INSTANCE != null) { - throw new IllegalStateException(); - } - INSTANCE = this; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java deleted file mode 100644 index 090e0abe51..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java +++ /dev/null @@ -1,201 +0,0 @@ -/******************************************************************************* -* 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 java.util.HashMap; -import java.util.Map; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.WorkspaceJob; -import org.eclipse.emf.common.util.URI; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.SchemaLibrary; -import org.eclipse.jpt.jaxb.core.internal.gen.ClassesGeneratorExtensionOptions; -import org.eclipse.jpt.jaxb.core.internal.gen.ClassesGeneratorOptions; -import org.eclipse.jpt.jaxb.core.internal.gen.GenerateJaxbClassesJob; -import org.eclipse.jpt.jaxb.core.xsd.XsdUtil; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen.ClassesGeneratorWizard; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.wst.xsd.contentmodel.internal.XSDImpl; -import org.eclipse.xsd.XSDSchema; - -/** - * ClassesGeneratorUi - */ -public class ClassesGeneratorUi { - - private final IJavaProject javaProject; - private final IFile xsdFile; - - // ********** static methods ********** - - public static void generate(IFile xsdFile) { - IJavaProject javaProject = JavaCore.create(xsdFile.getProject()); - if (javaProject == null) { - throw new NullPointerException(); - } - - new ClassesGeneratorUi(javaProject, xsdFile).generate(); - } - - // ********** constructors ********** - private ClassesGeneratorUi(IJavaProject javaProject, IFile xsdFile) { - super(); - if (javaProject == null) { - throw new NullPointerException(); - } - this.javaProject = javaProject; - this.xsdFile = xsdFile; - } - - // ********** generate ********** - /** - * prompt the user with a wizard - */ - protected void generate() { - ClassesGeneratorWizard wizard = new ClassesGeneratorWizard(this.javaProject, this.xsdFile); - wizard.setWindowTitle(JptJaxbUiMessages.ClassesGeneratorWizard_title); - WizardDialog dialog = new WizardDialog(this.getCurrentShell(), wizard); - dialog.create(); - int returnCode = dialog.open(); - if (returnCode != Window.OK) { - return; - } - - if(this.displayOverridingClassesWarning(wizard.getGeneratorOptions())) { - this.generateJaxbClasses( - wizard.getLocalSchemaUri(), - wizard.getDestinationFolder(), - wizard.getTargetPackage(), - wizard.getCatalog(), - wizard.usesMoxy(), - wizard.getBindingsFileNames(), - wizard.getGeneratorOptions(), - wizard.getGeneratorExtensionOptions()); - addSchemaToLibrary(wizard.getSchemaLocation()); - } - } - - // ********** internal methods ********** - - private void generateJaxbClasses( - URI schemaUri, - String outputDir, - String targetPackage, - String catalog, - boolean usesMoxyGenerator, - String[] bindingsFileNames, - ClassesGeneratorOptions generatorOptions, - ClassesGeneratorExtensionOptions generatorExtensionOptions) { - - try { - WorkspaceJob job = new GenerateJaxbClassesJob( - this.javaProject, - schemaUri.toString(), - outputDir, - targetPackage, - catalog, - usesMoxyGenerator, - bindingsFileNames, - generatorOptions, - generatorExtensionOptions); - job.schedule(); - } - catch(RuntimeException re) { - JptJaxbUiPlugin.log(re); - - String msg = re.getMessage(); - String message = (msg == null) ? re.toString() : msg; - this.logError(message); - } - } - - private void addSchemaToLibrary(String schemaLocation) { - JaxbProject jaxbProject = getJaxbProject(); - - if (jaxbProject == null) { - return; - } - - String resolvedUri = XsdUtil.getResolvedUri(null, schemaLocation); - XSDSchema schema = XSDImpl.buildXSDModel(resolvedUri); - if (schema != null) { - String schemaNamespace = - ((schema.getTargetNamespace()) == null ? - "" - : schema.getTargetNamespace()); - - SchemaLibrary schemaLib = jaxbProject.getSchemaLibrary(); - Map<String, String> schemas = new HashMap<String, String>(schemaLib.getSchemaLocations()); - schemas.put(schemaNamespace, schemaLocation); - schemaLib.setSchemaLocations(schemas); - } - } - - 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; - } - - /* may be null */ - private JaxbProject getJaxbProject() { - return JptJaxbCorePlugin.getJaxbProject(this.javaProject.getProject()); - } - - private boolean isOverridingClasses(ClassesGeneratorOptions generatorOptions) { - if(generatorOptions == null) { - throw new NullPointerException(); - } - if(generatorOptions.showsVersion() || generatorOptions.showsHelp()) { - return false; - } - return true; - } - - private boolean displayOverridingClassesWarning(ClassesGeneratorOptions generatorOptions) { - - if( ! this.isOverridingClasses(generatorOptions)) { - return true; - } - return MessageDialog.openQuestion( - this.getCurrentShell(), - JptJaxbUiMessages.ClassesGeneratorUi_generatingClassesWarningTitle, - JptJaxbUiMessages.ClassesGeneratorUi_generatingClassesWarningMessage); - } - - private Shell getCurrentShell() { - return Display.getCurrent().getActiveShell(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbJavaCompletionProposalComputer.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbJavaCompletionProposalComputer.java deleted file mode 100644 index 9a8fb04f8e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbJavaCompletionProposalComputer.java +++ /dev/null @@ -1,185 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jdt.core.CompletionContext; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.ui.text.java.ContentAssistInvocationContext; -import org.eclipse.jdt.ui.text.java.IJavaCompletionProposalComputer; -import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext; -import org.eclipse.jface.text.contentassist.CompletionProposal; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.internal.utility.PlatformTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; - - -public class JaxbJavaCompletionProposalComputer - implements IJavaCompletionProposalComputer { - - public JaxbJavaCompletionProposalComputer() { - super(); - } - - - public void sessionStarted() { - // do nothing - } - - @SuppressWarnings("unchecked") - public List computeCompletionProposals(ContentAssistInvocationContext context, IProgressMonitor monitor) { - return (context instanceof JavaContentAssistInvocationContext) ? - computeCompletionProposals((JavaContentAssistInvocationContext) context) - : Collections.emptyList(); - } - - /** - * We fail silently here because (it seems) <em>expected</em> exceptions occur - * more frequently than intermittent <em>unexpected</em> exceptions that might - * merit investigation (and a logged stacktrace might be the only hint as - * to what happened). - * <p> - * We will get an <em>expected</em> exception (typically a {@link NullPointerException NPE}) - * here if the user:<ol> - * <li>modifies the Java source file in a way that puts it drastically out - * of sync with the Dali context model (e.g. deleting a field or - * annotation) - * <li>immediately invokes Content Assist (typically <code>Ctrl+Space</code>) - * </ol> - * The AST we build here will be based on the just-modified Java source; but, - * since the user moved quickly and we will not have yet received any Java - * change notification (since we only get a Java change notification when - * the user has paused typing for at least 0.5 seconds), the context model - * will still be based on the unmodified Java source. As the new AST is - * passed down through the context model to the resource model all the code - * expects to find the AST in sync with the model. When this is not the - * case (e.g. a field in the resource model is no longer present in the AST - * because the user has deleted it or modified the code in such a way that - * the parser can no longer detect the field) the model will probably choke - * when it cannot find the corresponding AST node. - * <p> - * It seems reasonable, in these situations, to simply return no completion - * proposals. If the user simply waits a moment and tries again, we will be - * able to successfully calculate some proposals. - * <p> - * ~bjv - */ - private List<ICompletionProposal> computeCompletionProposals(JavaContentAssistInvocationContext context) { - try { - return computeCompletionProposals_(context); - } - catch (Exception ex) { - // JptJaxbCorePlugin.log(ex); // don't log "expected" exceptions (?) - return Collections.emptyList(); - } - } - - private List<ICompletionProposal> computeCompletionProposals_(JavaContentAssistInvocationContext context) { - ICompilationUnit cu = context.getCompilationUnit(); - IFile file = (cu != null) ? getCorrespondingResource(cu) : null; - IContentType contentType = (file != null) ? PlatformTools.getContentType(file) : null; - - if (contentType == null || ! contentType.isKindOf(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) { - return Collections.emptyList(); - } - - JaxbProject jaxbProject = JptJaxbCorePlugin.getJaxbProject(file.getProject()); - if (jaxbProject == null) { - return Collections.emptyList(); - } - - Iterable<? extends JavaContextNode> javaNodes = jaxbProject.getPrimaryJavaNodes(cu); - if (CollectionTools.isEmpty(javaNodes)) { - return Collections.emptyList(); - } - - CompletionContext cc = context.getCoreContext(); - - // the context's "token" is really a sort of "prefix" - it does NOT - // correspond to the "start" and "end" we get below... - char[] prefix = cc.getToken(); - Filter<String> filter = ((prefix == null) ? Filter.Null.<String>instance() : new IgnoreCasePrefixFilter(prefix)); - // the token "start" is the offset of the token's first character - int tokenStart = cc.getTokenStart(); - // the token "end" is the offset of the token's last character (yuk) - int tokenEnd = cc.getTokenEnd(); - if (tokenStart == -1) { // not sure why this happens - see bug 242286 - return Collections.emptyList(); - } - -// System.out.println("prefix: " + ((prefix == null) ? "[null]" : new String(prefix))); -// System.out.println("token start: " + tokenStart); -// System.out.println("token end: " + tokenEnd); -// String source = cu.getSource(); -// String token = source.substring(Math.max(0, tokenStart), Math.min(source.length(), tokenEnd + 1)); -// System.out.println("token: =>" + token + "<="); -// String snippet = source.substring(Math.max(0, tokenStart - 20), Math.min(source.length(), tokenEnd + 21)); -// System.out.println("surrounding snippet: =>" + snippet + "<="); - - // TODO move this parser call into the model... - CompilationUnit astRoot = ASTTools.buildASTRoot(cu); - List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>(); - for (JavaContextNode javaNode : javaNodes) { - for (String proposal : javaNode.getJavaCompletionProposals(context.getInvocationOffset(), filter, astRoot)) { - proposals.add(new CompletionProposal(proposal, tokenStart, tokenEnd - tokenStart + 1, proposal.length())); - } - } - return proposals; - } - - private IFile getCorrespondingResource(ICompilationUnit cu) { - try { - return (IFile) cu.getCorrespondingResource(); - } catch (JavaModelException ex) { - JptJaxbUiPlugin.log(ex); - return null; - } - } - - @SuppressWarnings("unchecked") - public List computeContextInformation(ContentAssistInvocationContext context, IProgressMonitor monitor) { - return Collections.emptyList(); - } - - public String getErrorMessage() { - return null; - } - - public void sessionEnded() { - // do nothing - } - - private static class IgnoreCasePrefixFilter implements Filter<String> { - private final char[] prefix; - IgnoreCasePrefixFilter(char[] prefix) { - super(); - this.prefix = prefix; - } - public boolean accept(String s) { - return StringTools.stringStartsWithIgnoreCase(s.toCharArray(), this.prefix); - } - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbMappingImageHelper.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbMappingImageHelper.java deleted file mode 100644 index 4c0ddd7a7b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbMappingImageHelper.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.jpt.jaxb.core.MappingKeys; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.swt.graphics.Image; - -public class JaxbMappingImageHelper -{ -// -// public static Image imageForTypeMapping(String mappingKey) { -// return JptUiPlugin.getImage(iconKeyForTypeMapping(mappingKey)); -// } -// -// public static String iconKeyForTypeMapping(String mappingKey) { -// if (MappingKeys.NULL_TYPE_MAPPING_KEY == mappingKey) { -// return JptUiIcons.NULL_TYPE_MAPPING; -// } -// else if (MappingKeys.ENTITY_TYPE_MAPPING_KEY.equals(mappingKey)) { -// return JptUiIcons.ENTITY; -// } -// else if (MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY.equals(mappingKey)) { -// return JptUiIcons.EMBEDDABLE; -// } -// else if (MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY.equals(mappingKey)) { -// return JptUiIcons.MAPPED_SUPERCLASS; -// } -// return null; -// } - - public static Image imageForAttributeMapping(String mappingKey) { - return JptJaxbUiPlugin.getImage(iconKeyForAttributeMapping(mappingKey)); - } - - public static String iconKeyForAttributeMapping(String mappingKey) { - if (MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY == mappingKey) { - return JptJaxbUiIcons.NULL_ATTRIBUTE_MAPPING; - } - else if (MappingKeys.XML_ANY_ATTRIBUTE_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) { - return JptJaxbUiIcons.XML_ANY_ATTRIBUTE; - } - else if (MappingKeys.XML_ANY_ELEMENT_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) { - return JptJaxbUiIcons.XML_ANY_ELEMENT; - } - else if (MappingKeys.XML_ATTRIBUTE_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) { - return JptJaxbUiIcons.XML_ATTRIBUTE; - } - else if (MappingKeys.XML_ELEMENT_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) { - return JptJaxbUiIcons.XML_ELEMENT; - } - else if (MappingKeys.XML_ELEMENT_REF_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) { - return JptJaxbUiIcons.XML_ELEMENT_REF; - } - else if (MappingKeys.XML_ELEMENT_REFS_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) { - return JptJaxbUiIcons.XML_ELEMENT_REFS; - } - else if (MappingKeys.XML_ELEMENTS_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) { - return JptJaxbUiIcons.XML_ELEMENTS; - } - else if (MappingKeys.XML_TRANSIENT_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) { - return JptJaxbUiIcons.XML_TRANSIENT; - } - else if (MappingKeys.XML_VALUE_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) { - return JptJaxbUiIcons.XML_VALUE; - } - - //return the JAXB_CONTENT icon instead of null, might as well have an icon if one is not defined - return JptJaxbUiIcons.JAXB_CONTENT; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiIcons.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiIcons.java deleted file mode 100644 index d89b9c0605..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiIcons.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 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; - -@SuppressWarnings("nls") -public class JptJaxbUiIcons { - - // **************** General icons ************************************** - - public static final String JAXB_CONTENT = "full/obj16/jaxb_content"; - public static final String PACKAGE = "full/obj16/package"; - - public static final String PERSISTENT_CLASS = "full/obj16/persistent_class"; - public static final String PERSISTENT_ENUM = "full/obj16/persistent_enum"; - public static final String TRANSIENT_CLASS = "full/obj16/transient_class"; - public static final String REGISTRY = "full/obj16/registry"; - - public static final String XML_ANY_ATTRIBUTE = "full/obj16/xml-any-attribute"; - public static final String XML_ANY_ELEMENT = "full/obj16/xml-any-element"; - public static final String XML_ATTRIBUTE = "full/obj16/xml-attribute"; - public static final String XML_ELEMENT = "full/obj16/xml-element"; - public static final String XML_ELEMENT_REF = "full/obj16/xml-element-ref"; - public static final String XML_ELEMENT_REFS = "full/obj16/xml-element-refs"; - public static final String XML_ELEMENTS = "full/obj16/xml-elements"; - - public static final String XML_TRANSIENT = "full/obj16/xml-transient"; - public static final String XML_VALUE = "full/obj16/xml-value"; - public static final String NULL_ATTRIBUTE_MAPPING = "full/obj16/null-attribute-mapping"; - - public static final String PERSISTENT_FIELD = "full/obj16/persistent_field"; - public static final String PERSISTENT_PROPERTY = "full/obj16/persistent_property"; - public static final String ENUM_CONSTANT = "full/obj16/enum_constant"; - - - // **************** Wizard icons ******************************************* - - public static final String SCHEMA_GEN = "full/wizban/NewXSD"; - - public static final String SCHEMA_GEN_WIZ_BANNER = "full/wizban/NewXSD"; - public static final String CLASSES_GEN_WIZ_BANNER = "full/wizban/newclass_wiz"; - public static final String JAXB_WIZ_BANNER = "full/wizban/new_jaxb_prj_wiz"; -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiMessages.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiMessages.java deleted file mode 100644 index a71c8df345..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiMessages.java +++ /dev/null @@ -1,186 +0,0 @@ -/******************************************************************************* -* 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 JavaProjectWizardPage_project; - public static String JavaProjectWizardPage_destinationProject; - - // ClassesGenerator - public static String ClassesGeneratorProjectWizardPage_title; - public static String ClassesGeneratorProjectWizardPage_desc; - - public static String ClassesGeneratorWizard_title; - public static String ClassesGeneratorWizard_errorDialogTitle; - public static String ClassesGeneratorWizard_couldNotCreate; - - public static String Error_openingEditor; - - public static String JaxbContent_label; - - public static String SchemasPage_description; - public static String SchemasPage_revert; - public static String SchemasPage_schemas; - public static String SchemasPage_namespaceColumnLabel; - public static String SchemasPage_locationColumnLabel; - public static String SchemasPage_addButtonLabel; - public static String SchemasPage_editButtonLabel; - public static String SchemasPage_removeButtonLabel; - public static String SchemasPage_addSchemaMessage; - public static String SchemasPage_editSchemaMessage; - public static String SchemasPage_addSchemaDialogTitle; - public static String SchemasPage_editSchemaDialogTitle; - public static String SchemasPage_addSchemaTitle; - public static String SchemasPage_editSchemaTitle; - public static String SchemasPage_locationLabel; - public static String SchemasPage_browseButtonLabel; - public static String SchemasPage_namespaceLabel; - public static String SchemasPage_noNamespaceText; - public static String SchemasPage_schemaUnresolvedMessage; - public static String SchemasPage_duplicateNamespaceMessage; - public static String SchemasPage_noLocationMessage; - public static String SchemasPage_chooseLocationTitle; - - public static String SchemaWizardPage_title; - public static String SchemaWizardPage_desc; - - public static String SchemaWizardPage_xmlCatalogTableTitle; - public static String SchemaWizardPage_xmlCatalogKeyColumn; - public static String SchemaWizardPage_xmlCatalogUriColumn; - - public static String SchemaWizardPage_errorUriCannotBeLocated; - - public static String SelectFileOrXMLCatalogIdPanel_fileFromWorkspace; - public static String SelectFileOrXMLCatalogIdPanel_xmlCatalogEntry; - public static String SelectFileOrXMLCatalogIdPanel_importButton; - - public static String ClassesGeneratorWizardPage_title; - public static String ClassesGeneratorWizardPage_desc; - - public static String ClassesGeneratorWizardPage_usesMoxyImplementation; - - public static String ClassesGeneratorWizardPage_catalog; - public static String ClassesGeneratorWizardPage_bindingsFiles; - public static String ClassesGeneratorWizardPage_browseButton; - public static String ClassesGeneratorWizardPage_addButton; - public static String ClassesGeneratorWizardPage_removeButton; - public static String ClassesGeneratorWizardPage_chooseABindingsFile; - public static String ClassesGeneratorWizardPage_chooseACatalog; - - public static String ClassesGeneratorWizardPage_sourceFolderSelectionDialog_title; - public static String ClassesGeneratorWizardPage_chooseSourceFolderDialog_desc; - - public static String ClassesGeneratorWizardPage_jaxbLibrariesNotAvailable; - public static String ClassesGeneratorWizardPage_moxyLibrariesNotAvailable; - - public static String ClassesGeneratorOptionsWizardPage_title; - public static String ClassesGeneratorOptionsWizardPage_desc; - - public static String ClassesGeneratorOptionsWizardPage_proxyGroup; - public static String ClassesGeneratorOptionsWizardPage_noProxy; - public static String ClassesGeneratorOptionsWizardPage_proxy; - public static String ClassesGeneratorOptionsWizardPage_proxyFile; - public static String ClassesGeneratorOptionsWizardPage_chooseAProxyFile; - - 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 ClassesGeneratorUi_generatingEntities; - public static String ClassesGeneratorUi_generatingEntitiesTask; - - public static String ClassesGeneratorUi_generatingClassesWarningTitle; - public static String ClassesGeneratorUi_generatingClassesWarningMessage; - - // SchemaGenerator - public static String SchemaGeneratorWizard_title; - public static String SchemaGeneratorWizard_generatingSchema; - - public static String SchemaGeneratorProjectWizardPage_title; - public static String SchemaGeneratorProjectWizardPage_desc; - - public static String SchemaGeneratorWizardPage_title; - public static String SchemaGeneratorWizardPage_desc; - - public static String SchemaGeneratorWizardPage_shemaLocation; - public static String SchemaGeneratorWizardPage_shema; - public static String SchemaGeneratorWizardPage_packages; - public static String SchemaGeneratorWizardPage_browse; - - public static String SchemaGeneratorWizardPage_chooseSchemaDialogTitle; - - public static String SchemaGeneratorWizardPage_errorNoSchema; - public static String SchemaGeneratorWizardPage_errorNoPackage; - - public static String SchemaGeneratorWizardPage_jaxbLibrariesNotAvailable; - - public static String SchemaGeneratorWizardPage_moxyLibrariesNotAvailable; - - public static String SchemaGeneratorWizard_generateSchemaTask; - - public static String NewSchemaFileWizardPage_errorNotJavaProject; - public static String NewSchemaFileWizardPage_overwriteExistingSchemas; - - - // new project wizard - - public static String JaxbProjectWizard_title; - - public static String JaxbProjectWizard_firstPage_title; - public static String JaxbProjectWizard_firstPage_desc; - - - // facet page - - public static String JaxbFacetWizardPage_title; - public static String JaxbFacetWizardPage_desc; - public static String JaxbFacetWizardPage_platformLabel; - public static String JaxbFacetWizardPage_facetsPageLink; - public static String JaxbFacetWizardPage_jaxbImplementationLabel; - - - 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/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/GenerateClassesAction.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/GenerateClassesAction.java deleted file mode 100644 index 526fd69580..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/GenerateClassesAction.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* -* 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/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/ObjectAction.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/ObjectAction.java deleted file mode 100644 index 652d75ac58..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/ObjectAction.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* -* 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/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/OpenJaxbResourceAction.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/OpenJaxbResourceAction.java deleted file mode 100644 index c852e481cb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/OpenJaxbResourceAction.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.core.resources.IResource; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jpt.jaxb.core.context.JaxbContextNode; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.ui.IEditorDescriptor; -import org.eclipse.ui.IEditorRegistry; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.actions.BaseSelectionListenerAction; -import org.eclipse.ui.ide.IDE; -import org.eclipse.ui.part.FileEditorInput; - - -public class OpenJaxbResourceAction - extends BaseSelectionListenerAction { - - private JaxbContextNode selectedNode; - - - public OpenJaxbResourceAction() { - super("Open"); //$NON-NLS-1$ - } - - - @Override - public boolean updateSelection(IStructuredSelection s) { - this.selectedNode = null; - - if (! super.updateSelection(s)) { - return false; - } - - if (s.size() != 1) { - return false; - } - - if (s.getFirstElement() instanceof JaxbContextRoot) { - return false; - } - - selectedNode = (JaxbContextNode) s.getFirstElement(); - - return true; - } - - @Override - public void run() { - if (! isEnabled()) { - return; - } - - IResource resource = this.selectedNode.getResource(); - - if (resource != null && resource.exists() && resource.getType() == IResource.FILE) { - openEditor((IFile) resource); - } - } - - protected void openEditor(IFile file) { - IEditorRegistry registry = PlatformUI.getWorkbench().getEditorRegistry(); - IContentType contentType = IDE.getContentType(file); - IEditorDescriptor editorDescriptor = registry.getDefaultEditor(file.getName(), contentType); - if (editorDescriptor == null) { - return; // no editor associated... - } - - IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - - try { - page.openEditor(new FileEditorInput(file), editorDescriptor.getId()); - } - catch (Exception e) { - MessageDialog.openError(page.getWorkbenchWindow().getShell(), JptJaxbUiMessages.Error_openingEditor, e.getMessage()); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/ContainerFilter.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/ContainerFilter.java deleted file mode 100644 index 5572e0b5fa..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/ContainerFilter.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* -* 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.filters; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; - -/** - * Filters out all containers i.e. all packages and folders - */ -public class ContainerFilter extends ViewerFilter { - - @Override - public boolean select(Viewer viewer, Object parent, Object element) { - boolean isContainer = element instanceof IContainer; - - if( ! isContainer && element instanceof IJavaElement) { - int type= ((IJavaElement)element).getElementType(); - isContainer = (type == IJavaElement.JAVA_MODEL - || type == IJavaElement.JAVA_PROJECT - || type == IJavaElement.PACKAGE_FRAGMENT - || type ==IJavaElement.PACKAGE_FRAGMENT_ROOT); - } - return ! isContainer; - } - - @Override - public String toString() { - return "Filter out Containers"; //$NON-NLS-1$ - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/EmptyInnerPackageFilter.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/EmptyInnerPackageFilter.java deleted file mode 100644 index e89609ec7a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/EmptyInnerPackageFilter.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Code originate from org.eclipse.jdt.internal.ui.filters - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.filters; - - -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; - -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.JavaModelException; - - -/** - * Filters empty non-leaf package fragments - */ -public class EmptyInnerPackageFilter extends ViewerFilter { - - /* - * @see ViewerFilter - */ - public boolean select(Viewer viewer, Object parent, Object element) { - if (element instanceof IPackageFragment) { - IPackageFragment pkg= (IPackageFragment)element; - try { - if (pkg.isDefaultPackage()) - return pkg.hasChildren(); - return !pkg.hasSubpackages() || pkg.hasChildren() || (pkg.getNonJavaResources().length > 0); - } catch (JavaModelException e) { - return false; - } - } - - return true; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/NonArchiveOrExternalElementFilter.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/NonArchiveOrExternalElementFilter.java deleted file mode 100644 index 9ae95f8b9b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/NonArchiveOrExternalElementFilter.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* -* 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 -* -* Code originate from XXXX -*******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.filters; - -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; - -/** - * NonArchiveOrExternalElementFilter - */ -public class NonArchiveOrExternalElementFilter extends ViewerFilter { - - @Override - public boolean select(Viewer viewer, Object parent, Object element) { - if(element instanceof IPackageFragmentRoot) { - IPackageFragmentRoot root= (IPackageFragmentRoot) element; - return !root.isArchive() && !root.isExternal(); - } - return true; - } - - @Override - public String toString() { - return "Filter out: Non-Archive and Non-External"; //$NON-NLS-1$ - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/NonContainerFilter.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/NonContainerFilter.java deleted file mode 100644 index 8fd6e6ac82..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/NonContainerFilter.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* -* 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.filters; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; - -/** - * Filters out all non Container and all JavaProject - * with name not equals to the given projectName. - */ -public class NonContainerFilter extends ViewerFilter -{ - final private String projectName; - - public NonContainerFilter(String projectName) { - this.projectName = projectName; - } - - @Override - public boolean select(Viewer viewer, Object parent, Object element) { - boolean isContainer = element instanceof IContainer; - int type; - if( ! isContainer && element instanceof IJavaElement) { - type = ((IJavaElement)element).getElementType(); - isContainer = (type == IJavaElement.JAVA_MODEL - || type == IJavaElement.JAVA_PROJECT - || type == IJavaElement.PACKAGE_FRAGMENT - || type ==IJavaElement.PACKAGE_FRAGMENT_ROOT); - } - if(isContainer && (element instanceof IJavaElement)) { - type = ((IJavaElement)element).getElementType(); - if(type == IJavaElement.JAVA_PROJECT) { - String projectName = ((IJavaProject)element).getElementName(); - return projectName.equals(this.projectName); - } - } - return isContainer; - } - - @Override - public String toString() { - return "Filter out Non-Containers"; //$NON-NLS-1$ - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/NonJavaElementFilter.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/NonJavaElementFilter.java deleted file mode 100644 index 0c1a6949bd..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/NonJavaElementFilter.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Code originate from org.eclipse.jdt.internal.ui.filters - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.filters; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IStorage; - -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; - -import org.eclipse.jdt.core.IJavaElement; - - -/** - * Filters out all non-Java elements, and elements named package-info - */ -public class NonJavaElementFilter extends ViewerFilter { - - static public String FILE_TO_EXCLUDE = "package-info.java"; //$NON-NLS-1$ - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) - */ - public boolean select(Viewer viewer, Object parent, Object element) { - if (element instanceof IJavaElement) { - return(FILE_TO_EXCLUDE.equals(((IJavaElement)element).getElementName())) ? - false : true; - } - - if (element instanceof IResource) { - IProject project= ((IResource)element).getProject(); - return project == null || !project.isOpen(); - } - - // Exclude all IStorage elements which are neither Java elements nor resources - if (element instanceof IStorage) - return false; - - return true; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorItemLabelProviderFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorItemLabelProviderFactory.java deleted file mode 100644 index dbb1274798..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorItemLabelProviderFactory.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 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.jaxb21; - -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.ui.jface.ItemLabelProvider; -import org.eclipse.jpt.common.ui.jface.ItemLabelProviderFactory; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbEnumConstant; -import org.eclipse.jpt.jaxb.core.context.JaxbPackage; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentEnum; -import org.eclipse.jpt.jaxb.core.context.JaxbRegistry; -import org.eclipse.jpt.jaxb.core.context.JaxbTransientClass; - - -public class GenericJaxb_2_1_NavigatorItemLabelProviderFactory - implements ItemLabelProviderFactory { - - private static GenericJaxb_2_1_NavigatorItemLabelProviderFactory INSTANCE; - - - public static GenericJaxb_2_1_NavigatorItemLabelProviderFactory instance() { - if (INSTANCE == null) { - INSTANCE = new GenericJaxb_2_1_NavigatorItemLabelProviderFactory(); - } - return INSTANCE; - } - - - protected GenericJaxb_2_1_NavigatorItemLabelProviderFactory() { - super(); - } - - - public ItemLabelProvider buildItemLabelProvider( - Object item, - DelegatingContentAndLabelProvider contentAndLabelProvider) { - - if (item instanceof JaxbContextRoot) { - return new JaxbContextRootItemLabelProvider((JaxbContextRoot) item, contentAndLabelProvider); - } - else if (item instanceof JaxbPackage) { - return new JaxbPackageItemLabelProvider((JaxbPackage) item, contentAndLabelProvider); - } - else if (item instanceof JaxbRegistry) { - return new JaxbRegistryItemLabelProvider((JaxbRegistry) item, contentAndLabelProvider); - } - else if (item instanceof JaxbPersistentClass) { - return new JaxbPersistentClassItemLabelProvider((JaxbPersistentClass) item, contentAndLabelProvider); - } - else if (item instanceof JaxbPersistentEnum) { - return new JaxbPersistentEnumItemLabelProvider((JaxbPersistentEnum) item, contentAndLabelProvider); - } - else if (item instanceof JaxbTransientClass) { - return new JaxbTransientClassItemLabelProvider((JaxbTransientClass) item, contentAndLabelProvider); - } - else if (item instanceof JaxbPersistentAttribute) { - return new JaxbPersistentAttributeItemLabelProvider((JaxbPersistentAttribute) item, contentAndLabelProvider); - } - else if (item instanceof JaxbEnumConstant) { - return new JaxbEnumConstantItemLabelProvider((JaxbEnumConstant) item, contentAndLabelProvider); - } - return null; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorTreeItemContentProviderFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorTreeItemContentProviderFactory.java deleted file mode 100644 index 2b053849fb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorTreeItemContentProviderFactory.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * 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.jaxb21; - -import org.eclipse.jpt.common.ui.internal.jface.DelegatingTreeContentAndLabelProvider; -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.ui.jface.TreeItemContentProvider; -import org.eclipse.jpt.common.ui.jface.TreeItemContentProviderFactory; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbPackage; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentEnum; -import org.eclipse.jpt.jaxb.core.context.JaxbRegistry; - - -public class GenericJaxb_2_1_NavigatorTreeItemContentProviderFactory - implements TreeItemContentProviderFactory { - - private static GenericJaxb_2_1_NavigatorTreeItemContentProviderFactory INSTANCE; - - - public static GenericJaxb_2_1_NavigatorTreeItemContentProviderFactory instance() { - if (INSTANCE == null) { - INSTANCE = new GenericJaxb_2_1_NavigatorTreeItemContentProviderFactory(); - } - return INSTANCE; - } - - - private GenericJaxb_2_1_NavigatorTreeItemContentProviderFactory() { - super(); - } - - - public TreeItemContentProvider buildItemContentProvider( - Object item, - DelegatingContentAndLabelProvider contentAndLabelProvider) { - - DelegatingTreeContentAndLabelProvider treeContentAndLabelProvider = - (DelegatingTreeContentAndLabelProvider) contentAndLabelProvider; - - if (item instanceof JaxbContextRoot) { - return new JaxbContextRootItemContentProvider((JaxbContextRoot) item, treeContentAndLabelProvider); - } - else if (item instanceof JaxbPackage) { - return new JaxbPackageItemContentProvider((JaxbPackage) item, treeContentAndLabelProvider); - } - else if (item instanceof JaxbPersistentClass) { - return new JaxbPersistentClassItemContentProvider((JaxbPersistentClass) item, treeContentAndLabelProvider); - } - else if (item instanceof JaxbPersistentEnum) { - return new JaxbPersistentEnumItemContentProvider((JaxbPersistentEnum) item, treeContentAndLabelProvider); - } - else if (item instanceof JaxbRegistry) { - return new JaxbRegistryItemContentProvider((JaxbRegistry) item, treeContentAndLabelProvider); - } - return null; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorUi.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorUi.java deleted file mode 100644 index 175f5e6d0d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorUi.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * 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.jaxb21; - -import org.eclipse.jpt.common.ui.jface.ItemLabelProviderFactory; -import org.eclipse.jpt.common.ui.jface.TreeItemContentProviderFactory; -import org.eclipse.jpt.jaxb.ui.navigator.JaxbNavigatorUi; - - -public class GenericJaxb_2_1_NavigatorUi - implements JaxbNavigatorUi { - - private static GenericJaxb_2_1_NavigatorUi INSTANCE; - - - public static GenericJaxb_2_1_NavigatorUi instance() { - if (INSTANCE == null) { - INSTANCE = new GenericJaxb_2_1_NavigatorUi(); - } - return INSTANCE; - } - - - protected GenericJaxb_2_1_NavigatorUi() { - super(); - } - - - public TreeItemContentProviderFactory getTreeItemContentProviderFactory() { - return GenericJaxb_2_1_NavigatorTreeItemContentProviderFactory.instance(); - } - - public ItemLabelProviderFactory getItemLabelProviderFactory() { - return GenericJaxb_2_1_NavigatorItemLabelProviderFactory.instance(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_PlatformUi.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_PlatformUi.java deleted file mode 100644 index 9336abc359..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_PlatformUi.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * 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.jaxb21; - -import org.eclipse.jpt.jaxb.ui.navigator.JaxbNavigatorUi; -import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi; - - -public class GenericJaxb_2_1_PlatformUi - implements JaxbPlatformUi { - - public JaxbNavigatorUi getNavigatorUi() { - return GenericJaxb_2_1_NavigatorUi.instance(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbContextRootItemContentProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbContextRootItemContentProvider.java deleted file mode 100644 index 4f6a013de8..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbContextRootItemContentProvider.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * 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.jaxb21; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jpt.common.ui.internal.jface.AbstractTreeItemContentProvider; -import org.eclipse.jpt.common.ui.internal.jface.DelegatingTreeContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.CollectionAspectAdapter; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbPackage; - - -public class JaxbContextRootItemContentProvider - extends AbstractTreeItemContentProvider<JaxbPackage> { - - public JaxbContextRootItemContentProvider( - JaxbContextRoot rootContext, DelegatingTreeContentAndLabelProvider contentProvider) { - super(rootContext, contentProvider); - } - - - @Override - public JaxbContextRoot getModel() { - return (JaxbContextRoot) super.getModel(); - } - - @Override - public IProject getParent() { - return getModel().getJaxbProject().getProject(); - } - - @Override - protected CollectionValueModel<JaxbPackage> buildChildrenModel() { - return new CollectionAspectAdapter<JaxbContextRoot, JaxbPackage>( - JaxbContextRoot.PACKAGES_COLLECTION, - getModel()) { - - @Override - protected Iterable<JaxbPackage> getIterable() { - return this.subject.getPackages(); - } - }; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbContextRootItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbContextRootItemLabelProvider.java deleted file mode 100644 index 1fa5c4e31d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbContextRootItemLabelProvider.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 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.jaxb21; - -import org.eclipse.jpt.common.ui.internal.jface.AbstractItemLabelProvider; -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.swt.graphics.Image; - - -public class JaxbContextRootItemLabelProvider - extends AbstractItemLabelProvider { - - public JaxbContextRootItemLabelProvider( - JaxbContextRoot rootContextNode, DelegatingContentAndLabelProvider labelProvider) { - - super(rootContextNode, labelProvider); - } - - - @Override - public JaxbContextRoot getModel() { - return (JaxbContextRoot) super.getModel(); - } - - @Override - protected PropertyValueModel<Image> buildImageModel() { - return new StaticPropertyValueModel<Image>(JptJaxbUiPlugin.getImage(JptJaxbUiIcons.JAXB_CONTENT)); - } - - @Override - protected PropertyValueModel<String> buildTextModel() { - return new StaticPropertyValueModel<String>(JptJaxbUiMessages.JaxbContent_label); - } - - @Override - protected PropertyValueModel<String> buildDescriptionModel() { - StringBuilder sb = new StringBuilder(); - sb.append(JptJaxbUiMessages.JaxbContent_label); - sb.append(" - "); //$NON-NLS-1$ - sb.append(getModel().getResource().getFullPath().makeRelative()); - return new StaticPropertyValueModel<String>(sb.toString()); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbEnumConstantItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbEnumConstantItemLabelProvider.java deleted file mode 100644 index 0a839f0d08..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbEnumConstantItemLabelProvider.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * 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.jaxb21; - -import org.eclipse.jpt.common.ui.internal.jface.AbstractItemLabelProvider; -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbEnumConstant; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; -import org.eclipse.swt.graphics.Image; - - -public class JaxbEnumConstantItemLabelProvider - extends AbstractItemLabelProvider { - - public JaxbEnumConstantItemLabelProvider( - JaxbEnumConstant jaxbEnumConstant, DelegatingContentAndLabelProvider labelProvider) { - - super(jaxbEnumConstant, labelProvider); - } - - - @Override - public JaxbEnumConstant getModel() { - return (JaxbEnumConstant) super.getModel(); - } - - @Override - protected PropertyValueModel<Image> buildImageModel() { - return new StaticPropertyValueModel<Image>(JptJaxbUiPlugin.getImage(JptJaxbUiIcons.ENUM_CONSTANT)); - } - - @Override - protected PropertyValueModel<String> buildTextModel() { - return new StaticPropertyValueModel<String>(getModel().getName()); - } - - @Override - protected PropertyValueModel<String> buildDescriptionModel() { - return new StaticPropertyValueModel<String>(getModel().getName()); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPackageItemContentProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPackageItemContentProvider.java deleted file mode 100644 index 620c6e783e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPackageItemContentProvider.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * 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.jaxb21; - -import org.eclipse.jpt.common.ui.internal.jface.AbstractTreeItemContentProvider; -import org.eclipse.jpt.common.ui.internal.jface.DelegatingTreeContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.CollectionAspectAdapter; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbPackage; -import org.eclipse.jpt.jaxb.core.context.JaxbType; - - -public class JaxbPackageItemContentProvider - extends AbstractTreeItemContentProvider<JaxbType> { - - public JaxbPackageItemContentProvider( - JaxbPackage jaxbPackage, DelegatingTreeContentAndLabelProvider contentProvider) { - - super(jaxbPackage, contentProvider); - } - - - @Override - public JaxbPackage getModel() { - return (JaxbPackage) super.getModel(); - } - - @Override - public JaxbContextRoot getParent() { - return (JaxbContextRoot) getModel().getParent(); - } - - @Override - protected CollectionValueModel<JaxbType> buildChildrenModel() { - return new CollectionAspectAdapter<JaxbContextRoot, JaxbType>( - JaxbContextRoot.TYPES_COLLECTION, getParent()) { - @Override - protected Iterable<JaxbType> getIterable() { - return this.subject.getTypes(getModel()); - } - }; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPackageItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPackageItemLabelProvider.java deleted file mode 100644 index a275cb7634..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPackageItemLabelProvider.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * 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.jaxb21; - -import org.eclipse.jpt.common.ui.internal.jface.AbstractItemLabelProvider; -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbPackage; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; -import org.eclipse.swt.graphics.Image; - - -public class JaxbPackageItemLabelProvider - extends AbstractItemLabelProvider { - - public JaxbPackageItemLabelProvider( - JaxbPackage jaxbPackage, DelegatingContentAndLabelProvider labelProvider) { - - super(jaxbPackage, labelProvider); - } - - @Override - public JaxbPackage getModel() { - return (JaxbPackage) super.getModel(); - } - - @Override - protected PropertyValueModel<Image> buildImageModel() { - return new StaticPropertyValueModel<Image>(JptJaxbUiPlugin.getImage(JptJaxbUiIcons.PACKAGE)); - } - - @Override - protected PropertyValueModel<String> buildTextModel() { - return new StaticPropertyValueModel<String>(getModel().getName()); - } - - @Override - protected PropertyValueModel<String> buildDescriptionModel() { - StringBuilder sb = new StringBuilder(); - sb.append(getModel().getName()); - sb.append(" - "); //$NON-NLS-1$ - sb.append(getModel().getResource().getFullPath().makeRelative()); - return new StaticPropertyValueModel<String>(sb.toString()); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentAttributeItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentAttributeItemLabelProvider.java deleted file mode 100644 index ff191b93af..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentAttributeItemLabelProvider.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.jaxb21; - -import org.eclipse.jpt.common.ui.internal.jface.AbstractItemLabelProvider; -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.ui.internal.JaxbMappingImageHelper; -import org.eclipse.swt.graphics.Image; - - -public class JaxbPersistentAttributeItemLabelProvider - extends AbstractItemLabelProvider { - - public JaxbPersistentAttributeItemLabelProvider( - JaxbPersistentAttribute attribute, DelegatingContentAndLabelProvider labelProvider) { - - super(attribute, labelProvider); - } - - - @Override - public JaxbPersistentAttribute getModel() { - return (JaxbPersistentAttribute) super.getModel(); - } - - @Override - protected PropertyValueModel<Image> buildImageModel() { - return new PropertyAspectAdapter<JaxbPersistentAttribute, Image>( - new String[] {JaxbPersistentAttribute.DEFAULT_MAPPING_KEY_PROPERTY, JaxbPersistentAttribute.MAPPING_PROPERTY}, - getModel()) { - @Override - protected Image buildValue_() { - return JaxbMappingImageHelper.imageForAttributeMapping(this.subject.getMappingKey()); - } - }; - } - - @Override - protected PropertyValueModel<String> buildTextModel() { - StringBuffer sb = new StringBuffer(); - if (getModel().isInherited()) { - sb.append(getModel().getInheritedJavaResourceAttributeOwningTypeName()); - sb.append('.'); - } - sb.append(getModel().getName()); - return new StaticPropertyValueModel<String>(sb.toString()); - } - - @Override - protected PropertyValueModel<String> buildDescriptionModel() { - return new StaticPropertyValueModel<String>(getModel().getName()); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentClassItemContentProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentClassItemContentProvider.java deleted file mode 100644 index dfcf97e383..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentClassItemContentProvider.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 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.jaxb21; - -import java.util.ArrayList; -import java.util.List; -import org.eclipse.jpt.common.ui.internal.jface.AbstractTreeItemContentProvider; -import org.eclipse.jpt.common.ui.internal.jface.DelegatingTreeContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.CollectionAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.CompositeCollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; - - -public class JaxbPersistentClassItemContentProvider - extends AbstractTreeItemContentProvider<JaxbPersistentAttribute> { - - public JaxbPersistentClassItemContentProvider( - JaxbPersistentClass jaxbPersistentClass, DelegatingTreeContentAndLabelProvider contentProvider) { - - super(jaxbPersistentClass, contentProvider); - } - - - @Override - public JaxbPersistentClass getModel() { - return (JaxbPersistentClass) super.getModel(); - } - - @Override - public JaxbContextRoot getParent() { - return (JaxbContextRoot) getModel().getParent(); - } - - @Override - protected CollectionValueModel<JaxbPersistentAttribute> buildChildrenModel() { - List<CollectionValueModel<JaxbPersistentAttribute>> list = new ArrayList<CollectionValueModel<JaxbPersistentAttribute>>(); - list.add(buildAttributesModel()); - list.add(buildInheritedAttributesModel()); - return new CompositeCollectionValueModel<CollectionValueModel<JaxbPersistentAttribute>, JaxbPersistentAttribute>(list); - } - - protected CollectionValueModel<JaxbPersistentAttribute> buildAttributesModel() { - return new CollectionAspectAdapter<JaxbPersistentClass, JaxbPersistentAttribute>( - JaxbPersistentClass.ATTRIBUTES_COLLECTION, getModel()) { - @Override - protected Iterable<JaxbPersistentAttribute> getIterable() { - return this.subject.getAttributes(); - } - }; - } - - protected CollectionValueModel<JaxbPersistentAttribute> buildInheritedAttributesModel() { - return new CollectionAspectAdapter<JaxbPersistentClass, JaxbPersistentAttribute>( - JaxbPersistentClass.INHERITED_ATTRIBUTES_COLLECTION, getModel()) { - @Override - protected Iterable<JaxbPersistentAttribute> getIterable() { - return this.subject.getInheritedAttributes(); - } - }; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentClassItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentClassItemLabelProvider.java deleted file mode 100644 index d13e1c3664..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentClassItemLabelProvider.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 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.jaxb21; - -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; -import org.eclipse.swt.graphics.Image; - - -public class JaxbPersistentClassItemLabelProvider - extends JaxbTypeItemLabelProvider { - - public JaxbPersistentClassItemLabelProvider( - JaxbPersistentClass jaxbPersistentClass, DelegatingContentAndLabelProvider labelProvider) { - - super(jaxbPersistentClass, labelProvider); - } - - @Override - protected PropertyValueModel<Image> buildImageModel() { - return new StaticPropertyValueModel<Image>(JptJaxbUiPlugin.getImage(JptJaxbUiIcons.PERSISTENT_CLASS)); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentEnumItemContentProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentEnumItemContentProvider.java deleted file mode 100644 index 5e7620866e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentEnumItemContentProvider.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * 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.jaxb21; - -import org.eclipse.jpt.common.ui.internal.jface.AbstractTreeItemContentProvider; -import org.eclipse.jpt.common.ui.internal.jface.DelegatingTreeContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.CollectionAspectAdapter; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbEnumConstant; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentEnum; - - -public class JaxbPersistentEnumItemContentProvider - extends AbstractTreeItemContentProvider<JaxbEnumConstant> { - - public JaxbPersistentEnumItemContentProvider( - JaxbPersistentEnum jaxbPersistentEnum, DelegatingTreeContentAndLabelProvider contentProvider) { - - super(jaxbPersistentEnum, contentProvider); - } - - - @Override - public JaxbPersistentEnum getModel() { - return (JaxbPersistentEnum) super.getModel(); - } - - @Override - public JaxbContextRoot getParent() { - return (JaxbContextRoot) getModel().getParent(); - } - - @Override - protected CollectionValueModel<JaxbEnumConstant> buildChildrenModel() { - return new CollectionAspectAdapter<JaxbPersistentEnum, JaxbEnumConstant>( - JaxbPersistentEnum.ENUM_CONSTANTS_COLLECTION, getModel()) { - @Override - protected Iterable<JaxbEnumConstant> getIterable() { - return this.subject.getEnumConstants(); - } - }; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentEnumItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentEnumItemLabelProvider.java deleted file mode 100644 index 36e6c40455..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentEnumItemLabelProvider.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 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.jaxb21; - -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentEnum; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; -import org.eclipse.swt.graphics.Image; - - -public class JaxbPersistentEnumItemLabelProvider - extends JaxbTypeItemLabelProvider { - - public JaxbPersistentEnumItemLabelProvider( - JaxbPersistentEnum jaxbEnum, DelegatingContentAndLabelProvider labelProvider) { - - super(jaxbEnum, labelProvider); - } - - @Override - protected PropertyValueModel<Image> buildImageModel() { - return new StaticPropertyValueModel<Image>(JptJaxbUiPlugin.getImage(JptJaxbUiIcons.PERSISTENT_ENUM)); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbRegistryItemContentProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbRegistryItemContentProvider.java deleted file mode 100644 index 940db5e8c4..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbRegistryItemContentProvider.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * 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.jaxb21; - -import org.eclipse.jpt.common.ui.internal.jface.AbstractTreeItemContentProvider; -import org.eclipse.jpt.common.ui.internal.jface.DelegatingTreeContentAndLabelProvider; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbElementFactoryMethod; -import org.eclipse.jpt.jaxb.core.context.JaxbRegistry; - - -public class JaxbRegistryItemContentProvider - extends AbstractTreeItemContentProvider<JaxbElementFactoryMethod> { - - public JaxbRegistryItemContentProvider( - JaxbRegistry jaxbRegistry, DelegatingTreeContentAndLabelProvider contentProvider) { - - super(jaxbRegistry, contentProvider); - } - - - @Override - public JaxbRegistry getModel() { - return (JaxbRegistry) super.getModel(); - } - - @Override - public JaxbContextRoot getParent() { - return (JaxbContextRoot) getModel().getParent(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbRegistryItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbRegistryItemLabelProvider.java deleted file mode 100644 index 4d897515e1..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbRegistryItemLabelProvider.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.jaxb21; - -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbRegistry; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; -import org.eclipse.swt.graphics.Image; - - -public class JaxbRegistryItemLabelProvider - extends JaxbTypeItemLabelProvider { - - public JaxbRegistryItemLabelProvider( - JaxbRegistry jaxbRegistry, DelegatingContentAndLabelProvider labelProvider) { - - super(jaxbRegistry, labelProvider); - } - - @Override - protected PropertyValueModel<Image> buildImageModel() { - return new StaticPropertyValueModel<Image>(JptJaxbUiPlugin.getImage(JptJaxbUiIcons.REGISTRY)); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbTransientClassItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbTransientClassItemLabelProvider.java deleted file mode 100644 index 5f79b33805..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbTransientClassItemLabelProvider.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.jaxb21; - -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbTransientClass; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; -import org.eclipse.swt.graphics.Image; - - -public class JaxbTransientClassItemLabelProvider - extends JaxbTypeItemLabelProvider { - - public JaxbTransientClassItemLabelProvider( - JaxbTransientClass jaxbTransientType, DelegatingContentAndLabelProvider labelProvider) { - - super(jaxbTransientType, labelProvider); - } - - @Override - protected PropertyValueModel<Image> buildImageModel() { - return new StaticPropertyValueModel<Image>(JptJaxbUiPlugin.getImage(JptJaxbUiIcons.TRANSIENT_CLASS)); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbTypeItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbTypeItemLabelProvider.java deleted file mode 100644 index c97eb44550..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbTypeItemLabelProvider.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 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.jaxb21; - -import org.eclipse.jpt.common.ui.internal.jface.AbstractItemLabelProvider; -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbType; - - -public abstract class JaxbTypeItemLabelProvider - extends AbstractItemLabelProvider { - - protected JaxbTypeItemLabelProvider( - JaxbType jaxbType, DelegatingContentAndLabelProvider labelProvider) { - - super(jaxbType, labelProvider); - } - - @Override - public JaxbType getModel() { - return (JaxbType) super.getModel(); - } - - @Override - protected PropertyValueModel<String> buildTextModel() { - return new StaticPropertyValueModel<String>(getModel().getTypeQualifiedName()); - } - - @Override - protected PropertyValueModel<String> buildDescriptionModel() { - StringBuilder sb = new StringBuilder(); - sb.append(getModel().getFullyQualifiedName()); - sb.append(" - "); //$NON-NLS-1$ - sb.append(getModel().getResource().getFullPath().makeRelative()); - return new StaticPropertyValueModel<String>(sb.toString()); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb22/GenericJaxb_2_2_PlatformUi.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb22/GenericJaxb_2_2_PlatformUi.java deleted file mode 100644 index 3e2ad5efd9..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb22/GenericJaxb_2_2_PlatformUi.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * 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.jaxb22; - -import org.eclipse.jpt.jaxb.ui.internal.jaxb21.GenericJaxb_2_1_NavigatorUi; -import org.eclipse.jpt.jaxb.ui.navigator.JaxbNavigatorUi; -import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi; - - -public class GenericJaxb_2_2_PlatformUi - implements JaxbPlatformUi { - - public JaxbNavigatorUi getNavigatorUi() { - return GenericJaxb_2_1_NavigatorUi.instance(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorActionProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorActionProvider.java deleted file mode 100644 index b38d0d85a0..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorActionProvider.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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.navigator; - -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jpt.jaxb.ui.internal.actions.OpenJaxbResourceAction; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.actions.ActionContext; -import org.eclipse.ui.navigator.CommonActionProvider; -import org.eclipse.ui.navigator.ICommonActionConstants; -import org.eclipse.ui.navigator.ICommonActionExtensionSite; -import org.eclipse.ui.navigator.ICommonMenuConstants; - - -public class JaxbNavigatorActionProvider - extends CommonActionProvider { - - private OpenJaxbResourceAction openAction; - - - public JaxbNavigatorActionProvider() { - super(); - } - - - @Override - public void init(ICommonActionExtensionSite aConfig) { - this.openAction = new OpenJaxbResourceAction(); - } - - @Override - public void setContext(ActionContext aContext) { - if (aContext != null && aContext.getSelection() instanceof IStructuredSelection) { - IStructuredSelection selection = (IStructuredSelection) aContext.getSelection(); - this.openAction.selectionChanged(selection); - } - - super.setContext(aContext); - } - - @Override - public void fillActionBars(IActionBars theActionBars) { - if (this.openAction.isEnabled()) { - theActionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, this.openAction); - } - } - - @Override - public void fillContextMenu(IMenuManager aMenu) { - if (getContext() == null || getContext().getSelection().isEmpty()) { - return; - } - - if (this.openAction.isEnabled()) { - aMenu.insertAfter(ICommonMenuConstants.GROUP_OPEN, this.openAction); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentAndLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentAndLabelProvider.java deleted file mode 100644 index c4844b218a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentAndLabelProvider.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 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.navigator; - -import org.eclipse.jpt.common.ui.internal.jface.DelegatingTreeContentAndLabelProvider; - - -public class JaxbNavigatorContentAndLabelProvider - extends DelegatingTreeContentAndLabelProvider { - - public JaxbNavigatorContentAndLabelProvider() { - super(new JaxbNavigatorTreeItemContentProviderFactory(), new JaxbNavigatorItemLabelProviderFactory()); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentProvider.java deleted file mode 100644 index e23922e219..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentProvider.java +++ /dev/null @@ -1,232 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 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.navigator; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.JaxbProjectManager; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi; -import org.eclipse.ui.IMemento; -import org.eclipse.ui.navigator.ICommonContentExtensionSite; -import org.eclipse.ui.navigator.ICommonContentProvider; - -/** - * This extension of navigator content provider delegates to the platform UI - * (see the org.eclipse.jpt.jaxb.ui.jaxbPlatformUis extension point) for navigator content. - * - * If there is a platform UI for the given project, this content provider will - * provide a root "JAXB Content" node (child of the project), otherwise there - * will be no content. For children of the "JAXB Content" node (or for any other - * sub-node), this provider will delegate to the content provider returned by the - * platform UI implementation. - */ -public class JaxbNavigatorContentProvider - implements ICommonContentProvider { - - private JaxbNavigatorContentAndLabelProvider delegate; - - private final CollectionChangeListener jaxbProjectListener; - - private StructuredViewer viewer; - - - public JaxbNavigatorContentProvider() { - super(); - this.jaxbProjectListener = this.buildJaxbProjectListener(); - JptJaxbCorePlugin.getProjectManager().addCollectionChangeListener(JaxbProjectManager.JAXB_PROJECTS_COLLECTION, this.jaxbProjectListener); - } - - protected CollectionChangeListener buildJaxbProjectListener() { - return new JaxbProjectListener(); - } - - public JaxbNavigatorContentAndLabelProvider getDelegate() { - return this.delegate; - } - - - // **************** IContentProvider implementation ************************ - - public void dispose() { - JptJaxbCorePlugin.getProjectManager().removeCollectionChangeListener(JaxbProjectManager.JAXB_PROJECTS_COLLECTION, this.jaxbProjectListener); - if (this.delegate != null) { - this.delegate.dispose(); - } - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - if (this.delegate != null) { - this.delegate.inputChanged(viewer, oldInput, newInput); - } - this.viewer = (StructuredViewer) viewer; - } - - - // **************** IStructuredContentProvider implementation ************** - - public Object[] getElements(Object inputElement) { - return getChildren(inputElement); - } - - - // **************** ITreeContentProvider implementation ******************** - - public Object getParent(Object element) { - if (this.delegate != null) { - return this.delegate.getParent(element); - } - - return null; - } - - public boolean hasChildren(Object element) { - if (element instanceof IAdaptable) { - IProject project = (IProject) ((IAdaptable) element).getAdapter(IProject.class); - - if (project != null) { - JaxbProject jaxbProject = JptJaxbCorePlugin.getJaxbProject(project); - if (jaxbProject != null) { - JaxbPlatformDescription desc = jaxbProject.getPlatform().getDescription(); - JaxbPlatformUi platformUi = - JptJaxbUiPlugin.getJaxbPlatformUiManager().getJaxbPlatformUi(desc); - - return platformUi != null; - } - } - } - - if (this.delegate != null) { - return this.delegate.hasChildren(element); - } - - return false; - } - - public Object[] getChildren(Object parentElement) { - if (parentElement instanceof IAdaptable) { - IProject project = (IProject) ((IAdaptable) parentElement).getAdapter(IProject.class); - - if (project != null) { - JaxbProject jaxbProject = JptJaxbCorePlugin.getJaxbProject(project); - if (jaxbProject != null) { - JaxbPlatformDescription desc = jaxbProject.getPlatform().getDescription(); - JaxbPlatformUi platformUi = - JptJaxbUiPlugin.getJaxbPlatformUiManager().getJaxbPlatformUi(desc); - - if (platformUi != null) { - return new Object[] {jaxbProject.getContextRoot()}; - } - } - } - } - - if (this.delegate != null) { - return this.delegate.getChildren(parentElement); - } - - return new Object[0]; - } - - - // **************** IMementoAware implementation *************************** - - public void saveState(IMemento memento) { - // no op - } - - public void restoreState(IMemento memento) { - // no op - } - - - // **************** ICommonContentProvider implementation ****************** - - public void init(ICommonContentExtensionSite config) { - if (this.delegate == null) { - JaxbNavigatorLabelProvider labelProvider = (JaxbNavigatorLabelProvider) config.getExtension().getLabelProvider(); - if (labelProvider != null && labelProvider.getDelegate() != null) { - this.delegate = labelProvider.getDelegate(); - } - else { - this.delegate = new JaxbNavigatorContentAndLabelProvider(); - } - } - } - - - // **************** member classes ***************************************** - - private class JaxbProjectListener - implements CollectionChangeListener - { - public void collectionChanged(CollectionChangeEvent event) { - this.refreshViewer(null); - } - public void collectionCleared(CollectionClearEvent event) { - this.refreshViewer(null); - } - public void itemsAdded(CollectionAddEvent event) { - for (Object item : event.getItems()) { - this.refreshViewer(((JaxbProject) item).getProject()); - } - } - public void itemsRemoved(CollectionRemoveEvent event) { - for (Object item : event.getItems()) { - this.refreshViewer(((JaxbProject) item).getProject()); - } - } - - private void refreshViewer(final IProject project) { - if (viewer != null - && viewer.getControl() != null - && !viewer.getControl().isDisposed()) { - // Using job here so that project model update (which also uses - // a job) will complete first - Job refreshJob = new Job("Refresh viewer") { - @Override - protected IStatus run(IProgressMonitor monitor) { - // Using runnable here so that refresh will go on correct thread - viewer.getControl().getDisplay().asyncExec(new Runnable() { - public void run() { - if (project != null) { - viewer.refresh(project); - } - else { - viewer.refresh(); - } - } - }); - return Status.OK_STATUS; - } - }; - if (project != null) { - refreshJob.setRule(project); - } - refreshJob.schedule(); - } - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorItemLabelProviderFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorItemLabelProviderFactory.java deleted file mode 100644 index ee3b2cbeb3..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorItemLabelProviderFactory.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 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.navigator; - -import java.util.HashMap; -import java.util.Map; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.ui.jface.ItemLabelProvider; -import org.eclipse.jpt.common.ui.jface.ItemLabelProviderFactory; -import org.eclipse.jpt.jaxb.core.context.JaxbContextNode; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi; - -public class JaxbNavigatorItemLabelProviderFactory - implements ItemLabelProviderFactory { - - /** - * Exactly *one* of these factories is created for each view that utilizes it. - * Therefore, as we delegate to the platform UI for each project, we should - * maintain the same multiplicity. That is, if there is a delegate for each - * platform UI, we should maintain *one* delegate for each view. - * - * Key: platform description, Value: delegate content provider factory - */ - private final Map<JaxbPlatformDescription, ItemLabelProviderFactory> delegates; - - - public JaxbNavigatorItemLabelProviderFactory() { - super(); - this.delegates = new HashMap<JaxbPlatformDescription, ItemLabelProviderFactory>(); - } - - public ItemLabelProvider buildItemLabelProvider(Object item, DelegatingContentAndLabelProvider contentAndLabelProvider) { - ItemLabelProviderFactory delegate = getDelegate(item); - if (delegate != null) { - return delegate.buildItemLabelProvider(item, contentAndLabelProvider); - } - return null; - } - - - private ItemLabelProviderFactory getDelegate(Object element) { - if (! (element instanceof IAdaptable)) { - return null; - } - - JaxbContextNode contextNode = (JaxbContextNode) ((IAdaptable) element).getAdapter(JaxbContextNode.class); - - if (contextNode == null) { - return null; - } - - JaxbPlatformDescription platformDesc = contextNode.getJaxbProject().getPlatform().getDescription(); - if (delegates.containsKey(platformDesc)) { - return delegates.get(platformDesc); - } - JaxbPlatformUi platformUi = JptJaxbUiPlugin.getJaxbPlatformUiManager().getJaxbPlatformUi(platformDesc); - ItemLabelProviderFactory delegate = - (platformUi == null) ? null : platformUi.getNavigatorUi().getItemLabelProviderFactory(); - delegates.put(platformDesc, delegate); - return delegate; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorLabelProvider.java deleted file mode 100644 index 615a7bac26..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorLabelProvider.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 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.navigator; - -import org.eclipse.jface.viewers.ILabelProviderListener; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.IMemento; -import org.eclipse.ui.navigator.ICommonContentExtensionSite; -import org.eclipse.ui.navigator.ICommonLabelProvider; - -/** - * This extension of navigator label provider delegates to the platform UI - * (see the org.eclipse.jpt.ui.jpaPlatform extension point) for navigator labels. - * - * This label provider provides a label for the root "JPA Content" node provided - * by the content provider (see {@link JaxbNavigatorContentProvider}) and delegates - * to the label provider returned by the platform UI implementation for labels - * for children of the "JPA Content" node (or for any other sub-node). - */ -public class JaxbNavigatorLabelProvider - extends LabelProvider - implements ICommonLabelProvider { - - private JaxbNavigatorContentAndLabelProvider delegate; - - - public JaxbNavigatorLabelProvider() { - super(); - } - - - public JaxbNavigatorContentAndLabelProvider getDelegate() { - return delegate; - } - - - // **************** IBaseLabelProvider implementation ********************** - - @Override - public void addListener(ILabelProviderListener listener) { - if (delegate != null) { - delegate.addListener(listener); - } - super.addListener(listener); - } - - @Override - public void removeListener(ILabelProviderListener listener) { - super.removeListener(listener); - if (delegate != null) { - delegate.removeListener(listener); - } - } - - @Override - public boolean isLabelProperty(Object element, String property) { - if (delegate != null) { - return delegate.isLabelProperty(element, property); - } - - return super.isLabelProperty(element, property); - } - - @Override - public void dispose() { - if (delegate != null) { - delegate.dispose(); - } - super.dispose(); - } - - - // **************** ILabelProvider implementation ************************** - - @Override - public Image getImage(Object element) { - if (delegate != null) { - return delegate.getImage(element); - } - - return super.getImage(element); - } - - @Override - public String getText(Object element) { - if (delegate != null) { - return delegate.getText(element); - } - - return super.getText(element); - } - - - // **************** IDescriptionProvider implementation ******************** - - public String getDescription(Object element) { - if (delegate != null) { - return delegate.getDescription(element); - } - - return super.getText(element); - } - - - // **************** IMementoAware implementation *************************** - - public void saveState(IMemento memento) { - // no op - } - - public void restoreState(IMemento memento) { - // no op - } - - - // **************** ICommonLabelProvider implementation ******************** - - public void init(ICommonContentExtensionSite config) { - if (delegate == null) { - JaxbNavigatorContentProvider contentProvider = (JaxbNavigatorContentProvider) config.getExtension().getContentProvider(); - if (contentProvider != null && contentProvider.getDelegate() != null) { - delegate = contentProvider.getDelegate(); - } - else { - delegate = new JaxbNavigatorContentAndLabelProvider(); - } - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorTreeItemContentProviderFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorTreeItemContentProviderFactory.java deleted file mode 100644 index 567fbb04f1..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorTreeItemContentProviderFactory.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 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.navigator; - -import java.util.HashMap; -import java.util.Map; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.ui.jface.TreeItemContentProvider; -import org.eclipse.jpt.common.ui.jface.TreeItemContentProviderFactory; -import org.eclipse.jpt.jaxb.core.context.JaxbContextNode; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi; - -public class JaxbNavigatorTreeItemContentProviderFactory - implements TreeItemContentProviderFactory { - - /** - * Exactly *one* of these factories is created for each view that utilizes it. - * Therefore, as we delegate to the platform UI for each project, we should - * maintain the same multiplicity. That is, if there is a delegate for each - * platform UI, we should maintain *one* delegate for each view. - * - * Key: platform id, Value: delegate content provider factory - */ - private Map<JaxbPlatformDescription, TreeItemContentProviderFactory> delegates; - - - public JaxbNavigatorTreeItemContentProviderFactory() { - super(); - this.delegates = new HashMap<JaxbPlatformDescription, TreeItemContentProviderFactory>(); - } - - public TreeItemContentProvider buildItemContentProvider(Object item, DelegatingContentAndLabelProvider contentAndLabelProvider) { - TreeItemContentProviderFactory delegate = getDelegate(item); - if (delegate != null) { - return delegate.buildItemContentProvider(item, contentAndLabelProvider); - } - return null; - } - - - private TreeItemContentProviderFactory getDelegate(Object element) { - if (! (element instanceof IAdaptable)) { - return null; - } - - JaxbContextNode contextNode = (JaxbContextNode) ((IAdaptable) element).getAdapter(JaxbContextNode.class); - - if (contextNode == null) { - return null; - } - - JaxbPlatformDescription platformDesc = contextNode.getJaxbProject().getPlatform().getDescription(); - if (delegates.containsKey(platformDesc)) { - return delegates.get(platformDesc); - } - JaxbPlatformUi platformUi = JptJaxbUiPlugin.getJaxbPlatformUiManager().getJaxbPlatformUi(platformDesc); - TreeItemContentProviderFactory delegate = - (platformUi == null) ? null : platformUi.getNavigatorUi().getTreeItemContentProviderFactory(); - delegates.put(platformDesc, delegate); - return delegate; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/platform/JaxbPlatformUiConfig.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/platform/JaxbPlatformUiConfig.java deleted file mode 100644 index b9d905d198..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/platform/JaxbPlatformUiConfig.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 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.platform; - -import org.eclipse.jpt.common.core.internal.utility.XPointTools; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi; - -public class JaxbPlatformUiConfig { - - private String id; - private String pluginId; - private JaxbPlatformDescription jaxbPlatform; - private String className; - private JaxbPlatformUi platformUi; - - - JaxbPlatformUiConfig() { - super(); - } - - - public String getId() { - return this.id; - } - - void setId(String id) { - this.id = id; - } - - public String getPluginId() { - return this.pluginId; - } - - void setPluginId(String pluginId) { - this.pluginId = pluginId; - } - - public JaxbPlatformDescription getJaxbPlatform() { - return this.jaxbPlatform; - } - - void setJaxbPlatform(JaxbPlatformDescription jaxbPlatform) { - this.jaxbPlatform = jaxbPlatform; - } - - public String getClassName() { - return this.className; - } - - void setClassName(String className) { - this.className = className; - } - - public JaxbPlatformUi getPlatformUi() { - if (this.platformUi == null) { - this.platformUi = XPointTools.instantiate( - this.pluginId, JaxbPlatformUiManagerImpl.QUALIFIED_EXTENSION_POINT_ID, - this.className, JaxbPlatformUi.class); - } - return this.platformUi; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/platform/JaxbPlatformUiManagerImpl.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/platform/JaxbPlatformUiManagerImpl.java deleted file mode 100644 index 9a82bc98d8..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/platform/JaxbPlatformUiManagerImpl.java +++ /dev/null @@ -1,133 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 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.platform; - -import static org.eclipse.jpt.common.core.internal.utility.XPointTools.*; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jpt.common.core.internal.utility.XPointTools.XPointException; -import org.eclipse.jpt.common.utility.internal.KeyedSet; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi; -import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUiManager; - -public class JaxbPlatformUiManagerImpl - implements JaxbPlatformUiManager { - - static final String EXTENSION_POINT_ID = "jaxbPlatformUis"; //$NON-NLS-1$ - static final String QUALIFIED_EXTENSION_POINT_ID = JptJaxbUiPlugin.PLUGIN_ID_ + EXTENSION_POINT_ID; //$NON-NLS-1$ - static final String PLATFORM_UI_ELEMENT = "jaxbPlatformUi"; //$NON-NLS-1$ - static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$ - static final String PLATFORM_ATTRIBUTE = "jaxbPlatform"; //$NON-NLS-1$ - static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$ - - - private static final JaxbPlatformUiManagerImpl INSTANCE = new JaxbPlatformUiManagerImpl(); - - - public static JaxbPlatformUiManagerImpl instance() { - return INSTANCE; - } - - - private KeyedSet<String, JaxbPlatformUiConfig> platformUiConfigs; - private KeyedSet<JaxbPlatformDescription, JaxbPlatformUiConfig> platformToUiConfigs; - - - // ********** constructor/initialization ********** - - private JaxbPlatformUiManagerImpl() { - super(); - this.platformUiConfigs = new KeyedSet<String, JaxbPlatformUiConfig>(); - this.platformToUiConfigs = new KeyedSet<JaxbPlatformDescription, JaxbPlatformUiConfig>(); - readExtensions(); - } - - - private void readExtensions() { - final IExtensionRegistry registry = Platform.getExtensionRegistry(); - - final IExtensionPoint xpoint - = registry.getExtensionPoint(JptJaxbUiPlugin.PLUGIN_ID, EXTENSION_POINT_ID); - - if (xpoint == null) { - throw new IllegalStateException(); - } - - List<IConfigurationElement> platformUiConfigs = new ArrayList<IConfigurationElement>(); - - for (IExtension extension : xpoint.getExtensions()) { - for (IConfigurationElement configElement : extension.getConfigurationElements()) { - if (configElement.getName().equals(PLATFORM_UI_ELEMENT)) { - platformUiConfigs.add(configElement); - } - } - } - - for (IConfigurationElement configElement: platformUiConfigs) { - readPlatformUiExtension(configElement); - } - } - - private void readPlatformUiExtension(IConfigurationElement element) { - try { - JaxbPlatformUiConfig platformUiConfig = new JaxbPlatformUiConfig(); - - // plug-in id - platformUiConfig.setPluginId(element.getContributor().getName()); - - // id - platformUiConfig.setId(findRequiredAttribute(element, ID_ATTRIBUTE)); - - if (this.platformUiConfigs.containsKey(platformUiConfig.getId())) { - logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, ID_ATTRIBUTE, platformUiConfig.getId()); - throw new XPointException(); - } - - // jaxb platform id - String jaxbPlatformId = findRequiredAttribute(element, PLATFORM_ATTRIBUTE); - JaxbPlatformDescription jaxbPlatform = - JptJaxbCorePlugin.getJaxbPlatformManager().getJaxbPlatform(jaxbPlatformId); - - if (jaxbPlatform == null) { - logInvalidValue(element, PLATFORM_ATTRIBUTE, jaxbPlatformId); - } - - if (this.platformToUiConfigs.containsKey(jaxbPlatform)) { - logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, PLATFORM_ATTRIBUTE, jaxbPlatformId); - throw new XPointException(); - } - - platformUiConfig.setJaxbPlatform(jaxbPlatform); - - // class - platformUiConfig.setClassName(findRequiredAttribute(element, CLASS_ATTRIBUTE)); - - this.platformUiConfigs.addItem(platformUiConfig.getId(), platformUiConfig); - this.platformToUiConfigs.addItem(jaxbPlatform, platformUiConfig); - } - catch (XPointException e) { - // Ignore and continue. The problem has already been reported to the user - // in the log. - } - } - - public JaxbPlatformUi getJaxbPlatformUi(JaxbPlatformDescription platformDesc) { - JaxbPlatformUiConfig config = this.platformToUiConfigs.getItem(platformDesc); - return (config == null) ? null : config.getPlatformUi(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectModel.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectModel.java deleted file mode 100644 index 96fb670b28..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectModel.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.eclipse.jpt.jaxb.ui.internal.properties; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jpt.common.utility.internal.model.value.AspectPropertyValueModelAdapter; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.JaxbProjectManager; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; - -/** - * Treat the JAXB project as an "aspect" of the Eclipse project (IProject); - * but the JAXB project is stored in the JAXB model, not the Eclipse project - * itself.... - * We also need to listen for the JAXB project to be rebuilt if the user - * changes the Eclipse project's JAXB platform (which is stored in the - * Eclipse project's preferences). - */ -class JaxbProjectModel - extends AspectPropertyValueModelAdapter<IProject, JaxbProject> { - - /** - * The JAXB project may also change via another page (notably, the project facets page). - * In that case, the preference change occurs before we actually have another project, - * so we must listen to the projects manager - */ - private final CollectionChangeListener projectManagerListener; - - - JaxbProjectModel(PropertyValueModel<IProject> projectModel) { - super(projectModel); - this.projectManagerListener = buildProjectManagerListener(); - } - - private CollectionChangeListener buildProjectManagerListener() { - return new CollectionChangeAdapter() { - // we are only looking for the project rebuild *add* event here so we can - // determine if the platform has changed. - // the other events are unimportant in this case - @Override - public void itemsAdded(CollectionAddEvent event) { - platformChanged(); - } - }; - } - - void platformChanged() { - this.propertyChanged(); - } - - @Override - protected void engageSubject_() { - JptJaxbCorePlugin.getProjectManager().addCollectionChangeListener( - JaxbProjectManager.JAXB_PROJECTS_COLLECTION, - this.projectManagerListener); - } - - @Override - protected void disengageSubject_() { - JptJaxbCorePlugin.getProjectManager().removeCollectionChangeListener( - JaxbProjectManager.JAXB_PROJECTS_COLLECTION, - this.projectManagerListener); - } - - @Override - protected JaxbProject buildValue_() { - return JptJaxbCorePlugin.getJaxbProject(this.subject); - } -}
\ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java deleted file mode 100644 index b9eadb8d96..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java +++ /dev/null @@ -1,320 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 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.properties; - -import static org.eclipse.jst.common.project.facet.ui.libprov.LibraryProviderFrameworkUi.createInstallLibraryPanel; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.Map; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jpt.common.core.internal.utility.ICUStringCollator; -import org.eclipse.jpt.common.ui.internal.properties.JptProjectPropertiesPage; -import org.eclipse.jpt.common.ui.internal.utility.swt.SWTTools; -import org.eclipse.jpt.common.utility.internal.StringConverter; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.model.value.AspectPropertyValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.BufferedWritablePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.CompositeCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyCollectionValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SetCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SortedListValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.StaticCollectionValueModel; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.jaxb.core.JaxbFacet; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.libprov.JaxbLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperationConfig; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Group; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -/** - * Way more complicated UI than you would think.... - */ -public class JaxbProjectPropertiesPage - extends JptProjectPropertiesPage { - - public static final String PROP_ID = "org.eclipse.jpt.jaxb.ui.jaxbProjectPropertiesPage"; //$NON-NLS-1$ - - private PropertyValueModel<JaxbProject> jaxbProjectModel; - - private BufferedWritablePropertyValueModel<JaxbPlatformDescription> platformModel; - private PropertyChangeListener platformListener; - - /* private */ static final Comparator<String> STRING_COMPARATOR = new ICUStringCollator(); - - // ************ construction ************ - - public JaxbProjectPropertiesPage() { - super(); - } - - - @Override - protected void buildModels() { - this.jaxbProjectModel = new JaxbProjectModel(this.projectModel); - - this.platformModel = this.buildPlatformModel(); - this.platformListener = this.buildPlatformListener(); - } - - - // ***** platform ID model - - private BufferedWritablePropertyValueModel<JaxbPlatformDescription> buildPlatformModel() { - return new BufferedWritablePropertyValueModel<JaxbPlatformDescription>( - new PlatformModel(this.jaxbProjectModel), this.trigger); - } - - private PropertyChangeListener buildPlatformListener(){ - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - JaxbProjectPropertiesPage.this.platformChanged((JaxbPlatformDescription) event.getNewValue()); - } - }; - } - - void platformChanged(JaxbPlatformDescription newPlatform) { - if ( ! this.getControl().isDisposed()) { - // handle null, in the case the jpa facet is changed via the facets page, - // the library install delegate is temporarily null - adjustLibraryProviders(); - } - } - - - // ********** LibraryFacetPropertyPage implementation ********** - - @Override - public IProjectFacetVersion getProjectFacetVersion() { - return this.getFacetedProject().getInstalledVersion(JaxbFacet.FACET); - } - - @Override - protected LibraryInstallDelegate createLibraryInstallDelegate(IFacetedProject project, IProjectFacetVersion fv) { - LibraryInstallDelegate lid = new LibraryInstallDelegate(project, fv); - lid.addListener(buildLibraryProviderListener()); - return lid; - } - - @Override - protected void adjustLibraryProviders() { - LibraryInstallDelegate lid = this.getLibraryInstallDelegate(); - if (lid != null) { - List<JaxbLibraryProviderInstallOperationConfig> jaxbConfigs - = new ArrayList<JaxbLibraryProviderInstallOperationConfig>(); - // add the currently selected one first - JaxbLibraryProviderInstallOperationConfig currentJaxbConfig = null; - LibraryProviderOperationConfig config = lid.getLibraryProviderOperationConfig(); - if (config instanceof JaxbLibraryProviderInstallOperationConfig) { - currentJaxbConfig = (JaxbLibraryProviderInstallOperationConfig) config; - jaxbConfigs.add(currentJaxbConfig); - } - for (ILibraryProvider lp : lid.getLibraryProviders()) { - config = lid.getLibraryProviderOperationConfig(lp); - if (config instanceof JaxbLibraryProviderInstallOperationConfig - && ! config.equals(currentJaxbConfig)) { - jaxbConfigs.add((JaxbLibraryProviderInstallOperationConfig) config); - } - } - for (JaxbLibraryProviderInstallOperationConfig jaxbConfig : jaxbConfigs) { - jaxbConfig.setJaxbPlatform(this.platformModel.getValue()); - } - } - } - - - // ********** page ********** - - @Override - protected void createWidgets(Composite parent) { - buildPlatformGroup(parent); - - Control libraryProviderComposite = createInstallLibraryPanel( - parent, - getLibraryInstallDelegate(), - JptJaxbUiMessages.JaxbFacetWizardPage_jaxbImplementationLabel); - - libraryProviderComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - -// PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, JaxbHelpContextIds.PROPERTIES_JAVA_PERSISTENCE); - } - - @Override - protected void engageListeners() { - super.engageListeners(); - this.platformModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.platformListener); - } - - @Override - public void disengageListeners() { - this.platformModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.platformListener); - super.disengageListeners(); - } - - - // ********** platform group ********** - - private void buildPlatformGroup(Composite composite) { - Group group = new Group(composite, SWT.NONE); - group.setText(JptJaxbUiMessages.JaxbFacetWizardPage_platformLabel); - group.setLayout(new GridLayout()); - group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - Combo platformDropDown = this.buildDropDown(group); - SWTTools.bind( - buildPlatformChoicesModel(), - this.platformModel, - platformDropDown, - JAXB_PLATFORM_LABEL_CONVERTER); - - buildFacetsPageLink(group, JptJaxbUiMessages.JaxbFacetWizardPage_facetsPageLink); - } - - /** - * Add the project's JAXB platform if it is not on the list of valid - * platforms. - * <p> - * This is probably only useful if the project is corrupted - * and has a platform that exists in the registry but is not on the - * list of valid platforms for the project's JAXB facet version. - * Because, if the project's JAXB platform is completely invalid, there - * would be no JAXB project! - */ - @SuppressWarnings("unchecked") - private ListValueModel<JaxbPlatformDescription> buildPlatformChoicesModel() { - return new SortedListValueModelAdapter<JaxbPlatformDescription>( - new SetCollectionValueModel<JaxbPlatformDescription>( - new CompositeCollectionValueModel<CollectionValueModel<JaxbPlatformDescription>, JaxbPlatformDescription>( - new PropertyCollectionValueModelAdapter<JaxbPlatformDescription>(this.platformModel), - buildRegistryPlatformsModel())), - JAXB_PLATFORM_COMPARATOR); - } - - private CollectionValueModel<JaxbPlatformDescription> buildRegistryPlatformsModel() { - Iterable<JaxbPlatformDescription> enabledPlatforms = - new FilteringIterable<JaxbPlatformDescription>( - JptJaxbCorePlugin.getJaxbPlatformManager().getJaxbPlatforms()) { - @Override - protected boolean accept(JaxbPlatformDescription o) { - return o.supportsJaxbFacetVersion(getProjectFacetVersion()); - } - }; - return new StaticCollectionValueModel<JaxbPlatformDescription>(enabledPlatforms); - } - - private static final Comparator<JaxbPlatformDescription> JAXB_PLATFORM_COMPARATOR = - new Comparator<JaxbPlatformDescription>() { - public int compare(JaxbPlatformDescription desc1, JaxbPlatformDescription desc2) { - return STRING_COMPARATOR.compare(desc1.getLabel(), desc2.getLabel()); - } - }; - - private static final StringConverter<JaxbPlatformDescription> JAXB_PLATFORM_LABEL_CONVERTER = - new StringConverter<JaxbPlatformDescription>() { - public String convertToString(JaxbPlatformDescription desc) { - return desc.getLabel(); - } - }; - - - // ********** OK/Revert/Apply behavior ********** - - @Override - protected boolean projectRebuildRequired() { - return this.platformModel.isBuffering(); - } - - @Override - protected void rebuildProject() { - // if the JAXB platform is changed, we need to completely rebuild the JAXB project - JptJaxbCorePlugin.getProjectManager().rebuildJaxbProject(getProject()); - } - - @Override - protected BufferedWritablePropertyValueModel<?>[] buildBufferedModels() { - return new BufferedWritablePropertyValueModel[] { - this.platformModel - }; - } - - - // ********** validation ********** - - @Override - protected Model[] buildValidationModels() { - return new Model[] { - platformModel - }; - } - - @Override - protected void performValidation(Map<Integer, ArrayList<IStatus>> statuses) { - /* platform */ - // user is unable to unset the platform, so no validation necessary - - /* library provider */ - super.performValidation(statuses); - } - - - // ********** UI model adapters ********** - - /** - * Treat the JAXB platform as an "aspect" of the JAXB project. - * The platform ID is stored in the project preferences. - * The platform ID does not change for a JAXB project - if the user wants a - * different platform, we build an entirely new JAXB project. - */ - static class PlatformModel - extends AspectPropertyValueModelAdapter<JaxbProject, JaxbPlatformDescription> { - - PlatformModel(PropertyValueModel<JaxbProject> jaxbProjectModel) { - super(jaxbProjectModel); - } - - @Override - protected JaxbPlatformDescription buildValue_() { - return this.subject.getPlatform().getDescription(); - } - - @Override - public void setValue_(JaxbPlatformDescription newPlatform) { - JptJaxbCorePlugin.setJaxbPlatform(this.subject.getProject(), newPlatform); - } - - @Override - protected void engageSubject_() { - // the platform ID does not change - } - - @Override - protected void disengageSubject_() { - // the platform ID does not change - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java deleted file mode 100644 index 5667c41aa4..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java +++ /dev/null @@ -1,962 +0,0 @@ -/******************************************************************************* - * 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.properties; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.EventListener; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.common.util.URI; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.dialogs.TitleAreaDialog; -import org.eclipse.jface.dialogs.TrayDialog; -import org.eclipse.jface.layout.TableColumnLayout; -import org.eclipse.jface.operation.IRunnableContext; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.ColumnViewerToolTipSupport; -import org.eclipse.jface.viewers.ColumnWeightData; -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.window.ToolTip; -import org.eclipse.jface.window.Window; -import org.eclipse.jpt.common.ui.internal.swt.ColumnAdapter; -import org.eclipse.jpt.common.ui.internal.swt.TableModelAdapter; -import org.eclipse.jpt.common.ui.internal.utility.swt.SWTTools; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.AspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.BufferedWritablePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.CollectionPropertyValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SortedListValueModelAdapter; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritableCollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.xsd.XsdUtil; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen.SelectFileOrXMLCatalogIdPanel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -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.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.PropertyPage; -import org.eclipse.wst.xsd.contentmodel.internal.XSDImpl; -import org.eclipse.xsd.XSDSchema; - -/** - * Shows the schemas associated with a JAXB project - */ -public class JaxbSchemasPropertiesPage - extends PropertyPage { - - private static final int SIZING_SELECTION_PANE_WIDTH = 450; - - - protected final WritablePropertyValueModel<IProject> projectModel; - - private final PropertyValueModel<JaxbProject> jaxbProjectModel; - - protected final BufferedWritablePropertyValueModel.Trigger trigger; - - private final SchemasModel schemasModel; - - private final WritableCollectionValueModel<Schema> schemasSelectionModel; - - - public JaxbSchemasPropertiesPage() { - super(); - this.projectModel = new SimplePropertyValueModel<IProject>(); - this.jaxbProjectModel = new JaxbProjectModel(this.projectModel); - this.trigger = new BufferedWritablePropertyValueModel.Trigger(); - this.schemasModel = new SchemasModel(this.jaxbProjectModel, this.trigger); - this.schemasSelectionModel = new SimpleCollectionValueModel<Schema>(); - setDescription(JptJaxbUiMessages.SchemasPage_description); - } - - - protected IProject getProject() { - return this.projectModel.getValue(); - } - - @Override - public final void createControl(Composite parent ) { - super.createControl( parent ); - - Button revertButton = getDefaultsButton(); - - revertButton.setText(JptJaxbUiMessages.SchemasPage_revert); - - GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - Point minButtonSize = revertButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); - gd.widthHint = Math.max(convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH), minButtonSize.x); - revertButton.setLayoutData(gd); - - updateButtons(); - - getShell().layout(true, true); - } - - @Override - protected final Control createContents(Composite parent) { - IAdaptable element = getElement(); - - IProject project = null; - if (element instanceof IProject) { - project = (IProject) element; - } - else { - project = (IProject) Platform.getAdapterManager().loadAdapter(element, IProject.class.getName()); - } - - this.projectModel.setValue(project); - - Composite pageComponent = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - layout.marginWidth = 0; - layout.marginHeight = 0; - pageComponent.setLayout(layout); - GridData data = new GridData(GridData.FILL_BOTH); - data.widthHint = SIZING_SELECTION_PANE_WIDTH; - pageComponent.setLayoutData(data); - - Label schemasLabel = new Label(pageComponent, SWT.LEFT); - schemasLabel.setText(JptJaxbUiMessages.SchemasPage_schemas); - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.horizontalSpan = 2; - schemasLabel.setLayoutData(data); - - // create the table composite - Composite tableComposite = new Composite(pageComponent, SWT.NONE); - data = new GridData(SWT.FILL, SWT.FILL, true, true); - data.grabExcessHorizontalSpace = true; - data.grabExcessVerticalSpace = true; - data.widthHint = SIZING_SELECTION_PANE_WIDTH; - tableComposite.setLayoutData(data); - - // create the table - TableViewer schemasTable = new TableViewer(tableComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI); - TableModelAdapter.adapt( - new SortedListValueModelAdapter<Schema>(this.schemasModel), - this.schemasSelectionModel, - schemasTable.getTable(), - new SchemaColumnAdapter(), - new SchemaTableLabelProvider()); - ColumnViewerToolTipSupport.enableFor(schemasTable, ToolTip.NO_RECREATE); - schemasTable.getTable().setHeaderVisible(true); - schemasTable.getTable().setToolTipText(null); - - // set the table composite layout (after the table, so that column information is available) - TableColumnLayout tableLayout = new TableColumnLayout(); - tableLayout.setColumnData(schemasTable.getTable().getColumn(0), new ColumnWeightData(15)); - tableLayout.setColumnData(schemasTable.getTable().getColumn(1), new ColumnWeightData(25)); - tableComposite.setLayout(tableLayout); - - // set the table layout data - data = new GridData(GridData.FILL_BOTH); - data.heightHint = schemasTable.getTable().getItemHeight() * 7; - data.widthHint = 200; - schemasTable.getTable().setLayoutData(data); - - createButtonGroup(pageComponent); - - Dialog.applyDialogFont(parent); - - return pageComponent; - } - - protected void createButtonGroup(Composite parent) { - Composite groupComponent = new Composite(parent, SWT.NULL); - GridLayout groupLayout = new GridLayout(); - groupLayout.marginWidth = 0; - groupLayout.marginHeight = 0; - groupComponent.setLayout(groupLayout); - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - groupComponent.setLayoutData(data); - - Button addButton = new Button(groupComponent, SWT.PUSH); - addButton.setText(JptJaxbUiMessages.SchemasPage_addButtonLabel); - addButton.addSelectionListener( - new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - addSchema(); - } - }); - setButtonLayoutData(addButton); - - Button editButton = new Button(groupComponent, SWT.PUSH); - editButton.setText(JptJaxbUiMessages.SchemasPage_editButtonLabel); - editButton.addSelectionListener( - new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - editSelectedSchema(); - } - }); - SWTTools.controlEnabledState(buildEditEnabledModel(), editButton); - setButtonLayoutData(editButton); - - Button removeButton = new Button(groupComponent, SWT.PUSH); - removeButton.setText(JptJaxbUiMessages.SchemasPage_removeButtonLabel); - removeButton.addSelectionListener( - new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - removeSelectedSchemas(); - } - }); - SWTTools.controlEnabledState(buildRemoveEnabledModel(), removeButton); - setButtonLayoutData(removeButton); - } - - - private void addSchema() { - // constructs a dialog for editing the new schema namespace and location - AddEditSchemaDialog dialog = - new AddEditSchemaDialog( - getShell(), - null, - this.schemasModel.getValue()); - - // opens the dialog - just returns if the user cancels it - if (dialog.open() == Window.CANCEL) { - return; - } - - // otherwise, adds the new schema - Schema schema = this.schemasModel.addSchema(dialog.getNamespace(), dialog.getLocation()); - - // select the new schema - this.schemasSelectionModel.setValues(new SingleElementIterable<Schema>(schema)); - } - - private PropertyValueModel<Boolean> buildEditEnabledModel() { - return new CollectionPropertyValueModelAdapter<Boolean>(this.schemasSelectionModel) { - @Override - protected Boolean buildValue() { - return this.collectionModel.size() == 1; - } - }; - } - - private void editSelectedSchema() { - // constructs a dialog for editing the new schema namespace and location - final Schema schema = this.schemasSelectionModel.iterator().next(); - AddEditSchemaDialog dialog = - new AddEditSchemaDialog( - getShell(), - schema, - this.schemasModel.getValue()); - - // opens the dialog - just returns if the user cancels it - if (dialog.open() == Window.CANCEL) { - return; - } - - // otherwise, changes the new schema - schema.setNamespace(dialog.getNamespace()); - schema.setLocation(dialog.getLocation()); - } - - private PropertyValueModel<Boolean> buildRemoveEnabledModel() { - return new CollectionPropertyValueModelAdapter<Boolean>(this.schemasSelectionModel) { - @Override - protected Boolean buildValue() { - return this.collectionModel.size() >= 1; - } - }; - } - - private void removeSelectedSchemas() { - this.schemasModel.removeSchemas(CollectionTools.iterable(this.schemasSelectionModel.iterator())); - } - - private void updateButtons() { - boolean enableApply = isValid(); - boolean enableRevert = true; - - Button applyButton = getApplyButton(); - - if (applyButton != null) { - applyButton.setEnabled(enableApply); - } - - Button revertButton = getDefaultsButton(); - - if (revertButton != null) { - revertButton.setEnabled(enableRevert); - } - } - - - // ********** OK/Revert/Apply behavior ********** - - @Override - public boolean performOk() { - try { - // true=fork; false=uncancellable - this.buildOkProgressMonitorDialog().run(true, false, this.buildOkRunnableWithProgress()); - } - catch (InterruptedException ex) { - return false; - } - catch (InvocationTargetException ex) { - throw new RuntimeException(ex.getTargetException()); - } - - return true; - } - - private IRunnableContext buildOkProgressMonitorDialog() { - return new ProgressMonitorDialog(this.getShell()); - } - - private IRunnableWithProgress buildOkRunnableWithProgress() { - return new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - IWorkspace ws = ResourcesPlugin.getWorkspace(); - try { - // the build we execute in #performOk_() locks the workspace root, - // so we need to use the workspace root as our scheduling rule here - ws.run( - buildOkWorkspaceRunnable(), - ws.getRoot(), - IWorkspace.AVOID_UPDATE, - monitor); - } - catch (CoreException ex) { - throw new InvocationTargetException(ex); - } - } - }; - } - - /* private */ IWorkspaceRunnable buildOkWorkspaceRunnable() { - return new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - performOk_(monitor); - } - }; - } - - void performOk_(IProgressMonitor monitor) throws CoreException { - if (this.schemasModel.hasChanges()) { - this.trigger.accept(); - JptJaxbCorePlugin.getProjectManager().rebuildJaxbProject(getProject()); - getProject().build(IncrementalProjectBuilder.FULL_BUILD, monitor); - } - } - - @Override - protected void performDefaults() { - this.trigger.reset(); - } - - @Override - public void dispose() { - - super.dispose(); - } - - - static class SchemasModel - extends AspectAdapter<JaxbProject> - implements CollectionValueModel<Schema> { - - /** - * The collection of schemas - */ - protected final Collection<Schema> schemas; - - /** - * This is the trigger that indicates whether the buffered value - * should be accepted or reset. - */ - protected final PropertyValueModel<Boolean> triggerHolder; - - /** This listens to the trigger holder. */ - protected final PropertyChangeListener triggerChangeListener; - - - SchemasModel(PropertyValueModel<JaxbProject> subjectHolder, PropertyValueModel<Boolean> triggerHolder) { - super(subjectHolder); - this.schemas = new ArrayList<Schema>(); - this.triggerHolder = triggerHolder; - this.triggerChangeListener = buildTriggerChangeListener(); - } - - - protected PropertyChangeListener buildTriggerChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - triggerChanged(event); - } - }; - } - - protected Collection<Schema> buildSchemas_() { - ArrayList<Schema> schemas = new ArrayList<Schema>(); - for (Map.Entry<String, String> entry : this.subject.getSchemaLibrary().getSchemaLocations().entrySet()) { - schemas.add(new Schema(entry.getKey(), entry.getValue())); - } - return schemas; - } - - public boolean hasChanges() { - return (this.subject == null) ? false : ! this.schemas.equals(buildSchemas_()); - } - - protected void triggerChanged(PropertyChangeEvent event) { - if (hasChanges()) { - if (this.subject != null && ((Boolean) event.getNewValue()).booleanValue()) { - this.accept(); - } else { - this.reset(); - } - } - } - - public void accept() { - Map<String, String> schemaLocations = new HashMap<String, String>(); - for (Schema schema : this.schemas) { - schemaLocations.put(schema.getNamespace(), schema.getLocation()); - } - this.subject.getSchemaLibrary().setSchemaLocations(schemaLocations); - } - - public void reset() { - this.schemas.clear(); - if (this.subject != null) { - this.schemas.addAll(buildSchemas_()); - } - fireCollectionChanged(VALUES, getValue()); - } - - public Schema addSchema(String namespace, String location) { - Schema schema = new Schema(namespace, location); - addItemToCollection(schema, this.schemas, VALUES); - return schema; - } - - public void removeSchemas(Iterable<Schema> schemas) { - removeItemsFromCollection(schemas, this.schemas, VALUES); - } - - - // ************ AspectAdapter impl ************************************ - - @Override - protected String getListenerAspectName() { - return VALUES; - } - - @Override - protected Class<? extends EventListener> getListenerClass() { - return CollectionChangeListener.class; - } - - @Override - protected boolean hasListeners() { - return hasAnyCollectionChangeListeners(VALUES); - } - - @Override - protected void fireAspectChanged(Object oldValue, Object newValue) { - fireCollectionChanged(VALUES, getValue()); - } - - @Override - protected void engageSubject_() { - this.schemas.addAll(buildSchemas_()); - } - - @Override - protected void disengageSubject_() { - this.schemas.clear(); - } - - @Override - protected void engageModels() { - super.engageModels(); - this.triggerHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.triggerChangeListener); - } - - @Override - protected void disengageModels() { - this.triggerHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.triggerChangeListener); - super.disengageModels(); - } - - @Override - protected Collection<Schema> getValue() { - return CollectionTools.collection(iterator()); - } - - - // ************ CollectionValueModel impl ***************************** - - public Iterator<Schema> iterator() { - return this.schemas.iterator(); - } - - public int size() { - return this.schemas.size(); - } - } - - - static class Schema - extends AbstractModel - implements Comparable<Schema> { - - static String locationDisplayString(String location) { - if (location == null) { - return ""; - } - - URI uri = URI.createURI(location); - if (uri.isPlatformResource()) { - return uri.toPlatformString(false); - } - - return location; - } - - static String namespaceDisplayString(String namespace) { - if ("".equals(namespace)) { - return JptJaxbUiMessages.SchemasPage_noNamespaceText; - } - else if (null == namespace) { - return ""; - } - - return namespace; - } - - Schema(String namespace, String location) { - super(); - this.namespace = namespace; - this.location = location; - } - - - private String namespace; - final static String NAMESPACE_PROPERTY = "namespace"; - - private String location; - final static String LOCATION_PROPERTY = "location"; - - - String getNamespace() { - return this.namespace; - } - - void setNamespace(String namespace) { - String old = this.namespace; - this.namespace = namespace; - firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); - } - - String namespaceDisplayString() { - return namespaceDisplayString(this.namespace); - } - - String getLocation() { - return this.location; - } - - String locationDisplayString() { - return locationDisplayString(getLocation()); - } - - void setLocation(String location) { - String old = this.location; - this.location = location; - firePropertyChanged(LOCATION_PROPERTY, old, location); - } - - public int compareTo(Schema o) { - return this.namespace.compareTo(o.namespace); - } - } - - - static class SchemaColumnAdapter - implements ColumnAdapter<Schema> { - - static final int COLUMN_COUNT = 2; - static final int NAMESPACE_COLUMN = 0; - static final int LOCATION_COLUMN = 1; - - - public int columnCount() { - return COLUMN_COUNT; - } - - public String columnName(int columnIndex) { - switch (columnIndex) { - case NAMESPACE_COLUMN : - return JptJaxbUiMessages.SchemasPage_namespaceColumnLabel; - case LOCATION_COLUMN : - return JptJaxbUiMessages.SchemasPage_locationColumnLabel; - default : - return null; - } - } - - public WritablePropertyValueModel<?>[] cellModels(Schema subject) { - WritablePropertyValueModel<?>[] cellModels = new WritablePropertyValueModel<?>[COLUMN_COUNT]; - cellModels[NAMESPACE_COLUMN] = buildNamespaceCellModel(subject); - cellModels[LOCATION_COLUMN] = buildLocationCellModel(subject); - return cellModels; - } - - private WritablePropertyValueModel<String> buildNamespaceCellModel(Schema subject) { - return new PropertyAspectAdapter<Schema, String>(Schema.NAMESPACE_PROPERTY, subject) { - @Override - protected String buildValue_() { - return this.subject.getNamespace(); - } - }; - } - - private WritablePropertyValueModel<String> buildLocationCellModel(Schema subject) { - return new PropertyAspectAdapter<Schema, String>(Schema.LOCATION_PROPERTY, subject) { - @Override - protected String buildValue_() { - return this.subject.getLocation(); - } - }; - } - } - - - static class SchemaTableLabelProvider - extends LabelProvider - implements ITableLabelProvider { - - public Image getColumnImage(Object element, int columnIndex) { - return null; - } - - public String getColumnText(Object element, int columnIndex) { - switch (columnIndex) { - case SchemaColumnAdapter.NAMESPACE_COLUMN : - return ((Schema) element).namespaceDisplayString(); - case SchemaColumnAdapter.LOCATION_COLUMN : - return ((Schema) element).locationDisplayString(); - default : - return null; - } - } - } - - - static class AddEditSchemaDialog - extends TitleAreaDialog { - - private Schema currentSchema; - - private String defaultMessage; - - private final WritablePropertyValueModel<String> location; - - private final WritablePropertyValueModel<String> namespace; - - private XSDSchema resolvedSchema; - - private final Mode mode; - - private Iterable<Schema> allSchemas; - - - public AddEditSchemaDialog(Shell shell, Schema currentSchema, Iterable<Schema> allSchemas) { - super(shell); - this.currentSchema = currentSchema; - this.allSchemas = allSchemas; - this.location = new SimplePropertyValueModel<String>(); - this.namespace = new SimplePropertyValueModel<String>(); - - this.mode = (this.currentSchema == null) ? Mode.ADD : Mode.EDIT; - if (this.mode == Mode.ADD) { - this.defaultMessage = JptJaxbUiMessages.SchemasPage_addSchemaMessage; - this.location.setValue(null); - this.namespace.setValue(null); - } - else { - this.defaultMessage = JptJaxbUiMessages.SchemasPage_editSchemaMessage; - this.location.setValue(currentSchema.getLocation()); - this.namespace.setValue(currentSchema.getNamespace()); - } - } - - - @Override - protected void configureShell(Shell newShell) { - super.configureShell(newShell); - if (this.mode == Mode.ADD) { - newShell.setText(JptJaxbUiMessages.SchemasPage_addSchemaDialogTitle); - } - else { - newShell.setText(JptJaxbUiMessages.SchemasPage_editSchemaDialogTitle); - } - } - - @Override - protected Control createDialogArea(Composite parent) { - Composite dialogArea = (Composite) super.createDialogArea(parent); - - setMessage(this.defaultMessage); - if (this.mode == Mode.ADD) { - setTitle(JptJaxbUiMessages.SchemasPage_addSchemaTitle); - } - else { - setTitle(JptJaxbUiMessages.SchemasPage_editSchemaTitle); - } - - Composite composite = new Composite(dialogArea, SWT.NONE); - composite.setLayout(new GridLayout(3, false)); - composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - Label locationLabel = new Label(composite, SWT.NULL); - locationLabel.setText(JptJaxbUiMessages.SchemasPage_locationLabel); - locationLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - - final Text locationText = new Text(composite, SWT.SINGLE | SWT.BORDER); - locationText.setText(locationDisplayString()); - locationText.setEditable(false); - locationText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); - this.location.addPropertyChangeListener( - PropertyValueModel.VALUE, - new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - locationText.setText(locationDisplayString()); - } - }); - - Button browseButton = new Button(composite, SWT.PUSH); - browseButton.setText(JptJaxbUiMessages.SchemasPage_browseButtonLabel); - browseButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, true, 1, 1)); - browseButton.addSelectionListener( - new SelectionListener() { - public void widgetSelected(SelectionEvent e) { - browseForSchemaLocation(); - } - - public void widgetDefaultSelected(SelectionEvent e) { - widgetSelected(e); - } - }); - - Label namespaceLabel = new Label(composite, SWT.NULL); - namespaceLabel.setText(JptJaxbUiMessages.SchemasPage_namespaceLabel); - namespaceLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - - final Text namespaceText = new Text(composite, SWT.SINGLE | SWT.BORDER); - namespaceText.setText(namespaceDisplayString()); - namespaceText.setEditable(false); - namespaceText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); - this.namespace.addPropertyChangeListener( - PropertyValueModel.VALUE, - new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - namespaceText.setText(namespaceDisplayString()); - } - }); - - Dialog.applyDialogFont(dialogArea); - - return dialogArea; - } - - @Override - public void create() { - super.create(); - - // disable ok button until user does something and then validation takes over - getButton(IDialogConstants.OK_ID).setEnabled(false); - } - - @Override - protected boolean isResizable() { - return true; - } - - private void browseForSchemaLocation() { - SchemaLocationDialog dialog = new SchemaLocationDialog(getShell()); - - // opens the dialog - just returns if the user cancels it - if (dialog.open() == Window.CANCEL) { - return; - } - - String location = dialog.getLocation(); - this.location.setValue(location); - - String resolvedUri = XsdUtil.getResolvedUri(null, location); - - XSDSchema schema = XSDImpl.buildXSDModel(resolvedUri); - String newNamespace = - (schema == null) ? - null - : ((schema.getTargetNamespace()) == null ? - "" - : schema.getTargetNamespace()); - this.namespace.setValue(newNamespace); - this.resolvedSchema = schema; - - validate(); - } - - public String getNamespace() { - return this.namespace.getValue(); - } - - protected String namespaceDisplayString() { - return Schema.namespaceDisplayString(getNamespace()); - } - - public String getLocation() { - return this.location.getValue(); - } - - protected String locationDisplayString() { - return Schema.locationDisplayString(getLocation()); - } - - private void validate() { - if (this.resolvedSchema == null) { - setErrorMessage(JptJaxbUiMessages.SchemasPage_schemaUnresolvedMessage); - } - else if (isDuplicateNamespace()) { - setErrorMessage(JptJaxbUiMessages.SchemasPage_duplicateNamespaceMessage); - } - else if (StringTools.stringIsEmpty(this.location.getValue())) { - setErrorMessage(JptJaxbUiMessages.SchemasPage_noLocationMessage); - } - else { - setErrorMessage(null); - setMessage(this.defaultMessage); - } - getButton(IDialogConstants.OK_ID).setEnabled(getErrorMessage() == null); - } - - private boolean isDuplicateNamespace() { - for (Schema schema : this.allSchemas) { - if ((this.currentSchema != schema) && getNamespace().equals(schema.getNamespace())) { - return true; - } - } - return false; - } - - - private enum Mode { - ADD, - EDIT - } - } - - - static class SchemaLocationDialog - extends TrayDialog { - - private SelectFileOrXMLCatalogIdPanel locationPanel; - - private String location; - - - public SchemaLocationDialog(Shell shell) { - super(shell); - } - - - @Override - protected void configureShell(Shell newShell) { - super.configureShell(newShell); - newShell.setText(JptJaxbUiMessages.SchemasPage_chooseLocationTitle); - } - - @Override - protected Control createDialogArea(Composite parent) { - Composite composite = (Composite) super.createDialogArea(parent); - - this.locationPanel = new SelectFileOrXMLCatalogIdPanel(composite, StructuredSelection.EMPTY); - this.locationPanel.setFilterExtensions(new String[] {".xsd"}); - this.locationPanel.update(); - this.locationPanel.setVisibleHelper(true); - - return composite; - } - - @Override - protected boolean isResizable() { - return true; - } - - @Override - protected void okPressed() { - IFile file = this.locationPanel.getFile(); - if (file != null) { - this.location = URI.createPlatformResourceURI(file.getFullPath().toString(), false).toString(); - } - else { - this.location = this.locationPanel.getXMLCatalogId(); - } - - super.okPressed(); - } - - public String getLocation() { - return this.location; - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/ProjectWizardPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/ProjectWizardPage.java deleted file mode 100644 index 89c3c8ca3e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/ProjectWizardPage.java +++ /dev/null @@ -1,246 +0,0 @@ -/******************************************************************************* -* 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.Iterator; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -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.FillLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; - -/** - * ProjectWizardPage - */ -public class ProjectWizardPage extends WizardPage -{ - private IJavaProject javaProject; - private ProjectGroup projectGroup; - - // ********** static methods ********** - - public static IJavaProject getJavaProjectFromSelection(IStructuredSelection selection) { - if(selection == null) { - return null; - } - Object firstElement = selection.getFirstElement(); - if(firstElement instanceof IJavaProject) { - return (IJavaProject)firstElement; - } - else if(firstElement instanceof IResource) { - IProject project = ((IResource) firstElement).getProject(); - return getJavaProjectFrom(project); - } - else if(firstElement instanceof IJavaElement) { - return ((IJavaElement)firstElement).getJavaProject(); - } - return null; - } - - public static IJavaProject getJavaProjectFrom(IProject project) { - return (IJavaProject)((IJavaElement)((IAdaptable)project).getAdapter(IJavaElement.class)); - } - - // ********** constructor ********** - - public ProjectWizardPage() { - super("Java Project"); //$NON-NLS-1$ - - this.setDescription(JptJaxbUiMessages.ClassesGeneratorProjectWizardPage_desc); - } - - public ProjectWizardPage(IJavaProject javaProject) { - this(); - - this.javaProject = javaProject; - } - - // ********** IDialogPage implementation ********** - - public void createControl(Composite parent) { - this.setPageComplete(false); - this.setControl(this.buildTopLevelControl(parent)); - } - - // ********** intra-wizard methods ********** - - public IJavaProject getJavaProject() { - return this.javaProject; - } - - // ********** internal methods ********** - - private Control buildTopLevelControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayout(new FillLayout()); - this.projectGroup = new ProjectGroup(composite); - Dialog.applyDialogFont(parent); -// PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, HELP_CONTEXT_ID); - return composite; - } - - private void setJavaProject(IJavaProject project) { - this.javaProject = project; - } - - private void projectChanged() { - this.setPageComplete(false); - String projectName = this.projectGroup.getProjectName(); - if( ! StringTools.stringIsEmpty(projectName)) { - - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - this.setJavaProject(JavaCore.create(project)); - this.setPageComplete(true); - } - } - - // ********** project group ********** - - class ProjectGroup { - - private Combo projectCombo; - - - // ********** constructor ********** - - private ProjectGroup(Composite parent) { - super(); - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayout(new GridLayout(2, false)); - - // Project - this.buildLabel(composite, JptJaxbUiMessages.JavaProjectWizardPage_project); - this.projectCombo = this.buildProjectCombo(composite, this.buildProjectComboSelectionListener()); - this.updateProjectCombo(); - - setPageComplete( ! StringTools.stringIsEmpty(this.getProjectName())); - } - - // ********** listeners ********** - - private SelectionListener buildProjectComboSelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - // nothing special for "default" (double-click?) - this.widgetSelected(event); - } - public void widgetSelected(SelectionEvent event) { - ProjectGroup.this.selectedProjectChanged(); - } - @Override - public String toString() { - return "JavaProjectWizardPage project combo-box selection listener"; //$NON-NLS-1$ - } - }; - } - - // ********** listener callbacks ********** - - void selectedProjectChanged() { - projectChanged(); - } - - // ********** intra-wizard methods ********** - - protected String getProjectName() { - return this.projectCombo.getText(); - } - - // ********** internal methods ********** - - protected void updateProjectCombo() { - - this.projectCombo.removeAll(); - - for (String name : this.getSortedJavaProjectsNames()) { - this.projectCombo.add(name); - } - if(javaProject != null) { - this.projectCombo.select(this.projectCombo.indexOf(javaProject.getProject().getName())); - } - } - - private String[] getSortedJavaProjectsNames() { - return ArrayTools.sort(this.getJavaProjectsNames()); - } - - private String[] getJavaProjectsNames() { - return ArrayTools.array( - new TransformationIterable<IProject, String>(this.getJavaProjects()) { - @Override - protected String transform(IProject project) { - return project.getName(); - } - }, - new String[0]); - } - - private Iterable<IProject> getJavaProjects() { - return new FilteringIterable<IProject>(CollectionTools.collection(this.getProjects())) { - @Override - protected boolean accept(IProject next) { - try { - return next.hasNature(JavaCore.NATURE_ID); - } - catch (CoreException e) { - return false; - } - } - }; - } - - private Iterator<IProject> getProjects() { - return new ArrayIterator<IProject>(ResourcesPlugin.getWorkspace().getRoot().getProjects()); - } - - // ********** UI components ********** - - private Label buildLabel(Composite parent, String text) { - Label label = new Label(parent, SWT.LEFT); - label.setLayoutData(new GridData()); - label.setText(text); - return label; - } - - private Combo buildProjectCombo(Composite parent, SelectionListener listener) { - Combo projectCombo = new Combo(parent, SWT.READ_ONLY); - GridData gridData = new GridData(); - gridData.horizontalAlignment = SWT.FILL; - gridData.grabExcessHorizontalSpace = true; - projectCombo.setLayoutData(gridData); - projectCombo.addSelectionListener(listener); - return projectCombo; - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorExtensionOptionsWizardPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorExtensionOptionsWizardPage.java deleted file mode 100644 index 7a98424b23..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorExtensionOptionsWizardPage.java +++ /dev/null @@ -1,221 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 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.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jaxb.core.JaxbFacet; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -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; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; - -/** - * ClassesGeneratorExtensionOptionsWizardPage - */ -public class ClassesGeneratorExtensionOptionsWizardPage extends WizardPage -{ - public static final String TARGET_OPTION = "-target "; //$NON-NLS-1$ - - 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(); - } - - // ********** private methods ********** - - private String getFacetVersion() { - IProjectFacetVersion projectFacetVersion = this.getProjectFacetVersion(); - return (projectFacetVersion == null) ? null : projectFacetVersion.getVersionString(); - } - - private IProjectFacetVersion getProjectFacetVersion() { - IFacetedProject facetedProject = null; - try { - facetedProject = ProjectFacetsManager.create(this.getProject()); - } - catch(CoreException e) { - JptJaxbUiPlugin.log(e); - return null; - } - return (facetedProject == null) ? null : facetedProject.getProjectFacetVersion(JaxbFacet.FACET); - } - - private IProject getProject() { - return ((ClassesGeneratorWizard)this.getWizard()).getJavaProject().getProject(); - } - - // ********** ExtensionOptionsComposite ********** - - 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, HELP_CONTEXT_ID); - - 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); - if( ! StringTools.stringIsEmpty(getFacetVersion())) { - this.additionalArgsText.setText(TARGET_OPTION + getFacetVersion()); - } - } - - // ********** 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/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorOptionsWizardPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorOptionsWizardPage.java deleted file mode 100644 index c6931e1985..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorOptionsWizardPage.java +++ /dev/null @@ -1,770 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 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.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.jpt.common.utility.internal.StringTools; -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.FileDialog; -import org.eclipse.swt.widgets.Group; -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 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(); - } - - // ********** UI controls ********** - - protected Button buildCheckBox(Composite parent, String text, SelectionListener listener, int verticalIndent) { - Button checkBox = new Button(parent, SWT.CHECK); - GridData gridData = new GridData(); - gridData.verticalIndent= verticalIndent; - checkBox.setLayoutData(gridData); - checkBox.setText(text); - checkBox.addSelectionListener(listener); - return checkBox; - } - - protected Button buildRadioButton(Composite parent, String text, SelectionListener listener, int horizontalSpan) { - Button radioButton = new Button(parent, SWT.RADIO); - GridData gridData = new GridData(); - gridData.horizontalSpan = horizontalSpan; - radioButton.setLayoutData(gridData); - radioButton.setText(text); - radioButton.addSelectionListener(listener); - return radioButton; - } - - protected Text buildText(Composite parent, int horizontalSpan) { - Text text = new Text(parent, SWT.SINGLE | SWT.BORDER); - GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false); - gridData.horizontalSpan = horizontalSpan; - text.setLayoutData(gridData); - return text; - } - - protected void disableText(Text text) { - text.setEnabled(false); - text.setText(""); //$NON-NLS-1$ - } - - // ********** internal methods ********** - - private String makeRelativeToProjectPath(String filePath) { - Path path = new Path(filePath); - IPath relativePath = path.makeRelativeTo(this.getProject().getLocation()); - return relativePath.toOSString(); - } - - private IProject getProject() { - return ((ClassesGeneratorWizard)this.getWizard()).getJavaProject().getProject(); - } - - // ********** ProxyOptionsComposite ********** - - class ProxyOptionsComposite { - - private final Button noProxyRadioButton; - - private final Button proxyRadioButton; - private final Text proxyText; - - private final Button proxyFileRadioButton; - private final Text proxyFileText; - private Button browseButton; - - // ********** constructor ********** - - private ProxyOptionsComposite(Composite parent) { - super(); - Group proxyGroup = new Group(parent, SWT.NONE); - GridLayout layout = new GridLayout(3, false); - proxyGroup.setLayout(layout); - proxyGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - proxyGroup.setText(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_proxyGroup); - - SelectionListener proxyButtonListener = this.buildProxyRadioButtonListener(); - - this.noProxyRadioButton = buildRadioButton(proxyGroup, - JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_noProxy, proxyButtonListener, 3); - - this.proxyRadioButton = buildRadioButton(proxyGroup, - JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_proxy, proxyButtonListener, 1); - this.proxyText = buildText(proxyGroup, 1); - new Label(proxyGroup, SWT.WRAP); //empty label for spacing - - this.proxyFileRadioButton = buildRadioButton(proxyGroup, - JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_proxyFile, proxyButtonListener, 1); - this.proxyFileText = buildText(proxyGroup, 1); - this.browseButton = this.buildBrowseButton(proxyGroup); - - this.noProxyRadioButton.setSelection(true); - this.proxyButtonChanged(); - } - - private Button buildBrowseButton(Composite parent) { - 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); - - // Browse buttons - Button browseButton = new Button(buttonComposite, SWT.PUSH); - browseButton.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_browseButton); - gridData = new GridData(); - gridData.horizontalAlignment= GridData.FILL; - gridData.grabExcessHorizontalSpace= true; - browseButton.setLayoutData(gridData); - - browseButton.addSelectionListener(new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) {} - - public void widgetSelected(SelectionEvent e) { - - String filePath = promptProxyFile(); - if ( ! StringTools.stringIsEmpty(filePath)) { - ProxyOptionsComposite.this.proxyFileText.setText(makeRelativeToProjectPath(filePath)); - } - } - }); - return browseButton; - } - - // ********** listeners ********** - - private SelectionListener buildProxyRadioButtonListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - this.widgetSelected(event); - } - public void widgetSelected(SelectionEvent event) { - proxyButtonChanged(); - } - }; - } - - private void proxyButtonChanged() { - boolean usesProxy = ! this.noProxyRadioButton.getSelection(); - if (usesProxy) { - if (this.proxyRadioButton.getSelection()) { - this.proxyText.setEnabled(true); - disableText(this.proxyFileText); - this.browseButton.setEnabled(false); - } - else if (this.proxyFileRadioButton.getSelection()) { - this.proxyFileText.setEnabled(true); - this.browseButton.setEnabled(true); - disableText(this.proxyText); - } - } - else { - disableText(this.proxyText); - disableText(this.proxyFileText); - this.browseButton.setEnabled(false); - } - } - - // ********** internal methods ********** - /** - * The Add button was clicked, its action invokes this action which should - * prompt the user to select a file and return it. - */ - private String promptProxyFile() { - IWizard wizard = ClassesGeneratorOptionsWizardPage.this.getWizard(); - String projectPath = ((ClassesGeneratorWizard)wizard).getJavaProject().getProject().getLocation().toString(); - - FileDialog dialog = new FileDialog(getShell()); - dialog.setText(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_chooseAProxyFile); - dialog.setFilterPath(projectPath); - - return dialog.open(); - } - - // ********** 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 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.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.isVerboseCheckBox = this.buildIsVerboseCheckBox(composite, this.buildIsVerboseSelectionListener()); - this.isQuietCheckBox = this.buildIsQuietCheckBox(composite, this.buildIsQuietSelectionListener()); - } - - // ********** UI components ********** - - private Button buildUsesStrictValidationCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_useStrictValidation, listener, 5); - checkBox.setSelection(this.usesStrictValidation()); - return checkBox; - } - - private Button buildMakesReadOnlyCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_makeReadOnly, listener, 5); - checkBox.setSelection(this.makesReadOnly()); - return checkBox; - } - - private Button buildSuppressesPackageInfoGenCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_suppressPackageInfoGen, listener, 5); - checkBox.setSelection(this.suppressesPackageInfoGen()); - return checkBox; - } - - private Button buildSuppressesHeaderGenCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_suppressesHeaderGen, listener, 5); - checkBox.setSelection(this.suppressesHeaderGen()); - return checkBox; - } - - private Button buildIsVerboseCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_verbose, listener, 5); - checkBox.setSelection(this.isVerbose()); - return checkBox; - } - - private Button buildIsQuietCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_quiet, listener, 5); - checkBox.setSelection(this.isQuiet()); - 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 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 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 = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_treatsAsXmlSchema, listener, 5); - checkBox.setSelection(this.treatsAsXmlSchema()); - return checkBox; - } - - private Button buildTreatsAsRelaxNgCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_treatsAsRelaxNg, listener, 5); - checkBox.setSelection(this.treatsAsRelaxNg()); - return checkBox; - } - private Button buildTreatsAsRelaxNgCompactCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_treatsAsRelaxNgCompact, listener, 5); - checkBox.setSelection(this.treatsAsRelaxNgCompact()); - return checkBox; - } - - private Button buildTreatsAsDtdCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_treatsAsDtd, listener, 5); - checkBox.setSelection(this.treatsAsDtd()); - return checkBox; - } - - private Button buildTreatsAsWsdlCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_treatsAsWsdl, listener, 5); - checkBox.setSelection(this.treatsAsWsdl()); - return checkBox; - } - - private Button buildVersionCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_showsVersion, listener, 5); - checkBox.setSelection(this.showsVersion()); - return checkBox; - } - - private Button buildHelpCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_showsHelp, listener, 5); - checkBox.setSelection(this.showsHelp()); - 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/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java deleted file mode 100644 index 364abbb9c5..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java +++ /dev/null @@ -1,405 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 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 java.util.HashMap; -import java.util.Map; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.WorkspaceJob; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.util.URI; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.jpt.common.ui.internal.wizards.JavaProjectWizardPage; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.SchemaLibrary; -import org.eclipse.jpt.jaxb.core.internal.gen.ClassesGeneratorExtensionOptions; -import org.eclipse.jpt.jaxb.core.internal.gen.ClassesGeneratorOptions; -import org.eclipse.jpt.jaxb.core.internal.gen.GenerateJaxbClassesJob; -import org.eclipse.jpt.jaxb.core.xsd.XsdUtil; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.osgi.util.NLS; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWizard; -import org.eclipse.wst.xsd.contentmodel.internal.XSDImpl; -import org.eclipse.xsd.XSDSchema; - -/** - * ClassesGeneratorWizard - */ -public class ClassesGeneratorWizard - extends Wizard - implements IWorkbenchWizard { - - private IJavaProject javaProject; - private IFile preselectedXsdFile; - protected IStructuredSelection selection; - - private String destinationFolder; - private String targetPackage; - private String catalog; - private boolean usesMoxy; - private String[] bindingsFileNames; - - private ClassesGeneratorOptions generatorOptions; - private ClassesGeneratorExtensionOptions generatorExtensionOptions; - - private JavaProjectWizardPage projectWizardPage; - private SchemaWizardPage schemaWizardPage; - - private ClassesGeneratorWizardPage settingsPage; - private ClassesGeneratorOptionsWizardPage optionsPage; - private ClassesGeneratorExtensionOptionsWizardPage extensionOptionsPage; - private boolean performsGeneration; - - - // ********** constructor ********** - - public ClassesGeneratorWizard() { - super(); - this.performsGeneration = true; - } - - public ClassesGeneratorWizard(IJavaProject javaProject, IFile xsdFile) { - super(); - this.javaProject = javaProject; - this.preselectedXsdFile = xsdFile; - this.performsGeneration = false; - } - - - // ********** IWorkbenchWizard implementation ********** - - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.selection = selection; - - this.setWindowTitle(JptJaxbUiMessages.ClassesGeneratorWizard_title); - this.setDefaultPageImageDescriptor(JptJaxbUiPlugin.getImageDescriptor(JptJaxbUiIcons.CLASSES_GEN_WIZ_BANNER)); - this.setNeedsProgressMonitor(true); - } - - - // ********** IWizard implementation ********** - - @Override - public void addPages() { - super.addPages(); - - if (this.selection != null) { - this.javaProject = this.getJavaProjectFromSelection(this.selection); - - this.projectWizardPage = new JavaProjectWizardPage(this.javaProject); - this.projectWizardPage.setTitle(JptJaxbUiMessages.ClassesGeneratorProjectWizardPage_title); - this.projectWizardPage.setDescription(JptJaxbUiMessages.ClassesGeneratorProjectWizardPage_desc); - this.projectWizardPage.setDestinationLabel(JptJaxbUiMessages.JavaProjectWizardPage_destinationProject); - this.addPage(this.projectWizardPage); - - // SchemaWizardPage - if (this.preselectedXsdFile == null) { - this.preselectedXsdFile = SchemaWizardPage.getSourceSchemaFromSelection(this.selection); - } - - if (this.preselectedXsdFile == null) { - this.schemaWizardPage = new SchemaWizardPage(this.selection); - this.addPage(this.schemaWizardPage); - } - } - - this.settingsPage = this.buildClassesGeneratorPage(); - this.optionsPage = this.buildClassesGeneratorOptionsPage(); - this.extensionOptionsPage = this.buildExtensionOptionsPage(); - - this.addPage(this.settingsPage); - this.addPage(this.optionsPage); - this.addPage(this.extensionOptionsPage); - } - - @Override - public boolean canFinish() { - return this.settingsPage.isPageComplete() - && this.optionsPage.isPageComplete() - && this.extensionOptionsPage.isPageComplete(); - } - - @Override - public boolean performFinish() { - - WizardPage currentPage = (WizardPage)getContainer().getCurrentPage(); - if (currentPage != null) { - if (! currentPage.isPageComplete()) { - return false; - } - this.retrieveGeneratorSettings(); - this.retrieveGeneratorOptions(); - this.retrieveGeneratorExtensionOptions(); - - IFolder folder = this.getJavaProject().getProject().getFolder(this.destinationFolder); - this.createFolderIfNotExist(folder); - } - - if (this.performsGeneration) { - if (displayOverridingClassesWarning(this.generatorOptions)) { - generateJaxbClasses(); - addSchemaToLibrary(); - } - } - - return true; - } - - // ********** intra-wizard methods ********** - - public IJavaProject getJavaProject() { - if(this.projectWizardPage != null) { - this.javaProject = this.projectWizardPage.getJavaProject(); - } - return this.javaProject; - } - - /* may be null */ - private JaxbProject getJaxbProject() { - return JptJaxbCorePlugin.getJaxbProject(getJavaProject().getProject()); - } - - /* return the physical location of the schema */ - public URI getLocalSchemaUri() { - if (this.preselectedXsdFile != null) { - return URI.createFileURI(this.preselectedXsdFile.getLocation().toString()); - } - else if (this.schemaWizardPage != null) { - return this.schemaWizardPage.getLocalSchemaURI(); - } - return null; - } - - /* return the uri or file platform resource uri used for schema resolution */ - public String getSchemaLocation() { - if (this.preselectedXsdFile != null) { - return URI.createPlatformResourceURI(this.preselectedXsdFile.getFullPath().toString(), false).toString(); - } - else if (this.schemaWizardPage != null) { - return this.schemaWizardPage.getSchemaLocation(); - } - return null; - } - - - // ********** public methods ********** - - public String getDestinationFolder() { - return this.destinationFolder; - } - - public String getTargetPackage() { - return this.targetPackage; - } - - public String getCatalog() { - return this.catalog; - } - - 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 ********** - - public IJavaProject getJavaProjectFromSelection(IStructuredSelection selection) { - if(selection == null) { - return null; - } - Object firstElement = selection.getFirstElement(); - if(firstElement instanceof IJavaProject) { - return (IJavaProject)firstElement; - } - else if(firstElement instanceof IResource) { - IProject project = ((IResource) firstElement).getProject(); - return getJavaProjectFrom(project); - } - else if(firstElement instanceof IJavaElement) { - return ((IJavaElement)firstElement).getJavaProject(); - } - return null; - } - - private ClassesGeneratorWizardPage buildClassesGeneratorPage() { - return new ClassesGeneratorWizardPage(); - } - - private ClassesGeneratorOptionsWizardPage buildClassesGeneratorOptionsPage() { - return new ClassesGeneratorOptionsWizardPage(); - } - - private ClassesGeneratorExtensionOptionsWizardPage buildExtensionOptionsPage() { - return new ClassesGeneratorExtensionOptionsWizardPage(); - } - - public IJavaProject getJavaProjectFrom(IProject project) { - return (IJavaProject)((IJavaElement)((IAdaptable)project).getAdapter(IJavaElement.class)); - } - - private boolean displayOverridingClassesWarning(ClassesGeneratorOptions generatorOptions) { - - if( ! this.isOverridingClasses(generatorOptions)) { - return true; - } - return MessageDialog.openQuestion( - this.getShell(), - JptJaxbUiMessages.ClassesGeneratorUi_generatingClassesWarningTitle, - JptJaxbUiMessages.ClassesGeneratorUi_generatingClassesWarningMessage); - } - - private boolean isOverridingClasses(ClassesGeneratorOptions generatorOptions) { - if(generatorOptions == null) { - throw new NullPointerException(); - } - if(generatorOptions.showsVersion() || generatorOptions.showsHelp()) { - return false; - } - return true; - } - - private void retrieveGeneratorSettings() { - 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 retrieveGeneratorOptions() { - 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.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 retrieveGeneratorExtensionOptions() { - - this.generatorExtensionOptions = new ClassesGeneratorExtensionOptions(); - - this.generatorExtensionOptions.setAllowsExtensions(this.extensionOptionsPage.allowsExtensions()); - this.generatorExtensionOptions.setClasspath(this.extensionOptionsPage.getClasspath()); - this.generatorExtensionOptions.setAdditionalArgs(this.extensionOptionsPage.getAdditionalArgs()); - } - - private void createFolderIfNotExist(IFolder folder) { - if( folder.exists()) { - return; - } - try { - folder.create(true, true, null); - } - catch (CoreException e) { - JptJaxbUiPlugin.log(e); - - this.logError(NLS.bind( - JptJaxbUiMessages.ClassesGeneratorWizard_couldNotCreate, - folder.getProjectRelativePath().toOSString())); - } - } - - private void generateJaxbClasses() { - try { - WorkspaceJob job = - new GenerateJaxbClassesJob( - this.getJavaProject(), - this.getLocalSchemaUri().toString(), - this.destinationFolder, - this.targetPackage, - this.catalog, - this.usesMoxy, - this.bindingsFileNames, - this.generatorOptions, - this.generatorExtensionOptions); - job.schedule(); - } - catch(RuntimeException re) { - JptJaxbUiPlugin.log(re); - - String msg = re.getMessage(); - String message = (msg == null) ? re.toString() : msg; - this.logError(message); - } - } - - private void addSchemaToLibrary() { - JaxbProject jaxbProject = getJaxbProject(); - - if (jaxbProject == null) { - return; - } - - String schemaLocation = getSchemaLocation(); - String resolvedUri = XsdUtil.getResolvedUri(null, schemaLocation); - XSDSchema schema = XSDImpl.buildXSDModel(resolvedUri); - if (schema != null) { - String schemaNamespace = - ((schema.getTargetNamespace()) == null ? - "" - : schema.getTargetNamespace()); - - SchemaLibrary schemaLib = jaxbProject.getSchemaLibrary(); - Map<String, String> schemas = new HashMap<String, String>(schemaLib.getSchemaLocations()); - schemas.put(schemaNamespace, schemaLocation); - schemaLib.setSchemaLocations(schemas); - } - } - - protected void logError(String message) { - this.displayError(message); - } - - private void displayError(String message) { - MessageDialog.openError( - this.getShell(), - JptJaxbUiMessages.ClassesGeneratorWizard_errorDialogTitle, - message - ); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizardPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizardPage.java deleted file mode 100644 index 762aea5275..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizardPage.java +++ /dev/null @@ -1,779 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 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 java.util.ArrayList; -import java.util.Collection; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.jdt.core.IJavaModel; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.internal.ui.wizards.TypedElementSelectionValidator; -import org.eclipse.jdt.internal.ui.wizards.TypedViewerFilter; -import org.eclipse.jdt.launching.IVMInstall; -import org.eclipse.jdt.launching.IVMInstall2; -import org.eclipse.jdt.ui.JavaElementComparator; -import org.eclipse.jdt.ui.JavaElementLabelProvider; -import org.eclipse.jdt.ui.StandardJavaElementContentProvider; -import org.eclipse.jdt.ui.wizards.NewTypeWizardPage; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.TrayDialog; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.IBaseLabelProvider; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.jface.viewers.ILabelProvider; -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.viewers.ViewerFilter; -import org.eclipse.jface.window.Window; -import org.eclipse.jpt.common.ui.internal.util.SWTUtil; -import org.eclipse.jpt.common.ui.internal.util.TableLayoutComposite; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.internal.gen.ClassesGenerator; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformGroupDescription; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.SWT; -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.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; -import org.osgi.framework.Bundle; - -/** - * ClassesGeneratorWizardPage - */ -public class ClassesGeneratorWizardPage extends NewTypeWizardPage { - static public final String JPT_ECLIPSELINK_UI_PLUGIN_ID = "org.eclipse.jpt.jpa.eclipselink.ui"; //$NON-NLS-1$ - static public final String XML_FILTER = "*.xml"; //$NON-NLS-1$ - static public final String[] bindingdFilesFilterExtensions = {".xjb",".xml",".xbd"}; //$NON-NLS-1$ - static public final JaxbPlatformGroupDescription ECLIPSELINK_PLATFORM_GROUP - = JptJaxbCorePlugin.getJaxbPlatformManager().getJaxbPlatformGroup("eclipselink"); //$NON-NLS-1$ - - public static final String HELP_CONTEXT_ID = "org.eclipse.jpt.ui.configure_jaxb_class_generation_dialog"; //$NON-NLS-1$ - - private SettingsGroup settingsGroup; - - private String targetFolder; - private String targetPackage; - - private Button usesMoxyCheckBox; - private boolean usesMoxy; - - // ********** constructor ********** - - public ClassesGeneratorWizardPage() { - super(true, "Classes Generator"); //$NON-NLS-1$ - - this.setDescription(JptJaxbUiMessages.ClassesGeneratorWizardPage_desc); - } - - // ********** UI components ********** - - public void createControl(Composite parent) { - this.setPageComplete(false); - this.setControl(this.buildTopLevelControl(parent)); - } - - // ********** intra-wizard methods ********** - - protected String getTargetFolder() { - return this.targetFolder; - } - - protected String getTargetPackage() { - return this.targetPackage; - } - - protected String getCatalog() { - return this.settingsGroup.getCatalog(); - } - - protected String[] getBindingsFileNames() { - return this.settingsGroup.getBindingsFileNames(); - } - - protected boolean usesMoxy() { - return this.usesMoxy; - } - - private void setUsesMoxy(boolean usesMoxy){ - this.usesMoxy = usesMoxy; - } - - // ********** overrides ********** - - @Override - protected IStatus packageChanged() { - IStatus status = super.packageChanged(); - IPackageFragment packageFragment = getPackageFragment(); - if(!status.matches(IStatus.ERROR)) { - this.targetPackage = packageFragment.getElementName(); - } - return status; - } - - @Override - protected IStatus containerChanged() { - IStatus status = super.containerChanged(); - String srcFolder = getPackageFragmentRootText(); - if( !status.matches(IStatus.ERROR) ){ - this.targetFolder = srcFolder.substring(srcFolder.indexOf("/") + 1); - } - return status; - } - - @Override - protected void handleFieldChanged(String fieldName) { - super.handleFieldChanged(fieldName); - if(this.fContainerStatus.matches(IStatus.ERROR)) { - this.updateStatus(fContainerStatus); - } - else if( ! this.fPackageStatus.matches(IStatus.OK) ) { - this.updateStatus(fPackageStatus); - } - else { - this.updateStatus(Status.OK_STATUS); - } - this.validateProjectClasspath(); - } - - /** - * Override setVisible to insure that our more important warning - * message about classpath problems is displayed to the user first. - */ - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if(visible) { - this.initContainerPage(((ClassesGeneratorWizard)this.getWizard()).getJavaProject()); - - if(this.projectPlatformIsJaxb()) { - this.setUsesMoxy(this.projectJaxbPlatformIsEclipseLink()); - this.usesMoxyCheckBox.setVisible(false); - } - else { - // default usesMoxy to true only when JPT EclipseLink bundle exists and MOXy is on the classpath - this.setUsesMoxy((this.jptEclipseLinkBundleExists() && this.moxyIsOnClasspath())); - - // checkbox is visible only if jpt.eclipselink.ui plugin is available - // and EclipseLink MOXy is not on the classpath - this.usesMoxyCheckBox.setVisible(this.jptEclipseLinkBundleExists() && ! this.moxyIsOnClasspath()); - } - this.validateProjectClasspath(); - - String schemaName = ((ClassesGeneratorWizard) getWizard()).getLocalSchemaUri().lastSegment(); - this.setTitle(NLS.bind(JptJaxbUiMessages.ClassesGeneratorWizardPage_title, schemaName)); - } - } - - /** - * Override to allow selection of source folder in current project only - * @see org.eclipse.jdt.ui.wizards.NewContainerWizardPage#chooseContainer() - * Only 1 line in this code is different from the parent - */ - @Override - protected IPackageFragmentRoot chooseContainer() { - Class<?>[] acceptedClasses = new Class[] { IPackageFragmentRoot.class, IJavaProject.class }; - TypedElementSelectionValidator validator= new TypedElementSelectionValidator(acceptedClasses, false) { - @Override - public boolean isSelectedValid(Object element) { - try { - if(element instanceof IJavaProject) { - IJavaProject jproject= (IJavaProject)element; - IPath path= jproject.getProject().getFullPath(); - return (jproject.findPackageFragmentRoot(path) != null); - } - else if(element instanceof IPackageFragmentRoot) { - return (((IPackageFragmentRoot)element).getKind() == IPackageFragmentRoot.K_SOURCE); - } - return true; - } - catch (JavaModelException e) { - JptJaxbUiPlugin.log(e); // just log, no UI in validation - } - return false; - } - }; - - acceptedClasses= new Class[] { IJavaModel.class, IPackageFragmentRoot.class, IJavaProject.class }; - ViewerFilter filter= new TypedViewerFilter(acceptedClasses) { - @Override - public boolean select(Viewer viewer, Object parent, Object element) { - if(element instanceof IPackageFragmentRoot) { - try { - return (((IPackageFragmentRoot)element).getKind() == IPackageFragmentRoot.K_SOURCE); - } - catch (JavaModelException e) { - JptJaxbUiPlugin.log(e.getStatus()); // just log, no UI in validation - return false; - } - } - return super.select(viewer, parent, element); - } - }; - - StandardJavaElementContentProvider provider= new StandardJavaElementContentProvider(); - ILabelProvider labelProvider= new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT); - ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(getShell(), labelProvider, provider); - dialog.setValidator(validator); - dialog.setComparator(new JavaElementComparator()); - dialog.setTitle(JptJaxbUiMessages.ClassesGeneratorWizardPage_sourceFolderSelectionDialog_title); - dialog.setMessage(JptJaxbUiMessages.ClassesGeneratorWizardPage_chooseSourceFolderDialog_desc); - dialog.addFilter(filter); - //set the java project as the input instead of the workspace like the NewContainerWizardPage was doing - //******************************************************// - dialog.setInput(this.getJavaProject()); // - //******************************************************// - dialog.setInitialSelection(getPackageFragmentRoot()); - dialog.setHelpAvailable(false); - - if(dialog.open() == Window.OK) { - Object element= dialog.getFirstResult(); - if(element instanceof IJavaProject) { - IJavaProject jproject= (IJavaProject)element; - return jproject.getPackageFragmentRoot(jproject.getProject()); - } - else if(element instanceof IPackageFragmentRoot) { - return (IPackageFragmentRoot)element; - } - return null; - } - return null; - } - - // ********** internal methods ********** - - private Control buildTopLevelControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayout(new GridLayout()); - - PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, HELP_CONTEXT_ID); - - this.settingsGroup = new SettingsGroup(composite); - - this.usesMoxyCheckBox = this.buildUsesMoxyCheckBox(composite); - - Dialog.applyDialogFont(parent); - return composite; - } - - private Button buildUsesMoxyCheckBox(Composite parent) { - - Button checkBox = new Button(parent, SWT.CHECK); - GridData gridData = new GridData(); - gridData.horizontalIndent = 5; - gridData.verticalIndent = 5; - checkBox.setLayoutData(gridData); - checkBox.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_usesMoxyImplementation); - 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(); - } - }; - } - - private boolean jptEclipseLinkBundleExists() { - return (this.getJptEclipseLinkBundle() != null); - } - - private Bundle getJptEclipseLinkBundle() { - return Platform.getBundle(JPT_ECLIPSELINK_UI_PLUGIN_ID); // Cannot reference directly EL plugin. - } - - private void validateProjectClasspath() { - //this line will suppress the "default package" warning (which doesn't really apply here - //as the JAXB gen uses an org.example.schemaName package by default) and will clear the classpath warnings when necessary - setMessage(null); - - if( ! this.genericJaxbIsOnClasspath()) { - this.displayWarning(JptJaxbUiMessages.ClassesGeneratorWizardPage_jaxbLibrariesNotAvailable); - } - else if(this.usesMoxy() && ! this.eclipseLinkMoxyIsOnClasspath()) { - //this message is being truncated by the wizard width in some cases - this.displayWarning(JptJaxbUiMessages.ClassesGeneratorWizardPage_moxyLibrariesNotAvailable); - } - - //this code will intelligently remove our classpath warnings when they are present but no longer apply (as an alternative - //to setting the message to null continuously as is currently done) -// else if( this.getMessage() != null){ -// if (this.getMessage().equals(JptJaxbUiMessages.ClassesGeneratorWizardPage_jaxbLibrariesNotAvailable) || -// this.getMessage().equals(JptJaxbUiMessages.ClassesGeneratorWizardPage_moxyLibrariesNotAvailable)) { -// setMessage(null); -// } -// } - } - - /** - * Test if the Jaxb compiler is on the classpath. - */ - private boolean genericJaxbIsOnClasspath() { - if(this.genericJaxbNonJdkIsOnClasspath()) { - return true; - } - else { - if(this.projectJre15OrLower()) { - return false; - } - else if(this.genericJaxbJdkIsOnClasspath()) { - return true; - } - else { - return this.toolsJarExists(); - } - } - } - - private boolean projectJre15OrLower() { - try { - IVMInstall vm = this.getVMInstall(); - if(vm == null) { - return false; - } - if (vm instanceof IVMInstall2) { - String javaVersion = ((IVMInstall2) vm).getJavaVersion(); - if(javaVersion != null) { - String versionString = javaVersion.substring(0, javaVersion.lastIndexOf('.')); - Float javaVersionNumber = Float.valueOf(versionString); - if( javaVersionNumber <= 1.5) { - return true; - } - } - } - return false; - } - catch (CoreException e) { - return false; - } - } - - /** - * Test if the JDK Jaxb compiler is on the classpath. - */ - private boolean genericJaxbJdkIsOnClasspath() { - return ClassesGenerator.genericJaxbJdkIsOnClasspath(this.getJavaProject()); - } - - /** - * Test if the non-JDK Jaxb compiler is on the classpath. - */ - private boolean genericJaxbNonJdkIsOnClasspath() { - return ClassesGenerator.genericJaxbNonJdkIsOnClasspath(this.getJavaProject()); - } - - private boolean toolsJarExists() { - return ClassesGenerator.toolsJarExists(this.getJavaProject()); - } - - private IVMInstall getVMInstall() throws CoreException { - return ClassesGenerator.getVMInstall(this.getJavaProject()); - } - - /** - * Test if the EclipseLink Jaxb compiler is on the classpath. - */ - private boolean moxyIsOnClasspath() { - try { - IType genClass = this.getJavaProject().findType(ClassesGenerator.JAXB_ECLIPSELINK_GEN_CLASS); - return (genClass != null); - } - catch (JavaModelException e) { - throw new RuntimeException(e); - } - } - - private boolean eclipseLinkMoxyIsOnClasspath() { - return (this.moxyIsOnClasspath() && this.genericJaxbNonJdkIsOnClasspath()); - } - - private boolean projectPlatformIsJaxb() { - return JptJaxbCorePlugin.getJaxbProject(this.getJavaProject().getProject()) != null; - } - - private boolean projectJaxbPlatformIsEclipseLink() { - JaxbPlatformDescription jaxbPlatform = JptJaxbCorePlugin.getJaxbPlatformDescription(this.getJavaProject().getProject()); - JaxbPlatformGroupDescription jaxbPlatformGroup = (jaxbPlatform == null) ? null : jaxbPlatform.getGroup(); - return jaxbPlatformGroup == ECLIPSELINK_PLATFORM_GROUP; - } - - private void displayWarning(String message) { - this.setMessage(message, WARNING); - } - - // ********** inner class ********** - - // ********** SettingsGroup class ********** - - private class SettingsGroup { - - private final Text catalogText; - - private final ArrayList<String> bindingsFileNames; - - // ********** constructor ********** - - private SettingsGroup(Composite parent) { - super(); - Composite composite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(4, false); //must be 4 for the package controls - layout.marginHeight = 0; - layout.marginWidth = 0; - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - // TODO PlatformUI.getWorkbench().getHelpSystem().setHelp(this.group, HELP_CONTEXT_ID); - - // Source folder - createContainerControls(composite, 4); - - // Package - createPackageControls(composite, 4); - - Label label = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL); - GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false, 4, 1); - gridData.verticalIndent = 5; - label.setLayoutData(gridData); - - // Catalog - Label catalogLabel = new Label(composite, SWT.NONE); - catalogLabel.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_catalog); - gridData = new GridData(); - gridData.verticalIndent = 5; - catalogLabel.setLayoutData(gridData); - this.catalogText = this.buildCatalogText(composite); - this.buildBrowseButton(composite); - - // Bindings files - this.bindingsFileNames = new ArrayList<String>(); - Label bindingsFileLabel = new Label(composite, SWT.NONE); - bindingsFileLabel.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_bindingsFiles); - bindingsFileLabel.setLayoutData(new GridData()); - this.buildBindingsFileTable(composite); - } - - // ********** intra-wizard methods ********** - - protected String getCatalog() { - return this.catalogText.getText(); - } - - protected String[] getBindingsFileNames() { - return ArrayTools.array(this.bindingsFileNames.iterator(), new String[0]); - } - - // ********** UI components ********** - - private Text buildCatalogText(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 void buildBrowseButton(Composite parent) { - - 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); - - // Browse buttons - Button browseButton = new Button(buttonComposite, SWT.PUSH); - browseButton.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_browseButton); - gridData = new GridData(); - gridData.horizontalAlignment= GridData.FILL; - gridData.verticalIndent = 5; - gridData.grabExcessHorizontalSpace= true; - browseButton.setLayoutData(gridData); - - browseButton.addSelectionListener(new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) {} - - public void widgetSelected(SelectionEvent e) { - - String filePath = promptXmlFile(); - if( ! StringTools.stringIsEmpty(filePath)) { - - catalogText.setText(makeRelativeToProjectPath(filePath)); - } - } - }); - } - - 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.horizontalSpan = 2; - gridData.heightHint= SWTUtil.getTableHeightHint(table, 3); - 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 button - Button addButton = new Button(buttonComposite, SWT.PUSH); - addButton.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_addButton); - gridData = new GridData(); - gridData.horizontalAlignment = GridData.FILL; - gridData.grabExcessHorizontalSpace= true; - addButton.setLayoutData(gridData); - addButton.addSelectionListener(new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) {} - - public void widgetSelected(SelectionEvent e) { - String filePath = addBindingsFileDialog(); - if( ! StringTools.stringIsEmpty(filePath)) { - addBindingsFile(filePath, tableDataModel); - tableViewer.refresh(); - } - } - }); - // Remove button - Button removeButton = new Button(buttonComposite, SWT.PUSH); - removeButton.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_removeButton); - gridData = new GridData(); - gridData.horizontalAlignment = GridData.FILL; - gridData.grabExcessHorizontalSpace= true; - 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(); - removeBindingsFile(bindingsFileName); - - tableViewer.refresh(); - } - }); - addButton.setFocus(); - } - - // ********** internal methods ********** - - private String addBindingsFileDialog() { - PromptBindingsFilesDialog dialog = new PromptBindingsFilesDialog(getShell()); - - // opens the dialog - just returns if the user cancels it - if(dialog.open() == Window.CANCEL) { - return null; - } - - String location = dialog.getLocation(); - return location; - } - - private String makeRelativeToProjectPath(String filePath) { - Path path = new Path(filePath); - IPath relativePath = path.makeRelativeTo(getJavaProject().getProject().getLocation()); - return relativePath.toOSString(); - } - - private void addBindingsFile(String relativePath, final ArrayList<String> tableDataModel) { - if( ! tableDataModel.contains(relativePath)) { - tableDataModel.add(relativePath); - } - } - - private void removeBindingsFile(String bindingsName) { - this.bindingsFileNames.remove(bindingsName); - } - - 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 promptXmlFile() { - String projectPath= getJavaProject().getProject().getLocation().toString(); - - FileDialog dialog = new FileDialog(getShell()); - dialog.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_chooseACatalog); - dialog.setFilterPath(projectPath); - dialog.setFilterExtensions(new String[] {XML_FILTER}); - - return dialog.open(); - } - - private void addColumnsData(TableLayoutComposite layout) { - layout.addColumnData(new ColumnWeightData(50, true)); - } - - } - - // ********** TableLabelProvider ********** - - 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; - } - } - - // ********** TableContentProvider ********** - - private class TableContentProvider implements IStructuredContentProvider { - - // ********** constructor ********** - TableContentProvider() { - super(); - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {} - - public void dispose() {} - - public Object[] getElements(Object inputElement) { - return ((Collection<?>) inputElement).toArray(); - } - } - - // ********** PromptBindingsFilesDialog ********** - - private class PromptBindingsFilesDialog extends TrayDialog { - - private SelectFileOrXMLCatalogIdPanel locationPanel; - - private String location; - - // ********** constructor ********** - public PromptBindingsFilesDialog(Shell shell) { - super(shell); - } - - @Override - protected void configureShell(Shell newShell) { - super.configureShell(newShell); - newShell.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_chooseABindingsFile); - } - - @Override - protected Control createDialogArea(Composite parent) { - Composite composite = (Composite) super.createDialogArea(parent); - - this.locationPanel = new SelectFileOrXMLCatalogIdPanel(composite, StructuredSelection.EMPTY); - this.locationPanel.setFilterExtensions(bindingdFilesFilterExtensions); - this.locationPanel.update(); - this.locationPanel.setVisibleHelper(true); - - return composite; - } - - @Override - protected boolean isResizable() { - return true; - } - - @Override - protected void okPressed() { - IFile file = this.locationPanel.getFile(); - if (file != null) { - this.location = file.getProjectRelativePath().toOSString(); - } - super.okPressed(); - } - - public String getLocation() { - return this.location; - } - } -}
\ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SchemaWizardPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SchemaWizardPage.java deleted file mode 100644 index cb1a1d6c0a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SchemaWizardPage.java +++ /dev/null @@ -1,215 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 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.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.emf.common.CommonPlugin; -import org.eclipse.emf.common.util.URI; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.jpt.common.ui.internal.wizards.JavaProjectWizardPage; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.wst.common.uriresolver.internal.util.URIHelper; - -/** - * SchemaWizardPage - */ -public class SchemaWizardPage - extends WizardPage { - - protected static final String[] browseXSDFilterExtensions = {".xsd"}; //$NON-NLS-1$ - - private final IStructuredSelection initialSelection; - private IProject targetProject; - - protected SelectFileOrXMLCatalogIdPanel selectSourcePanel; - - - // ********** static method ********** - - public static IFile getSourceSchemaFromSelection(IStructuredSelection selection) { - Object firstElement = selection.getFirstElement(); - if(firstElement instanceof IFile) { - String elementExtension = ((IFile)firstElement).getFileExtension(); - if(elementExtension != null) { - if(browseXSDFilterExtensions[0].endsWith(elementExtension)) { - return ((IFile)firstElement); - } - } - } - return null; - } - - - // ********** constructor ********** - - SchemaWizardPage(IStructuredSelection selection) { - super("SchemaWizardPage"); //$NON-NLS-1$ - - this.initialSelection = selection; - } - - - // ********** IDialogPage implementation ********** - - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); -// PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, HELP_CONTEXT_ID); - composite.setLayout(new GridLayout()); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - this.setControl(composite); - - this.selectSourcePanel = new SelectFileOrXMLCatalogIdPanel(composite, this.initialSelection); - this.selectSourcePanel.setLayoutData(new GridData(GridData.FILL_BOTH)); - - SelectFileOrXMLCatalogIdPanel.PanelListener listener = new SelectFileOrXMLCatalogIdPanel.PanelListener() { - public void completionStateChanged() { - selectFileOrXMLCatalogIdPanelChanged(); - } - }; - this.selectSourcePanel.setListener(listener); - - Dialog.applyDialogFont(parent); - } - - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if(visible) { - - if(this.getSchemaFile() != null) { - this.selectSourcePanel.setSingleFileViewDefaultSelection(new StructuredSelection(this.getSchemaFile())); - } - else { - this.updateTargetProject(); - IFile schema = getSourceSchemaFromSelection(this.initialSelection); - if(schema != null) { - this.selectSourcePanel.setSingleFileViewDefaultSelection(new StructuredSelection(schema)); - } - else { - this.selectSourcePanel.setSingleFileViewDefaultSelection(new StructuredSelection(this.targetProject)); - } - } - this.selectSourcePanel.update(); - - this.setTitle(JptJaxbUiMessages.SchemaWizardPage_title); - this.setDescription(JptJaxbUiMessages.SchemaWizardPage_desc); - this.selectSourcePanel.setFilterExtensions(browseXSDFilterExtensions); - } - this.selectSourcePanel.setVisibleHelper(visible); - } - - - // ********** IWizardPage implementation ********** - - @Override - public boolean isPageComplete() { - - return this.fileOrXmlCatalogEntrySelected() && (this.getErrorMessage() == null); - } - - - // ********** intra-wizard methods ********** - - /* return the file, if a file is selected */ - public IFile getSchemaFile() { - return this.selectSourcePanel.getFile(); - } - - /* return xml catalog id, if a catalog entry is selected */ - public String getXMLCatalogId() { - return this.selectSourcePanel.getXMLCatalogId(); - } - - /* return identifier of schema location, whether using file or xml catalog */ - public String getSchemaLocation() { - IFile file = this.selectSourcePanel.getFile(); - if (file != null) { - return URI.createPlatformResourceURI(file.getFullPath().toString(), false).toString(); - } - return this.selectSourcePanel.getXMLCatalogId(); - } - - /* return local uri of schema, whether using file or xml catalog */ - public URI getLocalSchemaURI() { - IFile file = this.selectSourcePanel.getFile(); - if (file != null) { - return URI.createFileURI(file.getLocation().toString()); - } - - String uri = this.selectSourcePanel.getXMLCatalogURI(); - if (uri != null) { - return CommonPlugin.asLocalURI(URI.createURI(uri)); - } - - return null; - } - - - // ********** internal methods ********** - - private void updateTargetProject() { - IWizardPage previousPage = this.getPreviousPage(); - - if(previousPage instanceof JavaProjectWizardPage) { - // get project from previousPage - this.targetProject = (((JavaProjectWizardPage)previousPage).getJavaProject()).getProject(); - } - else if(initialSelection != null && ! this.initialSelection.isEmpty()) { - // no previousPage - get project from initialSelection - this.targetProject = this.getProjectFromInitialSelection(); - } - } - - private IProject getProjectFromInitialSelection() { - Object firstElement = initialSelection.getFirstElement(); - if(firstElement instanceof IProject) { - return (IProject)firstElement; - } - else if(firstElement instanceof IResource) { - return ((IResource) firstElement).getProject(); - } - else if(firstElement instanceof IJavaElement) { - return ((IJavaElement)firstElement).getJavaProject().getProject(); - } - return null; - } - - private boolean fileOrXmlCatalogEntrySelected() { - return this.getSchemaFile() != null || this.getXMLCatalogId() != null; - } - - private String computeErrorMessage() { - String errorMessage = null; - URI uri = this.getLocalSchemaURI(); - if (uri != null) { - if (! URIHelper.isReadableURI(uri.toString(), false)) { - errorMessage = JptJaxbUiMessages.SchemaWizardPage_errorUriCannotBeLocated; - } - } - return errorMessage; - } - - private void selectFileOrXMLCatalogIdPanelChanged() { - String errorMessage = this.computeErrorMessage(); - this.setErrorMessage(errorMessage); - this.setPageComplete(this.isPageComplete()); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectFileOrXMLCatalogIdPanel.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectFileOrXMLCatalogIdPanel.java deleted file mode 100644 index da4cdc8c87..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectFileOrXMLCatalogIdPanel.java +++ /dev/null @@ -1,192 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Code originate from org.eclipse.wst.xml.ui.internal.dialogs - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -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.ui.part.PageBook; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry; - - -public class SelectFileOrXMLCatalogIdPanel extends Composite implements SelectionListener { - - public interface PanelListener { - void completionStateChanged(); - } - - protected PanelListener listener; - protected PageBook pageBook; - - protected Button[] radioButton; - protected SelectFilePanel selectFilePanel; - protected SelectXMLCatalogIdPanel selectXMLCatalogIdPanel; - - // ********** constructor ********** - - public SelectFileOrXMLCatalogIdPanel(Composite parent, IStructuredSelection selection) { - super(parent, SWT.NONE); - - // container group - setLayout(new GridLayout()); - GridData gd = new GridData(GridData.FILL_BOTH); - gd.heightHint = 400; - gd.widthHint = 400; - setLayoutData(gd); - - radioButton = new Button[2]; - radioButton[0] = new Button(this, SWT.RADIO); - radioButton[0].setText(JptJaxbUiMessages.SelectFileOrXMLCatalogIdPanel_fileFromWorkspace); - radioButton[0].setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - radioButton[0].setSelection(true); - radioButton[0].addSelectionListener(this); - - radioButton[1] = new Button(this, SWT.RADIO); - radioButton[1].setText(JptJaxbUiMessages.SelectFileOrXMLCatalogIdPanel_xmlCatalogEntry); - radioButton[1].setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - radioButton[1].addSelectionListener(this); - - pageBook = new PageBook(this, SWT.NONE); - pageBook.setLayoutData(new GridData(GridData.FILL_BOTH)); - - selectFilePanel = new SelectFilePanel(pageBook, selection); - this.setSingleFileViewDefaultSelection(selection); - - // Catalog - ICatalog xmlCatalog = JptJaxbUiPlugin.instance().getDefaultXMLCatalog(); - selectXMLCatalogIdPanel = new SelectXMLCatalogIdPanel(pageBook, xmlCatalog); - selectXMLCatalogIdPanel.getTableViewer().addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - updateCompletionStateChange(); - } - }); - Dialog.applyDialogFont(parent); - pageBook.showPage(selectFilePanel.getControl()); - } - - public void setSingleFileViewDefaultSelection(ISelection selection) { - this.selectFilePanel.setDefaultSelection(selection); - } - - public IFile getFile() { - IFile result = null; - if (radioButton[0].getSelection()) { - result = selectFilePanel.getFile(); - } - return result; - } - - public ICatalogEntry getXMLCatalogEntry() { - ICatalogEntry result = null; - if (radioButton[1].getSelection()) { - result = selectXMLCatalogIdPanel.getXMLCatalogEntry(); - } - return result; - } - - public String getXMLCatalogId() { - String result = null; - if (radioButton[1].getSelection()) { - result = selectXMLCatalogIdPanel.getId(); - } - return result; - } - - public String getXMLCatalogURI() { - String result = null; - if (radioButton[1].getSelection()) { - result = selectXMLCatalogIdPanel.getURI(); - } - return result; - } - - public void setCatalogEntryType(int catalogEntryType) { - selectXMLCatalogIdPanel.setCatalogEntryType(catalogEntryType); - } - - public void setFilterExtensions(String[] filterExtensions) { - selectFilePanel.resetFilters(); - selectFilePanel.addFilterExtensions(filterExtensions); - - selectXMLCatalogIdPanel.getTableViewer().setFilterExtensions(filterExtensions); - } - - public void setListener(PanelListener listener) { - this.listener = listener; - } - - public void setVisibleHelper(boolean isVisible) { - selectFilePanel.setVisibleHelper(isVisible); - } - - public void updateCompletionStateChange() { - if (listener != null) { - listener.completionStateChanged(); - } - } - - public void widgetDefaultSelected(SelectionEvent e) { - } - - public void widgetSelected(SelectionEvent e) { - if (e.widget == radioButton[0]) { - pageBook.showPage(selectFilePanel.getControl()); - } - else { - pageBook.showPage(selectXMLCatalogIdPanel); - } - updateCompletionStateChange(); - } - - // ********** inner class ********** - - protected class SelectFilePanel extends SelectSingleFileViewFacade implements SelectSingleFileViewFacade.Listener { - protected Control control; - - public SelectFilePanel(Composite parent, IStructuredSelection selection) { - super(selection, true); - // String[] ext = {".dtd"}; - // addFilterExtensions(ext); - this.control = this.createControl(parent); - this.overrideImportButtonText(); - - this.control.setLayoutData(new GridData(GridData.FILL_BOTH)); - SelectFilePanel.this.setListener(this); - } - - public Control getControl() { - return this.control; - } - - public void setControlComplete(boolean isComplete) { - updateCompletionStateChange(); - } - - private void overrideImportButtonText() { - this.importButton.setText(JptJaxbUiMessages.SelectFileOrXMLCatalogIdPanel_importButton); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectSingleFileViewFacade.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectSingleFileViewFacade.java deleted file mode 100644 index 888095e447..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectSingleFileViewFacade.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* -* 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.core.resources.IFile; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.widgets.Composite; - -/** - * SelectSingleFileView - * - * Façade class to change accessibility of SelectSingleFileView. - */ -public class SelectSingleFileViewFacade extends org.eclipse.wst.common.ui.internal.viewers.SelectSingleFileView { - - public static interface Listener extends org.eclipse.wst.common.ui.internal.viewers.SelectSingleFileView.Listener - {} - - public SelectSingleFileViewFacade(IStructuredSelection selection, boolean isFileMandatory) { - super(selection, isFileMandatory); - } - - public void addFilterExtensions(String[] filterExtensions) { - super.addFilterExtensions(filterExtensions); - } - - public Composite createControl(Composite parent) { - return super.createControl(parent); - } - - public IFile getFile() { - return super.getFile(); - } - - public void resetFilters() { - super.resetFilters(); - } - - public void setVisibleHelper(boolean isVisible) { - super.setVisibleHelper(isVisible); - } - - public void setDefaultSelection(ISelection selection) { - super.setDefaultSelection(selection); - } - - public void setListener(Listener listener) { - super.setListener(listener); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectXMLCatalogIdPanel.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectXMLCatalogIdPanel.java deleted file mode 100644 index 111684b49b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectXMLCatalogIdPanel.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Code originate from org.eclipse.wst.xml.ui.internal.dialogs - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen; - -import java.util.Collection; -import java.util.List; -import java.util.Vector; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry; -import org.eclipse.wst.xml.core.internal.catalog.provisional.INextCatalog; - - -public class SelectXMLCatalogIdPanel extends Composite { - protected int catalogEntryType; - protected boolean doTableSizeHack = false; - - protected XMLCatalogTableViewer tableViewer; - protected ICatalog fXmlCatalog; - - public SelectXMLCatalogIdPanel(Composite parent, ICatalog xmlCatalog) { - super(parent, SWT.NONE); - this.fXmlCatalog = xmlCatalog; - - GridLayout gridLayout = new GridLayout(); - this.setLayout(gridLayout); - GridData gd = new GridData(GridData.FILL_BOTH); - gd.heightHint = 200; - gd.widthHint = 700; - this.setLayoutData(gd); - - Label label = new Label(this, SWT.NONE); - label.setText(JptJaxbUiMessages.SchemaWizardPage_xmlCatalogTableTitle); - - tableViewer = createTableViewer(this); - tableViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - tableViewer.setInput("dummy"); //$NON-NLS-1$ - } - - protected XMLCatalogTableViewer createTableViewer(Composite parent) { - String headings[] = new String[2]; - headings[0] = JptJaxbUiMessages.SchemaWizardPage_xmlCatalogKeyColumn; - headings[1] = JptJaxbUiMessages.SchemaWizardPage_xmlCatalogUriColumn; - - XMLCatalogTableViewer theTableViewer = new XMLCatalogTableViewer(parent, headings) { - - protected void addXMLCatalogEntries(List list, ICatalogEntry[] entries) { - for (int i = 0; i < entries.length; i++) { - ICatalogEntry entry = entries[i]; - if (catalogEntryType == 0) { - list.add(entry); - } - else if (catalogEntryType == entry.getEntryType()) { - list.add(entry); - } - } - } - - public Collection getXMLCatalogEntries() { - List result = null; - - if ((fXmlCatalog == null) || doTableSizeHack) { - // this lets us create a table with an initial height of - // 10 rows - // otherwise we get stuck with 0 row heigh table... that's - // too small - doTableSizeHack = false; - result = new Vector(); - for (int i = 0; i < 6; i++) { - result.add(""); //$NON-NLS-1$ - } - } - else { - result = new Vector(); - INextCatalog[] nextCatalogs = fXmlCatalog.getNextCatalogs(); - for (int i = 0; i < nextCatalogs.length; i++) { - INextCatalog catalog = nextCatalogs[i]; - ICatalog referencedCatalog = catalog.getReferencedCatalog(); - if (referencedCatalog != null) { - if (JptJaxbUiPlugin.SYSTEM_CATALOG_ID.equals(referencedCatalog.getId())) { - ICatalog systemCatalog = referencedCatalog; - addXMLCatalogEntries(result, systemCatalog.getCatalogEntries()); - - } - else if (JptJaxbUiPlugin.USER_CATALOG_ID.equals(referencedCatalog.getId())) { - ICatalog userCatalog = referencedCatalog; - addXMLCatalogEntries(result, userCatalog.getCatalogEntries()); - - } - } - } - } - return result; - } - }; - return theTableViewer; - } - - - public String getId() { - ICatalogEntry entry = getXMLCatalogEntry(); - return entry != null ? entry.getKey() : null; - } - - public XMLCatalogTableViewer getTableViewer() { - return tableViewer; - } - - public String getURI() { - ICatalogEntry entry = getXMLCatalogEntry(); - return entry != null ? entry.getURI() : null; - } - - public ICatalogEntry getXMLCatalogEntry() { - ICatalogEntry result = null; - ISelection selection = tableViewer.getSelection(); - Object selectedObject = (selection instanceof IStructuredSelection) ? ((IStructuredSelection) selection).getFirstElement() : null; - if (selectedObject instanceof ICatalogEntry) { - result = (ICatalogEntry) selectedObject; - } - return result; - } - - public void setCatalogEntryType(int catalogEntryType) { - this.catalogEntryType = catalogEntryType; - tableViewer.refresh(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/XMLCatalogTableViewer.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/XMLCatalogTableViewer.java deleted file mode 100644 index 4a24f1c36b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/XMLCatalogTableViewer.java +++ /dev/null @@ -1,195 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Code originate from org.eclipse.wst.xml.ui.internal.dialogs - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Comparator; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.wst.common.uriresolver.internal.util.URIHelper; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry; - -import com.ibm.icu.text.Collator; - -public class XMLCatalogTableViewer extends TableViewer { - - protected static String ERROR_STATE_KEY = "errorstatekey"; //$NON-NLS-1$ - - protected static Image dtdFileImage = JptJaxbUiPlugin.getImage("icons/full/obj16/dtdfile.gif"); //$NON-NLS-1$ - protected static Image unknownFileImage = JptJaxbUiPlugin.getImage("icons/full/obj16/text.gif"); //$NON-NLS-1$ - protected static Image xsdFileImage = JptJaxbUiPlugin.getImage("icons/full/obj16/XSDFile.gif"); //$NON-NLS-1$ - protected static Image errorImage = JptJaxbUiPlugin.getImage("icons/full/ovr16/error_ovr.gif"); //$NON-NLS-1$ - - // ********** constructor ********** - - public XMLCatalogTableViewer(Composite parent, String[] columnProperties) { - super(parent, SWT.FULL_SELECTION); - - Table table = getTable(); - table.setLinesVisible(true); - table.setHeaderVisible(true); - table.setLinesVisible(true); - - TableLayout layout = new TableLayout(); - for (int i = 0; i < columnProperties.length; i++) { - TableColumn column = new TableColumn(table, i); - column.setText(columnProperties[i]); - column.setAlignment(SWT.LEFT); - layout.addColumnData(new ColumnWeightData(50, true)); - } - table.setLayout(layout); - table.setLinesVisible(false); - - setColumnProperties(columnProperties); - - setContentProvider(new CatalogEntryContentProvider()); - setLabelProvider(new CatalogEntryLabelProvider()); - } - - public Collection getXMLCatalogEntries() { - return null; - } - - public void menuAboutToShow(IMenuManager menuManager) { - Action action = new Action("hello") { //$NON-NLS-1$ - public void run() { - System.out.println("run!"); //$NON-NLS-1$ - } - }; - menuManager.add(action); - } - - public void setFilterExtensions(String[] extensions) { - resetFilters(); - addFilter(new XMLCatalogTableViewerFilter(extensions)); - } - - // ********** inner class ********** - - public class CatalogEntryContentProvider implements IStructuredContentProvider { - - public void dispose() { - } - - public Object[] getElements(Object element) { - Object[] array = getXMLCatalogEntries().toArray(); - Comparator comparator = new Comparator() { - public int compare(Object o1, Object o2) { - int result = 0; - if ((o1 instanceof ICatalogEntry) && (o2 instanceof ICatalogEntry)) { - ICatalogEntry mappingInfo1 = (ICatalogEntry) o1; - ICatalogEntry mappingInfo2 = (ICatalogEntry) o2; - result = Collator.getInstance().compare(mappingInfo1.getKey(), mappingInfo2.getKey()); - } - return result; - } - }; - Arrays.sort(array, comparator); - return array; - } - - public void inputChanged(Viewer viewer, Object old, Object newobj) { - } - - public boolean isDeleted(Object object) { - return false; - } - } - - public class CatalogEntryLabelProvider extends LabelProvider implements ITableLabelProvider { - - public Image getColumnImage(Object object, int columnIndex) { - Image result = null; - if (columnIndex == 0) { - Image base = null; - if (object instanceof ICatalogEntry) { - ICatalogEntry catalogEntry = (ICatalogEntry) object; - String uri = catalogEntry.getURI(); - if (uri.endsWith("dtd")) { //$NON-NLS-1$ - base = dtdFileImage; - } - else if (uri.endsWith("xsd")) { //$NON-NLS-1$ - base = xsdFileImage; - } - else { - base = unknownFileImage; - } - - if (base != null) { - if (URIHelper.isReadableURI(uri, false)) { - result = base; - } - else { - // TODO... SSE port - result = base;// imageFactory.createCompositeImage(base, - // errorImage, - // ImageFactory.BOTTOM_LEFT); - } - } - } - } - return result; - } - - public String getColumnText(Object object, int columnIndex) { - String result = null; - if (object instanceof ICatalogEntry) { - ICatalogEntry catalogEntry = (ICatalogEntry) object; - result = columnIndex == 0 ? catalogEntry.getKey() : catalogEntry.getURI(); - result = URIHelper.removePlatformResourceProtocol(result); - } - return result != null ? result : ""; //$NON-NLS-1$ - } - } - - class XMLCatalogTableViewerFilter extends ViewerFilter { - protected String[] extensions; - - public XMLCatalogTableViewerFilter(String[] extensions) { - this.extensions = extensions; - } - - public boolean isFilterProperty(Object element, Object property) { - return false; - } - - public boolean select(Viewer viewer, Object parent, Object element) { - boolean result = false; - if (element instanceof ICatalogEntry) { - ICatalogEntry catalogEntry = (ICatalogEntry) element; - for (int i = 0; i < extensions.length; i++) { - if (catalogEntry.getURI().endsWith(extensions[i])) { - result = true; - break; - } - } - } - return result; - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetInstallPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetInstallPage.java deleted file mode 100644 index 23526b7272..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetInstallPage.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 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.facet; - -import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetInstallDataModelProperties; - -public class JaxbFacetInstallPage - extends JaxbFacetPage - implements JaxbFacetInstallDataModelProperties { - - public JaxbFacetInstallPage() { - super("jpt.jaxb.facet.install.page"); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetPage.java deleted file mode 100644 index d2897cd77d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetPage.java +++ /dev/null @@ -1,198 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 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.facet; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetDataModelProperties; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate; -import org.eclipse.jst.common.project.facet.ui.libprov.LibraryProviderFrameworkUi; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Group; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.help.IWorkbenchHelpSystem; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.web.ui.internal.wizards.DataModelFacetInstallPage; - - -public abstract class JaxbFacetPage - extends DataModelFacetInstallPage - implements JaxbFacetDataModelProperties { - - protected JaxbFacetPage(String pageName) { - super(pageName); - setTitle(JptJaxbUiMessages.JaxbFacetWizardPage_title); - setDescription(JptJaxbUiMessages.JaxbFacetWizardPage_desc); - setImageDescriptor(JptJaxbUiPlugin.getImageDescriptor(JptJaxbUiIcons.JAXB_WIZ_BANNER)); - } - - - @Override - public void setConfig(Object config) { - if (! (config instanceof IDataModel)) { - config = Platform.getAdapterManager().loadAdapter(config, IDataModel.class.getName()); - } - super.setConfig(config); - } - - @Override - protected Composite createTopLevelComposite(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - composite.setLayout(layout); - - addSubComposites(composite); - - Dialog.applyDialogFont(parent); -// PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, JpaHelpContextIds.DIALOG_JPA_FACET); - - return composite; - } - - protected void addSubComposites(Composite composite) { - new PlatformGroup(composite); - new ClasspathConfigGroup(composite); - } - - protected Button createButton(Composite container, int span, String text, int style) { - Button button = new Button(container, SWT.NONE | style); - button.setText(text); - GridData gd = new GridData(); - gd.horizontalSpan = span; - button.setLayoutData(gd); - return button; - } - - protected Combo createCombo(Composite container, int span, boolean fillHorizontal) { - Combo combo = new Combo(container, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY); - GridData gd; - if (fillHorizontal) { - gd = new GridData(GridData.FILL_HORIZONTAL); - } - else { - gd = new GridData(); - } - gd.horizontalSpan = span; - combo.setLayoutData(gd); - return combo; - } - - @Override - protected String[] getValidationPropertyNames() { - return new String[] { - PLATFORM, - LIBRARY_INSTALL_DELEGATE - }; - } - - @Override - public boolean isPageComplete() { - if (! super.isPageComplete()) { - return false; - } - else { - IStatus status = this.model.validate(); - if (status.getSeverity() == IStatus.ERROR) { - setErrorMessage(status.getMessage()); - return false; - }; - setErrorMessage(null); - return true; - } - } - - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - setErrorMessage(); - } - } - - @Override - public void transferStateToConfig() { - // This method is called when "finish" is being performed. - // We remove "this" as a listener so that it will stop responding to data model changes. - // "This" listens only for validation purposes, and we are done with validation at this - // point. Furthermore, any validation at this point runs into the danger of deadlocking - // the wizard. - this.model.removeListener(this); - this.synchHelper.dispose(); - super.transferStateToConfig(); - } - - @Override - protected void validatePage() { - // done to prevent "orphan" pages from validating - if (getWizard() == null) { - return; - } - - super.validatePage(); - } - - @Override - protected void validatePage(boolean showMessage) { - // done to prevent "orphan" pages from validating - if (getWizard() == null) { - return; - } - - super.validatePage(showMessage); - } - - protected final IWorkbenchHelpSystem getHelpSystem() { - return PlatformUI.getWorkbench().getHelpSystem(); - } - - - protected final class PlatformGroup - { - private final Combo platformCombo; - - - public PlatformGroup(Composite composite) { - Group group = new Group(composite, SWT.NONE); - group.setText(JptJaxbUiMessages.JaxbFacetWizardPage_platformLabel); - group.setLayout(new GridLayout()); - group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); -// PlatformUI.getWorkbench().getHelpSystem().setHelp(group, JpaHelpContextIds.DIALOG_JPA_PLATFORM); - - this.platformCombo = createCombo(group, 1, true); - JaxbFacetPage.this.synchHelper.synchCombo(platformCombo, PLATFORM, null); - } - } - - - protected final class ClasspathConfigGroup { - - public ClasspathConfigGroup(Composite composite) { - - LibraryInstallDelegate librariesInstallDelegate - = (LibraryInstallDelegate) getDataModel().getProperty(LIBRARY_INSTALL_DELEGATE); - - Composite librariesComposite - = (Composite) LibraryProviderFrameworkUi.createInstallLibraryPanel( - composite, librariesInstallDelegate, - JptJaxbUiMessages.JaxbFacetWizardPage_jaxbImplementationLabel); - librariesComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); -// PlatformUI.getWorkbench().getHelpSystem().setHelp(librariesComposite, JpaHelpContextIds.NEW_JPA_PROJECT_CONTENT_PAGE_CLASSPATH); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetVersionChangePage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetVersionChangePage.java deleted file mode 100644 index 26e1e43b0a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetVersionChangePage.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 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.facet; - -import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetVersionChangeDataModelProperties; - -public class JaxbFacetVersionChangePage - extends JaxbFacetPage - implements JaxbFacetVersionChangeDataModelProperties { - - public JaxbFacetVersionChangePage() { - super("jpt.jaxb.facet.versionChange.page"); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/JaxbProjectWizard.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/JaxbProjectWizard.java deleted file mode 100644 index 696d4cee32..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/JaxbProjectWizard.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * 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.proj; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.jpt.jaxb.ui.internal.wizards.proj.model.JaxbProjectCreationDataModelProvider; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; -import org.eclipse.wst.web.ui.internal.wizards.NewProjectDataModelFacetWizard; - - -public class JaxbProjectWizard - extends NewProjectDataModelFacetWizard { - - public JaxbProjectWizard() { - super(); - setWindowTitle(JptJaxbUiMessages.JaxbProjectWizard_title); - } - - public JaxbProjectWizard(IDataModel dataModel) { - super(dataModel); - setWindowTitle(JptJaxbUiMessages.JaxbProjectWizard_title); - } - - - @Override - protected ImageDescriptor getDefaultPageImageDescriptor() { - return JptJaxbUiPlugin.getImageDescriptor(JptJaxbUiIcons.JAXB_WIZ_BANNER); - } - - @Override - protected IWizardPage createFirstPage() { - return new JaxbProjectWizardFirstPage(model, "first.page"); //$NON-NLS-1$ - } - - @Override - protected IDataModel createDataModel() { - return DataModelFactory.createDataModel(new JaxbProjectCreationDataModelProvider()); - } - - @Override - protected IFacetedProjectTemplate getTemplate() { - return ProjectFacetsManager.getTemplate("jpt.jaxb.template"); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/JaxbProjectWizardFirstPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/JaxbProjectWizardFirstPage.java deleted file mode 100644 index 1a1ec07af8..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/JaxbProjectWizardFirstPage.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * 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.proj; - -import org.eclipse.jpt.jaxb.core.JaxbFacet; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.web.ui.internal.wizards.DataModelFacetCreationWizardPage; - - -public class JaxbProjectWizardFirstPage - extends DataModelFacetCreationWizardPage { - - public JaxbProjectWizardFirstPage(IDataModel dataModel, String pageName) { - super(dataModel, pageName); - setTitle(JptJaxbUiMessages.JaxbProjectWizard_firstPage_title); - setDescription(JptJaxbUiMessages.JaxbProjectWizard_firstPage_desc); - //setInfopopID(JpaJaxbHelpContextIds.NEW_JAXB_PROJECT); - } - - - @Override - protected Composite createTopLevelComposite(Composite parent) { - final Composite top = super.createTopLevelComposite(parent); - createWorkingSetGroupPanel(top, new String[] { RESOURCE_WORKING_SET, JAVA_WORKING_SET }); - return top; - } - -// @Override -// public boolean internalLaunchNewRuntimeWizard(Shell shell, IDataModel model) { -// IFacetedProjectWorkingCopy fpwc = (IFacetedProjectWorkingCopy) model.getProperty(FACETED_PROJECT_WORKING_COPY); -// IProjectFacetVersion moduleFacet = FacetTools.getModuleFacet(fpwc); -// if (moduleFacet != null) { -// return launchNewRuntimeWizard(shell, model, moduleFacet.getProjectFacet().getId()); -// } -// else { -// return launchNewRuntimeWizard(shell, model); -// } -// } - - @Override - protected String getModuleTypeID() { - return JaxbFacet.ID; - } - - @Override - public void storeDefaultSettings() { - super.storeDefaultSettings(); - // TODO -// IDialogSettings settings = getDialogSettings(); -// if (settings != null) { -// FacetDataModelMap map = (FacetDataModelMap)model.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP); -// String facetID = getModuleFacetID(); -// IDataModel j2eeModel = map.getFacetDataModel(facetID); -// if(j2eeModel.getBooleanProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR)){ -// String lastEARName = j2eeModel.getStringProperty(IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME); -// settings.put(STORE_LABEL, lastEARName); -// } -// } - } - - @Override - public void restoreDefaultSettings() { - super.restoreDefaultSettings(); - // TODO -// IDialogSettings settings = getDialogSettings(); -// if (settings != null) { -// String lastEARName = settings.get(STORE_LABEL); -// if (lastEARName != null){ -// FacetDataModelMap map = (FacetDataModelMap)model.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP); -// String facetID = getModuleFacetID(); -// IDataModel j2eeModel = map.getFacetDataModel(facetID); -// j2eeModel.setProperty(IJ2EEModuleFacetInstallDataModelProperties.LAST_EAR_NAME, lastEARName); -// } -// } - } - -// @Override -// protected IDialogSettings getDialogSettings() { -// return J2EEUIPlugin.getDefault().getDialogSettings(); -// } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/model/JaxbProjectCreationDataModelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/model/JaxbProjectCreationDataModelProvider.java deleted file mode 100644 index 76747b04ab..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/model/JaxbProjectCreationDataModelProvider.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * 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.proj.model; - -import java.util.ArrayList; -import java.util.Collection; -import org.eclipse.jpt.jaxb.core.JaxbFacet; -import org.eclipse.jst.common.project.facet.core.JavaFacet; -import org.eclipse.wst.common.componentcore.datamodel.FacetProjectCreationDataModelProvider; -import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties; -import org.eclipse.wst.common.project.facet.core.IProjectFacet; - - -public class JaxbProjectCreationDataModelProvider - extends FacetProjectCreationDataModelProvider - implements IFacetProjectCreationDataModelProperties { - - public JaxbProjectCreationDataModelProvider() { - super(); - } - - - @Override - public void init() { - super.init(); - - Collection<IProjectFacet> requiredFacets = new ArrayList<IProjectFacet>(); - requiredFacets.add(JavaFacet.FACET); - requiredFacets.add(JaxbFacet.FACET); - setProperty(REQUIRED_FACETS_COLLECTION, requiredFacets); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/AbstractJarDestinationWizardPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/AbstractJarDestinationWizardPage.java deleted file mode 100644 index b703e1c3bb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/AbstractJarDestinationWizardPage.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* -* 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.schemagen; - -import org.eclipse.jdt.ui.jarpackager.JarPackageData; -import org.eclipse.jface.viewers.IStructuredSelection; - -/** - * Façade class to change accessibility of AbstractJarDestinationWizardPage. - */ -@SuppressWarnings("restriction") -public abstract class AbstractJarDestinationWizardPage extends org.eclipse.jdt.internal.ui.jarpackager.AbstractJarDestinationWizardPage -{ - - public AbstractJarDestinationWizardPage(String pageName, IStructuredSelection selection, JarPackageData jarPackage) { - super(pageName, selection, jarPackage); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/CheckboxTreeAndListGroup.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/CheckboxTreeAndListGroup.java deleted file mode 100644 index e551a5e32f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/CheckboxTreeAndListGroup.java +++ /dev/null @@ -1,856 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Code originate from org.eclipse.jdt.internal.ui.jarpackager - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.schemagen; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.CheckboxTableViewer; -import org.eclipse.jface.viewers.CheckboxTreeViewer; -import org.eclipse.jface.viewers.ICheckStateListener; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.ITreeViewerListener; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TreeExpansionEvent; -import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.Tree; - -/** - * Combines a CheckboxTreeViewer and CheckboxListViewer. - * All viewer selection-driven interactions are handled within this viewer - */ -public class CheckboxTreeAndListGroup implements ICheckStateListener, ISelectionChangedListener, ITreeViewerListener { - - private Object fRoot; - private Object fCurrentTreeSelection; - private List fExpandedTreeNodes= new ArrayList(); - private Map fCheckedStateStore= this.buildCheckedStateStore(); - private List fWhiteCheckedTreeItems= new ArrayList(); - private List fListeners= new ArrayList(); - - private ITreeContentProvider fTreeContentProvider; - private IStructuredContentProvider fListContentProvider; - private ILabelProvider fTreeLabelProvider; - private ILabelProvider fListLabelProvider; - - // widgets - private CheckboxTreeViewer fTreeViewer; - private CheckboxTableViewer fListViewer; - - /** - * Creates an instance of this class. Use this constructor if you wish to specify - * the width and/or height of the combined widget (to only hardcode one of the - * sizing dimensions, specify the other dimension's value as -1) - * @param parent parent composite - * @param rootObject - * @param treeContentProvider - * @param treeLabelProvider - * @param listContentProvider - * @param listLabelProvider - * @param style - * @param width the width - * @param height the height - */ - public CheckboxTreeAndListGroup( - Composite parent, - Object rootObject, - ITreeContentProvider treeContentProvider, - ILabelProvider treeLabelProvider, - IStructuredContentProvider listContentProvider, - ILabelProvider listLabelProvider, - int style, - int width, - int height) { - fRoot= rootObject; - fTreeContentProvider= treeContentProvider; - fListContentProvider= listContentProvider; - fTreeLabelProvider= treeLabelProvider; - fListLabelProvider= listLabelProvider; - createContents(parent, width, height, style); - } - /** - * This method must be called just before this window becomes visible. - */ - public void aboutToOpen() { - determineWhiteCheckedDescendents(fRoot); - checkNewTreeElements(getTreeChildren(fRoot)); - fCurrentTreeSelection= null; - - //select the first element in the list - Object[] elements= getTreeChildren(fRoot); - Object primary= elements.length > 0 ? elements[0] : null; - if (primary != null) { - fTreeViewer.setSelection(new StructuredSelection(primary)); - } - fTreeViewer.getControl().setFocus(); - } - /** - * Adds the passed listener to self's collection of clients - * that listen for changes to element checked states - * - * @param listener ICheckStateListener - */ - public void addCheckStateListener(ICheckStateListener listener) { - fListeners.add(listener); - } - /** - * Adds the receiver and all of it's ancestors to the checkedStateStore if they - * are not already there. - * @param treeElement - */ - private void addToHierarchyToCheckedStore(Object treeElement) { - - // if this tree element is already gray then its ancestors all are as well - if (!fCheckedStateStore.containsKey(treeElement)) - fCheckedStateStore.put(treeElement, new ArrayList()); - - Object parent= fTreeContentProvider.getParent(treeElement); - if (parent != null) - addToHierarchyToCheckedStore(parent); - } - /** - * Returns a boolean indicating whether all children of the passed tree element - * are currently white-checked - * - * @return boolean - * @param treeElement java.lang.Object - */ - protected boolean areAllChildrenWhiteChecked(Object treeElement) { - Object[] children= getTreeChildren(treeElement); - for (int i= 0; i < children.length; ++i) { - if (!fWhiteCheckedTreeItems.contains(children[i])) - return false; - } - - return true; - } - /** - * Returns a boolean indicating whether all list elements associated with - * the passed tree element are currently checked - * - * @return boolean - * @param treeElement java.lang.Object - */ - protected boolean areAllElementsChecked(Object treeElement) { - List checkedElements= (List)fCheckedStateStore.get(treeElement); - if (checkedElements == null) // ie.- tree item not even gray-checked - return false; - - return getListItemsSize(treeElement) == checkedElements.size(); - } - /** - * Iterates through the passed elements which are being realized for the first - * time and check each one in the tree viewer as appropriate - * @param elements - */ - protected void checkNewTreeElements(Object[] elements) { - for (int i= 0; i < elements.length; ++i) { - Object currentElement= elements[i]; - boolean checked= fCheckedStateStore.containsKey(currentElement); - fTreeViewer.setChecked(currentElement, checked); - fTreeViewer.setGrayed( - currentElement, - checked && !fWhiteCheckedTreeItems.contains(currentElement)); - } - } - /** - * An item was checked in one of self's two views. Determine which - * view this occurred in and delegate appropriately - * - * @param event CheckStateChangedEvent - */ - public void checkStateChanged(final CheckStateChangedEvent event) { - - //Potentially long operation - show a busy cursor - BusyIndicator.showWhile(fTreeViewer.getControl().getDisplay(), new Runnable() { - public void run() { - if (event.getCheckable().equals(fTreeViewer)) - treeItemChecked(event.getElement(), event.getChecked()); - else - listItemChecked(event.getElement(), event.getChecked(), true); - - notifyCheckStateChangeListeners(event); - } - }); - } - /** - * Lay out and initialize self's visual components. - * - * @param parent org.eclipse.swt.widgets.Composite - * @param width int - * @param height int - * @param style - */ - protected void createContents( - Composite parent, - int width, - int height, - int style) { - // group pane - Composite composite= new Composite(parent, style); - GridLayout layout= new GridLayout(); - layout.numColumns= 2; - layout.makeColumnsEqualWidth= true; - layout.marginHeight= 0; - layout.marginWidth= 0; - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - - createTreeViewer(composite, width / 2, height); - createListViewer(composite, width / 2, height); - - initialize(); - } - /** - * Creates this group's list viewer. - * @param parent the parent composite - * @param width the width - * @param height the height - */ - protected void createListViewer(Composite parent, int width, int height) { - fListViewer= CheckboxTableViewer.newCheckList(parent, SWT.BORDER); - fListViewer.setUseHashlookup(true); - GridData data= new GridData(GridData.FILL_BOTH); - data.widthHint= width; - data.heightHint= height; - fListViewer.getTable().setLayoutData(data); - fListViewer.setContentProvider(fListContentProvider); - fListViewer.setLabelProvider(fListLabelProvider); - fListViewer.addCheckStateListener(this); - } - /** - * Creates this group's tree viewer. - * @param parent parent composite - * @param width the width - * @param height the height - */ - protected void createTreeViewer(Composite parent, int width, int height) { - Tree tree= new Tree(parent, SWT.CHECK | SWT.BORDER); - GridData data= new GridData(GridData.FILL_BOTH); - data.widthHint= width; - data.heightHint= height; - tree.setLayoutData(data); - - fTreeViewer= new CheckboxTreeViewer(tree); - fTreeViewer.setUseHashlookup(true); - fTreeViewer.setContentProvider(fTreeContentProvider); - fTreeViewer.setLabelProvider(fTreeLabelProvider); - fTreeViewer.addTreeListener(this); - fTreeViewer.addCheckStateListener(this); - fTreeViewer.addSelectionChangedListener(this); - } - /** - * Returns a boolean indicating whether the passed tree element should be - * at LEAST gray-checked. Note that this method does not consider whether - * it should be white-checked, so a specified tree item which should be - * white-checked will result in a <code>true</code> answer from this method. - * To determine whether a tree item should be white-checked use method - * #determineShouldBeWhiteChecked(Object). - * - * @param treeElement java.lang.Object - * @return boolean - * @see #determineShouldBeWhiteChecked(java.lang.Object) - */ - protected boolean determineShouldBeAtLeastGrayChecked(Object treeElement) { - // if any list items associated with treeElement are checked then it - // retains its gray-checked status regardless of its children - List checked= (List) fCheckedStateStore.get(treeElement); - if (checked != null && (!checked.isEmpty())) - return true; - - // if any children of treeElement are still gray-checked then treeElement - // must remain gray-checked as well - Object[] children= getTreeChildren(treeElement); - for (int i= 0; i < children.length; ++i) { - if (fCheckedStateStore.containsKey(children[i])) - return true; - } - - return false; - } - /** - * Returns a boolean indicating whether the passed tree item should be - * white-checked. - * - * @return boolean - * @param treeElement java.lang.Object - */ - protected boolean determineShouldBeWhiteChecked(Object treeElement) { - return areAllChildrenWhiteChecked(treeElement) - && areAllElementsChecked(treeElement); - } - /** - * Recursively adds appropriate tree elements to the collection of - * known white-checked tree elements. - * - * @param treeElement java.lang.Object - */ - protected void determineWhiteCheckedDescendents(Object treeElement) { - // always go through all children first since their white-checked - // statuses will be needed to determine the white-checked status for - // this tree element - Object[] children= getTreeChildren(treeElement); - for (int i= 0; i < children.length; ++i) - determineWhiteCheckedDescendents(children[i]); - - // now determine the white-checked status for this tree element - if (determineShouldBeWhiteChecked(treeElement)) - setWhiteChecked(treeElement, true); - } - /** - * Causes the tree viewer to expand all its items - */ - public void expandAll() { - fTreeViewer.expandAll(); - } - /** - * Answers a flat collection of all of the checked elements in the - * list portion of self - * - * @return java.util.Vector - */ - public Iterator getAllCheckedListItems() { - Set result= new HashSet(); - Iterator listCollectionsEnum= this.fCheckedStateStore.values().iterator(); - while (listCollectionsEnum.hasNext()) - result.addAll((List)listCollectionsEnum.next()); - return result.iterator(); - } - /** - * Answer a collection of all of the checked elements in the tree portion - * of self - * - * @return java.util.Vector - */ - public Set getAllCheckedTreeItems() { - return new HashSet(fCheckedStateStore.keySet()); - } - /** - * Answers the number of elements that have been checked by the - * user. - * - * @return int - */ - public int getCheckedElementCount() { - return fCheckedStateStore.size(); - } - /** - * Returns a count of the number of list items associated with a - * given tree item. - * - * @return int - * @param treeElement java.lang.Object - */ - protected int getListItemsSize(Object treeElement) { - Object[] elements= getListElements(treeElement); - return elements.length; - } - /** - * Gets the table that displays the folder content - * - * @return the table used to show the list - */ - public Table getTable() { - return fListViewer.getTable(); - } - /** - * Gets the tree that displays the list for a folder - * - * @return the tree used to show the folders - */ - public Tree getTree() { - return fTreeViewer.getTree(); - } - /** - * Adds the given filter to the tree viewer and - * triggers refiltering and resorting of the elements. - * - * @param filter a viewer filter - */ - public void addTreeFilter(ViewerFilter filter) { - fTreeViewer.addFilter(filter); - } - - public void removeTreeFilter(ViewerFilter filter) { - fTreeViewer.removeFilter(filter); - } - - /** - * Adds the given filter to the list viewer and - * triggers refiltering and resorting of the elements. - * - * @param filter a viewer filter - */ - public void addListFilter(ViewerFilter filter) { - fListViewer.addFilter(filter); - } - - /** - * Logically gray-check all ancestors of treeItem by ensuring that they - * appear in the checked table - * @param treeElement - */ - protected void grayCheckHierarchy(Object treeElement) { - - // if this tree element is already gray then its ancestors all are as well - if (fCheckedStateStore.containsKey(treeElement)) - return; // no need to proceed upwards from here - - fCheckedStateStore.put(treeElement, new ArrayList()); - if (determineShouldBeWhiteChecked(treeElement)) { - setWhiteChecked(treeElement, true); - } - Object parent= fTreeContentProvider.getParent(treeElement); - if (parent != null) - grayCheckHierarchy(parent); - } - /** - * Sets the initial checked state of the passed list element to true. - * @param element - */ - public void initialCheckListItem(Object element) { - Object parent= fTreeContentProvider.getParent(element); - fCurrentTreeSelection= parent; - //As this is not done from the UI then set the box for updating from the selection to false - listItemChecked(element, true, false); - updateHierarchy(parent); - } - /** - * Sets the initial checked state of the passed element to true, - * as well as to all of its children and associated list elements - * @param element - */ - public void initialCheckTreeItem(Object element) { - treeItemChecked(element, true); - } - /** - * Initializes this group's viewers after they have been laid out. - */ - protected void initialize() { - fTreeViewer.setInput(fRoot); - } - /** - * Callback that's invoked when the checked status of an item in the list - * is changed by the user. Do not try and update the hierarchy if we are building the - * initial list. - * @param listElement - * @param state - * @param updatingFromSelection - */ - protected void listItemChecked( - Object listElement, - boolean state, - boolean updatingFromSelection) { - List checkedListItems= (List) fCheckedStateStore.get(fCurrentTreeSelection); - - if (state) { - if (checkedListItems == null) { - // since the associated tree item has gone from 0 -> 1 checked - // list items, tree checking may need to be updated - grayCheckHierarchy(fCurrentTreeSelection); - checkedListItems= (List) fCheckedStateStore.get(fCurrentTreeSelection); - } - checkedListItems.add(listElement); - } else { - checkedListItems.remove(listElement); - if (checkedListItems.isEmpty()) { - // since the associated tree item has gone from 1 -> 0 checked - // list items, tree checking may need to be updated - ungrayCheckHierarchy(fCurrentTreeSelection); - } - } - - if (updatingFromSelection) - updateHierarchy(fCurrentTreeSelection); - } - /** - * Notifies all checked state listeners that the passed element has had - * its checked state changed to the passed state - * @param event - */ - protected void notifyCheckStateChangeListeners(CheckStateChangedEvent event) { - Iterator listenersEnum= fListeners.iterator(); - while (listenersEnum.hasNext()) - ((ICheckStateListener) listenersEnum.next()).checkStateChanged(event); - } - /** - *Sets the contents of the list viewer based upon the specified selected - *tree element. This also includes checking the appropriate list items. - * - *@param treeElement java.lang.Object - */ - public void populateListViewer(final Object treeElement) { - if (treeElement == fCurrentTreeSelection) - return; - fCurrentTreeSelection= treeElement; - fListViewer.setInput(treeElement); - List listItemsToCheck= (List) fCheckedStateStore.get(treeElement); - - if (listItemsToCheck != null) { - Iterator listItemsEnum= listItemsToCheck.iterator(); - while (listItemsEnum.hasNext()) - fListViewer.setChecked(listItemsEnum.next(), true); - } - } - /** - * Removes the passed listener from self's collection of clients - * that listen for changes to element checked states - * - * @param listener ICheckStateListener - */ - public void removeCheckStateListener(ICheckStateListener listener) { - fListeners.remove(listener); - } - /** - * Handles the selection of an item in the tree viewer - * - * @param event ISelection - */ - public void selectionChanged(final SelectionChangedEvent event) { - BusyIndicator.showWhile(getTable().getShell().getDisplay(), new Runnable() { - public void run() { - IStructuredSelection selection= (IStructuredSelection) event.getSelection(); - Object selectedElement= selection.getFirstElement(); - if (selectedElement == null) { - fCurrentTreeSelection= null; - fListViewer.setInput(fCurrentTreeSelection); - return; - } - populateListViewer(selectedElement); - } - }); - } - - /** - * Selects or deselect all of the elements in the tree depending on the value of the selection - * boolean. Be sure to update the displayed files as well. - * @param selection - */ - public void setAllSelections(final boolean selection) { - - //Potentially long operation - show a busy cursor - BusyIndicator.showWhile(fTreeViewer.getControl().getDisplay(), new Runnable() { - public void run() { - setTreeChecked(fRoot, selection); - fListViewer.setAllChecked(selection); - } - }); - } - - /** - * Sets the list viewer's providers to those passed - * - * @param contentProvider ITreeContentProvider - * @param labelProvider ILabelProvider - */ - public void setListProviders( - IStructuredContentProvider contentProvider, - ILabelProvider labelProvider) { - fListViewer.setContentProvider(contentProvider); - fListViewer.setLabelProvider(labelProvider); - } - /** - * Sets the sorter that is to be applied to self's list viewer - * @param comparator - */ - public void setListComparator(ViewerComparator comparator) { - fListViewer.setComparator(comparator); - } - /** - * Sets the root of the widget to be new Root. Regenerate all of the tables and lists from this - * value. - * - * @param newRoot - */ - public void setRoot(Object newRoot) { - this.fRoot= newRoot; - initialize(); - } - /** - * Sets the checked state of the passed tree element appropriately, and - * do so recursively to all of its child tree elements as well - * @param treeElement - * @param state - */ - protected void setTreeChecked(Object treeElement, boolean state) { - - if (treeElement.equals(fCurrentTreeSelection)) { - fListViewer.setAllChecked(state); - } - - if (state) { - Object[] listItems= getListElements(treeElement); - List listItemsChecked= new ArrayList(); - for (int i= 0; i < listItems.length; ++i) - listItemsChecked.add(listItems[i]); - - fCheckedStateStore.put(treeElement, listItemsChecked); - } else - fCheckedStateStore.remove(treeElement); - - setWhiteChecked(treeElement, state); - fTreeViewer.setChecked(treeElement, state); - fTreeViewer.setGrayed(treeElement, false); - - // now logically check/uncheck all children as well - Object[] children= getTreeChildren(treeElement); - for (int i= 0; i < children.length; ++i) { - setTreeChecked(children[i], state); - } - } - /** - * Sets the tree viewer's providers to those passed - * - * @param contentProvider ITreeContentProvider - * @param labelProvider ILabelProvider - */ - public void setTreeProviders( - ITreeContentProvider contentProvider, - ILabelProvider labelProvider) { - fTreeViewer.setContentProvider(contentProvider); - fTreeViewer.setLabelProvider(labelProvider); - } - /** - * Sets the sorter that is to be applied to self's tree viewer - * @param sorter - */ - public void setTreeComparator(ViewerComparator sorter) { - fTreeViewer.setComparator(sorter); - } - /** - * Adjusts the collection of references to white-checked tree elements appropriately. - * - * @param treeElement java.lang.Object - * @param isWhiteChecked boolean - */ - protected void setWhiteChecked(Object treeElement, boolean isWhiteChecked) { - if (isWhiteChecked) { - if (!fWhiteCheckedTreeItems.contains(treeElement)) - fWhiteCheckedTreeItems.add(treeElement); - } else - fWhiteCheckedTreeItems.remove(treeElement); - } - /** - * Handle the collapsing of an element in a tree viewer - * @param event - */ - public void treeCollapsed(TreeExpansionEvent event) { - // We don't need to do anything with this - } - - /** - * Handles the expansionsion of an element in a tree viewer - * @param event - */ - public void treeExpanded(TreeExpansionEvent event) { - - Object item= event.getElement(); - - // First see if the children need to be given their checked state at all. If they've - // already been realized then this won't be necessary - if (!fExpandedTreeNodes.contains(item)) { - fExpandedTreeNodes.add(item); - checkNewTreeElements(getTreeChildren(item)); - } - } - - /** - * Callback that's invoked when the checked status of an item in the tree - * is changed by the user. - * @param treeElement - * @param state - */ - protected void treeItemChecked(Object treeElement, boolean state) { - - // recursively adjust all child tree elements appropriately - setTreeChecked(treeElement, state); - - Object parent= fTreeContentProvider.getParent(treeElement); - if (parent == null) - return; - - // now update upwards in the tree hierarchy - if (state) - grayCheckHierarchy(parent); - else - ungrayCheckHierarchy(parent); - - updateHierarchy(treeElement); - } - /** - * Logically un-gray-check all ancestors of treeItem iff appropriate. - * @param treeElement - */ - protected void ungrayCheckHierarchy(Object treeElement) { - if (!determineShouldBeAtLeastGrayChecked(treeElement)) - fCheckedStateStore.remove(treeElement); - - Object parent= fTreeContentProvider.getParent(treeElement); - if (parent != null) - ungrayCheckHierarchy(parent); - } - /** - * Sets the checked state of self and all ancestors appropriately - * @param treeElement - */ - protected void updateHierarchy(Object treeElement) { - - boolean whiteChecked= determineShouldBeWhiteChecked(treeElement); - boolean shouldBeAtLeastGray= determineShouldBeAtLeastGrayChecked(treeElement); - - fTreeViewer.setChecked(treeElement, whiteChecked || shouldBeAtLeastGray); - setWhiteChecked(treeElement, whiteChecked); - if (whiteChecked) - fTreeViewer.setGrayed(treeElement, false); - else - fTreeViewer.setGrayed(treeElement, shouldBeAtLeastGray); - - // proceed up the tree element hierarchy - Object parent= fTreeContentProvider.getParent(treeElement); - if (parent != null) { - updateHierarchy(parent); - } - } - /** - * Update the selections of the tree elements in items to reflect the new - * selections provided. - * - * @param items with keys of Object (the tree element) and values of List (the selected - * list elements). - */ - public void updateSelections(final Map items) { - - //Potentially long operation - show a busy cursor - BusyIndicator.showWhile(fTreeViewer.getControl().getDisplay(), new Runnable() { - public void run() { - handleUpdateSelection(items); - } - }); - } - /** - * Returns the result of running the given elements through the filters. - * @param filters - * - * @param elements the elements to filter - * @return only the elements which all filters accept - */ - protected Object[] filter(ViewerFilter[] filters, Object[] elements) { - if (filters != null) { - ArrayList filtered = new ArrayList(elements.length); - for (int i = 0; i < elements.length; i++) { - boolean add = true; - for (int j = 0; j < filters.length; j++) { - add = filters[j].select(null, null, elements[i]); - if (!add) - break; - } - if (add) - filtered.add(elements[i]); - } - return filtered.toArray(); - } - return elements; - } - - private Object[] getTreeChildren(Object element) { - return filter(fTreeViewer.getFilters(), fTreeContentProvider.getChildren(element)); - } - - private Object[] getListElements(Object element) { - return filter(fListViewer.getFilters(), fListContentProvider.getElements(element)); - } - - public Set getWhiteCheckedTreeItems() { - return new HashSet(fWhiteCheckedTreeItems); - } - - private HashMap buildCheckedStateStore() { - return new HashMap(9); - } - - private void handleUpdateSelection(Map items) { - Iterator keyIterator= items.keySet().iterator(); - - //Update the store before the hierarchy to prevent updating parents before all of the children are done - while (keyIterator.hasNext()) { - Object key= keyIterator.next(); - //Replace the items in the checked state store with those from the supplied items - List selections= (List) items.get(key); - if (selections.size() == 0) - //If it is empty remove it from the list - fCheckedStateStore.remove(key); - else { - fCheckedStateStore.put(key, selections); - // proceed up the tree element hierarchy - Object parent= fTreeContentProvider.getParent(key); - if (parent != null) { - addToHierarchyToCheckedStore(parent); - } - } - } - - //Now update hierarchies - keyIterator= items.keySet().iterator(); - - while (keyIterator.hasNext()) { - Object key= keyIterator.next(); - updateHierarchy(key); - if (fCurrentTreeSelection != null && fCurrentTreeSelection.equals(key)) { - fListViewer.setAllChecked(false); - fListViewer.setCheckedElements(((List) items.get(key)).toArray()); - } - } - } - - /** - * Checks if an element is grey checked. - * @param object - * @return if an element is grey checked. - */ - public boolean isTreeItemGreyChecked(Object object) { - return fTreeViewer.getGrayed(object); - } - - /** - * For a given element, expand its chidren to a level. - * @param object - * @param level - */ - public void expandTreeToLevel(Object object, int level) { - fTreeViewer.expandToLevel(object, level); - } - /** - * @param selection - */ - public void setTreeSelection(ISelection selection) { - fTreeViewer.setSelection(selection); - } -}
\ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/NewSchemaFileWizardPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/NewSchemaFileWizardPage.java deleted file mode 100644 index d6fcb911bf..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/NewSchemaFileWizardPage.java +++ /dev/null @@ -1,213 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 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.schemagen; - -import static org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties.CONTAINER_PATH; -import static org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties.FILE_NAME; -import static org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties.PROJECT; -import static org.eclipse.jpt.jaxb.ui.internal.wizards.schemagen.SchemaGeneratorWizard.XSD_EXTENSION; - -import java.io.File; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jface.dialogs.IMessageProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jpt.common.utility.internal.FileTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; -import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -/** - * NewSchemaFileWizardPage - */ -public class NewSchemaFileWizardPage extends WizardNewFileCreationPage { - - protected IDataModel dataModel; - - private IStructuredSelection initialSelection; - - static public String DEFAULT_SCHEMA_NAME = "NewXMLSchema" + XSD_EXTENSION; //$NON-NLS-1$ - - // ********** constructor ********** - - public NewSchemaFileWizardPage(String pageName, IStructuredSelection selection, IDataModel dataModel, - String title, String description) { - - super(pageName, selection); - this.initialSelection = selection; - - this.init(dataModel); - this.setTitle(title); - this.setDescription(description); - } - - protected void init(IDataModel dataModel) { - this.dataModel = dataModel; - - IProject project = this.getProjectFromInitialSelection(); - this.dataModel.setProperty(PROJECT, project); - - IPath containerPath = (IPath) this.dataModel.getProperty(CONTAINER_PATH); - if (containerPath != null) { - this.setContainerFullPath(containerPath); - } - } - - // ********** IDialogPage implementation ********** - @Override - public void createControl(Composite parent) { - super.createControl(parent); - - this.setAllowExistingResources(true); - this.setFileName(DEFAULT_SCHEMA_NAME); - } - - // ********** intra-wizard methods ********** - - public IProject getProject() { - return (IProject) this.dataModel.getProperty(PROJECT); - } - - /** - * @return the path of the schema file relative to the project - */ - public IPath getFileRelativePath() { - IPath filePath = this.getContainerFullPath(); - String projectName = filePath.segment(0); - - if(this.getProject().getName().equals(projectName)) { - filePath = filePath.removeFirstSegments(1); - } - return filePath; - } - - // ********** validation ********** - - @Override - protected boolean validatePage() { - this.dataModel.setProperty(PROJECT, this.getProjectNamed(this.getContainerName())); - this.dataModel.setProperty(CONTAINER_PATH, this.getContainerFullPath()); - this.dataModel.setProperty(FILE_NAME, this.getFileName()); - - boolean valid = super.validatePage(); - if( ! valid) { - return valid; - } - this.overrideFileExistsWarning(); - - //TODO move this validation to the dataModel - see MappingFileNewFileWizardPage - // Validate Project - valid = this.projectIsJavaProject(this.getProject()); - if( ! valid) { - this.setErrorMessage(JptJaxbUiMessages.NewSchemaFileWizardPage_errorNotJavaProject); - return valid; - } - // Validate XSD file not exists. - valid = this.xsdFileNotExists(); - if( ! valid) { - this.setMessage(JptJaxbUiMessages.NewSchemaFileWizardPage_overwriteExistingSchemas, IMessageProvider.WARNING); - return true; - } - this.setErrorMessage(null); - - return valid; - } - - // ********** internal methods ********** - - private boolean projectIsJavaProject(IProject project) { - try { - return (project != null) && (project.hasNature(JavaCore.NATURE_ID)); - } - catch (CoreException e) { - return false; - } - } - - private IProject getProjectFromInitialSelection() { - Object firstElement = initialSelection.getFirstElement(); - if(firstElement instanceof IProject) { - return (IProject)firstElement; - } - else if(firstElement instanceof IResource) { - return ((IResource) firstElement).getProject(); - } - else if(firstElement instanceof IJavaElement) { - return ((IJavaElement)firstElement).getJavaProject().getProject(); - } - return null; - } - - private IProject getProjectNamed(String projectName) { - if(StringTools.stringIsEmpty(projectName)) { - return null; - } - return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - } - - private String getContainerName() { - IPath containerPath = this.getContainerFullPath(); - if(containerPath == null) { - return null; - } - String containerName = containerPath.segment(0); - return containerName; - } - - private void overrideFileExistsWarning() { - String existsString= IDEWorkbenchMessages.ResourceGroup_nameExists; - existsString.toString(); - - existsString = existsString.substring("''{0}''".length(), existsString.length()); //$NON-NLS-1$ - String message = this.getMessage(); - if(message != null && message.endsWith(existsString)) { - this.setMessage(null); - } - } - - private boolean xsdFileNotExists() { - - return ! this.xsdFileExists(this.getContainerAbsolutePath().toFile()); - } - - private boolean xsdFileExists(File directory) { - - if(directory.listFiles() == null) { - throw new RuntimeException("Could not find directory: " + directory); //$NON-NLS-1$ - } - for(File file : directory.listFiles()) { - if (file.isDirectory()) { - continue; - } - else if(XSD_EXTENSION.equalsIgnoreCase(FileTools.extension(file))) { - return true; - } - } - return false; - } - - private IPath getContainerAbsolutePath() { - IPath projectRelativePath = this.getContainerFullPath().makeRelativeTo(this.getProject().getFullPath()); - IResource directory = (projectRelativePath.isEmpty()) ? - this.getProject() : - this.getProject().getFile(projectRelativePath); - return directory.getLocation(); - } - -} 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 deleted file mode 100644 index 7b1dc1c747..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizard.java +++ /dev/null @@ -1,266 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 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.schemagen; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.resources.WorkspaceJob; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.FileTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jaxb.core.internal.gen.SchemaGenerator; -import org.eclipse.jpt.jaxb.core.internal.operations.SchemaFileCreationDataModelProvider; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.osgi.util.NLS; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider; - -/** - * SchemaGeneratorWizard - */ -public class SchemaGeneratorWizard extends Wizard implements INewWizard -{ - protected IStructuredSelection initialSelection; - private IJavaProject targetProject; - - protected IDataModel dataModel; - - private NewSchemaFileWizardPage newSchemaFileWizardPage; - - private SchemaGeneratorWizardPage schemaGenWizardPage; - - public static final String XSD_EXTENSION = ".xsd"; //$NON-NLS-1$ - - // ********** constructor ********** - - public SchemaGeneratorWizard() { - super(); - setWindowTitle(JptJaxbUiMessages.SchemaGeneratorWizard_title); - setDefaultPageImageDescriptor(JptJaxbUiPlugin.getImageDescriptor(JptJaxbUiIcons.SCHEMA_GEN_WIZ_BANNER)); - } - - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.initialSelection = selection; - - if (selection == null || selection.isEmpty()) { - return; - } - this.targetProject = this.getProjectFromInitialSelection(); - this.dataModel = null; - } - - // ********** IWizard implementation ********** - - @Override - public void addPages() { - super.addPages(); - - this.newSchemaFileWizardPage = this.buildNewSchemaFileWizardPage(this.initialSelection); - this.addPage(this.newSchemaFileWizardPage); - - this.schemaGenWizardPage = this.buildSchemaGeneratorWizardPage(this.buildSelection(this.getProject())); - this.addPage(this.schemaGenWizardPage); - } - - @Override - public boolean performFinish() { - - this.targetProject = this.getJavaProject(); - - String[] sourceClassNames = this.buildSourceClassNames(this.getAllCheckedItems()); - - WorkspaceJob genSchemaJob = new GenerateSchemaJob( - this.targetProject, - sourceClassNames, - this.getTargetSchema(), - this.usesMoxy()); - genSchemaJob.schedule(); - - return true; - } - - // ********** intra-wizard methods ********** - - public IJavaProject getJavaProject() { - return this.getJavaProjectFrom(this.getProject()); - } - - // ********** internal methods ********** - - private IProject getProject() { - return this.newSchemaFileWizardPage.getProject(); - } - - private IJavaProject getProjectFromInitialSelection() { - IJavaProject project = null; - - Object firstElement = this.initialSelection.getFirstElement(); - if(firstElement instanceof IJavaElement) { - IJavaElement javaElement = (IJavaElement)firstElement; - int type = javaElement.getElementType(); - if(type == IJavaElement.JAVA_PROJECT) { - project = (IJavaProject)javaElement; - } - else if(type == IJavaElement.PACKAGE_FRAGMENT) { - project = ((IPackageFragment)javaElement).getJavaProject(); - } - } - return project; - } - - private IJavaProject getJavaProjectFrom(IProject project) { - IJavaProject javaProject = (IJavaProject)((IJavaElement)((IAdaptable)project).getAdapter(IJavaElement.class)); - if(javaProject == null) { - throw new RuntimeException("Not a Java Project"); //$NON-NLS-1$ - } - return javaProject; - } - - private String getTargetSchema() { - - IPath filePath = this.newSchemaFileWizardPage.getFileRelativePath(); - String fileName = this.newSchemaFileWizardPage.getFileName(); - String targetSchema = (filePath.isEmpty()) ? - fileName : - filePath.toOSString() + File.separator + fileName; - - return this.addXsdExtension(targetSchema); - } - - private String addXsdExtension(String fileName) { - - return (FileTools.extension(fileName).equalsIgnoreCase(XSD_EXTENSION)) ? - fileName : - fileName + XSD_EXTENSION; - } - - private Object[] getAllCheckedItems() { - return this.schemaGenWizardPage.getAllCheckedItems(); - } - - private String[] buildSourceClassNames(Object[] checkedElements) { - - ArrayList<String> classNames = new ArrayList<String>(); - - for(Object element: checkedElements) { - IJavaElement javaElement = (IJavaElement)element; - String packageName = javaElement.getParent().getElementName(); - String elementName = javaElement.getElementName(); - String className = FileTools.stripExtension(elementName); - if(StringTools.stringIsEmpty(packageName)) { - classNames.add(className); - } - else { - classNames.add(packageName + '.' + className); - } - } - - return ArrayTools.array(classNames, new String[0]); - } - - private boolean usesMoxy() { - return this.schemaGenWizardPage.usesMoxy(); - } - - protected NewSchemaFileWizardPage buildNewSchemaFileWizardPage(IStructuredSelection selection) { - return new NewSchemaFileWizardPage( - "Page_1", selection, this.getDataModel(), //$NON-NLS-1$ - JptJaxbUiMessages.SchemaGeneratorProjectWizardPage_title, - JptJaxbUiMessages.SchemaGeneratorProjectWizardPage_desc); - } - - protected SchemaGeneratorWizardPage buildSchemaGeneratorWizardPage(IStructuredSelection selection) { - return new SchemaGeneratorWizardPage(selection); - } - - private IStructuredSelection buildSelection(IProject project) { - - List<IAdaptable> selectedElements = new ArrayList<IAdaptable>(1); - this.addProjectTo(selectedElements, project); - return new StructuredSelection(selectedElements); - } - - private void addProjectTo(List<IAdaptable> selectedElements, IProject project) { - try { - if(project != null && project.hasNature(JavaCore.NATURE_ID)) - selectedElements.add(JavaCore.create(project)); - } - catch(CoreException ex) { - // ignore selected element - } - } - - protected IDataModel getDataModel() { - if (this.dataModel == null) { - this.dataModel = DataModelFactory.createDataModel(getDefaultProvider()); - } - return this.dataModel; - } - - protected IDataModelProvider getDefaultProvider() { - return new SchemaFileCreationDataModelProvider(); - } - - // ********** generate schema job ********** - - static class GenerateSchemaJob extends WorkspaceJob { - private final IJavaProject javaProject; - private final String[] sourceClassNames; - private final String targetSchema; - private final boolean useMoxy; - - GenerateSchemaJob(IJavaProject project, String[] sourceClassNames, String targetSchema, boolean useMoxy) { - super(JptJaxbUiMessages.SchemaGeneratorWizard_generatingSchema); - - this.javaProject = project ; - this.sourceClassNames = sourceClassNames; - this.targetSchema = targetSchema; - this.useMoxy = useMoxy; - - this.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(this.javaProject.getProject())); - } - - @Override - public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { - SubMonitor sm = SubMonitor.convert(monitor, NLS.bind(JptJaxbUiMessages.SchemaGeneratorWizard_generateSchemaTask, this.targetSchema), 1); - try { - SchemaGenerator.generate(this.javaProject, this.targetSchema, this.sourceClassNames, this.useMoxy, sm.newChild(1)); - } - catch (OperationCanceledException e) { - return Status.CANCEL_STATUS; - } - return Status.OK_STATUS; - } - } -}
\ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizardPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizardPage.java deleted file mode 100644 index 70aa054611..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizardPage.java +++ /dev/null @@ -1,439 +0,0 @@ -/******************************************************************************* -* 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.schemagen; - -import java.util.Iterator; - -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.ui.JavaElementComparator; -import org.eclipse.jdt.ui.JavaElementLabelProvider; -import org.eclipse.jdt.ui.ProblemsLabelDecorator; -import org.eclipse.jdt.ui.StandardJavaElementContentProvider; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.DecoratingLabelProvider; -import org.eclipse.jface.viewers.ICheckStateListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.jaxb.core.internal.gen.SchemaGenerator; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.jpt.jaxb.ui.internal.filters.ContainerFilter; -import org.eclipse.jpt.jaxb.ui.internal.filters.EmptyInnerPackageFilter; -import org.eclipse.jpt.jaxb.ui.internal.filters.NonArchiveOrExternalElementFilter; -import org.eclipse.jpt.jaxb.ui.internal.filters.NonContainerFilter; -import org.eclipse.jpt.jaxb.ui.internal.filters.NonJavaElementFilter; -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.ui.PlatformUI; -import org.osgi.framework.Bundle; - -/** - * SchemaGeneratorWizardPage - */ -public class SchemaGeneratorWizardPage extends AbstractJarDestinationWizardPage { - - private IJavaProject targetProject; - - // widgets - private SettingsGroup settingsGroup; - private NonContainerFilter projectFilter; - - private Button usesMoxyCheckBox; - private boolean usesMoxy; - - static public String JPT_ECLIPSELINK_UI_PLUGIN_ID = "org.eclipse.jpt.jpa.eclipselink.ui"; //$NON-NLS-1$ - - // other constants - private static final int SIZING_SELECTION_WIDGET_WIDTH = 480; - private static final int SIZING_SELECTION_WIDGET_HEIGHT = 150; - - public static final String HELP_CONTEXT_ID = "org.eclipse.jpt.ui.wizard_jaxbschema_classes"; //$NON-NLS-1$ - - // ********** constructor ********** - - public SchemaGeneratorWizardPage(IStructuredSelection selection) { - super("JAXB Schema Generator", selection, null); //$NON-NLS-1$ - - this.setUsesMoxy(false); - this.setTitle(JptJaxbUiMessages.SchemaGeneratorWizardPage_title); - this.setDescription(JptJaxbUiMessages.SchemaGeneratorWizardPage_desc); - } - - // ********** IDialogPage implementation ********** - @Override - public void createControl(Composite parent) { - this.setPageComplete(false); - this.setControl(this.buildTopLevelControl(parent)); - } - - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - - if(visible) { - this.updateTargetProject(); - this.updateInputGroupTreeFilter(); - - // default usesMoxy to true only when JPT EclipseLink bundle exists and MOXy is on the classpath - this.updateUsesMoxy(this.jptEclipseLinkBundleExists() && this.moxyIsOnClasspath()); - - // checkbox visible only if jpt.eclipselink.ui plugin is available - // and EclipseLink MOXy is not on the classpath - this.usesMoxyCheckBox.setVisible(this.jptEclipseLinkBundleExists() && ! this.moxyIsOnClasspath()); - - this.validateProjectClasspath(); - } - } - - // ********** IWizardPage implementation ********** - - @Override - public boolean isPageComplete() { - boolean complete = this.validateSourceGroup(); - if(complete) { - this.validateProjectClasspath(); - } - return complete; - } - - @Override - public void setPreviousPage(IWizardPage page) { - super.setPreviousPage(page); - if(this.getControl() != null) - this.updatePageCompletion(); - } - - // ********** intra-wizard methods ********** - - protected Object[] getAllCheckedItems() { - return ArrayTools.array(this.getInputGroup().getAllCheckedListItems()); - } - - protected boolean usesMoxy() { - return this.usesMoxy; - } - - // ********** validation ********** - - @Override - @SuppressWarnings("restriction") - protected void updatePageCompletion() { - super.updatePageCompletion(); - } - - @Override - protected boolean validateDestinationGroup() { - // do nothing - return true; - } - - @Override - protected boolean validateSourceGroup() { - if(this.getAllCheckedItems().length == 0) { - if(this.getErrorMessage() == null) { - this.setErrorMessage(JptJaxbUiMessages.SchemaGeneratorWizardPage_errorNoPackage); - } - return false; - } - this.setErrorMessage(null); - return true; - } - - private void validateProjectClasspath() { - if(this.targetProject == null) { // project selected available yet - return; - } - //this line will suppress the "default package" warning (which doesn't really apply here - //as the JAXB gen uses an org.example.schemaName package by default) and will clear the classpath warnings when necessary - setMessage(null); - - if( ! this.genericJaxbIsOnClasspath()) { - this.displayWarning(JptJaxbUiMessages.SchemaGeneratorWizardPage_jaxbLibrariesNotAvailable); - } - else if(this.usesMoxy() && ! this.moxyIsOnClasspath()) { - //this message is being truncated by the wizard width in some cases - this.displayWarning(JptJaxbUiMessages.SchemaGeneratorWizardPage_moxyLibrariesNotAvailable); - } - - //this code will intelligently remove our classpath warnings when they are present but no longer apply (as an alternative - //to setting the message to null continuously as is currently done) -// else if( this.getMessage() != null){ -// if (this.getMessage().equals(JptJaxbUiMessages.ClassesGeneratorWizardPage_jaxbLibrariesNotAvailable) || -// this.getMessage().equals(JptJaxbUiMessages.ClassesGeneratorWizardPage_moxyLibrariesNotAvailable)) { -// setMessage(null); -// } -// } - } - - /** - * Test if the Jaxb compiler is on the classpath. - */ - private boolean genericJaxbIsOnClasspath() { - try { - String className = SchemaGenerator.JAXB_GENERIC_SCHEMA_GEN_CLASS; - IType genClass = this.targetProject.findType(className); - return (genClass != null); - } - catch(JavaModelException e) { - throw new RuntimeException(e); - } - } - - // ********** internal methods ********** - - private Control buildTopLevelControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayout(new GridLayout()); - - PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, HELP_CONTEXT_ID); - - this.settingsGroup = new SettingsGroup(composite); - - this.usesMoxyCheckBox = this.buildUsesMoxyCheckBox(composite); - - Dialog.applyDialogFont(parent); - return composite; - } - - private void updateTargetProject() { - - this.targetProject = ((SchemaGeneratorWizard)this.getWizard()).getJavaProject(); - } - - private void updateInputGroupTreeFilter() { - this.getInputGroup().setAllSelections(false); - - if(this.projectFilter != null) { - this.getInputGroup().removeTreeFilter(this.projectFilter); - } - this.projectFilter = new NonContainerFilter(this.targetProject.getProject().getName()); - this.getInputGroup().addTreeFilter(this.projectFilter); - } - - private boolean jptEclipseLinkBundleExists() { - return (this.getJptEclipseLinkBundle() != null); - } - - private Bundle getJptEclipseLinkBundle() { - return Platform.getBundle(JPT_ECLIPSELINK_UI_PLUGIN_ID); // Cannot reference directly EL plugin. - } - - private void setUsesMoxy(boolean usesMoxy){ - this.usesMoxy = usesMoxy; - } - - private void updateUsesMoxy(boolean usesMoxy){ - this.setUsesMoxy(usesMoxy); - this.usesMoxyCheckBox.setSelection(this.usesMoxy()); - this.validateProjectClasspath(); - } - - /** - * Test if the EclipseLink Jaxb compiler is on the classpath. - */ - private boolean moxyIsOnClasspath() { - try { - String className = SchemaGenerator.JAXB_ECLIPSELINK_SCHEMA_GEN_CLASS; - IType genClass = this.targetProject.findType(className); - return (genClass != null); - } - catch (JavaModelException e) { - throw new RuntimeException(e); - } - } - - private void displayWarning(String message) { - this.setMessage(message, WARNING); - } - - private CheckboxTreeAndListGroup getInputGroup() { - return this.settingsGroup.inputGroup; - } - - // ********** overrides ********** - /** - * Returns an iterator over this page's collection of currently-specified - * elements to be exported. This is the primary element selection facility - * accessor for subclasses. - * - * @return an iterator over the collection of elements currently selected for export - */ - @Override - protected Iterator<?> getSelectedResourcesIterator() { - return this.getInputGroup().getAllCheckedListItems(); - } - - @Override - protected void update() { - this.updatePageCompletion(); - } - - @Override - public final void saveWidgetValues() { - // do nothing - } - - @Override - protected void internalSaveWidgetValues() { - // do nothing - } - - @Override - protected void restoreWidgetValues() { - // do nothing - } - - - @Override - protected void initializeJarPackage() { - // do nothing - } - - @Override - protected void giveFocusToDestination() { - // do nothing - } - - // ********** UI components ********** - - private Button buildUsesMoxyCheckBox(Composite parent) { - - Button checkBox = new Button(parent, SWT.CHECK); - GridData gridData = new GridData(); - gridData.verticalIndent = 10; - checkBox.setLayoutData(gridData); - checkBox.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_usesMoxyImplementation); - 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) { - updateUsesMoxy(usesMoxyCheckBox.getSelection()); - validateProjectClasspath(); - } - }; - } - - // ********** SettingsGroup class ********** - - private class SettingsGroup { - - private CheckboxTreeAndListGroup inputGroup; - - // ********** constructor ********** - - private SettingsGroup(Composite parent) { - super(); - initializeDialogUnits(parent); - - Composite composite = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - layout.marginWidth = 0; - layout.marginHeight = 0; - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - buildSchemaComposite(composite); - - // Input Tree - createPlainLabel(composite, JptJaxbUiMessages.SchemaGeneratorWizardPage_packages); - this.inputGroup = this.createInputGroup(composite); - - } - - protected void buildSchemaComposite(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(3, false); // false = do not make columns equal width - layout.marginWidth = 0; - layout.marginTop = 0; - layout.marginBottom = 10; - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - } - - // ********** UI components ********** - - /** - * Creates the checkbox tree and list for selecting resources. - * - * @param parent the parent control - */ - protected CheckboxTreeAndListGroup createInputGroup(Composite parent) { - CheckboxTreeAndListGroup checkboxTreeGroup; - - int labelFlags = JavaElementLabelProvider.SHOW_BASICS - | JavaElementLabelProvider.SHOW_OVERLAY_ICONS - | JavaElementLabelProvider.SHOW_SMALL_ICONS; - ITreeContentProvider treeContentProvider= - new StandardJavaElementContentProvider() { - @Override - public boolean hasChildren(Object element) { - // prevent the + from being shown in front of packages - return !(element instanceof IPackageFragment) && super.hasChildren(element); - } - }; - final DecoratingLabelProvider provider = new DecoratingLabelProvider(new JavaElementLabelProvider(labelFlags), new ProblemsLabelDecorator(null)); - checkboxTreeGroup = new CheckboxTreeAndListGroup( - parent, - JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()), - treeContentProvider, - provider, - new StandardJavaElementContentProvider(), - provider, - SWT.NONE, - SIZING_SELECTION_WIDGET_WIDTH, - SIZING_SELECTION_WIDGET_HEIGHT); - checkboxTreeGroup.addTreeFilter(new EmptyInnerPackageFilter()); - checkboxTreeGroup.setTreeComparator(new JavaElementComparator()); - checkboxTreeGroup.setListComparator(new JavaElementComparator()); - - checkboxTreeGroup.addTreeFilter(new NonJavaElementFilter()); - checkboxTreeGroup.addTreeFilter(new NonArchiveOrExternalElementFilter()); - - checkboxTreeGroup.addListFilter(new ContainerFilter()); - checkboxTreeGroup.addListFilter(new NonJavaElementFilter()); - - checkboxTreeGroup.getTree().addListener(SWT.MouseUp, SchemaGeneratorWizardPage.this); - checkboxTreeGroup.getTable().addListener(SWT.MouseUp, SchemaGeneratorWizardPage.this); - - ICheckStateListener listener = new ICheckStateListener() { - public void checkStateChanged(CheckStateChangedEvent event) { - update(); - } - }; - - checkboxTreeGroup.addCheckStateListener(listener); - return checkboxTreeGroup; - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/navigator/JaxbNavigatorUi.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/navigator/JaxbNavigatorUi.java deleted file mode 100644 index 2db5a2e7aa..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/navigator/JaxbNavigatorUi.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * 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.navigator; - -import org.eclipse.jpt.common.ui.jface.ItemLabelProvider; -import org.eclipse.jpt.common.ui.jface.ItemLabelProviderFactory; -import org.eclipse.jpt.common.ui.jface.TreeItemContentProvider; -import org.eclipse.jpt.common.ui.jface.TreeItemContentProviderFactory; - -/** - * Defines content and label provider factories for Project Navigator view for a given JAXB project. - * <p> - * 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. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbNavigatorUi { - - /** - * Return the factory to create {@link TreeItemContentProvider}s - */ - TreeItemContentProviderFactory getTreeItemContentProviderFactory(); - - /** - * Return the factory to create {@link ItemLabelProvider}s - */ - ItemLabelProviderFactory getItemLabelProviderFactory(); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/platform/JaxbPlatformUi.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/platform/JaxbPlatformUi.java deleted file mode 100644 index e50e9ee980..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/platform/JaxbPlatformUi.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * 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.platform; - -import org.eclipse.jpt.jaxb.ui.navigator.JaxbNavigatorUi; - -/** - * This interface is to be implemented by a JAXB implementation vendor to provide extensions - * to JAXB UI functionality. - * <p> - * Any implementation should be <i>stateless</i> in nature. - * <p> - * See the extension point: org.eclipse.jpt.jaxb.ui.jaxbPlatforms - * <p> - * 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. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbPlatformUi { - - // ********** navigator UI ********** - - /** - * Return the {@link JaxbNavigatorUi} for this platform, - * which determines Project Explorer content - */ - JaxbNavigatorUi getNavigatorUi(); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/platform/JaxbPlatformUiManager.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/platform/JaxbPlatformUiManager.java deleted file mode 100644 index 1f04ed438d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/platform/JaxbPlatformUiManager.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * 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.platform; - -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; - -/** - * Repository for {@link JaxbPlatformUi}s - * <p> - * 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. - * - * @version 3.0 - * @since 3.0 - * @see JptJaxbUiPlugin#getJaxbPlatformUiManager() - */ -public interface JaxbPlatformUiManager { - - /** - * Return the platform UI responsible for providing UI elements for the given - * JAXB platform description - */ - public JaxbPlatformUi getJaxbPlatformUi(JaxbPlatformDescription platformDesc); -} |