summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Fullbright2013-05-23 18:12:47 (EDT)
committerNeil Hauge2013-05-23 18:14:27 (EDT)
commit48cfd417c0803315180ab010cebdf4ebd6a8cdb1 (patch)
tree5bbe06bf2fe4a5b62ec236e3b7ae61b12b3ba881
parent8e5d53b1a11d64be6ee65d2a564c8d7800dc8650 (diff)
downloadwebtools.dali-48cfd417c0803315180ab010cebdf4ebd6a8cdb1.zip
webtools.dali-48cfd417c0803315180ab010cebdf4ebd6a8cdb1.tar.gz
webtools.dali-48cfd417c0803315180ab010cebdf4ebd6a8cdb1.tar.bz2
406238 - Add new JPA preset configurations to allow default Add to EARv201305240436
behavior.
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/plugin.xml17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpt_jpa_core.properties6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JptJpaCoreMessages.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/BasicJpaEEConfigurationPresetFactory.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/BasicJpaSEConfigurationPresetFactory.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/DefaultJpaConfigurationPresetFactory.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/JpaProjectWizard.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/model/JpaProjectCreationDataModelProvider.java33
8 files changed, 330 insertions, 13 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/plugin.xml b/jpa/plugins/org.eclipse.jpt.jpa.core/plugin.xml
index bc5403f..6a9f66e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/plugin.xml
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/plugin.xml
@@ -599,9 +599,6 @@
<label>%JPA_TEMPLATE_LABEL</label>
<fixed facet="jpt.jpa"/>
<fixed facet="java"/>
- <!--
- <preset id="jpt.jpa.2_0.preset"/>
- -->
</template>
<action facet="jpt.jpa" type="install" id="jpt.jpa.install">
@@ -632,6 +629,20 @@
<extension
+ point="org.eclipse.wst.common.project.facet.core.presets">
+
+ <dynamic-preset id="basic.jpa.se.configuration">
+ <factory class="org.eclipse.jpt.jpa.core.internal.facet.BasicJpaSEConfigurationPresetFactory"/>
+ </dynamic-preset>
+
+ <dynamic-preset id="basic.jpa.ee.configuration">
+ <factory class="org.eclipse.jpt.jpa.core.internal.facet.BasicJpaEEConfigurationPresetFactory"/>
+ </dynamic-preset>
+
+ </extension>
+
+
+ <extension
point="org.eclipse.wst.common.project.facet.core.runtimes">
<supported>
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpt_jpa_core.properties b/jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpt_jpa_core.properties
index c4cd386..e329787 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpt_jpa_core.properties
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpt_jpa_core.properties
@@ -59,3 +59,9 @@ MAKE_PERSISTENT_PROCESSING_JAVA_CLASSES=Processing Java classes...
MAKE_PERSISTENT_ANNOTATING_CLASS=Annotating: {0}
MAKE_PERSISTENT_LISTING_IN_PERSISTENCE_XML=Listing in persistence.xml...
MAKE_PERSISTENT_ADD_TO_PERSISTENCE_XML_RESOURCE_MODEL=Adding to XML resource model
+
+BASIC_JPA_SE_PRESET_CONFIG__LABEL=Basic JPA Configuration
+BASIC_JPA_SE_PRESET_CONFIG__DESC=A general starting point for a JPA application.
+BASIC_JPA_EE_PRESET_CONFIG__LABEL=Basic JPA EE Configuration
+BASIC_JPA_EE_PRESET_CONFIG__DESC=A general starting point for a JPA application intended to be used as part of a Java EE deployment.
+
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JptJpaCoreMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JptJpaCoreMessages.java
index 1b9915c..5ca6629 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JptJpaCoreMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JptJpaCoreMessages.java
@@ -71,6 +71,12 @@ public class JptJpaCoreMessages {
public static String MAKE_PERSISTENT_ANNOTATING_CLASS;
public static String MAKE_PERSISTENT_ADD_TO_PERSISTENCE_XML_RESOURCE_MODEL;
public static String MAKE_PERSISTENT_LISTING_IN_PERSISTENCE_XML;
+
+ public static String BASIC_JPA_SE_PRESET_CONFIG__LABEL;
+ public static String BASIC_JPA_SE_PRESET_CONFIG__DESC;
+ public static String BASIC_JPA_EE_PRESET_CONFIG__LABEL;
+ public static String BASIC_JPA_EE_PRESET_CONFIG__DESC;
+
private JptJpaCoreMessages() {
throw new UnsupportedOperationException();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/BasicJpaEEConfigurationPresetFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/BasicJpaEEConfigurationPresetFactory.java
new file mode 100644
index 0000000..e925241
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/BasicJpaEEConfigurationPresetFactory.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.jpa.core.internal.facet;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JptJpaCoreMessages;
+import org.eclipse.jst.common.project.facet.core.JavaFacet;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.wst.common.project.facet.core.IDynamicPreset;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectBase;
+import org.eclipse.wst.common.project.facet.core.IPresetFactory;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.PresetDefinition;
+import org.eclipse.wst.common.project.facet.core.internal.DefaultFacetsExtensionPoint;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+
+public class BasicJpaEEConfigurationPresetFactory
+ implements IPresetFactory {
+
+ public static final String PRESET_ID = "basic.jpa.ee.configuration"; //$NON-NLS-1$
+
+ public PresetDefinition createPreset(String presetId, Map<String,Object> context)
+ throws CoreException {
+
+ IFacetedProjectBase fproj
+ = (IFacetedProjectBase) context.get(IDynamicPreset.CONTEXT_KEY_FACETED_PROJECT);
+
+ IRuntime runtime = fproj.getPrimaryRuntime();
+
+ String label = JptJpaCoreMessages.BASIC_JPA_EE_PRESET_CONFIG__LABEL;
+ String description = JptJpaCoreMessages.BASIC_JPA_EE_PRESET_CONFIG__DESC;
+
+ Set<IProjectFacetVersion> facets = new HashSet();
+ Set<IProjectFacetVersion> defaultFacets = DefaultFacetsExtensionPoint.getDefaultFacets(fproj);
+ Set<IProjectFacet> defaultJpaFacets = new HashSet();
+ defaultJpaFacets.add(JavaFacet.FACET);
+ defaultJpaFacets.add(JpaProject.FACET);
+ defaultJpaFacets.add(IJ2EEFacetConstants.UTILITY_FACET);
+
+ for (IProjectFacet pf : defaultJpaFacets) {
+ facets.add(findProjectFacetVersion(defaultFacets, pf, runtime));
+ }
+
+ return new PresetDefinition(label, description, facets);
+ }
+
+
+ private static IProjectFacetVersion findProjectFacetVersion(
+ Set<IProjectFacetVersion> facets, IProjectFacet facet, IRuntime runtime) {
+
+ for (IProjectFacetVersion fv : facets) {
+ if (fv.getProjectFacet() == facet) {
+ return fv;
+ }
+ }
+
+ IProjectFacetVersion defaultPFVersion = facet.getDefaultVersion();
+ if (runtime != null) {
+ try {
+ IProjectFacetVersion pfv = facet.getLatestSupportedVersion(runtime);
+ if (pfv != null) {
+ return pfv;
+ }
+ }
+ catch (CoreException ce) {
+ // fall through, return default
+ }
+ }
+
+ return defaultPFVersion;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/BasicJpaSEConfigurationPresetFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/BasicJpaSEConfigurationPresetFactory.java
new file mode 100644
index 0000000..d33ddc2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/BasicJpaSEConfigurationPresetFactory.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.jpa.core.internal.facet;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JptJpaCoreMessages;
+import org.eclipse.jst.common.project.facet.core.JavaFacet;
+import org.eclipse.wst.common.project.facet.core.IDynamicPreset;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectBase;
+import org.eclipse.wst.common.project.facet.core.IPresetFactory;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.PresetDefinition;
+import org.eclipse.wst.common.project.facet.core.internal.DefaultFacetsExtensionPoint;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+
+public class BasicJpaSEConfigurationPresetFactory
+ implements IPresetFactory {
+
+ public static final String PRESET_ID = "basic.jpa.se.configuration"; //$NON-NLS-1$
+
+ public PresetDefinition createPreset(String presetId, Map<String,Object> context)
+ throws CoreException {
+
+ IFacetedProjectBase fproj
+ = (IFacetedProjectBase) context.get(IDynamicPreset.CONTEXT_KEY_FACETED_PROJECT);
+
+ IRuntime runtime = fproj.getPrimaryRuntime();
+
+ String label = JptJpaCoreMessages.BASIC_JPA_SE_PRESET_CONFIG__LABEL;
+ String description = JptJpaCoreMessages.BASIC_JPA_SE_PRESET_CONFIG__DESC;
+
+ Set<IProjectFacetVersion> facets = new HashSet();
+ Set<IProjectFacetVersion> defaultFacets = DefaultFacetsExtensionPoint.getDefaultFacets(fproj);
+ Set<IProjectFacet> defaultJpaFacets = new HashSet();
+ defaultJpaFacets.add(JavaFacet.FACET);
+ defaultJpaFacets.add(JpaProject.FACET);
+
+ for (IProjectFacet pf : defaultJpaFacets) {
+ facets.add(findProjectFacetVersion(defaultFacets, pf, runtime));
+ }
+
+ return new PresetDefinition(label, description, facets);
+ }
+
+
+ private static IProjectFacetVersion findProjectFacetVersion(
+ Set<IProjectFacetVersion> facets, IProjectFacet facet, IRuntime runtime) {
+
+ for (IProjectFacetVersion fv : facets) {
+ if (fv.getProjectFacet() == facet) {
+ return fv;
+ }
+ }
+
+ IProjectFacetVersion defaultPFVersion = facet.getDefaultVersion();
+ if (runtime != null) {
+ try {
+ IProjectFacetVersion pfv = facet.getLatestSupportedVersion(runtime);
+ if (pfv != null) {
+ return pfv;
+ }
+ }
+ catch (CoreException ce) {
+ // fall through, return default
+ }
+ }
+
+ return defaultPFVersion;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/DefaultJpaConfigurationPresetFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/DefaultJpaConfigurationPresetFactory.java
new file mode 100644
index 0000000..86f2443
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/DefaultJpaConfigurationPresetFactory.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.jpa.core.internal.facet;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jst.common.project.facet.core.JavaFacet;
+import org.eclipse.jst.j2ee.internal.plugin.JavaEEPreferencesInitializer;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.wst.common.project.facet.core.IDynamicPreset;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectBase;
+import org.eclipse.wst.common.project.facet.core.IPresetFactory;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.PresetDefinition;
+import org.eclipse.wst.common.project.facet.core.internal.DefaultFacetsExtensionPoint;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+
+public class DefaultJpaConfigurationPresetFactory
+ implements IPresetFactory {
+
+ public static final String PRESET_ID = "default.jpa.configuration"; //$NON-NLS-1$
+
+ public PresetDefinition createPreset(String presetId, Map<String,Object> context)
+ throws CoreException {
+
+ IFacetedProjectBase fproj
+ = (IFacetedProjectBase) context.get(IDynamicPreset.CONTEXT_KEY_FACETED_PROJECT);
+
+ IRuntime runtime = fproj.getPrimaryRuntime();
+
+ String label = "Default JPA Configuration";
+ String description = "A good starting point for JPA development. Additional facets may later be installed to add new functionality to the project.";
+
+ Set<IProjectFacetVersion> facets = new HashSet();
+ Set<IProjectFacetVersion> defaultFacets = DefaultFacetsExtensionPoint.getDefaultFacets(fproj);
+ Set<IProjectFacet> defaultJpaFacets = new HashSet();
+ defaultJpaFacets.add(JavaFacet.FACET);
+ defaultJpaFacets.add(JpaProject.FACET);
+ if (JavaEEPreferencesInitializer.getDefaultBoolean(JavaEEPreferencesInitializer.Keys.ADD_TO_EAR_BY_DEFAULT)) {
+ defaultJpaFacets.add(IJ2EEFacetConstants.UTILITY_FACET);
+ }
+
+ for (IProjectFacet pf : defaultJpaFacets) {
+ facets.add(findProjectFacetVersion(defaultFacets, pf, runtime));
+ }
+
+ return new PresetDefinition(label, description, facets);
+ }
+
+
+ private static IProjectFacetVersion findProjectFacetVersion(
+ Set<IProjectFacetVersion> facets, IProjectFacet facet, IRuntime runtime) {
+
+ for (IProjectFacetVersion fv : facets) {
+ if (fv.getProjectFacet() == facet) {
+ return fv;
+ }
+ }
+
+ IProjectFacetVersion defaultPFVersion = facet.getDefaultVersion();
+ if (runtime != null) {
+ try {
+ IProjectFacetVersion pfv = facet.getLatestSupportedVersion(runtime);
+ if (pfv != null) {
+ return pfv;
+ }
+ }
+ catch (CoreException ce) {
+ // fall through, return default
+ }
+ }
+
+ return defaultPFVersion;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/JpaProjectWizard.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/JpaProjectWizard.java
index 7146c4a..1dfd3cf 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/JpaProjectWizard.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/JpaProjectWizard.java
@@ -9,16 +9,24 @@
******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.wizards.proj;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jpt.jpa.core.internal.facet.BasicJpaEEConfigurationPresetFactory;
+import org.eclipse.jpt.jpa.core.internal.facet.BasicJpaSEConfigurationPresetFactory;
import org.eclipse.jpt.jpa.ui.JptJpaUiImages;
import org.eclipse.jpt.jpa.ui.JptJpaUiMessages;
import org.eclipse.jpt.jpa.ui.internal.perspective.JpaPerspectiveFactory;
import org.eclipse.jpt.jpa.ui.internal.wizards.proj.model.JpaProjectCreationDataModelProvider;
+import org.eclipse.jst.j2ee.internal.plugin.JavaEEPreferencesInitializer;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.swt.widgets.Composite;
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.IFacetedProjectWorkingCopy;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
import org.eclipse.wst.web.ui.internal.wizards.NewProjectDataModelFacetWizard;
public class JpaProjectWizard
@@ -59,4 +67,25 @@ public class JpaProjectWizard
protected String getFinalPerspectiveID() {
return JpaPerspectiveFactory.ID;
}
+
+ @Override
+ public void createPageControls(Composite container) {
+ super.createPageControls(container);
+
+ IFacetedProjectWorkingCopy pfwc = getFacetedProjectWorkingCopy();
+ IRuntime runtime = pfwc.getPrimaryRuntime();
+ if (JavaEEPreferencesInitializer.getDefaultBoolean(JavaEEPreferencesInitializer.Keys.ADD_TO_EAR_BY_DEFAULT)) {
+ try {
+ if (runtime == null || IJ2EEFacetConstants.UTILITY_FACET.getLatestSupportedVersion(runtime) != null) {
+ pfwc.setSelectedPreset(BasicJpaEEConfigurationPresetFactory.PRESET_ID);
+ return;
+ }
+ }
+ catch (CoreException ce) {
+ // fall through
+ }
+ }
+
+ pfwc.setSelectedPreset(BasicJpaSEConfigurationPresetFactory.PRESET_ID);
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/model/JpaProjectCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/model/JpaProjectCreationDataModelProvider.java
index 4c0befa..c9566d5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/model/JpaProjectCreationDataModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/model/JpaProjectCreationDataModelProvider.java
@@ -53,7 +53,10 @@ public class JpaProjectCreationDataModelProvider
this.moduleFacetDataModelListener
= new IDataModelListener() {
public void propertyChanged(DataModelEvent event) {
- if (IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME.equals(event.getPropertyName())) {
+ if (IJ2EEModuleFacetInstallDataModelProperties.FACET_PROJECT_NAME.equals(event.getPropertyName())) {
+ model.notifyPropertyChange(EAR_PROJECT_NAME, IDataModel.DEFAULT_CHG);
+ }
+ else if (IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME.equals(event.getPropertyName())) {
if (isPropertySet(EAR_PROJECT_NAME)) {
setProperty(EAR_PROJECT_NAME, event.getProperty());
}
@@ -181,12 +184,18 @@ public class JpaProjectCreationDataModelProvider
@Override
public boolean propertySet(String propertyName, Object propertyValue) {
+ IDataModel moduleFacetDataModel = getModuleFacetDataModel();
+ if (moduleFacetDataModel != null && moduleFacetDataModel.getAllProperties().contains(propertyName)) {
+ moduleFacetDataModel.setProperty(propertyName, propertyValue);
+ }
+
if (EAR_PROJECT_NAME.equals(propertyName) || ADD_TO_EAR.equals(propertyName) || FACET_RUNTIME.equals(propertyName) || MODULE_FACET_DATA_MODEL.equals(propertyName)) {
- IDataModel moduleFacetDataModel = getModuleFacetDataModel();
if (moduleFacetDataModel != null){
if (EAR_PROJECT_NAME.equals(propertyName) || MODULE_FACET_DATA_MODEL.equals(propertyName)) {
- moduleFacetDataModel.setProperty(
- IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME, getEarProjectName());
+ if (this.model.isPropertySet(EAR_PROJECT_NAME)) {
+ moduleFacetDataModel.setProperty(
+ IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME, getEarProjectName());
+ }
}
if (ADD_TO_EAR.equals(propertyName) || MODULE_FACET_DATA_MODEL.equals(propertyName)) {
moduleFacetDataModel.setProperty(
@@ -302,12 +311,16 @@ public class JpaProjectCreationDataModelProvider
oldModuleFacetDataModel.removeListener(this.moduleFacetDataModelListener);
}
if (newModuleFacetDataModel != null) {
- newModuleFacetDataModel.setProperty(
- IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR,
- getProperty(ADD_TO_EAR));
- newModuleFacetDataModel.setProperty(
- IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME,
- getProperty(EAR_PROJECT_NAME));
+ if (this.model.isPropertySet(ADD_TO_EAR)) {
+ newModuleFacetDataModel.setProperty(
+ IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR,
+ getProperty(ADD_TO_EAR));
+ }
+ if (this.model.isPropertySet(EAR_PROJECT_NAME)) {
+ newModuleFacetDataModel.setProperty(
+ IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME,
+ getProperty(EAR_PROJECT_NAME));
+ }
newModuleFacetDataModel.addListener(this.moduleFacetDataModelListener);
}
else {