diff options
Diffstat (limited to 'jaxb/plugins/org.eclipse.jpt.jaxb.ui')
57 files changed, 0 insertions, 6935 deletions
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 bd4371771c..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="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/wst/**"/> - <accessrule kind="accessible" pattern="org/eclipse/jst/**"/> - </accessrules> - </classpathentry> - <classpathentry kind="src" path="src"/> - <classpathentry kind="src" path="property_files"/> - <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 a196dd7686..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -bin -@dot -temp.folder -build.xml -javaCompiler...args -javaCompiler...args.*
\ No newline at end of file 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 7a34f4bbcf..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Mon Feb 08 18:48:37 EST 2010 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/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 5004e1c329..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF +++ /dev/null @@ -1,40 +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.1.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.ui;bundle-version="[3.4.0,4.0.0)", - org.eclipse.jpt.jaxb.core;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jpt.core;bundle-version="[2.3.0,3.0.0)", - org.eclipse.jpt.ui;bundle-version="[2.0.0,3.0.0)", - org.eclipse.jpt.utility;bundle-version="[1.2.0,2.0.0)", - org.eclipse.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.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)" -Export-Package: org.eclipse.jpt.jaxb.ui, - org.eclipse.jpt.jaxb.ui.internal, - org.eclipse.jpt.jaxb.ui.internal.actions, - org.eclipse.jpt.jaxb.ui.internal.filters, - org.eclipse.jpt.jaxb.ui.internal.wizards, - org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen, - org.eclipse.jpt.jaxb.ui.internal.wizards.facet, - org.eclipse.jpt.jaxb.ui.internal.wizards.facet.model, - org.eclipse.jpt.jaxb.ui.internal.wizards.proj, - org.eclipse.jpt.jaxb.ui.internal.wizards.proj.model, - org.eclipse.jpt.jaxb.ui.internal.wizards.schemagen -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 b2eea6d8ff..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/build.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 -################################################################################ -javacSource = 1.5 -javacTarget = 1.5 -source.. = src/,\ - property_files/ -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.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/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/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 7759e2cf32..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.properties +++ /dev/null @@ -1,36 +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 -############################################################################### - -# ==================================================================== -# 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 - -jaxbWizardCategoryName = JAXB - -generateJaxbClasses = JAXB Classes... - -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
\ No newline at end of file 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 eb698f0cc7..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.xml +++ /dev/null @@ -1,108 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.2"?>
<!-- - 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 - --> - -<plugin> - - <extension - point="org.eclipse.core.runtime.adapters"> - - <factory - class="org.eclipse.jpt.jaxb.ui.internal.wizards.facet.model.JaxbFacetInstallConfigToDataModelAdapterFactory" - adaptableType="org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetInstallConfig"> - <adapter type="org.eclipse.wst.common.frameworks.datamodel.IDataModel"/> - </factory> - - </extension> - - - <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.ui.popupMenus"> - - <!-- contributions to the "Generate" submenu --> - <objectContribution - id="org.eclipse.jpt.ui.xsdFileActions" - objectClass="org.eclipse.core.resources.IFile" - nameFilter="*.xsd"> - <filter - name="projectNature" - value="org.eclipse.jdt.core.javanature"> - </filter> - <action - id="org.eclipse.jpt.jaxb.ui.generateJaxbClasses" - label="%generateJaxbClasses" - menubarPath="generateMenuId/GenerateXML" - class="org.eclipse.jpt.jaxb.ui.internal.actions.GenerateClassesAction"> - </action> - </objectContribution> - - </extension> - - - <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> - - </extension> - -</plugin> diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/property_files/jpt_jaxb_core.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/property_files/jpt_jaxb_core.properties deleted file mode 100644 index 4e444c4aa0..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/property_files/jpt_jaxb_core.properties +++ /dev/null @@ -1,14 +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 -################################################################################ - -SchemaGenerator_creatingJAXBPropertiesFileTask = Creating jaxb.properties file - -ClassesGenerator_generatingClasses = Generating JAXB Classes from Schema -ClassesGenerator_generatingClassesTask = Generating classes
\ No newline at end of file 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 57d0312591..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/property_files/jpt_jaxb_ui.properties +++ /dev/null @@ -1,142 +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} - -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. - -ClassesGeneratorWizardPage_title = Generate Classes from Schema: {0} -ClassesGeneratorWizardPage_desc = Configure JAXB class generation. - -ClassesGeneratorWizardPage_usesMoxyImplementation = Use EclipseLink MOXy as the JAXB implementation - -ClassesGeneratorWizardPage_catalog = Catalog: -ClassesGeneratorWizardPage_bindingsFiles = Bindings files: -ClassesGeneratorWizardPage_browseButton = Browse... -ClassesGeneratorWizardPage_addButton = Add... -ClassesGeneratorWizardPage_removeButton = Remove -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 = No proxy -ClassesGeneratorOptionsWizardPage_proxy = Proxy: -ClassesGeneratorOptionsWizardPage_proxyFile = Proxy file: -ClassesGeneratorOptionsWizardPage_chooseAProxyFile = Proxy File Selection - -ClassesGeneratorOptionsWizardPage_useStrictValidation = Use strict validation -ClassesGeneratorOptionsWizardPage_makeReadOnly = Generate read-only files -ClassesGeneratorOptionsWizardPage_suppressPackageInfoGen = Suppress package-info generation -ClassesGeneratorOptionsWizardPage_suppressesHeaderGen = Suppress generation of file header -ClassesGeneratorOptionsWizardPage_target = Target XJC 2.0 -ClassesGeneratorOptionsWizardPage_verbose = Verbose -ClassesGeneratorOptionsWizardPage_quiet = Suppress compiler output - -ClassesGeneratorOptionsWizardPage_treatsAsXmlSchema = Treat input as XML schema -ClassesGeneratorOptionsWizardPage_treatsAsRelaxNg = Treat input as RELAX NG -ClassesGeneratorOptionsWizardPage_treatsAsRelaxNgCompact = Treat input as RELAX NG compact syntax -ClassesGeneratorOptionsWizardPage_treatsAsDtd = Treat input as XML DTD -ClassesGeneratorOptionsWizardPage_treatsAsWsdl = Treat input as WSDL and compile schema inside it -ClassesGeneratorOptionsWizardPage_showsVersion = Show version -ClassesGeneratorOptionsWizardPage_showsHelp = Show help - -ClassesGeneratorExtensionOptionsWizardPage_title = Classes Generator Extension Configuration -ClassesGeneratorExtensionOptionsWizardPage_desc = Configure JAXB compiler vendor extensions. - -ClassesGeneratorExtensionOptionsWizardPage_allowExtensions = Allow vendor extensions -ClassesGeneratorExtensionOptionsWizardPage_classpath = Classpath: -ClassesGeneratorExtensionOptionsWizardPage_additionalArguments = Additional arguments: - -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 schema 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 - - -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_jaxbImplementationLabel = JAXB implementation - -JaxbFacetDataModel_validatePlatformNotSpecified = Platform must be specified 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 480d529875..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/JptJaxbUiPlugin.java +++ /dev/null @@ -1,108 +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.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 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; - } - - // ********** 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 73837d0990..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java +++ /dev/null @@ -1,164 +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.core.resources.IFile; -import org.eclipse.core.resources.WorkspaceJob; -import org.eclipse.core.runtime.IPath; -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.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.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen.ClassesGeneratorWizard; -import org.eclipse.jpt.utility.internal.StringTools; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - -/** - * ClassesGeneratorUi - */ -public class ClassesGeneratorUi { - private final IJavaProject javaProject; - private final String schemaPathOrUri; - - // ********** static methods ********** - - public static void generate(IFile xsdFile) { - IJavaProject javaProject = JavaCore.create(xsdFile.getProject()); - if (javaProject == null) { - throw new NullPointerException(); - } - IPath xmlSchema = xsdFile.getProjectRelativePath(); - - new ClassesGeneratorUi(javaProject, xmlSchema.toOSString()).generate(); - } - - // ********** constructors ********** - private ClassesGeneratorUi(IJavaProject javaProject, String schemaPathOrUri) { - super(); - if(javaProject == null || StringTools.stringIsEmpty(schemaPathOrUri)) { - throw new NullPointerException(); - } - this.javaProject = javaProject; - this.schemaPathOrUri = schemaPathOrUri; - } - - // ********** generate ********** - /** - * prompt the user with a wizard - */ - protected void generate() { - ClassesGeneratorWizard wizard = new ClassesGeneratorWizard(this.javaProject, this.schemaPathOrUri); - wizard.setWindowTitle(JptJaxbUiMessages.ClassesGeneratorWizard_title); - WizardDialog dialog = new WizardDialog(this.getCurrentShell(), wizard); - dialog.create(); - int returnCode = dialog.open(); - if (returnCode != Window.OK) { - return; - } - String outputDir = wizard.getDestinationFolder(); - String targetPackage = wizard.getTargetPackage(); - String catalog = wizard.getCatalog(); - boolean usesMoxy = wizard.usesMoxy(); - String[] bindingsFileNames = wizard.getBindingsFileNames(); - ClassesGeneratorOptions generatorOptions = wizard.getGeneratorOptions(); - ClassesGeneratorExtensionOptions generatorExtensionOptions = wizard.getGeneratorExtensionOptions(); - - if(this.displayOverridingClassesWarning(generatorOptions)) { - this.generateJaxbClasses(outputDir, targetPackage, catalog, usesMoxy, bindingsFileNames, generatorOptions, generatorExtensionOptions); - } - } - - // ********** internal methods ********** - - private void generateJaxbClasses( - String outputDir, - String targetPackage, - String catalog, - boolean usesMoxyGenerator, - String[] bindingsFileNames, - ClassesGeneratorOptions generatorOptions, - ClassesGeneratorExtensionOptions generatorExtensionOptions) { - - try { - WorkspaceJob job = new GenerateJaxbClassesJob( - this.javaProject, - this.schemaPathOrUri, - 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 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; - } - - 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/JptJaxbUiIcons.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiIcons.java deleted file mode 100644 index 5b5f09bfe4..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiIcons.java +++ /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 -*******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal; - -@SuppressWarnings("nls") -public class JptJaxbUiIcons -{ - // **************** General icons ************************************** - - public static final String SCHEMA_GEN = "full/wizban/NewXSD"; - - // **************** Wizard icons ******************************************* - - 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 da2f756036..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiMessages.java +++ /dev/null @@ -1,158 +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 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 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; - - - // 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_jaxbImplementationLabel; - - public static String JaxbFacetDataModel_validatePlatformNotSpecified; - - - - 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/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/wizards/JavaProjectWizardPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/JavaProjectWizardPage.java deleted file mode 100644 index 70f25961f7..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/JavaProjectWizardPage.java +++ /dev/null @@ -1,252 +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.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.jpt.utility.internal.ArrayTools; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.StringTools; -import org.eclipse.jpt.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; -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.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.ui.PlatformUI; - -/** - * JavaProjectWizardPage - */ -public class JavaProjectWizardPage extends WizardPage { - - private IJavaProject javaProject; - private Table projectTable; - private TableViewer projectTableViewer; - - private static String SELECT_PROJECT_PAGE_NAME = "SelectJavaProject"; //$NON-NLS-1$ - private static int PROJECT_NAME_COLUMN_INDEX = 0; - - // ********** constructor ********** - - public JavaProjectWizardPage(IJavaProject javaProject) { - super(SELECT_PROJECT_PAGE_NAME); - - this.javaProject = javaProject; - } - - // ********** IDialogPage implementation ********** - - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - composite.setLayout(layout); - - this.buildLabel(composite, JptJaxbUiMessages.JavaProjectWizardPage_destinationProject); - - this.projectTable = this.buildProjectTable(composite, this.buildProjectTableSelectionListener()); - - this.projectTableViewer = this.buildProjectTableViewer( - this.projectTable, - this.buildProjectTableLabelProvider(), - this.buildProjectTableContentProvider()); - this.fillProjectList(); - this.setControl(composite); - this.setTableSelection(this.javaProject); - this.validate(); - } - - // ********** listeners ********** - - private SelectionListener buildProjectTableSelectionListener() { - return new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - selectedProjectChanged(); - } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - widgetSelected(e); - } - - @Override - public String toString() { - return "PromptProjectWizardPage project table selection listener"; //$NON-NLS-1$ - } - }; - } - - // ********** listener callbacks ********** - - protected void selectedProjectChanged() { - if(this.projectTable.getSelectionIndex() != -1) { - TableItem item = this.projectTable.getItem(this.projectTable.getSelectionIndex()); - String projectName = item.getText(0); - if( ! StringTools.stringIsEmpty(projectName)) { - - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - this.setJavaProject(JavaCore.create(project)); - this.validate(); - } - } - } - - // ********** intra-wizard methods ********** - - public IJavaProject getJavaProject() { - return this.javaProject; - } - - // ********** protected methods ********** - - protected void setTableSelection(IJavaProject javaProject) { - if(javaProject != null) { - String projectName = javaProject.getProject().getName(); - for(TableItem item: this.projectTable.getItems()) { - if(item.getText(0).equals(projectName)) { - this.projectTable.setSelection(item); - } - } - } - } - - protected void fillProjectList() { - this.projectTableViewer.setInput(this.getSortedJavaProjectsNames()); - } - - // ********** internal methods ********** - - private void validate() { - this.setPageComplete(this.projectTable.getSelectionIndex() != -1); - } - - private void setJavaProject(IJavaProject project) { - this.javaProject = project; - } - - 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()); - } - - // ********** inner classes ********** - - private final class ProjectTableLabelProvider extends LabelProvider implements ITableLabelProvider { - - public Image getColumnImage(Object element, int columnIndex) { - if(columnIndex == PROJECT_NAME_COLUMN_INDEX) - return PlatformUI.getWorkbench().getSharedImages().getImage(org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJ_PROJECT); - return null; - } - - public String getColumnText(Object element, int columnIndex) { - assert element instanceof String; - String projectName = (String)element; - if(columnIndex == PROJECT_NAME_COLUMN_INDEX) - return projectName; - return null; - } - } - - private final class ProjectTableContentProvider implements IStructuredContentProvider { - - public Object[] getElements(Object inputElement) { - return ((String[])inputElement); - } - - public void dispose() {} - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {} - } - - // ********** UI components ********** - - private ITableLabelProvider buildProjectTableLabelProvider() { - return new ProjectTableLabelProvider(); - } - - private IStructuredContentProvider buildProjectTableContentProvider() { - return new ProjectTableContentProvider(); - } - - private Label buildLabel(Composite parent, String text) { - Label label = new Label( parent, SWT.NONE ); - label.setText(text); - return label; - } - - private Table buildProjectTable(Composite parent, SelectionListener listener) { - TableViewer tableViewer = new TableViewer(parent, - SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.VIRTUAL); - - Table table = tableViewer.getTable(); - table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - table.addSelectionListener(listener); - return table; - } - - private TableViewer buildProjectTableViewer(Table parent, ITableLabelProvider labelProvider, IStructuredContentProvider contentProvider) { - - TableViewer tableViewer = new TableViewer(parent); - tableViewer.setLabelProvider(labelProvider); - tableViewer.setContentProvider(contentProvider); - return tableViewer; - } -} 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 c2605b09d4..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.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.jpt.utility.internal.ArrayTools; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.StringTools; -import org.eclipse.jpt.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; -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 c0300c5825..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorExtensionOptionsWizardPage.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.wizards.classesgen; - -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -/** - * ClassesGeneratorExtensionOptionsWizardPage - */ -public class ClassesGeneratorExtensionOptionsWizardPage extends WizardPage -{ - - private ExtensionOptionsComposite additionalArgsComposite; - - // ********** constructor ********** - - protected ClassesGeneratorExtensionOptionsWizardPage() { - super("Classes Generator Extension Options"); //$NON-NLS-1$ - - this.initialize(); - } - - protected void initialize() { - this.setTitle(JptJaxbUiMessages.ClassesGeneratorExtensionOptionsWizardPage_title); - this.setDescription(JptJaxbUiMessages.ClassesGeneratorExtensionOptionsWizardPage_desc); - } - - // ********** UI components ********** - - public void createControl(Composite parent) { - this.setPageComplete(true); - this.setControl(this.buildTopLevelControl(parent)); - } - - private Control buildTopLevelControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayout(new GridLayout()); - - this.additionalArgsComposite = new ExtensionOptionsComposite(composite); - - return composite; - } - - // ********** intra-wizard methods ********** - - protected boolean allowsExtensions() { - return this.additionalArgsComposite.allowsExtensions(); - } - - protected String getClasspath() { - return this.additionalArgsComposite.getClasspath(); - } - - protected String getAdditionalArgs() { - return this.additionalArgsComposite.getAdditionalArgs(); - } - - // ********** AdditionalArgsComposite ********** - - class ExtensionOptionsComposite { - - private boolean allowsExtensions; - private final Text classpathText; - private final Button allowsExtensionsCheckBox; - - private final Text additionalArgsText; - - // ********** constructor ********** - - private ExtensionOptionsComposite(Composite parent) { - super(); - this.allowsExtensions = false; - - Composite composite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(1, false); - layout.marginHeight = 0; - layout.marginWidth = 0; - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - // TODO PlatformUI.getWorkbench().getHelpSystem().setHelp(this.group, 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); - } - - // ********** 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 b040e0e316..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorOptionsWizardPage.java +++ /dev/null @@ -1,805 +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.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.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.jpt.utility.internal.StringTools; -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 getTarget() { - return this.options1Composite.targetIs20(); - } - - protected boolean isVerbose() { - return this.options1Composite.isVerbose(); - } - - protected boolean isQuiet() { - return this.options1Composite.isQuiet(); - } - - protected boolean treatsAsXmlSchema() { - return this.options2Composite.treatsAsXmlSchema(); - } - - protected boolean treatsAsRelaxNg() { - return this.options2Composite.treatsAsRelaxNg(); - } - - protected boolean treatsAsRelaxNgCompact() { - return this.options2Composite.treatsAsRelaxNgCompact(); - } - - protected boolean treatsAsDtd() { - return this.options2Composite.treatsAsDtd(); - } - - protected boolean treatsAsWsdl() { - return this.options2Composite.treatsAsWsdl(); - } - - protected boolean showsVersion() { - return this.options2Composite.showsVersion(); - } - - protected boolean showsHelp() { - return this.options2Composite.showsHelp(); - } - - // ********** 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 target; - private final Button targetCheckBox; - - private boolean isVerbose; - private final Button isVerboseCheckBox; - - private boolean isQuiet; - private final Button isQuietCheckBox; - - // ********** constructor ********** - - Options1Composite(Composite parent) { - super(); - this.usesStrictValidation = true; - this.makesReadOnly = false; - this.suppressesPackageInfoGen = false; - this.suppressesHeaderGen = false; - this.target = false; - this.isVerbose = false; - this.isQuiet = false; - - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayout(new GridLayout()); - - this.usesStrictValidationCheckBox = this.buildUsesStrictValidationCheckBox(composite, this.buildUsesStrictValidationSelectionListener()); - this.makesReadOnlyCheckBox = this.buildMakesReadOnlyCheckBox(composite, this.buildMakesReadOnlySelectionListener()); - this.suppressesPackageInfoGenCheckBox = this.buildSuppressesPackageInfoGenCheckBox(composite, this.buildSuppressesPackageInfoGenSelectionListener()); - this.suppressesHeaderGenCheckBox = this.buildSuppressesHeaderGenCheckBox(composite, this.buildSuppressesHeaderGenSelectionListener()); - this.targetCheckBox = this.buildTargetCheckBox(composite, this.buildTargetSelectionListener()); - this.isVerboseCheckBox = this.buildIsVerboseCheckBox(composite, this.buildIsVerboseSelectionListener()); - this.isQuietCheckBox = this.buildIsQuietCheckBox(composite, this.buildIsQuietSelectionListener()); - } - - // ********** UI components ********** - - private Button buildUsesStrictValidationCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = 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 buildTargetCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_target, listener, 5); - checkBox.setSelection(this.targetIs20()); - 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 buildTargetSelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - this.widgetSelected(event); - } - public void widgetSelected(SelectionEvent event) { - Options1Composite.this.setTargetIs20( - Options1Composite.this.targetCheckBox.getSelection()); - } - }; - } - - private SelectionListener buildIsVerboseSelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - this.widgetSelected(event); - } - public void widgetSelected(SelectionEvent event) { - Options1Composite.this.setIsVerbose( - Options1Composite.this.isVerboseCheckBox.getSelection()); - } - }; - } - - private SelectionListener buildIsQuietSelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - this.widgetSelected(event); - } - public void widgetSelected(SelectionEvent event) { - Options1Composite.this.setIsQuiet( - Options1Composite.this.isQuietCheckBox.getSelection()); - } - }; - } - - // ********** getters/setters ********* - - protected boolean usesStrictValidation() { - return this.usesStrictValidation; - } - - protected void setUsesStrictValidation(boolean usesStrictValidation){ - this.usesStrictValidation = usesStrictValidation; - } - - protected boolean makesReadOnly() { - return this.makesReadOnly; - } - - protected void setMakesReadOnly(boolean makesReadOnly){ - this.makesReadOnly = makesReadOnly; - } - - protected boolean suppressesPackageInfoGen() { - return this.suppressesPackageInfoGen; - } - - protected void setSuppressesPackageInfoGen(boolean suppressesPackageInfoGen){ - this.suppressesPackageInfoGen = suppressesPackageInfoGen; - } - - protected boolean suppressesHeaderGen() { - return this.suppressesHeaderGen; - } - - protected void setSuppressesHeaderGen(boolean suppressesHeaderGen){ - this.suppressesHeaderGen = suppressesHeaderGen; - } - - protected boolean targetIs20() { - return this.target; - } - - protected void setTargetIs20(boolean targetIs20){ - this.target = targetIs20; - } - - protected boolean isVerbose() { - return this.isVerbose; - } - - protected void setIsVerbose(boolean isVerbose){ - this.isVerbose = isVerbose; - } - - protected boolean isQuiet() { - return this.isQuiet; - } - - protected void setIsQuiet(boolean isQuiet){ - this.isQuiet = isQuiet; - } - - } - - // ********** Options2Composite ********** - - class Options2Composite { - - private boolean treatsAsXmlSchema; - private final Button treatsAsXmlSchemaCheckBox; - - private boolean treatsAsRelaxNg; - private final Button treatsAsRelaxNgCheckBox; - - private boolean treatsAsRelaxNgCompact; - private final Button treatsAsRelaxNgCompactCheckBox; - - private boolean treatsAsDtd; - private final Button treatsAsDtdCheckBox; - - private boolean treatsAsWsdl; - private final Button treatsAsWsdlCheckBox; - - private boolean showsVersion; - private final Button showsVersionCheckBox; - - private boolean showsHelp; - private final Button showsHelpCheckBox; - - // ********** constructor ********** - - Options2Composite(Composite parent) { - super(); - this.treatsAsXmlSchema = false; - this.treatsAsRelaxNg = false; - this.treatsAsRelaxNgCompact = false; - this.treatsAsDtd = false; - this.treatsAsWsdl = false; - this.showsVersion = false; - this.showsHelp = false; - - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayout(new GridLayout()); - - this.treatsAsXmlSchemaCheckBox = this.buildTreatsAsXmlSchemaCheckBox(composite, this.buildTreatsAsXmlSchemaSelectionListener()); - this.treatsAsRelaxNgCheckBox = this.buildTreatsAsRelaxNgCheckBox(composite, this.buildTreatsAsRelaxNgSelectionListener()); - this.treatsAsRelaxNgCompactCheckBox = this.buildTreatsAsRelaxNgCompactCheckBox(composite, this.buildTreatsAsRelaxNgCompactSelectionListener()); - this.treatsAsDtdCheckBox = this.buildTreatsAsDtdCheckBox(composite, this.buildTreatsAsDtdSelectionListener()); - this.treatsAsWsdlCheckBox = this.buildTreatsAsWsdlCheckBox(composite, this.buildTreatsAsWsdlSelectionListener()); - this.showsVersionCheckBox = this.buildVersionCheckBox(composite, this.buildVersionSelectionListener()); - this.showsHelpCheckBox = this.buildHelpCheckBox(composite, this.buildHelpSelectionListener()); - } - - // ********** UI components ********** - - private Button buildTreatsAsXmlSchemaCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = 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 a682566b93..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java +++ /dev/null @@ -1,357 +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.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.core.runtime.IPath; -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.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.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.JavaProjectWizardPage; -import org.eclipse.osgi.util.NLS; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWizard; - -/** - * ClassesGeneratorWizard - */ -public class ClassesGeneratorWizard extends Wizard implements IWorkbenchWizard { - - private IJavaProject javaProject; - private String schemaPathOrUri; - 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, String xsdSchemaPath) { - super(); - this.javaProject = javaProject; - this.schemaPathOrUri = xsdSchemaPath; - - 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.addPage(this.projectWizardPage); - - // SchemaWizardPage - IFile schemaSelected = SchemaWizardPage.getSourceSchemaFromSelection(this.selection); - if(schemaSelected == null) { - this.schemaWizardPage = new SchemaWizardPage(this.selection); - this.addPage(this.schemaWizardPage); - } - else { - this.schemaPathOrUri = this.makeRelativeToProjectPath(schemaSelected.getFullPath()); - } - } - 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 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(this.displayOverridingClassesWarning(this.generatorOptions)) { - this.generateJaxbClasses(); - } - } - - return true; - } - - @Override - public boolean canFinish() { - return (this.settingsPage.isPageComplete() && - this.optionsPage.isPageComplete() && - this.extensionOptionsPage.isPageComplete()); - } - - // ********** intra-wizard methods ********** - - public IJavaProject getJavaProject() { - if(this.projectWizardPage != null) { - this.javaProject = this.projectWizardPage.getJavaProject(); - } - return this.javaProject; - } - - public String getSchemaPathOrUri() { - if(this.schemaWizardPage != null) { - IFile schemaFile = this.schemaWizardPage.getSourceSchema(); - if(schemaFile != null) { - return this.makeRelativeToProjectPath(schemaFile.getFullPath()); - } - else { - return this.schemaWizardPage.getSourceURI(); - } - } - return this.schemaPathOrUri; - } - - private String makeRelativeToProjectPath(IPath path) { - IPath relativePath = path.makeRelativeTo(this.getJavaProject().getProject().getFullPath()); - return relativePath.toOSString(); - } - - // ********** 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; - } - - 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 generateJaxbClasses() { - try { - WorkspaceJob job = new GenerateJaxbClassesJob( - this.getJavaProject(), - this.getSchemaPathOrUri(), - 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 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.setTargetIs20(this.optionsPage.getTarget()); - this.generatorOptions.setIsVerbose(this.optionsPage.isVerbose()); - this.generatorOptions.setIsQuiet(this.optionsPage.isQuiet()); - - this.generatorOptions.setTreatsAsXmlSchema(this.optionsPage.treatsAsXmlSchema()); - this.generatorOptions.setTreatsAsRelaxNg(this.optionsPage.treatsAsRelaxNg()); - this.generatorOptions.setTreatsAsRelaxNgCompact(this.optionsPage.treatsAsRelaxNgCompact()); - this.generatorOptions.setTreatsAsDtd(this.optionsPage.treatsAsDtd()); - this.generatorOptions.setTreatsAsWsdl(this.optionsPage.treatsAsWsdl()); - this.generatorOptions.setShowsVersion(this.optionsPage.showsVersion()); - this.generatorOptions.setShowsHelp(this.optionsPage.showsHelp()); - } - - private void retrieveGeneratorExtensionOptions() { - - this.generatorExtensionOptions = new ClassesGeneratorExtensionOptions(); - - this.generatorExtensionOptions.setAllowsExtensions(this.extensionOptionsPage.allowsExtensions()); - this.generatorExtensionOptions.setClasspath(this.extensionOptionsPage.getClasspath()); - this.generatorExtensionOptions.setAdditionalArgs(this.extensionOptionsPage.getAdditionalArgs()); - } - - private ClassesGeneratorWizardPage buildClassesGeneratorPage() { - - return new ClassesGeneratorWizardPage(); - } - - private ClassesGeneratorOptionsWizardPage buildClassesGeneratorOptionsPage() { - return new ClassesGeneratorOptionsWizardPage(); - } - - private ClassesGeneratorExtensionOptionsWizardPage buildExtensionOptionsPage() { - return new ClassesGeneratorExtensionOptionsWizardPage(); - } - - 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())); - } - } - - 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 fdc4940650..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizardPage.java +++ /dev/null @@ -1,645 +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 java.io.File; -import java.util.ArrayList; -import java.util.Collection; - -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.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.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.jaxb.core.internal.gen.ClassesGenerator; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.jpt.ui.JptUiPlugin; -import org.eclipse.jpt.ui.internal.util.SWTUtil; -import org.eclipse.jpt.ui.internal.util.TableLayoutComposite; -import org.eclipse.jpt.utility.internal.ArrayTools; -import org.eclipse.jpt.utility.internal.StringTools; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.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; -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 String JPT_ECLIPSELINK_UI_PLUGIN_ID = "org.eclipse.jpt.eclipselink.ui"; //$NON-NLS-1$ - static public String XML_FILTER = "*.xml"; //$NON-NLS-1$ - static public String BINDINGS_FILE_FILTER = "*.xjb;*.xml;*.xbd"; //$NON-NLS-1$ - - public static final String HELP_CONTEXT_ID = JptUiPlugin.PLUGIN_ID + ".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; - } - - protected void setUsesMoxy(boolean usesMoxy){ - this.usesMoxy = usesMoxy; - } - - // ********** 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.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) { - 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.moxyIsOnClasspath()) { - //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); -// } -// } - } - - private void displayWarning(String message) { - this.setMessage(message, WARNING); - } - - /** - * Test if the Jaxb compiler is on the classpath. - */ - private boolean genericJaxbIsOnClasspath() { - try { - String className = ClassesGenerator.JAXB_GENERIC_GEN_CLASS; - IType genClass = this.getJavaProject().findType(className); - return (genClass != null); - } - catch (JavaModelException e) { - throw new RuntimeException(e); - } - } - - /** - * Test if the EclipseLink Jaxb compiler is on the classpath. - */ - private boolean moxyIsOnClasspath() { - try { - String className = ClassesGenerator.JAXB_ECLIPSELINK_GEN_CLASS; - IType genClass = this.getJavaProject().findType(className); - return (genClass != null); - } - catch (JavaModelException e) { - throw new RuntimeException(e); - } - } - - // ********** 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)) { - updateStatus(fContainerStatus); - }else if( ! this.fPackageStatus.matches(IStatus.OK) ) { - updateStatus(fPackageStatus); - } else { - updateStatus(Status.OK_STATUS); - } - 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()); - - // default usesMoxy to true only when JPT EclipseLink bundle exists and MOXy is on the classpath - this.usesMoxy = (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 schemaPathOrUri = ((ClassesGeneratorWizard)this.getWizard()).getSchemaPathOrUri(); - this.setTitle(NLS.bind(JptJaxbUiMessages.ClassesGeneratorWizardPage_title, schemaPathOrUri)); - } - } - - /** - * 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; - } - - // ********** 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 buttons - 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) { - - ArrayList<String> filePaths = promptBindingsFiles(); - for(String filePath : filePaths) { - addBindingsFile(filePath, tableDataModel); - } - tableViewer.refresh(); - } - }); - // Remove buttons - 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 makeRelativeToProjectPath(String filePath) { - Path path = new Path(filePath); - IPath relativePath = path.makeRelativeTo(getJavaProject().getProject().getLocation()); - return relativePath.toOSString(); - } - - private void addBindingsFile(String filePath, final ArrayList<String> tableDataModel) { - String relativePath = this.makeRelativeToProjectPath(filePath); - 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 ArrayList<String> promptBindingsFiles() { - String projectPath= getJavaProject().getProject().getLocation().toString(); - - FileDialog dialog = new FileDialog(getShell(), SWT.MULTI); - dialog.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_chooseABindingsFile); - 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)); - } - - } - - // ********** 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.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 0f9371cfbc..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SchemaWizardPage.java +++ /dev/null @@ -1,190 +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.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.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.jpt.jaxb.ui.internal.wizards.JavaProjectWizardPage; -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 { - - private final IStructuredSelection initialSelection; - private IProject targetProject; - - protected SelectFileOrXMLCatalogIdPanel selectSourcePanel; - - protected static final String[] browseXSDFilterExtensions = {".xsd"}; //$NON-NLS-1$ - - // ********** 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.getSourceSchema() != null) { - this.selectSourcePanel.setSingleFileViewDefaultSelection(new StructuredSelection(this.getSourceSchema())); - } - 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.schemaOrUriSelected() && (this.getErrorMessage() == null); - } - - // ********** intra-wizard methods ********** - - public IFile getSourceSchema() { - 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; - } - - public String getXMLCatalogId() { - return this.selectSourcePanel.getXMLCatalogId(); - } - - // ********** 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.getSourceSchema() != null) || (this.getSourceURI() != null)); - } - - private String computeErrorMessage() { - String errorMessage = null; - String uri = this.getSourceURI(); - if(uri != null) { - if( ! URIHelper.isReadableURI(uri, 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 c7a6db1116..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectFileOrXMLCatalogIdPanel.java +++ /dev/null @@ -1,185 +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.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("Select file from Workspace"); - 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("Select XML Catalog entry"); - 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); - 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.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 2745d0ab04..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/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.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 54fb896f49..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetInstallPage.java +++ /dev/null @@ -1,166 +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.facet; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.dialogs.Dialog; -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.facet.model.JaxbFacetInstallDataModelProperties; -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 class JaxbFacetInstallPage - extends DataModelFacetInstallPage - implements JaxbFacetInstallDataModelProperties { - - public JaxbFacetInstallPage() { - super("jpt.jaxb.facet.install.page"); - 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(); - } - } - - 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); - JaxbFacetInstallPage.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/model/JaxbFacetInstallConfigToDataModelAdapterFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetInstallConfigToDataModelAdapterFactory.java deleted file mode 100644 index de0df6270e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetInstallConfigToDataModelAdapterFactory.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.internal.wizards.facet.model; - -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetInstallConfig; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class JaxbFacetInstallConfigToDataModelAdapterFactory - implements IAdapterFactory { - - private static final Class<?>[] ADAPTER_LIST = new Class[] { IDataModel.class }; - - public Class<?>[] getAdapterList() { - return ADAPTER_LIST; - } - - public Object getAdapter(Object adaptableObj, Class adapterType) { - if (adapterType == IDataModel.class) { - JaxbFacetInstallDataModelProvider provider - = new JaxbFacetInstallDataModelProvider((JaxbFacetInstallConfig) adaptableObj); - return DataModelFactory.createDataModel( provider ); - } - - return null; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetInstallDataModelProperties.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetInstallDataModelProperties.java deleted file mode 100644 index be2889ea9d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetInstallDataModelProperties.java +++ /dev/null @@ -1,25 +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.facet.model; - -import org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties; - -public interface JaxbFacetInstallDataModelProperties - extends IDataModelProperties { - - public static final String JAXB_FACET_INSTALL_CONFIG - = "JaxbFacetInstallDataModelProperties.JAVA_FACET_INSTALL_CONFIG"; //$NON-NLS-1$ - - public static final String PLATFORM - = "JaxbFacetInstallDataModelProperties.PLATFORM"; //$NON-NLS-1$ - - public static final String LIBRARY_INSTALL_DELEGATE - = "JaxbFacetInstallDataModelProperties.LIBRARY_INSTALL_DELEGATE"; //$NON-NLS-1$ -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetInstallDataModelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetInstallDataModelProvider.java deleted file mode 100644 index 8241fa8b3f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetInstallDataModelProvider.java +++ /dev/null @@ -1,308 +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.facet.model; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.Comparator; -import java.util.Set; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jpt.jaxb.core.JaxbFacet; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetInstallConfig; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.jpt.utility.internal.ArrayTools; -import org.eclipse.jpt.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.utility.internal.iterables.TransformationIterable; -import org.eclipse.jst.common.project.facet.core.libprov.IPropertyChangeListener; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate; -import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider; -import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent; -import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener; - -public class JaxbFacetInstallDataModelProvider - extends FacetInstallDataModelProvider - implements JaxbFacetInstallDataModelProperties { - - protected static final DataModelPropertyDescriptor[] EMPTY_DMPD_ARRAY = new DataModelPropertyDescriptor[0]; - - - protected static final Comparator<DataModelPropertyDescriptor> DMPD_COMPARATOR = - new Comparator<DataModelPropertyDescriptor>() { - public int compare(DataModelPropertyDescriptor dmpd1, DataModelPropertyDescriptor dmpd2) { - return dmpd1.getPropertyDescription().compareTo(dmpd2.getPropertyDescription()); - } - }; - - protected static IStatus buildErrorStatus(String message) { - return buildStatus(IStatus.ERROR, message); - } - - protected static IStatus buildStatus(int severity, String message) { - return new Status(severity, JptJaxbUiPlugin.PLUGIN_ID, message); - } - - - private JaxbFacetInstallConfig config; - - private PropertyChangeListener configListener; - - - public JaxbFacetInstallDataModelProvider() { - this(new JaxbFacetInstallConfig()); - } - - public JaxbFacetInstallDataModelProvider(JaxbFacetInstallConfig config) { - super(); - this.config = config; - this.configListener = buildConfigListener(); - this.config.addPropertyChangeListener(this.configListener); - } - - - protected PropertyChangeListener buildConfigListener() { - return new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getPropertyName().equals(JaxbFacetInstallConfig.FACETED_PROJECT_WORKING_COPY_PROPERTY)) { - - } - } - }; - } - - @Override - public Set getPropertyNames() { - Set names = super.getPropertyNames(); - names.add(JAXB_FACET_INSTALL_CONFIG); - names.add(PLATFORM); - names.add(LIBRARY_INSTALL_DELEGATE); - return names; - } - - @Override - public void init() { - super.init(); - getDataModel().setProperty(JAXB_FACET_INSTALL_CONFIG, this.config); - if (this.config.getPlatform() != null) { - getDataModel().setProperty(PLATFORM, this.config.getPlatform()); - } - else { - this.config.setPlatform(getDefaultPlatform()); - } - } - - @Override - public Object getDefaultProperty(String propertyName) { - if (propertyName.equals(FACET_ID)) { - return JaxbFacet.ID; - } - else if (propertyName.equals(PLATFORM)) { - return getDefaultPlatform(); - } - else if (propertyName.equals(LIBRARY_INSTALL_DELEGATE)) { - // means that library install delegate has not been initialized - LibraryInstallDelegate lid = buildLibraryInstallDelegate(); - setLibraryInstallDelegate(lid); - return lid; - } - - return super.getDefaultProperty(propertyName); - } - - protected JaxbPlatformDescription getDefaultPlatform() { - return JptJaxbCorePlugin.getDefaultPlatform(getProjectFacetVersion()); - } - - protected LibraryInstallDelegate buildLibraryInstallDelegate() { - IFacetedProjectWorkingCopy fpjwc = this.getFacetedProjectWorkingCopy(); - if (fpjwc == null) { - return null; - } - IProjectFacetVersion pfv = this.getProjectFacetVersion(); - if (pfv == null) { - return null; - } - LibraryInstallDelegate lid = new LibraryInstallDelegate(fpjwc, pfv); - lid.addListener(buildLibraryInstallDelegateListener()); - return lid; - } - - protected IPropertyChangeListener buildLibraryInstallDelegateListener() { - return new IPropertyChangeListener() { - public void propertyChanged(String property, Object oldValue, Object newValue ) { - if (LibraryInstallDelegate.PROP_AVAILABLE_PROVIDERS.equals(property)) { - adjustLibraryProviders(); - } - JaxbFacetInstallDataModelProvider.this.getDataModel().notifyPropertyChange( - LIBRARY_INSTALL_DELEGATE, IDataModel.VALUE_CHG); - } - }; - } - - @Override - public boolean propertySet(String propertyName, Object propertyValue) { - boolean ok = super.propertySet(propertyName, propertyValue); - - if (propertyName.equals(FACET_VERSION)) { - adjustLibraryProviders(); - this.model.notifyPropertyChange(PLATFORM, IDataModel.DEFAULT_CHG); - if (getLibraryInstallDelegate().getProjectFacetVersion().equals(getProjectFacetVersion())) { - getLibraryInstallDelegate().dispose(); - setLibraryInstallDelegate(buildLibraryInstallDelegate()); - } - } - else if (propertyName.equals(FACETED_PROJECT_WORKING_COPY)) { - getFacetedProjectWorkingCopy().addListener( - new IFacetedProjectListener() { - public void handleEvent(IFacetedProjectEvent event) { - LibraryInstallDelegate lid = getLibraryInstallDelegate(); - if (lid != null) { - // may be null while model is being built up - // ... or in tests - lid.refresh(); - } - } - }, - IFacetedProjectEvent.Type.PRIMARY_RUNTIME_CHANGED); - } - else if (propertyName.equals(JAXB_FACET_INSTALL_CONFIG)) { - return false; - } - else if (propertyName.equals(PLATFORM)) { - this.config.setPlatform((JaxbPlatformDescription) propertyValue); - adjustLibraryProviders(); - } - else if (propertyName.equals(LIBRARY_INSTALL_DELEGATE)) { - this.config.setLibraryInstallDelegate((LibraryInstallDelegate) propertyValue); - } - - return ok; - } - - @Override - public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) { - if (propertyName.equals(PLATFORM)) { - return this.buildValidPlatformDescriptors(); - } - - return super.getValidPropertyDescriptors(propertyName); - } - - protected DataModelPropertyDescriptor[] buildValidPlatformDescriptors() { - Iterable<JaxbPlatformDescription> validPlatformDescriptions = buildValidPlatformDescriptions(); - Iterable<DataModelPropertyDescriptor> validPlatformDescriptors = - new TransformationIterable<JaxbPlatformDescription, DataModelPropertyDescriptor>(validPlatformDescriptions) { - @Override - protected DataModelPropertyDescriptor transform(JaxbPlatformDescription description) { - return buildPlatformDescriptor(description); - } - }; - return ArrayTools.sort(ArrayTools.array(validPlatformDescriptors, EMPTY_DMPD_ARRAY), DMPD_COMPARATOR); - } - - protected Iterable<JaxbPlatformDescription> buildValidPlatformDescriptions() { - return new FilteringIterable<JaxbPlatformDescription>( - JptJaxbCorePlugin.getJaxbPlatformManager().getJaxbPlatforms()) { - @Override - protected boolean accept(JaxbPlatformDescription o) { - return o.supportsJaxbFacetVersion(getProjectFacetVersion()); - } - }; - } - - @Override - public DataModelPropertyDescriptor getPropertyDescriptor(String propertyName) { - if (propertyName.equals(PLATFORM)) { - return buildPlatformDescriptor(getPlatform()); - } - - return super.getPropertyDescriptor(propertyName); - } - - protected DataModelPropertyDescriptor buildPlatformDescriptor(JaxbPlatformDescription desc) { - return new DataModelPropertyDescriptor(desc, desc.getLabel()); - } - - @Override - public IStatus validate(String propertyName) { - if (propertyName.equals(PLATFORM)) { - return validatePlatform(); - } - if (propertyName.equals(LIBRARY_INSTALL_DELEGATE)) { - return getLibraryInstallDelegate().validate(); - } - - return super.validate(propertyName); - } - - protected IStatus validatePlatform() { - return (getPlatform() == null) ? - buildErrorStatus(JptJaxbUiMessages.JaxbFacetDataModel_validatePlatformNotSpecified) - : OK_STATUS; - } - - protected IFacetedProjectWorkingCopy getFacetedProjectWorkingCopy() { - return (IFacetedProjectWorkingCopy) this.config.getFacetedProjectWorkingCopy(); - } - - protected IProjectFacetVersion getProjectFacetVersion() { - return (IProjectFacetVersion) this.config.getProjectFacetVersion(); - } - - protected JaxbPlatformDescription getPlatform() { - return (JaxbPlatformDescription) getProperty(PLATFORM); - } - - protected LibraryInstallDelegate getLibraryInstallDelegate() { - return (LibraryInstallDelegate) getProperty(LIBRARY_INSTALL_DELEGATE); - } - - protected void setLibraryInstallDelegate(LibraryInstallDelegate lid) { - getDataModel().setProperty(LIBRARY_INSTALL_DELEGATE, lid); - } - - protected void adjustLibraryProviders() { - LibraryInstallDelegate lid = getLibraryInstallDelegate(); - if (lid != null) { -// List<JpaLibraryProviderInstallOperationConfig> jpaConfigs -// = new ArrayList<JpaLibraryProviderInstallOperationConfig>(); -// // add the currently selected one first -// JpaLibraryProviderInstallOperationConfig currentJpaConfig = null; -// LibraryProviderOperationConfig config = lid.getLibraryProviderOperationConfig(); -// if (config instanceof JpaLibraryProviderInstallOperationConfig) { -// currentJpaConfig = (JpaLibraryProviderInstallOperationConfig) config; -// jpaConfigs.add(currentJpaConfig); -// } -// for (ILibraryProvider lp : lid.getLibraryProviders()) { -// config = lid.getLibraryProviderOperationConfig(lp); -// if (config instanceof JpaLibraryProviderInstallOperationConfig -// && ! config.equals(currentJpaConfig)) { -// jpaConfigs.add((JpaLibraryProviderInstallOperationConfig) config); -// } -// } -// for (JpaLibraryProviderInstallOperationConfig jpaConfig : jpaConfigs) { -// jpaConfig.setJpaPlatformId(getPlatformId()); -// } - } - } - - @Override - public void dispose() { - super.dispose(); - this.config.removePropertyChangeListener(this.configListener); - } -} 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 b5ff6a80c5..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.internal.JptJaxbUiIcons; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.jpt.jaxb.ui.internal.wizards.proj.model.JaxbProjectCreationDataModelProvider; -import org.eclipse.jpt.ui.JptUiPlugin; -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 JptUiPlugin.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 aa53811e71..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/NewSchemaFileWizardPage.java +++ /dev/null @@ -1,145 +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 static org.eclipse.jpt.core.internal.operations.JpaFileCreationDataModelProperties.*; -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.viewers.IStructuredSelection; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.jpt.utility.internal.StringTools; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; -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" + SchemaGeneratorWizard.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.setFileName(DEFAULT_SCHEMA_NAME); - } - - // ********** intra-wizard methods ********** - - public IProject getProject() { - return (IProject) this.dataModel.getProperty(PROJECT); - } - - public IPath getFilePath() { - return this.getContainerFullPath(); - } - - // ********** 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; - } - - valid = this.projectIsJavaProject(this.getProject()); - if( ! valid) { - this.setErrorMessage(JptJaxbUiMessages.NewSchemaFileWizardPage_errorNotJavaProject); - return valid; - } - 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; - } - -} 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 21cedc9448..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizard.java +++ /dev/null @@ -1,261 +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.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.Path; -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.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.jpt.utility.internal.ArrayTools; -import org.eclipse.jpt.utility.internal.FileTools; -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.getFilePath(); - String fileName = this.newSchemaFileWizardPage.getFileName(); - String targetSchema = filePath.toOSString() + File.separator + fileName; - if ( ! FileTools.extension(targetSchema).equalsIgnoreCase(XSD_EXTENSION)) { - targetSchema += XSD_EXTENSION; - } - - return this.makeRelativeToProjectPath(targetSchema); - } - - private String makeRelativeToProjectPath(String filePath) { - Path path = new Path(filePath); - IPath relativePath = path.makeRelativeTo(this.targetProject.getProject().getLocation()); - return relativePath.removeFirstSegments(1).toOSString(); - } - - 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); - 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 d81490ce43..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizardPage.java +++ /dev/null @@ -1,440 +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.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.jpt.ui.JptUiPlugin; -import org.eclipse.jpt.utility.internal.ArrayTools; -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.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 = JptUiPlugin.PLUGIN_ID + ".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; - } - } -} |