Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLink2_3PersistenceUnitMetadataComposite.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaVersionIsCompatibleWith.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/Jpa2_0FlagTransformer.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/JpaProjectPropertiesPage.java8
4 files changed, 56 insertions, 66 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLink2_3PersistenceUnitMetadataComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLink2_3PersistenceUnitMetadataComposite.java
index 126225bb04..6c07784e9d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLink2_3PersistenceUnitMetadataComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLink2_3PersistenceUnitMetadataComposite.java
@@ -17,23 +17,25 @@ import org.eclipse.jpt.common.utility.internal.iterable.SuperListIterableWrapper
import org.eclipse.jpt.common.utility.internal.model.value.TransformationPropertyValueModel;
import org.eclipse.jpt.common.utility.iterable.ListIterable;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
+import org.eclipse.jpt.common.utility.transformer.Transformer;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitDefaults;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitMetadata;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTenantDiscriminatorColumn2_3;
-import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkPersistenceUnitDefaults;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmSpecifiedTenantDiscriminatorColumn2_3;
+import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkPersistenceUnitDefaults;
import org.eclipse.jpt.jpa.eclipselink.ui.details.JptJpaEclipseLinkUiDetailsMessages;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.details.TenantDiscriminatorColumnsComposite;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.details.TenantDiscriminatorColumnsComposite.TenantDiscriminatorColumnsEditor;
import org.eclipse.jpt.jpa.ui.JptJpaUiMessages;
import org.eclipse.jpt.jpa.ui.details.orm.JptJpaUiDetailsOrmMessages;
import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds;
+import org.eclipse.jpt.jpa.ui.internal.JpaVersionIsCompatibleWith;
import org.eclipse.jpt.jpa.ui.internal.details.AccessTypeComboViewer;
import org.eclipse.jpt.jpa.ui.internal.details.db.CatalogCombo;
import org.eclipse.jpt.jpa.ui.internal.details.db.SchemaCombo;
import org.eclipse.jpt.jpa.ui.internal.details.orm.EntityMappingsDetailsPageManager;
import org.eclipse.jpt.jpa.ui.internal.details.orm.PersistenceUnitMetadataComposite;
-import org.eclipse.jpt.jpa.ui.internal.jpa2.Jpa2_0FlagTransformer;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
@@ -130,7 +132,7 @@ public class EclipseLink2_3PersistenceUnitMetadataComposite extends PersistenceU
gridData.horizontalSpan = 2;
diCheckBox.setLayoutData(gridData);
- SWTTools.controlVisibleState(Jpa2_0FlagTransformer.convertToFlagModel(this.getSubjectHolder()), diCheckBox);
+ SWTTools.controlVisibleState(this.buildDelimitedIdentifiersCheckBoxIsVisibleModel(), diCheckBox);
// Tenant discriminator columns group pane
@@ -151,6 +153,14 @@ public class EclipseLink2_3PersistenceUnitMetadataComposite extends PersistenceU
);
}
+ private PropertyValueModel<Boolean> buildDelimitedIdentifiersCheckBoxIsVisibleModel() {
+ return new TransformationPropertyValueModel<OrmPersistenceUnitMetadata, Boolean>(this.getSubjectHolder(), this.buildPUMetadataIsCompatibleWithJpa2_0Transformer());
+ }
+
+ private Transformer<OrmPersistenceUnitMetadata, Boolean> buildPUMetadataIsCompatibleWithJpa2_0Transformer() {
+ return new JpaVersionIsCompatibleWith<OrmPersistenceUnitMetadata>(JpaProject2_0.FACET_VERSION_STRING);
+ }
+
private PropertyValueModel<Boolean> buildPaneEnablerHolder() {
return new TransformationPropertyValueModel<OrmPersistenceUnitDefaults, Boolean>(getPersistenceUnitDefaultsHolder()) {
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaVersionIsCompatibleWith.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaVersionIsCompatibleWith.java
new file mode 100644
index 0000000000..3b689255ed
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaVersionIsCompatibleWith.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 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.ui.internal;
+
+import org.eclipse.jpt.common.utility.internal.transformer.AbstractTransformer;
+import org.eclipse.jpt.jpa.core.JpaModel;
+
+/**
+ * Transform a JPA model into a flag indicating whether the model supports
+ * the configured JPA version.
+ * The flag is <code>null</code> if the JPA model is <code>null</code>.
+ */
+public class JpaVersionIsCompatibleWith<M extends JpaModel>
+ extends AbstractTransformer<M, Boolean>
+{
+ private final String version;
+
+ public JpaVersionIsCompatibleWith(String version) {
+ super();
+ if (version == null) {
+ throw new NullPointerException();
+ }
+ this.version = version;
+ }
+
+ @Override
+ protected Boolean transform_(M jpaModel) {
+ return Boolean.valueOf(jpaModel.getJpaProject().getJpaPlatform().getJpaVersion().isCompatibleWithJpaVersion(this.version));
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/Jpa2_0FlagTransformer.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/Jpa2_0FlagTransformer.java
deleted file mode 100644
index 133352bce6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/Jpa2_0FlagTransformer.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 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.ui.internal.jpa2;
-
-import java.io.Serializable;
-import org.eclipse.jpt.common.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.common.utility.internal.transformer.AbstractTransformer;
-import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.common.utility.transformer.Transformer;
-import org.eclipse.jpt.jpa.core.JpaModel;
-import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
-
-/**
- * Transform a JPA node into a
- * flag indicating whether the node supports JPA 2.0.
- * The flag is <code>null</code> if the JPA node is <code>null</code>.
- */
-public final class Jpa2_0FlagTransformer<M extends JpaModel>
- extends AbstractTransformer<M, Boolean>
- implements Serializable
-{
- /**
- * Convert the specified JPA model model into a boolean model that returns
- * whether the JPA model supports JPA 2.0.
- * The flag is <code>null</code> if the JPA node is <code>null</code>.
- */
- public static <M extends JpaModel> PropertyValueModel<Boolean> convertToFlagModel(PropertyValueModel<M> jpaModelModel) {
- return new TransformationPropertyValueModel<M, Boolean>(jpaModelModel, Jpa2_0FlagTransformer.<M>instance());
- }
-
- @SuppressWarnings("rawtypes")
- private static final Transformer INSTANCE = new Jpa2_0FlagTransformer();
-
- @SuppressWarnings("unchecked")
- public static <T extends JpaModel> Transformer<T, Boolean> instance() {
- return INSTANCE;
- }
-
- // ensure single instance
- private Jpa2_0FlagTransformer() {
- super();
- }
-
- @Override
- protected Boolean transform_(M jpaModel) {
- return Boolean.valueOf(jpaModel.getJpaProject().getJpaPlatform().getJpaVersion().isCompatibleWithJpaVersion(JpaProject2_0.FACET_VERSION_STRING));
- }
-
- private static final long serialVersionUID = 1L;
- private Object readResolve() {
- // replace this object with the singleton
- return INSTANCE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/JpaProjectPropertiesPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/JpaProjectPropertiesPage.java
index de8214e965..edca52a1b2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/JpaProjectPropertiesPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/JpaProjectPropertiesPage.java
@@ -87,7 +87,7 @@ import org.eclipse.jpt.jpa.ui.JpaProjectModel;
import org.eclipse.jpt.jpa.ui.JpaWorkbench;
import org.eclipse.jpt.jpa.ui.JptJpaUiMessages;
import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds;
-import org.eclipse.jpt.jpa.ui.internal.jpa2.Jpa2_0FlagTransformer;
+import org.eclipse.jpt.jpa.ui.internal.JpaVersionIsCompatibleWith;
import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider;
import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate;
@@ -366,7 +366,11 @@ public class JpaProjectPropertiesPage
// ***** JPA 2.0 project flag
private PropertyValueModel<Boolean> buildJpa2_0ProjectFlagModel() {
- return Jpa2_0FlagTransformer.convertToFlagModel(this.jpaProjectModel);
+ return new TransformationPropertyValueModel<JpaProject, Boolean>(this.jpaProjectModel, this.buildJpaProjectIsCompatibleWithJpa2_0Transformer());
+ }
+
+ private Transformer<JpaProject, Boolean> buildJpaProjectIsCompatibleWithJpa2_0Transformer() {
+ return new JpaVersionIsCompatibleWith<JpaProject>(JpaProject2_0.FACET_VERSION_STRING);
}
// ***** metamodel models

Back to the top