Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Vosburgh2016-07-28 20:14:17 +0000
committerBrian Vosburgh2017-05-18 22:38:33 +0000
commitce5e961182c452b99155eba989789b431f4de576 (patch)
tree1f652cc44c024a04d21e1316fa3f5f436e5e7117
parentda673999b9b25389911d0878fe8947e54ad30a42 (diff)
downloadwebtools.dali-ce5e961182c452b99155eba989789b431f4de576.tar.gz
webtools.dali-ce5e961182c452b99155eba989789b431f4de576.tar.xz
webtools.dali-ce5e961182c452b99155eba989789b431f4de576.zip
aspect adapters 2016-07-28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlFile.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/ClassRef.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/JarFileRef.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/platform/EclipseLinkNavigatorItemContentProviderFactory.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/base/AbstractNavigatorItemContentProviderFactory.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/PersistenceStructureItemLabelProviderFactory.java42
8 files changed, 61 insertions, 70 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlFile.java
index 0b422b5aba..d12ce13fca 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlFile.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlFile.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2016 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.
@@ -13,6 +13,8 @@ import java.util.Collection;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jpt.common.core.resource.xml.JptXmlResource;
import org.eclipse.jpt.common.utility.internal.ObjectTools;
+import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter;
+import org.eclipse.jpt.common.utility.transformer.Transformer;
import org.eclipse.jpt.jpa.core.JpaFile;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
@@ -42,6 +44,15 @@ public interface XmlFile
* String constant associated with changes to the root property.
*/
String ROOT_PROPERTY = "root"; //$NON-NLS-1$
+ Transformer<XmlFile, Root> ROOT_TRANSFORMER = new RootTransformer();
+ class RootTransformer
+ extends TransformerAdapter<XmlFile, Root>
+ {
+ @Override
+ public Root transform(XmlFile xmlFile) {
+ return xmlFile.getRoot();
+ }
+ }
/**
* Return the resource model object
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/ClassRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/ClassRef.java
index 067d6c4e2e..8fb9697264 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/ClassRef.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/ClassRef.java
@@ -68,6 +68,15 @@ public interface ClassRef
* Return the class name of the class ref.
*/
String getClassName();
+ Transformer<ClassRef, String> CLASS_NAME_TRANSFORMER = new ClassNameTransformer();
+ class ClassNameTransformer
+ extends TransformerAdapter<ClassRef, String>
+ {
+ @Override
+ public String transform(ClassRef ref) {
+ return ref.getClassName();
+ }
+ }
/**
* Set the class name of the class ref.
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/JarFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/JarFileRef.java
index 9e827579a9..e44a94f0b6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/JarFileRef.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/JarFileRef.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2016 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.
@@ -50,6 +50,17 @@ public interface JarFileRef
*/
String getFileName();
+ Transformer<JarFileRef, String> FILE_NAME_TRANSFORMER = new FileNameTransformer();
+
+ class FileNameTransformer
+ extends TransformerAdapter<JarFileRef, String>
+ {
+ @Override
+ public String transform(JarFileRef ref) {
+ return ref.getFileName();
+ }
+ }
+
/**
* Set the file name of the jar file ref.
*/
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java
index 904748e5d7..45229ae358 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2015 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2016 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.
@@ -70,6 +70,16 @@ public interface MappingFileRef
*/
String getFileName();
+ Transformer<MappingFileRef, String> FILE_NAME_TRANSFORMER = new FileNameTransformer();
+ class FileNameTransformer
+ extends TransformerAdapter<MappingFileRef, String>
+ {
+ @Override
+ public String transform(MappingFileRef ref) {
+ return ref.getFileName();
+ }
+ }
+
/**
* Set the file name of the mapping file ref.
*/
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java
index 86585806f0..7a5156eacc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java
@@ -100,6 +100,15 @@ public class EclipseLinkPersistenceUnit
* String constant associated with changes to the implied eclipselink mapping file ref
*/
public static final String IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY = "impliedEclipseLinkMappingFileRef"; //$NON-NLS-1$
+ public static final Transformer<EclipseLinkPersistenceUnit, MappingFileRef> IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_TRANSFORMER = new ImpliedEclipseLinkMappingFileRefTransformer();
+ public static class ImpliedEclipseLinkMappingFileRefTransformer
+ extends TransformerAdapter<EclipseLinkPersistenceUnit, MappingFileRef>
+ {
+ @Override
+ public MappingFileRef transform(EclipseLinkPersistenceUnit pu) {
+ return pu.getImpliedEclipseLinkMappingFileRef();
+ }
+ }
/**
* Store the implied EL mapping file ref even if it is not part of the context model.
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/platform/EclipseLinkNavigatorItemContentProviderFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/platform/EclipseLinkNavigatorItemContentProviderFactory.java
index ac9203a128..86cf4af31c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/platform/EclipseLinkNavigatorItemContentProviderFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/platform/EclipseLinkNavigatorItemContentProviderFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2016 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.
@@ -11,8 +11,8 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.platform;
import java.util.ArrayList;
import org.eclipse.jpt.common.ui.jface.ItemTreeContentProvider;
-import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapterXXXX;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyCollectionValueModelAdapter;
+import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools;
import org.eclipse.jpt.common.utility.model.value.CollectionValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.context.JpaContextModel;
@@ -72,18 +72,6 @@ public class EclipseLinkNavigatorItemContentProviderFactory
}
protected PropertyValueModel<MappingFileRef> buildPersistenceUnitImpliedEclipseLinkMappingFileRefModel(EclipseLinkPersistenceUnit item) {
- return new PersistenceUnitImpliedEclipseLinkMappingFileRefModel(item);
- }
-
- public static class PersistenceUnitImpliedEclipseLinkMappingFileRefModel
- extends PropertyAspectAdapterXXXX<EclipseLinkPersistenceUnit, MappingFileRef>
- {
- public PersistenceUnitImpliedEclipseLinkMappingFileRefModel(EclipseLinkPersistenceUnit persistenceUnit) {
- super(EclipseLinkPersistenceUnit.IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY, persistenceUnit);
- }
- @Override
- protected MappingFileRef buildValue_() {
- return this.subject.getImpliedEclipseLinkMappingFileRef();
- }
+ return PropertyValueModelTools.modelAspectAdapter(item, EclipseLinkPersistenceUnit.IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY, EclipseLinkPersistenceUnit.IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_TRANSFORMER);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/base/AbstractNavigatorItemContentProviderFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/base/AbstractNavigatorItemContentProviderFactory.java
index 792cc82143..b4585c4a52 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/base/AbstractNavigatorItemContentProviderFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/base/AbstractNavigatorItemContentProviderFactory.java
@@ -24,6 +24,7 @@ import org.eclipse.jpt.common.utility.internal.model.value.ListCollectionValueMo
import org.eclipse.jpt.common.utility.internal.model.value.ListValueModelTools;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapterXXXX;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyCollectionValueModelAdapter;
+import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools;
import org.eclipse.jpt.common.utility.internal.model.value.TransformationListValueModel;
import org.eclipse.jpt.common.utility.internal.predicate.PredicateTools;
import org.eclipse.jpt.common.utility.internal.transformer.TransformerTools;
@@ -422,7 +423,7 @@ public abstract class AbstractNavigatorItemContentProviderFactory
}
protected PropertyValueModel<EntityMappings> buildOrmXmlEntityMappingsModel(OrmXml ormXml) {
- return new OrmXmlEntityMappingsModel(ormXml);
+ return PropertyValueModelTools.modelAspectAdapter(ormXml, XmlFile.ROOT_PROPERTY, TransformerTools.downcast(XmlFile.ROOT_TRANSFORMER));
}
public static class EntityMappingsManagedTypesModel
@@ -443,18 +444,6 @@ public abstract class AbstractNavigatorItemContentProviderFactory
}
}
- public static class OrmXmlEntityMappingsModel
- extends PropertyAspectAdapterXXXX<OrmXml, EntityMappings>
- {
- public OrmXmlEntityMappingsModel(OrmXml ormXml) {
- super(XmlFile.ROOT_PROPERTY, ormXml);
- }
- @Override
- protected EntityMappings buildValue_() {
- return this.subject.getRoot();
- }
- }
-
// ********** JPA structure node **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/PersistenceStructureItemLabelProviderFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/PersistenceStructureItemLabelProviderFactory.java
index b10d1b1dca..401b926da5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/PersistenceStructureItemLabelProviderFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/PersistenceStructureItemLabelProviderFactory.java
@@ -171,19 +171,7 @@ public class PersistenceStructureItemLabelProviderFactory
}
protected PropertyValueModel<String> buildMappingFileRefTextModel(MappingFileRef mappingFileRef) {
- return new MappingFileRefTextModel(mappingFileRef);
- }
-
- public static class MappingFileRefTextModel
- extends PropertyAspectAdapterXXXX<MappingFileRef, String>
- {
- public MappingFileRefTextModel(MappingFileRef subject) {
- super(MappingFileRef.FILE_NAME_PROPERTY, subject);
- }
- @Override
- protected String buildValue_() {
- return this.subject.getFileName();
- }
+ return PropertyValueModelTools.modelAspectAdapter(mappingFileRef, MappingFileRef.FILE_NAME_PROPERTY, MappingFileRef.FILE_NAME_TRANSFORMER);
}
protected PropertyValueModel<String> buildMappingFileRefDescriptionModel(MappingFileRef mappingFileRef) {
@@ -210,19 +198,7 @@ public class PersistenceStructureItemLabelProviderFactory
}
protected PropertyValueModel<String> buildClassRefTextModel(ClassRef classRef) {
- return new ClassRefTextModel(classRef);
- }
-
- public static class ClassRefTextModel
- extends PropertyAspectAdapterXXXX<ClassRef, String>
- {
- public ClassRefTextModel(ClassRef subject) {
- super(ClassRef.CLASS_NAME_PROPERTY, subject);
- }
- @Override
- protected String buildValue_() {
- return this.subject.getClassName();
- }
+ return PropertyValueModelTools.modelAspectAdapter(classRef, ClassRef.CLASS_NAME_PROPERTY, ClassRef.CLASS_NAME_TRANSFORMER);
}
protected PropertyValueModel<String> buildClassRefDescriptionModel(ClassRef classRef) {
@@ -250,19 +226,7 @@ public class PersistenceStructureItemLabelProviderFactory
}
protected PropertyValueModel<String> buildJarFileRefTextModel(JarFileRef jarFileRef) {
- return new JarFileRefTextModel(jarFileRef);
- }
-
- public static class JarFileRefTextModel
- extends PropertyAspectAdapterXXXX<JarFileRef, String>
- {
- public JarFileRefTextModel(JarFileRef subject) {
- super(JarFileRef.FILE_NAME_PROPERTY, subject);
- }
- @Override
- protected String buildValue_() {
- return this.subject.getFileName();
- }
+ return PropertyValueModelTools.modelAspectAdapter(jarFileRef, JarFileRef.FILE_NAME_PROPERTY, JarFileRef.FILE_NAME_TRANSFORMER);
}
protected PropertyValueModel<String> buildJarFileRefDescriptionModel(JarFileRef jarFileRef) {

Back to the top