Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfullbright2011-02-08 23:13:17 +0000
committerpfullbright2011-02-08 23:13:17 +0000
commitf84a6f5610cfc2b3752d1a0caffadb4d2f801a70 (patch)
treee1523306a68d8ad6253f1de9a4be93ab5db9a725
parente0f30ce76b361218e802413484f66435bbdd5ba0 (diff)
downloadwebtools.dali-f84a6f5610cfc2b3752d1a0caffadb4d2f801a70.tar.gz
webtools.dali-f84a6f5610cfc2b3752d1a0caffadb4d2f801a70.tar.xz
webtools.dali-f84a6f5610cfc2b3752d1a0caffadb4d2f801a70.zip
changed facet config to use data model only; added jre and user library validators
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF3
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.properties5
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml73
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jpt_jaxb_core.properties5
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JptJaxbCoreMessages.java6
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetConfig.java187
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDataModelProperties.java (renamed from jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetDataModelProperties.java)7
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDataModelProvider.java (renamed from jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetDataModelProvider.java)216
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDelegate.java20
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallConfigFactory.java21
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallDataModelProperties.java (renamed from jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetInstallDataModelProperties.java)4
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallDataModelProvider.java (renamed from jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallConfig.java)9
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeConfig.java38
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeConfigFactory.java21
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeDataModelProperties.java (renamed from jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetVersionChangeDataModelProperties.java)4
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeDataModelProvider.java (renamed from jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetVersionChangeDataModelProvider.java)26
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbJreLibraryProviderInstallOperationConfig.java61
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java32
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/GenericJaxbUserLibraryValidator.java56
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/JaxbJreLibraryValidator.java44
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/JaxbLibValUtil.java135
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF5
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.xml28
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetInstallPage.java4
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetPage.java16
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetVersionChangePage.java4
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetInstallConfigToDataModelAdapterFactory.java35
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetInstallDataModelProvider.java25
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetVersionChangeConfigToDataModelAdapterFactory.java36
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/META-INF/MANIFEST.MF1
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbTestCase.java18
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/projects/TestJaxbProject.java41
32 files changed, 639 insertions, 547 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF
index 3a86ffb2ac..3c3ee43439 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF
@@ -9,7 +9,8 @@ Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.6.100,4.0.0)",
+Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.200,4.0.0)",
+ org.eclipse.core.runtime;bundle-version="[3.6.100,4.0.0)",
org.eclipse.debug.core;bundle-version="[3.4.0,4.0.0)",
org.eclipse.jdt.core;bundle-version="[3.7.0,4.0.0)",
org.eclipse.jdt.launching;bundle-version="[3.4.0,4.0.0)",
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.properties
index 522cd24f5b..6f814334bb 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.properties
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2006, 2010 Oracle. All rights reserved.
+# Copyright (c) 2006, 2011 Oracle. All rights reserved.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v1.0, which accompanies this distribution
# and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -25,4 +25,7 @@ JAXB_TEMPLATE_LABEL = JAXB Project
JAXB_NO_OP_LIBRARY_PROVIDER_MESSAGE = The JAXB facet requires a JAXB implementation library to be present on the project classpath. By disabling library configuration, the user takes on the responsibility of ensuring that the classpath is configured appropriately via alternate means.
+JAXB_JRE_LIBRARY_PROVIDER_LABEL = JRE
+JAXB_JRE_LIBRARY_PROVIDER_MESSAGE = The project JRE provides the annotations and implementation to support the chosen JAXB version.
+
JAXB_VALIDATOR = JAXB Validator
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml b/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml
index 26f1a3eebe..2c02e0b7ad 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<!--
- Copyright (c) 2010 Oracle. All rights reserved.
+ Copyright (c) 2010, 2011 Oracle. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v1.0, which accompanies this distribution
and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -68,6 +68,44 @@
</extension>
+ <extension
+ point="org.eclipse.jpt.common.core.libraryValidators">
+
+ <libraryValidator
+ id="jaxbJreLibraryValidator"
+ class="org.eclipse.jpt.jaxb.core.internal.libval.JaxbJreLibraryValidator">
+ <enablement>
+ <with variable="libraryProvider">
+ <test property="org.eclipse.jpt.common.core.extendsId" value="jaxb-jre-library-provider"/>
+ </with>
+ </enablement>
+ </libraryValidator>
+
+ <libraryValidator
+ id="genericJaxbUserLibraryValidator"
+ class="org.eclipse.jpt.jaxb.core.internal.libval.GenericJaxbUserLibraryValidator">
+ <enablement>
+ <with variable="libraryProvider">
+ <test property="org.eclipse.jpt.common.core.extendsId" value="jaxb-user-library-provider"/>
+ </with>
+ </enablement>
+ </libraryValidator>
+
+ <!--
+ <libraryValidator
+ id="genericEclipselinkBundlesLibraryValidator"
+ class="org.eclipse.jpt.core.internal.libval.GenericEclipseLinkBundlesLibraryValidator">
+ <enablement>
+ <with variable="libraryProvider">
+ <test property="org.eclipse.jpt.core.extendsId" value="eclipselink-bundles-library-provider"/>
+ </with>
+ </enablement>
+ </libraryValidator>
+ -->
+
+ </extension>
+
+
<extension
point="org.eclipse.jst.common.project.facet.core.libraryProviders">
@@ -85,6 +123,28 @@
</provider>
<provider
+ id="jaxb-jre-library-provider">
+ <label>%JAXB_JRE_LIBRARY_PROVIDER_LABEL</label>
+ <priority>900</priority>
+ <param name="message" value="%JAXB_JRE_LIBRARY_PROVIDER_MESSAGE"/>
+ <enablement>
+ <and>
+ <with variable="requestingProjectFacet">
+ <test property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="jpt.jaxb" forcePluginActivation="true"/>
+ </with>
+ </and>
+ </enablement>
+ <action type="INSTALL">
+ <config class="org.eclipse.jpt.jaxb.core.internal.libprov.JaxbJreLibraryProviderInstallOperationConfig"/>
+ <operation class="org.eclipse.jst.common.project.facet.core.libprov.NoOpLibraryProviderOperation"/>
+ </action>
+ <action type="UNINSTALL">
+ <operation class="org.eclipse.jst.common.project.facet.core.libprov.NoOpLibraryProviderOperation"/>
+ </action>
+ </provider>
+
+ <provider
id="jaxb-user-library-provider"
extends="wtp-user-library-provider">
<enablement>
@@ -99,6 +159,7 @@
</action>
</provider>
+ <!--
<provider
id="jaxb-osgi-bundles-library-provider"
extends="wtp-osgi-bundles-library-provider"
@@ -115,6 +176,12 @@
</action>
</provider>
+ <provider
+ id="jaxb-eclipselink-bundles-library-provider"
+ extends="jaxb-osgi-bundles-library-provider"
+ abstract="true"/>
+ -->
+
</extension>
@@ -156,12 +223,12 @@
</template>
<action facet="jpt.jaxb" type="install" id="jpt.jaxb.install">
- <config-factory class="org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetInstallConfigFactory"/>
+ <config-factory class="org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetInstallDataModelProvider"/>
<delegate class="org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetInstallDelegate"/>
</action>
<action facet="jpt.jaxb" type="version-change" id="jpt.jaxb.version-change">
- <config-factory class="org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetVersionChangeConfigFactory"/>
+ <config-factory class="org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetVersionChangeDataModelProvider"/>
<delegate class="org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetVersionChangeDelegate"/>
</action>
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jpt_jaxb_core.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jpt_jaxb_core.properties
index 9e369004d5..0688655614 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jpt_jaxb_core.properties
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jpt_jaxb_core.properties
@@ -1,5 +1,5 @@
################################################################################
-# Copyright (c) 2010 Oracle. All rights reserved.
+# Copyright (c) 2010, 2011 Oracle. All rights reserved.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v1.0, which accompanies this distribution
# and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -16,4 +16,7 @@ ClassesGenerator_generatingClassesTask = Generating classes
JaxbFacetConfig_validatePlatformNotSpecified = Platform must be specified
JaxbFacetConfig_validatePlatformDoesNotSupportFacetVersion = Platform does not support the current JAXB facet version
+JreLibraryValidator_invalidPlatform = Project JRE does not support the current JAXB platform.
+JreLibraryValidator_invalidJreJaxbVersion = Project JRE does not support the current JAXB version.
+
PREFERENCES_FLUSH_JOB_NAME=Flush Preferences: {0}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JptJaxbCoreMessages.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JptJaxbCoreMessages.java
index 01b8828830..b8dd9e9dfb 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JptJaxbCoreMessages.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JptJaxbCoreMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2010 Oracle. All rights reserved.
+* Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -22,7 +22,9 @@ public class JptJaxbCoreMessages {
public static String JaxbFacetConfig_validatePlatformNotSpecified;
public static String JaxbFacetConfig_validatePlatformDoesNotSupportFacetVersion;
-
+ public static String JreLibraryValidator_invalidPlatform;
+ public static String JreLibraryValidator_invalidJreJaxbVersion;
+
public static String PREFERENCES_FLUSH_JOB_NAME;
public static String SchemaGenerator_creatingJAXBPropertiesFileTask;
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetConfig.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetConfig.java
deleted file mode 100644
index b89cb69406..0000000000
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetConfig.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.jaxb.core.internal.facet;
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
-import org.eclipse.jpt.jaxb.core.internal.JptJaxbCoreMessages;
-import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
-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.project.facet.core.ActionConfig;
-import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-public abstract class JaxbFacetConfig
- extends ActionConfig {
-
- private PropertyChangeSupport changeSupport;
-
- public static final String FACETED_PROJECT_WORKING_COPY_PROPERTY = "facetedProjectWorkingCopy";
-
- public static final String PROJECT_FACET_VERSION_PROPERTY = "projectFacetVersion";
-
- public static final String PLATFORM_PROPERTY = "platform";
- private JaxbPlatformDescription platform;
-
- public static final String LIBRARY_INSTALL_DELEGATE_PROPERTY = "libraryInstallDelegate";
- private LibraryInstallDelegate libraryInstallDelegate;
-
-
-
- protected JaxbFacetConfig() {
- super();
- this.changeSupport = new PropertyChangeSupport(this);
- }
-
-
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- this.changeSupport.addPropertyChangeListener(listener);
- }
-
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- this.changeSupport.removePropertyChangeListener(listener);
- }
-
- @Override
- public void setFacetedProjectWorkingCopy(IFacetedProjectWorkingCopy fpjwc) {
- IFacetedProjectWorkingCopy oldFpjwc = getFacetedProjectWorkingCopy();
- super.setFacetedProjectWorkingCopy(fpjwc);
- this.changeSupport.firePropertyChange(FACETED_PROJECT_WORKING_COPY_PROPERTY, oldFpjwc, fpjwc);
- }
-
- @Override
- public void setProjectFacetVersion(IProjectFacetVersion fv) {
- IProjectFacetVersion oldFv = getProjectFacetVersion();
- super.setProjectFacetVersion(fv);
- this.changeSupport.firePropertyChange(PROJECT_FACET_VERSION_PROPERTY, oldFv, fv);
- adjustLibraryProviders();
- if (getLibraryInstallDelegate() != null && getLibraryInstallDelegate().getProjectFacetVersion().equals(getProjectFacetVersion())) {
- getLibraryInstallDelegate().dispose();
- setLibraryInstallDelegate(buildLibraryInstallDelegate());
- }
- }
-
- public JaxbPlatformDescription getPlatform() {
- if (this.platform != null) {
- return this.platform;
- }
- return getExistingPlatform();
- }
-
- public void setPlatform(JaxbPlatformDescription platform) {
- JaxbPlatformDescription oldPlatform = this.platform;
- this.platform = platform;
- this.changeSupport.firePropertyChange(PLATFORM_PROPERTY, oldPlatform, platform);
- adjustLibraryProviders();
- }
-
- protected JaxbPlatformDescription getExistingPlatform() {
- IProject project = getFacetedProjectWorkingCopy().getProject();
- return (project == null) ? null : JptJaxbCorePlugin.getJaxbPlatformDescription(project);
- }
-
- public LibraryInstallDelegate getLibraryInstallDelegate() {
- if (this.libraryInstallDelegate == null) {
- this.libraryInstallDelegate = buildLibraryInstallDelegate();
- }
- return this.libraryInstallDelegate;
- }
-
- 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();
- }
- }
- };
- }
-
- 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());
-// }
- }
- }
-
- public void setLibraryInstallDelegate(LibraryInstallDelegate libraryInstallDelegate) {
- LibraryInstallDelegate oldLibraryInstallDelegate = this.libraryInstallDelegate;
- this.libraryInstallDelegate = libraryInstallDelegate;
- this.changeSupport.firePropertyChange(
- LIBRARY_INSTALL_DELEGATE_PROPERTY, oldLibraryInstallDelegate, libraryInstallDelegate);
- }
-
-
- // ********** validation **********
-
- protected static IStatus OK_STATUS = Status.OK_STATUS;
-
- protected static IStatus buildErrorStatus(String message) {
- return buildStatus(IStatus.ERROR, message);
- }
-
- protected static IStatus buildStatus(int severity, String message) {
- return new Status(severity, JptJaxbCorePlugin.PLUGIN_ID, message);
- }
-
-
- @Override
- public IStatus validate() {
- IStatus status = validatePlatform();
- if (status.isOK()) {
- status = this.libraryInstallDelegate.validate();
- }
-
- return status;
- }
-
- protected IStatus validatePlatform() {
- return (getPlatform() == null) ?
- buildErrorStatus(JptJaxbCoreMessages.JaxbFacetConfig_validatePlatformNotSpecified)
- : OK_STATUS;
- }
-}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetDataModelProperties.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDataModelProperties.java
index 61957b2f39..a9d2a5f736 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetDataModelProperties.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDataModelProperties.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -7,7 +7,7 @@
* Contributors:
* Oracle - initial API and implementation
*******************************************************************************/
-package org.eclipse.jpt.jaxb.ui.internal.wizards.facet.model;
+package org.eclipse.jpt.jaxb.core.internal.facet;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties;
@@ -17,9 +17,6 @@ public interface JaxbFacetDataModelProperties
static final String PREFIX_
= JaxbFacetDataModelProperties.class.getSimpleName() + "."; //$NON-NLS-1$
- public static final String JAXB_FACET_INSTALL_CONFIG
- = PREFIX_ + "JAVA_FACET_INSTALL_CONFIG"; //$NON-NLS-1$
-
public static final String PLATFORM
= PREFIX_ + "PLATFORM"; //$NON-NLS-1$
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetDataModelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDataModelProvider.java
index 40e6799791..c1a2b6b5bd 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetDataModelProvider.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDataModelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -7,22 +7,26 @@
* Contributors:
* Oracle - initial API and implementation
*******************************************************************************/
-package org.eclipse.jpt.jaxb.ui.internal.wizards.facet.model;
+package org.eclipse.jpt.jaxb.core.internal.facet;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
import java.util.Comparator;
+import java.util.List;
import java.util.Set;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jpt.common.utility.internal.ArrayTools;
import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.jaxb.core.JaxbFacet;
import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
-import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetConfig;
+import org.eclipse.jpt.jaxb.core.internal.JptJaxbCoreMessages;
+import org.eclipse.jpt.jaxb.core.libprov.JaxbLibraryProviderInstallOperationConfig;
import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
+import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider;
import org.eclipse.jst.common.project.facet.core.libprov.IPropertyChangeListener;
import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate;
+import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperationConfig;
import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider;
import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
@@ -47,85 +51,36 @@ public abstract class JaxbFacetDataModelProvider
};
- private JaxbFacetConfig config;
- private PropertyChangeListener configListener;
+ // listens to primary runtime changing
+ private IFacetedProjectListener fprojListener;
- private IPropertyChangeListener libraryInstallDelegateListener;
+ private LibraryInstallDelegate defaultLibraryInstallDelegate;
- protected JaxbFacetDataModelProvider(JaxbFacetConfig config) {
+ protected JaxbFacetDataModelProvider() {
super();
- this.config = config;
- this.configListener = buildConfigListener();
- this.config.addPropertyChangeListener(this.configListener);
- this.libraryInstallDelegateListener = buildLibraryInstallDelegateListener();
+ this.fprojListener = buildFprojListener();
}
- protected PropertyChangeListener buildConfigListener() {
- return new PropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent evt) {
- if (evt.getPropertyName().equals(JaxbFacetConfig.FACETED_PROJECT_WORKING_COPY_PROPERTY)) {
-
- }
- else if (evt.getPropertyName().equals(JaxbFacetConfig.PROJECT_FACET_VERSION_PROPERTY)) {
- if (! isPropertySet(PLATFORM)) {
- JaxbFacetDataModelProvider.this.config.setPlatform(getDefaultPlatform());
- }
- }
- else if (evt.getPropertyName().equals(JaxbFacetConfig.LIBRARY_INSTALL_DELEGATE_PROPERTY)) {
- LibraryInstallDelegate oldLid = (LibraryInstallDelegate) evt.getOldValue();
- if (oldLid != null) {
- oldLid.removeListener(JaxbFacetDataModelProvider.this.libraryInstallDelegateListener);
- }
- LibraryInstallDelegate newLid = (LibraryInstallDelegate) evt.getNewValue();
- if (newLid != null) {
- newLid.addListener(JaxbFacetDataModelProvider.this.libraryInstallDelegateListener);
- }
- setLibraryInstallDelegate(newLid);
- }
+ protected IFacetedProjectListener buildFprojListener() {
+ return new IFacetedProjectListener() {
+ public void handleEvent(IFacetedProjectEvent event) {
+ getLibraryInstallDelegate().refresh();
}
};
}
- protected IPropertyChangeListener buildLibraryInstallDelegateListener() {
- return new IPropertyChangeListener() {
- public void propertyChanged(String property, Object oldValue, Object newValue ) {
- JaxbFacetDataModelProvider.this.getDataModel().notifyPropertyChange(
- LIBRARY_INSTALL_DELEGATE, IDataModel.VALUE_CHG);
- }
- };
- }
-
@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());
- }
-
- if (this.config.getLibraryInstallDelegate() != null) {
- getDataModel().setProperty(LIBRARY_INSTALL_DELEGATE, this.config.getLibraryInstallDelegate());
- this.config.getLibraryInstallDelegate().addListener(this.libraryInstallDelegateListener);
- }
- }
-
- @Override
public Object getDefaultProperty(String propertyName) {
if (propertyName.equals(FACET_ID)) {
return JaxbFacet.ID;
@@ -134,10 +89,7 @@ public abstract class JaxbFacetDataModelProvider
return getDefaultPlatform();
}
else if (propertyName.equals(LIBRARY_INSTALL_DELEGATE)) {
- // means that library install delegate has not been initialized
- LibraryInstallDelegate lid = this.config.getLibraryInstallDelegate();
- setLibraryInstallDelegate(lid);
- return lid;
+ return getDefaultLibraryInstallDelegate();
}
return super.getDefaultProperty(propertyName);
@@ -147,35 +99,81 @@ public abstract class JaxbFacetDataModelProvider
return JptJaxbCorePlugin.getDefaultPlatform(getProjectFacetVersion());
}
+ protected LibraryInstallDelegate getDefaultLibraryInstallDelegate() {
+ // delegate itself changes only when facet version changes
+ if (this.defaultLibraryInstallDelegate == null) {
+ this.defaultLibraryInstallDelegate = buildDefaultLibraryInstallDelegate();
+ }
+ else if (! this.defaultLibraryInstallDelegate.getProjectFacetVersion().equals(getProjectFacetVersion())) {
+ this.defaultLibraryInstallDelegate.dispose();
+ this.defaultLibraryInstallDelegate = buildDefaultLibraryInstallDelegate();
+ }
+ return defaultLibraryInstallDelegate;
+ }
+
+ protected LibraryInstallDelegate buildDefaultLibraryInstallDelegate() {
+ IFacetedProjectWorkingCopy fpjwc = getFacetedProjectWorkingCopy();
+ IProjectFacetVersion pfv = getProjectFacetVersion();
+ if (fpjwc == null || 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)) {
+ adjustLibraryInstallDelegate();
+ }
+ getDataModel().notifyPropertyChange(LIBRARY_INSTALL_DELEGATE, IDataModel.VALUE_CHG);
+ }
+ };
+ }
+
+ protected void adjustLibraryInstallDelegate() {
+ LibraryInstallDelegate lid = this.getLibraryInstallDelegate();
+ if (lid != null) {
+ List<JaxbLibraryProviderInstallOperationConfig> jaxbConfigs
+ = new ArrayList<JaxbLibraryProviderInstallOperationConfig>();
+ // add the currently selected one first
+ JaxbLibraryProviderInstallOperationConfig currentJaxbConfig = null;
+ LibraryProviderOperationConfig config = lid.getLibraryProviderOperationConfig();
+ if (config instanceof JaxbLibraryProviderInstallOperationConfig) {
+ currentJaxbConfig = (JaxbLibraryProviderInstallOperationConfig) config;
+ jaxbConfigs.add(currentJaxbConfig);
+ }
+ for (ILibraryProvider lp : lid.getLibraryProviders()) {
+ config = lid.getLibraryProviderOperationConfig(lp);
+ if (config instanceof JaxbLibraryProviderInstallOperationConfig
+ && ! config.equals(currentJaxbConfig)) {
+ jaxbConfigs.add((JaxbLibraryProviderInstallOperationConfig) config);
+ }
+ }
+ for (JaxbLibraryProviderInstallOperationConfig jaxbConfig : jaxbConfigs) {
+ jaxbConfig.setJaxbPlatform(getPlatform());
+ }
+ }
+ }
+
@Override
public boolean propertySet(String propertyName, Object propertyValue) {
boolean ok = super.propertySet(propertyName, propertyValue);
- if (propertyName.equals(FACET_VERSION)) {
- this.model.notifyPropertyChange(PLATFORM, IDataModel.DEFAULT_CHG);
- }
- 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);
+ if (propertyName.equals(FACETED_PROJECT_WORKING_COPY)) {
+ // should only be done once
+ IFacetedProjectWorkingCopy fproj = (IFacetedProjectWorkingCopy) propertyValue;
+ fproj.addListener(this.fprojListener, IFacetedProjectEvent.Type.PRIMARY_RUNTIME_CHANGED);
}
- else if (propertyName.equals(JAXB_FACET_INSTALL_CONFIG)) {
- return false;
+ else if (propertyName.equals(FACET_VERSION)) {
+ adjustLibraryInstallDelegate();
+ this.model.notifyPropertyChange(PLATFORM, IDataModel.DEFAULT_CHG);
+ this.model.notifyPropertyChange(LIBRARY_INSTALL_DELEGATE, IDataModel.DEFAULT_CHG);
}
else if (propertyName.equals(PLATFORM)) {
- this.config.setPlatform((JaxbPlatformDescription) propertyValue);
- }
- else if (propertyName.equals(LIBRARY_INSTALL_DELEGATE)) {
- this.config.setLibraryInstallDelegate((LibraryInstallDelegate) propertyValue);
+ adjustLibraryInstallDelegate();
}
return ok;
@@ -225,17 +223,42 @@ public abstract class JaxbFacetDataModelProvider
return new DataModelPropertyDescriptor(desc, desc.getLabel());
}
+ // ********** validation **********
+
+ protected static IStatus OK_STATUS = Status.OK_STATUS;
+
+ protected static IStatus buildErrorStatus(String message) {
+ return buildStatus(IStatus.ERROR, message);
+ }
+
+ protected static IStatus buildStatus(int severity, String message) {
+ return new Status(severity, JptJaxbCorePlugin.PLUGIN_ID, message);
+ }
+
@Override
public IStatus validate(String propertyName) {
- return this.config.validate();
+ if (propertyName.equals(PLATFORM)) {
+ return this.validatePlatform();
+ }
+ else if (propertyName.equals(LIBRARY_INSTALL_DELEGATE)) {
+ return getLibraryInstallDelegate().validate();
+ }
+
+ return super.validate(propertyName);
+ }
+
+ protected IStatus validatePlatform() {
+ return (getPlatform() == null) ?
+ buildErrorStatus(JptJaxbCoreMessages.JaxbFacetConfig_validatePlatformNotSpecified)
+ : OK_STATUS;
}
protected IFacetedProjectWorkingCopy getFacetedProjectWorkingCopy() {
- return (IFacetedProjectWorkingCopy) this.config.getFacetedProjectWorkingCopy();
+ return (IFacetedProjectWorkingCopy) getProperty(FACETED_PROJECT_WORKING_COPY);
}
protected IProjectFacetVersion getProjectFacetVersion() {
- return (IProjectFacetVersion) this.config.getProjectFacetVersion();
+ return (IProjectFacetVersion) getProperty(FACET_VERSION);
}
protected JaxbPlatformDescription getPlatform() {
@@ -246,16 +269,9 @@ public abstract class JaxbFacetDataModelProvider
return (LibraryInstallDelegate) getProperty(LIBRARY_INSTALL_DELEGATE);
}
- protected void setLibraryInstallDelegate(LibraryInstallDelegate lid) {
- getDataModel().setProperty(LIBRARY_INSTALL_DELEGATE, lid);
- }
-
@Override
public void dispose() {
super.dispose();
- this.config.removePropertyChangeListener(this.configListener);
- if (this.config.getLibraryInstallDelegate() != null) {
- this.config.getLibraryInstallDelegate().removeListener(this.libraryInstallDelegateListener);
- }
+ getFacetedProjectWorkingCopy().removeListener(this.fprojListener);
}
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDelegate.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDelegate.java
index fab3be7448..2a5a516cb1 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDelegate.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDelegate.java
@@ -1,3 +1,12 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
package org.eclipse.jpt.jaxb.core.internal.facet;
import org.eclipse.core.resources.IProject;
@@ -6,6 +15,8 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
+import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IDelegate;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
@@ -26,10 +37,11 @@ public abstract class JaxbFacetDelegate
SubMonitor subMonitor = SubMonitor.convert(monitor, 7);
- JaxbFacetConfig jaxbConfig = (JaxbFacetConfig) config;
+ IDataModel jaxbConfig = (IDataModel) config;
// project settings
- JaxbPlatformDescription platform = jaxbConfig.getPlatform();
+ JaxbPlatformDescription platform =
+ (JaxbPlatformDescription) jaxbConfig.getProperty(JaxbFacetDataModelProperties.PLATFORM);
JptJaxbCorePlugin.setJaxbPlatform(project, platform);
subMonitor.worked(1);
@@ -38,6 +50,8 @@ public abstract class JaxbFacetDelegate
subMonitor.worked(1);
//Delegate to LibraryInstallDelegate to configure the project classpath
- jaxbConfig.getLibraryInstallDelegate().execute(subMonitor.newChild(1));
+ LibraryInstallDelegate lid =
+ (LibraryInstallDelegate) jaxbConfig.getProperty(JaxbFacetDataModelProperties.LIBRARY_INSTALL_DELEGATE);
+ lid.execute(subMonitor.newChild(1));
}
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallConfigFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallConfigFactory.java
deleted file mode 100644
index b52d7b2311..0000000000
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallConfigFactory.java
+++ /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
- *******************************************************************************/
-package org.eclipse.jpt.jaxb.core.internal.facet;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.common.project.facet.core.IActionConfigFactory;
-
-public class JaxbFacetInstallConfigFactory
- implements IActionConfigFactory {
-
- public Object create() throws CoreException {
- return new JaxbFacetInstallConfig();
- }
-}
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.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallDataModelProperties.java
index 98ae9b5765..a1c426ccf2 100644
--- 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.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallDataModelProperties.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -7,7 +7,7 @@
* Contributors:
* Oracle - initial API and implementation
*******************************************************************************/
-package org.eclipse.jpt.jaxb.ui.internal.wizards.facet.model;
+package org.eclipse.jpt.jaxb.core.internal.facet;
public interface JaxbFacetInstallDataModelProperties
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallConfig.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallDataModelProvider.java
index 9f59aeca9e..40e26c3349 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallConfig.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallDataModelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -10,10 +10,11 @@
package org.eclipse.jpt.jaxb.core.internal.facet;
-public class JaxbFacetInstallConfig
- extends JaxbFacetConfig {
+public class JaxbFacetInstallDataModelProvider
+ extends JaxbFacetDataModelProvider
+ implements JaxbFacetInstallDataModelProperties {
- public JaxbFacetInstallConfig() {
+ public JaxbFacetInstallDataModelProvider() {
super();
}
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeConfig.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeConfig.java
deleted file mode 100644
index 23a6610355..0000000000
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeConfig.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.jaxb.core.internal.facet;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jpt.jaxb.core.internal.JptJaxbCoreMessages;
-
-
-public class JaxbFacetVersionChangeConfig
- extends JaxbFacetConfig {
-
- public JaxbFacetVersionChangeConfig() {
- super();
- }
-
-
- // **************** validation ********************************************
-
- @Override
- protected IStatus validatePlatform() {
- IStatus status = super.validatePlatform();
-
- if (status.isOK()) {
- if (! getPlatform().supportsJaxbFacetVersion(getProjectFacetVersion())) {
- status = buildErrorStatus(JptJaxbCoreMessages.JaxbFacetConfig_validatePlatformDoesNotSupportFacetVersion);
- }
- }
-
- return status;
- }
-}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeConfigFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeConfigFactory.java
deleted file mode 100644
index a11fce67fa..0000000000
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeConfigFactory.java
+++ /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
- *******************************************************************************/
-package org.eclipse.jpt.jaxb.core.internal.facet;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.common.project.facet.core.IActionConfigFactory;
-
-public class JaxbFacetVersionChangeConfigFactory
- implements IActionConfigFactory {
-
- public Object create() throws CoreException {
- return new JaxbFacetVersionChangeConfig();
- }
-}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetVersionChangeDataModelProperties.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeDataModelProperties.java
index 60e7749baa..d9c5b2a932 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetVersionChangeDataModelProperties.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeDataModelProperties.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -7,7 +7,7 @@
* Contributors:
* Oracle - initial API and implementation
*******************************************************************************/
-package org.eclipse.jpt.jaxb.ui.internal.wizards.facet.model;
+package org.eclipse.jpt.jaxb.core.internal.facet;
public interface JaxbFacetVersionChangeDataModelProperties
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetVersionChangeDataModelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeDataModelProvider.java
index 393fb8ca46..d5772b50e8 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetVersionChangeDataModelProvider.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeDataModelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -7,11 +7,12 @@
* Contributors:
* Oracle - initial API and implementation
*******************************************************************************/
-package org.eclipse.jpt.jaxb.ui.internal.wizards.facet.model;
+package org.eclipse.jpt.jaxb.core.internal.facet;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetVersionChangeConfig;
+import org.eclipse.jpt.jaxb.core.internal.JptJaxbCoreMessages;
import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
public class JaxbFacetVersionChangeDataModelProvider
@@ -19,11 +20,7 @@ public class JaxbFacetVersionChangeDataModelProvider
implements JaxbFacetVersionChangeDataModelProperties {
public JaxbFacetVersionChangeDataModelProvider() {
- this(new JaxbFacetVersionChangeConfig());
- }
-
- public JaxbFacetVersionChangeDataModelProvider(JaxbFacetVersionChangeConfig config) {
- super(config);
+ super();
}
@@ -36,4 +33,17 @@ public class JaxbFacetVersionChangeDataModelProvider
}
return validPlatformDescs;
}
+
+ @Override
+ protected IStatus validatePlatform() {
+ IStatus status = super.validatePlatform();
+
+ if (status.isOK()) {
+ if (! getPlatform().supportsJaxbFacetVersion(getProjectFacetVersion())) {
+ status = buildErrorStatus(JptJaxbCoreMessages.JaxbFacetConfig_validatePlatformDoesNotSupportFacetVersion);
+ }
+ }
+
+ return status;
+ }
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbJreLibraryProviderInstallOperationConfig.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbJreLibraryProviderInstallOperationConfig.java
new file mode 100644
index 0000000000..87d08f80ca
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbJreLibraryProviderInstallOperationConfig.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.libprov;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.libval.LibraryValidator;
+import org.eclipse.jpt.jaxb.core.libprov.JaxbLibraryProviderInstallOperationConfig;
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
+import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderInstallOperationConfig;
+
+
+public class JaxbJreLibraryProviderInstallOperationConfig
+ extends LibraryProviderInstallOperationConfig
+ implements JaxbLibraryProviderInstallOperationConfig {
+
+ private JaxbPlatformDescription jaxbPlatform;
+
+
+ public JaxbJreLibraryProviderInstallOperationConfig() {
+ super();
+ }
+
+
+ public JaxbPlatformDescription getJaxbPlatform() {
+ return this.jaxbPlatform;
+ }
+
+ public void setJaxbPlatform(JaxbPlatformDescription jaxbPlatform) {
+ JaxbPlatformDescription old = this.jaxbPlatform;
+ this.jaxbPlatform = jaxbPlatform;
+ if (old != jaxbPlatform) {
+ notifyListeners(PROP_JAXB_PLATFORM, old, jaxbPlatform);
+ }
+ }
+
+ @Override
+ public synchronized IStatus validate() {
+ IStatus status = super.validate();
+ if (! status.isOK()) {
+ return status;
+ }
+
+ for (LibraryValidator libraryValidator : JptCommonCorePlugin.getLibraryValidators(this)) {
+ status = libraryValidator.validate(this);
+ if (! status.isOK()) {
+ return status;
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java
new file mode 100644
index 0000000000..4ec0fc3238
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.libval;
+
+
+public class GenericEclipseLinkBundlesLibraryValidator
+// extends AbstractOsgiBundlesLibraryValidator
+ {
+
+// public IStatus validate(JptLibraryProviderInstallOperationConfig config) {
+// JpaOsgiBundlesLibraryProviderInstallOperationConfig jpaConfig
+// = (JpaOsgiBundlesLibraryProviderInstallOperationConfig) config;
+// Map<String, VersionRange[]> bundleVersionRanges = new HashMap<String, VersionRange[]>();
+// String bundleName = "javax.persistence"; //$NON-NLS-1$
+// VersionRange[] versionRanges = new VersionRange[0];
+// if (config.getProjectFacetVersion().equals(JpaFacet.VERSION_1_0)) {
+// versionRanges = new VersionRange[] {new VersionRange("[1.0, 3.0)")}; //$NON-NLS-1$
+// }
+// else if (config.getProjectFacetVersion().equals(JpaFacet.VERSION_2_0)) {
+// versionRanges = new VersionRange[] {new VersionRange("[2.0, 3.0)")}; //$NON-NLS-1$
+// }
+// bundleVersionRanges.put(bundleName, versionRanges);
+// return validate(jpaConfig, bundleVersionRanges);
+// }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/GenericJaxbUserLibraryValidator.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/GenericJaxbUserLibraryValidator.java
new file mode 100644
index 0000000000..762a8c98e6
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/GenericJaxbUserLibraryValidator.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.libval;
+
+import java.util.HashSet;
+import java.util.Set;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jpt.common.core.internal.libval.LibValUtil;
+import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig;
+import org.eclipse.jpt.common.core.libval.LibraryValidator;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.jaxb.core.JaxbFacet;
+import org.eclipse.jpt.jaxb.core.internal.libprov.JaxbUserLibraryProviderInstallOperationConfig;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+public class GenericJaxbUserLibraryValidator
+ implements LibraryValidator {
+
+ public synchronized IStatus validate(JptLibraryProviderInstallOperationConfig config) {
+
+ JaxbUserLibraryProviderInstallOperationConfig jaxbConfig
+ = (JaxbUserLibraryProviderInstallOperationConfig) config;
+
+ IProjectFacetVersion jreJaxbVersion = JaxbLibValUtil.findJreJaxbVersion(jaxbConfig);
+ IProjectFacetVersion jaxbVersion = config.getProjectFacetVersion();
+
+ Set<String> classNames = new HashSet<String>();
+
+ if (jreJaxbVersion == null) {
+ classNames.add("javax.xml.bind.annotation.XmlSeeAlso"); //$NON-NLS-1$
+ }
+ if (jaxbVersion.compareTo(JaxbFacet.VERSION_2_2) >= 0
+ && (jreJaxbVersion == null || jreJaxbVersion.compareTo(JaxbFacet.VERSION_2_2) < 0)) {
+ classNames.add("javax.xml.bind.JAXBPermission"); //$NON-NLS-1$
+ }
+
+ Iterable<IPath> libraryPaths =
+ new TransformationIterable<IClasspathEntry, IPath>(jaxbConfig.resolve()) {
+ @Override
+ protected IPath transform(IClasspathEntry o) {
+ return o.getPath();
+ }
+ };
+
+ return LibValUtil.validate(libraryPaths, classNames);
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/JaxbJreLibraryValidator.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/JaxbJreLibraryValidator.java
new file mode 100644
index 0000000000..462dd9ac4e
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/JaxbJreLibraryValidator.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.libval;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig;
+import org.eclipse.jpt.common.core.libval.LibraryValidator;
+import org.eclipse.jpt.jaxb.core.GenericJaxbPlatform;
+import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
+import org.eclipse.jpt.jaxb.core.internal.JptJaxbCoreMessages;
+import org.eclipse.jpt.jaxb.core.libprov.JaxbLibraryProviderInstallOperationConfig;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+
+public class JaxbJreLibraryValidator
+ implements LibraryValidator {
+
+ public IStatus validate(JptLibraryProviderInstallOperationConfig config) {
+
+ JaxbLibraryProviderInstallOperationConfig jaxbConfig
+ = (JaxbLibraryProviderInstallOperationConfig) config;
+
+ if (! jaxbConfig.getJaxbPlatform().getGroup().equals(GenericJaxbPlatform.GROUP)) {
+ return new Status(IStatus.ERROR, JptJaxbCorePlugin.PLUGIN_ID, JptJaxbCoreMessages.JreLibraryValidator_invalidPlatform);
+ }
+
+ IProjectFacetVersion jreJaxbVersion = JaxbLibValUtil.findJreJaxbVersion(jaxbConfig);
+ IProjectFacetVersion jaxbVersion = config.getProjectFacetVersion();
+
+ if (jreJaxbVersion == null || jreJaxbVersion.compareTo(jaxbVersion) < 0) {
+ return new Status(IStatus.ERROR, JptJaxbCorePlugin.PLUGIN_ID, JptJaxbCoreMessages.JreLibraryValidator_invalidJreJaxbVersion);
+ }
+
+ return Status.OK_STATUS;
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/JaxbLibValUtil.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/JaxbLibValUtil.java
new file mode 100644
index 0000000000..8d3a913fd9
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/JaxbLibValUtil.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jaxb.core.internal.libval;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.zip.ZipFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.IVMInstall2;
+import org.eclipse.jdt.launching.IVMInstallType;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jdt.launching.LibraryLocation;
+import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.jaxb.core.JaxbFacet;
+import org.eclipse.jpt.jaxb.core.libprov.JaxbLibraryProviderInstallOperationConfig;
+import org.eclipse.jst.common.project.facet.core.StandardJreRuntimeComponent;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent;
+
+
+public class JaxbLibValUtil {
+
+ static IProjectFacetVersion findJreJaxbVersion(JaxbLibraryProviderInstallOperationConfig config) {
+ IRuntime runtime = config.getFacetedProject().getPrimaryRuntime();
+
+ if (runtime != null) {
+ for (IRuntimeComponent rc : runtime.getRuntimeComponents()) {
+ IVMInstall vm = findVMInstall(rc);
+ if (vm != null) {
+ return findJreJaxbVersion(vm);
+ }
+ }
+ }
+
+ IVMInstall vm = JavaRuntime.getDefaultVMInstall();
+ if (vm != null) {
+ return findJreJaxbVersion(vm);
+ }
+
+ return null;
+ }
+
+ private static IVMInstall findVMInstall(IRuntimeComponent rc) {
+ String vmInstallTypeId
+ = rc.getProperty(StandardJreRuntimeComponent.PROP_VM_INSTALL_TYPE);
+ String vmInstallId
+ = rc.getProperty(StandardJreRuntimeComponent.PROP_VM_INSTALL_ID);
+
+ if (vmInstallTypeId == null || vmInstallId == null) {
+ return null;
+ }
+
+ IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(vmInstallTypeId);
+
+ if( vmInstallType == null ) {
+ return null;
+ }
+
+ return vmInstallType.findVMInstall(vmInstallId);
+ }
+
+ private static IProjectFacetVersion findJreJaxbVersion(IVMInstall vm) {
+ if (vm instanceof IVMInstall2) {
+ String javaVersion = ((IVMInstall2) vm).getJavaVersion();
+ if (javaVersion != null) {
+ if (javaVersion.startsWith(JavaCore.VERSION_1_7)) {
+ return JaxbFacet.VERSION_2_2;
+ }
+ // all other versions except 1.6 have no corresponding version (as of yet)
+ // 1.6 must be further analyzed
+ if (! javaVersion.startsWith(JavaCore.VERSION_1_6)) {
+ return null;
+ }
+ }
+ }
+
+ Iterable<IPath> vmLibPaths
+ = new TransformationIterable<LibraryLocation, IPath>(
+ new ArrayIterable<LibraryLocation>(JavaRuntime.getLibraryLocations(vm))) {
+ @Override
+ protected IPath transform(LibraryLocation o) {
+ return o.getSystemLibraryPath();
+ }
+ };
+
+ boolean foundXmlSeeAlso = false; // marker for jaxb 2.1 +
+ boolean foundJAXBPermission = false; // marker for jaxb 2.2 +
+
+ for (IPath vmLibPath : vmLibPaths) {
+ File file = vmLibPath.toFile();
+
+ if (file.exists()) {
+ ZipFile zip = null;
+
+ try {
+ zip = new ZipFile(file);
+
+ foundXmlSeeAlso |= zip.getEntry("javax/xml/bind/annotation/XmlSeeAlso.class") != null;
+ foundJAXBPermission |= zip.getEntry("javax/xml/bind/JAXBPermission.class") != null;
+
+ // short circuit for JAXB 2.2
+ if (foundJAXBPermission) {
+ return JaxbFacet.VERSION_2_2;
+ }
+ }
+ catch (IOException e) {}
+ finally {
+ if (zip != null) {
+ try {
+ zip.close();
+ }
+ catch (IOException e) {}
+ }
+ }
+ }
+ }
+
+ if (foundXmlSeeAlso) {
+ return JaxbFacet.VERSION_2_1;
+ }
+
+ return null;
+ }
+}
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
index f916cc351b..af73ce27df 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF
@@ -11,12 +11,12 @@ 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.jface.text;bundle-version="[3.7.0,4.0.0)",
org.eclipse.jdt.ui;bundle-version="[3.4.0,4.0.0)",
+ org.eclipse.jface.text;bundle-version="[3.7.0,4.0.0)",
org.eclipse.jpt.common.core;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.jpt.jaxb.core;bundle-version="[1.0.0,2.0.0)",
org.eclipse.jpt.common.ui;bundle-version="[1.0.0,2.0.0)",
org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.jpt.jaxb.core;bundle-version="[1.0.0,2.0.0)",
org.eclipse.jst.common.project.facet.core;bundle-version="[1.4.200,2.0.0)",
org.eclipse.jst.common.project.facet.ui;bundle-version="[1.4.200,2.0.0)",
org.eclipse.ui.ide;bundle-version="[3.4.0,4.0.0)",
@@ -42,7 +42,6 @@ Export-Package: org.eclipse.jpt.jaxb.ui,
org.eclipse.jpt.jaxb.ui.internal.wizards;x-internal:=true,
org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen;x-internal:=true,
org.eclipse.jpt.jaxb.ui.internal.wizards.facet;x-internal:=true,
- org.eclipse.jpt.jaxb.ui.internal.wizards.facet.model;x-internal:=true,
org.eclipse.jpt.jaxb.ui.internal.wizards.proj;x-internal:=true,
org.eclipse.jpt.jaxb.ui.internal.wizards.proj.model;x-internal:=true,
org.eclipse.jpt.jaxb.ui.internal.wizards.schemagen;x-internal:=true,
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.xml b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.xml
index 17c79c91aa..01e1c1522f 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.xml
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.xml
@@ -17,24 +17,6 @@
schema="schema/jaxbPlatformUis.exsd"/>
- <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>
-
- <factory
- class="org.eclipse.jpt.jaxb.ui.internal.wizards.facet.model.JaxbFacetVersionChangeConfigToDataModelAdapterFactory"
- adaptableType="org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetVersionChangeConfig">
- <adapter type="org.eclipse.wst.common.frameworks.datamodel.IDataModel"/>
- </factory>
-
- </extension>
-
-
<extension
point="org.eclipse.ui.newWizards">
@@ -120,6 +102,16 @@
<extension
+ point="org.eclipse.jst.common.project.facet.ui.libraryProviderActionPanels">
+
+ <panel
+ provider="jaxb-jre-library-provider"
+ class="org.eclipse.jst.common.project.facet.ui.libprov.SimpleMessageLibraryProviderInstallPanel"/>
+
+ </extension>
+
+
+ <extension
point="org.eclipse.ui.navigator.navigatorContent">
<navigatorContent
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
index dbae27a4fa..23526b7272 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -9,7 +9,7 @@
*******************************************************************************/
package org.eclipse.jpt.jaxb.ui.internal.wizards.facet;
-import org.eclipse.jpt.jaxb.ui.internal.wizards.facet.model.JaxbFacetInstallDataModelProperties;
+import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetInstallDataModelProperties;
public class JaxbFacetInstallPage
extends JaxbFacetPage
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetPage.java
index 99d5dcdb17..861dae7f92 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetPage.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -12,10 +12,10 @@ package org.eclipse.jpt.jaxb.ui.internal.wizards.facet;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetDataModelProperties;
import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons;
import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages;
-import org.eclipse.jpt.jaxb.ui.internal.wizards.facet.model.JaxbFacetDataModelProperties;
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;
@@ -125,6 +125,18 @@ public abstract class JaxbFacetPage
}
}
+ @Override
+ public void transferStateToConfig() {
+ // This method is called when "finish" is being performed.
+ // We remove "this" as a listener so that it will stop responding to data model changes.
+ // "This" listens only for validation purposes, and we are done with validation at this
+ // point. Furthermore, any validation at this point runs into the danger of deadlocking
+ // the wizard.
+ this.model.removeListener(this);
+ this.synchHelper.dispose();
+ super.transferStateToConfig();
+ }
+
protected final IWorkbenchHelpSystem getHelpSystem() {
return PlatformUI.getWorkbench().getHelpSystem();
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetVersionChangePage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetVersionChangePage.java
index 4f11932622..26e1e43b0a 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetVersionChangePage.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetVersionChangePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -9,7 +9,7 @@
*******************************************************************************/
package org.eclipse.jpt.jaxb.ui.internal.wizards.facet;
-import org.eclipse.jpt.jaxb.ui.internal.wizards.facet.model.JaxbFacetVersionChangeDataModelProperties;
+import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetVersionChangeDataModelProperties;
public class JaxbFacetVersionChangePage
extends JaxbFacetPage
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/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 750f80f586..0000000000
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetInstallDataModelProvider.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.jpt.jaxb.core.internal.facet.JaxbFacetInstallConfig;
-
-public class JaxbFacetInstallDataModelProvider
- extends JaxbFacetDataModelProvider
- implements JaxbFacetInstallDataModelProperties {
-
- public JaxbFacetInstallDataModelProvider() {
- this(new JaxbFacetInstallConfig());
- }
-
- public JaxbFacetInstallDataModelProvider(JaxbFacetInstallConfig config) {
- super(config);
- }
-}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetVersionChangeConfigToDataModelAdapterFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetVersionChangeConfigToDataModelAdapterFactory.java
deleted file mode 100644
index dc74680868..0000000000
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/model/JaxbFacetVersionChangeConfigToDataModelAdapterFactory.java
+++ /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
- *******************************************************************************/
-package org.eclipse.jpt.jaxb.ui.internal.wizards.facet.model;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetVersionChangeConfig;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-
-public class JaxbFacetVersionChangeConfigToDataModelAdapterFactory
- 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) {
- JaxbFacetVersionChangeDataModelProvider provider
- = new JaxbFacetVersionChangeDataModelProvider((JaxbFacetVersionChangeConfig) adaptableObj);
- return DataModelFactory.createDataModel( provider );
- }
-
- return null;
- }
-}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/META-INF/MANIFEST.MF b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/META-INF/MANIFEST.MF
index a6db6cb887..d39856f57c 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/META-INF/MANIFEST.MF
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/META-INF/MANIFEST.MF
@@ -17,6 +17,7 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="[3.6.100,4.0.0)",
org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)",
org.eclipse.jst.common.project.facet.core;bundle-version="[1.4.200,2.0.0)",
org.eclipse.wst.common.frameworks;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.core;bundle-version="[1.4.200,2.0.0)",
org.eclipse.xsd;bundle-version="[2.6.0,3.0.0)",
org.junit;bundle-version="3.8.0"
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbTestCase.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbTestCase.java
index fe41c7f071..f3a3c728d2 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbTestCase.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -14,9 +14,13 @@ import org.eclipse.jpt.common.core.tests.internal.utility.jdt.AnnotationTestCase
import org.eclipse.jpt.jaxb.core.JaxbFacet;
import org.eclipse.jpt.jaxb.core.JaxbProject;
import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
-import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetInstallConfig;
+import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetDataModelProperties;
+import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetInstallDataModelProvider;
import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
import org.eclipse.jpt.jaxb.core.tests.internal.projects.TestJaxbProject;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
@@ -36,15 +40,15 @@ public class JaxbTestCase
}
protected TestJaxbProject buildJaxbProject(
- String projectName, boolean autoBuild, JaxbFacetInstallConfig jaxbConfig)
+ String projectName, boolean autoBuild, IDataModel jaxbConfig)
throws Exception {
return TestJaxbProject.buildJaxbProject(projectName, autoBuild, jaxbConfig);
}
- protected JaxbFacetInstallConfig buildJaxbFacetInstallConfig() {
- JaxbFacetInstallConfig config = new JaxbFacetInstallConfig();
- config.setProjectFacetVersion(getProjectFacetVersion());
- config.setPlatform(getPlatform());
+ protected IDataModel buildJaxbFacetInstallConfig() {
+ IDataModel config = DataModelFactory.createDataModel(new JaxbFacetInstallDataModelProvider());
+ config.setProperty(IFacetDataModelProperties.FACET_VERSION, getProjectFacetVersion());
+ config.setProperty(JaxbFacetDataModelProperties.PLATFORM, getPlatform());
return config;
}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/projects/TestJaxbProject.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/projects/TestJaxbProject.java
index c8465ef41f..b759240164 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/projects/TestJaxbProject.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/projects/TestJaxbProject.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -14,7 +14,9 @@ import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject;
import org.eclipse.jpt.jaxb.core.JaxbFacet;
import org.eclipse.jpt.jaxb.core.JaxbProject;
import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
-import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetInstallConfig;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
/**
* This builds and holds a "JAXB" project.
@@ -23,41 +25,44 @@ import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetInstallConfig;
* The JPA project's settings (platform, database connection, etc.) can be
* controlled by building a data model and passing it into the constructor.
*/
-public class TestJaxbProject extends TestJavaProject {
+public class TestJaxbProject
+ extends TestJavaProject {
+
private final JaxbProject jaxbProject;
-
-
+
+
// ********** builders **********
-
- public static TestJaxbProject buildJaxbProject(String baseProjectName, boolean autoBuild, JaxbFacetInstallConfig config)
+
+ public static TestJaxbProject buildJaxbProject(
+ String baseProjectName, boolean autoBuild, IDataModel config)
throws CoreException {
return new TestJaxbProject(baseProjectName, autoBuild, config);
}
-
+
+
// ********** constructors/initialization **********
-
+
public TestJaxbProject(String projectName) throws CoreException {
this(projectName, false);
}
-
+
public TestJaxbProject(String projectName, boolean autoBuild) throws CoreException {
this(projectName, autoBuild, null);
}
-
- public TestJaxbProject(String projectName, boolean autoBuild, JaxbFacetInstallConfig config) throws CoreException {
+
+ public TestJaxbProject(String projectName, boolean autoBuild, IDataModel config) throws CoreException {
super(projectName, autoBuild);
- String jaxbFacetVersion = config.getProjectFacetVersion().getVersionString();
+ String jaxbFacetVersion =
+ ((IProjectFacetVersion) config.getProperty(IFacetDataModelProperties.FACET_VERSION)).getVersionString();
this.installFacet(JaxbFacet.ID, jaxbFacetVersion, config);
this.jaxbProject = JptJaxbCorePlugin.getJaxbProject(this.getProject());
// this.jaxbProject.setUpdater(new SynchronousJpaProjectUpdater(this.jaxbProject));
}
-
-
-
+
+
// ********** public methods **********
-
+
public JaxbProject getJaxbProject() {
return this.jaxbProject;
}
-
}

Back to the top