summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNan Li2012-10-05 15:25:16 (EDT)
committer Neil Hauge2012-10-05 15:27:50 (EDT)
commit90fab4dff643e8682ae91c0ef24b0bdaf042228a (patch)
tree42e78ae8a8049760e322714a43bf7a38555a74a6
parent6e8007d20e870b309813c6cb6bd2f7eb65640a3d (diff)
downloadwebtools.dali-90fab4dff643e8682ae91c0ef24b0bdaf042228a.zip
webtools.dali-90fab4dff643e8682ae91c0ef24b0bdaf042228a.tar.gz
webtools.dali-90fab4dff643e8682ae91c0ef24b0bdaf042228a.tar.bz2
373582 - XML code completion for class references.
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java238
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappedSuperclass.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlMultiRelationshipMapping.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlRelationshipMapping.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/MapKey.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlClassReference.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlElementCollection.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmElementCollectionMapping2_0.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkArrayMapping2_3.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapping.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverterContainerImpl.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomConverter.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomizer.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddableImpl.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddedIdMapping.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddedMapping.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkIdMapping.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToManyMapping.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToOneMapping.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkObjectTypeConverter.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToManyMapping.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToOneMapping.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkStructConverter.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkStructureMapping2_3.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkTransformationMapping.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkTypeConverter.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVariableOneToOneMapping.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVersionMapping.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlArray.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlBasic.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlBasicCollection.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlBasicMap.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlConverter.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlElementCollection.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEmbeddable.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEmbedded.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEmbeddedId.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEntity.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlId.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlManyToMany.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlMappedSuperclass.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlObjectTypeConverter.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlOneToMany.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlStructConverter.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlStructure.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlTransformation.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlTypeConverter.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlVariableOneToOne.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlVersion.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaXmlCompletionProposalComputer.java19
60 files changed, 1349 insertions, 66 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java
index 0006a2e..5fe0afe 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java
@@ -9,16 +9,29 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.context;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNode;
import org.eclipse.jpt.common.core.internal.utility.JDTTools;
import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.utility.internal.ArrayTools;
import org.eclipse.jpt.common.utility.internal.ClassName;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.ReflectionTools;
import org.eclipse.jpt.common.utility.internal.Transformer;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.Column;
import org.eclipse.jpt.jpa.core.context.ColumnMapping;
@@ -35,6 +48,7 @@ import org.eclipse.jpt.jpa.core.context.ReferenceTable;
import org.eclipse.jpt.jpa.core.context.Relationship;
import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.jpa2.context.AttributeMapping2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.CollectionMapping2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.ElementCollectionMapping2_0;
@@ -108,6 +122,13 @@ public final class MappingTools {
java.lang.Character.class.getName()
};
+ private static final String[] BASIC_ARRAY_TYPE_NAMES = {
+ byte[].class.getSimpleName(),
+ Byte[].class.getSimpleName(),
+ char[].class.getSimpleName(),
+ Character[].class.getSimpleName()
+ };
+
/**
* Return whether the specified type is among the various "other" types
* that can default to a basic mapping.
@@ -115,7 +136,7 @@ public final class MappingTools {
public static boolean typeIsOtherValidBasicType(String typeName) {
return ArrayTools.contains(OTHER_VALID_BASIC_TYPE_NAMES, typeName);
}
-
+
private static final String[] OTHER_VALID_BASIC_TYPE_NAMES = {
java.lang.String.class.getName(),
java.math.BigInteger.class.getName(),
@@ -126,6 +147,35 @@ public final class MappingTools {
java.sql.Time.class.getName(),
java.sql.Timestamp.class.getName(),
};
+
+ private static final String[] PRIMITIVE_TYPE_NAMES = {
+ boolean.class.getName(),
+ byte.class.getName(),
+ char.class.getName(),
+ double.class.getName(),
+ float.class.getName(),
+ int.class.getName(),
+ long.class.getName(),
+ short.class.getName()
+ };
+
+ private static final String[] PRIMITIVE_WRAPPER_TYPE_NAMES = {
+ Boolean.class.getName(),
+ Byte.class.getName(),
+ Character.class.getName(),
+ Double.class.getName(),
+ Float.class.getName(),
+ Integer.class.getName(),
+ Long.class.getName(),
+ Short.class.getName()
+ };
+
+ private static final String[] COLLECTION_TYPE_NAMES = {
+ Collection.class.getName(),
+ List.class.getName(),
+ Map.class.getName(),
+ Set.class.getName()
+ };
/**
* Default join table name from the JPA spec:<br>
@@ -486,6 +536,192 @@ public final class MappingTools {
(resourceNode instanceof SourceNode);
}
+ /**
+ * Returns sorted names of interfaces of the given project
+ */
+ public static Iterable<String> getSortedJavaInterfaceNames(IJavaProject javaProject) {
+ return CollectionTools.sort(getJavaInterfaceNames(javaProject));
+ }
+
+ /**
+ * Returns the names of interfaces of the given project
+ */
+ public static Iterable<String> getJavaInterfaceNames(IJavaProject javaProject) {
+ return new TransformationIterable<IType, String>(getJavaInterfaces(javaProject)) {
+ @Override
+ protected String transform(IType type) {
+ return type.getFullyQualifiedName();
+ }
+ };
+ }
+
+ /**
+ * Returns all the interfaces across the given project
+ */
+ public static Iterable<IType> getJavaInterfaces(IJavaProject javaProject) {
+ return new FilteringIterable<IType>(getJavaTypes(javaProject)) {
+ @Override
+ protected boolean accept(IType type) {
+ try {
+ return type.isInterface();
+ } catch (JavaModelException e) {
+ JptJpaCorePlugin.instance().logError(e);
+ }
+ return false;
+ }
+ };
+ }
+
+ /**
+ * Returns sorted names of classes of the given project
+ */
+ public static Iterable<String> getSortedJavaClassNames(IJavaProject javaProject) {
+ return CollectionTools.sort(getJavaClassNames(javaProject));
+ }
+
+ /**
+ * Returns the names of classes of the given project
+ */
+ public static Iterable<String> getJavaClassNames(IJavaProject javaProject) {
+ return new TransformationIterable<IType, String>(getJavaClasses(javaProject)) {
+ @Override
+ protected String transform(IType type) {
+ return type.getFullyQualifiedName();
+ }
+ };
+ }
+
+
+ /**
+ * Returns all the classes across the given project
+ */
+ public static Iterable<IType> getJavaClasses(IJavaProject javaProject) {
+ return new FilteringIterable<IType>(getJavaTypes(javaProject)) {
+ @Override
+ protected boolean accept(IType type) {
+ try {
+ return type.isClass();
+ } catch (JavaModelException e) {
+ JptJpaCorePlugin.instance().logError(e);
+ }
+ return false;
+ }
+ };
+ }
+
+ /**
+ * Returns all the enums across the given project
+ */
+ public static Iterable<IType> getJavaEnums(IJavaProject javaProject) {
+ return new FilteringIterable<IType>(getJavaTypes(javaProject)) {
+ @Override
+ protected boolean accept(IType type) {
+ try {
+ return type.isEnum();
+ } catch (JavaModelException e) {
+ JptJpaCorePlugin.instance().logError(e);
+ }
+ return false;
+ }
+ };
+ }
+
+ /**
+ * Returns the names of enums in the given project
+ */
+ public static Iterable<String> getJavaEnumNames(IJavaProject javaProject) {
+ return new TransformationIterable<IType, String>(getJavaEnums(javaProject)) {
+ @Override
+ protected String transform(IType type) {
+ return type.getFullyQualifiedName();
+ }
+ };
+ }
+
+ /**
+ * Returns sorted names of enums in the given project
+ */
+ public static Iterable<String> getSortedJavaEnumNames(IJavaProject javaProject) {
+ return CollectionTools.sort(getJavaEnumNames(javaProject));
+ }
+
+ /**
+ * Returns all the types cross the given project
+ */
+ public static Iterable<IType> getJavaTypes(IJavaProject javaProject) {
+ List<IType> typesList = new ArrayList<IType>();
+ try {
+ IPackageFragmentRoot[] pkgRoots = javaProject.getAllPackageFragmentRoots();
+ for (IPackageFragmentRoot root : pkgRoots) {
+ IJavaElement[] jElements = root.getChildren();
+ for (IJavaElement jElement : jElements) {
+ if (jElement.getElementType() == IJavaElement.PACKAGE_FRAGMENT) {
+ ICompilationUnit[] units = ((IPackageFragment) jElement).getCompilationUnits();
+ for (ICompilationUnit unit : units) {
+ CollectionTools.addAll(typesList, unit.getTypes());
+ }
+ }
+ }
+ }
+ } catch (JavaModelException e) {
+ JptJpaCorePlugin.instance().logError(e);
+ }
+ return typesList;
+ }
+
+ /**
+ * Returns the names of basic array types.
+ */
+ public static Iterable<String> getBasicArrayTypeNames() {
+ return CollectionTools.list(BASIC_ARRAY_TYPE_NAMES);
+ }
+
+
+ /**
+ * Returns the names of primary basic types with including primitives
+ */
+ public static Iterable<String> getPrimaryBasicTypeNamesWithoutPrimitives() {
+ List<String> names = new ArrayList<String>();
+ names.addAll(CollectionTools.list(PRIMITIVE_WRAPPER_TYPE_NAMES));
+ names.addAll(CollectionTools.list(OTHER_VALID_BASIC_TYPE_NAMES));
+ return names;
+ }
+
+ /**
+ * Returns the names of primary basic types
+ */
+ public static Iterable<String> getPrimaryBasicTypeNames() {
+ List<String> names = new ArrayList<String>();
+ names.addAll(CollectionTools.list(PRIMITIVE_TYPE_NAMES));
+ names.addAll(CollectionTools.list(PRIMITIVE_WRAPPER_TYPE_NAMES));
+ names.addAll(CollectionTools.list(OTHER_VALID_BASIC_TYPE_NAMES));
+ return names;
+ }
+
+ /**
+ * Returns the names of all possible valid basic types
+ *
+ * @return a String iterable that includes extra basic types besides
+ * these ones returned by getPrimaryBasicTypeNames method
+ *
+ * @see #getPrimaryBasicTypeNames()
+ */
+ public static Iterable<String> getAllBasicTypeNames() {
+ List<String> names = new ArrayList<String>();
+ names.addAll(CollectionTools.list(getPrimaryBasicTypeNames()));
+ names.addAll(CollectionTools.list(BASIC_ARRAY_TYPE_NAMES));
+ names.add(Enum.class.getSimpleName());
+ return names;
+ }
+
+ /**
+ * Returns the names of collection types
+ */
+ public static Iterable<String> getCollectionTypeNames() {
+ List<String> names = new ArrayList<String>();
+ names.addAll(CollectionTools.list(COLLECTION_TYPE_NAMES));
+ return names;
+ }
// ********** constructor **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java
index 204a0d6..854b3c5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java
@@ -1227,7 +1227,7 @@ public abstract class AbstractEntityMappings
return result;
}
}
- return EmptyIterable.instance();
+ return null;
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java
index f792c3c..3887944 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java
@@ -1979,6 +1979,10 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
if (result != null) {
return result;
}
+ result = this.idClassReference.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
return null;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappedSuperclass.java
index 6bc760e..6f547d0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappedSuperclass.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappedSuperclass.java
@@ -213,4 +213,19 @@ public abstract class AbstractOrmMappedSuperclass<X extends XmlMappedSuperclass>
return new GenericMappedSuperclassPrimaryKeyValidator(this);
// TODO - JPA 2.0 validation
}
+
+ // ********** completion proposals **********
+
+ @Override
+ public Iterable<String> getCompletionProposals(int pos) {
+ Iterable<String> result = super.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ result = this.idClassReference.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ return null;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
index 079dbf4..3dcd7dc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
@@ -866,6 +866,13 @@ public abstract class AbstractOrmMultiRelationshipMapping<X extends AbstractXmlM
return this.getTargetEntityNonTransientAttributeNames();
}
+ @SuppressWarnings("unchecked")
+ protected Iterable<String> getCandidateMapKeyClassNames() {
+ return new CompositeIterable<String>(
+ MappingTools.getSortedJavaClassNames(getJavaProject()),
+ MappingTools.getPrimaryBasicTypeNames()
+ );
+ }
// ********** metamodel **********
@@ -1084,6 +1091,9 @@ public abstract class AbstractOrmMultiRelationshipMapping<X extends AbstractXmlM
if (this.mapKeyNameTouches(pos)) {
return this.getCandidateMapKeyNames();
}
+ if (this.mapKeyClassTouches(pos)) {
+ return this.getCandidateMapKeyClassNames();
+ }
result = this.mapKeyColumn.getCompletionProposals(pos);
if (result != null) {
return result;
@@ -1106,7 +1116,12 @@ public abstract class AbstractOrmMultiRelationshipMapping<X extends AbstractXmlM
}
protected boolean mapKeyNameTouches(int pos) {
- return this.xmlAttributeMapping.mapKeyNameTouches(pos);
+ return this.getXmlMapKey() == null? false : this.getXmlMapKey().mapKeyNameTouches(pos);
+ }
+
+ protected boolean mapKeyClassTouches(int pos) {
+ return this.xmlAttributeMapping.getMapKeyClass() == null ? false :
+ this.xmlAttributeMapping.getMapKeyClass().classNameTouches(pos);
}
// ********** abstract owner **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java
index 00c400e..e2ecc72 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java
@@ -32,6 +32,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmMappingRelationship;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipMapping;
import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmCascade;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
@@ -455,6 +456,17 @@ public abstract class AbstractOrmRelationshipMapping<X extends AbstractXmlRelati
if (result != null) {
return result;
}
+ if (this.targetEntityTouches(pos)) {
+ return this.getCandidateTargetEntityClassNames();
+ }
return null;
}
+
+ protected boolean targetEntityTouches(int pos) {
+ return this.xmlAttributeMapping.targetEntityTouches(pos);
+ }
+
+ protected Iterable<String> getCandidateTargetEntityClassNames() {
+ return MappingTools.getSortedJavaClassNames(getJavaProject());
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java
index 303417f..c8111ca 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java
@@ -39,6 +39,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericTypeMappingValidator;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
@@ -620,43 +621,11 @@ public abstract class AbstractOrmTypeMapping<X extends XmlTypeMapping>
return null;
}
- private Iterable<String> getCandidateClassNames() {
- final String packageName = this.getEntityMappings().getPackage();
- if (!StringTools.stringIsEmpty(packageName)) {
- return new TransformationIterable<String, String>(this.getFilteredCandidateClassNames(packageName)) {
- @Override
- protected String transform(String className) {
- return className.substring(packageName.length()+1);
- }
- };
- }
- return this.getCandidateFullyQualifiedClassNames();
- }
-
- private Iterable<String> getFilteredCandidateClassNames(final String packageName) {
- return new FilteringIterable<String>(this.getCandidateFullyQualifiedClassNames()) {
- @Override
- protected boolean accept(String className) {
- return className.startsWith(packageName);
- }
- };
- }
-
- /**
- * @return names of the classes specified by class refs and jar files
- */
- // should return names of all the classes defined in the project?
- private Iterable<String> getCandidateFullyQualifiedClassNames() {
- return new TransformationIterable<PersistentType, String>(
- this.getPersistenceUnit().getJavaPersistentTypes()) {
- @Override
- protected String transform(PersistentType pType) {
- return pType.getName();
- }
- };
+ protected Iterable<String> getCandidateClassNames() {
+ return MappingTools.getSortedJavaClassNames(this.getJavaProject());
}
- private boolean classNameTouches(int pos) {
+ protected boolean classNameTouches(int pos) {
return this.getXmlTypeMapping().classNameTouches(pos);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java
index cdef44c..0854342 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java
@@ -27,6 +27,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmIdClassReference;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
import org.eclipse.jpt.jpa.core.internal.context.AbstractJpaContextNode;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
@@ -444,4 +445,26 @@ public class GenericOrmIdClassReference
XmlClassReference xmlIdClassRef = this.getXmlIdClassRef();
return (xmlIdClassRef == null) ? null : xmlIdClassRef.getClassNameTextRange();
}
+
+ // ********** completion proposals **********
+
+ @Override
+ public Iterable<String> getCompletionProposals(int pos) {
+ Iterable<String> result = super.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ if (this.idCLassNameTouches(pos)) {
+ return this.getCandidateIdClassNames();
+ }
+ return null;
+ }
+
+ protected Iterable<String> getCandidateIdClassNames() {
+ return MappingTools.getSortedJavaClassNames(this.getJavaProject());
+ }
+
+ protected boolean idCLassNameTouches(int pos) {
+ return this.getXmlIdClassRef() == null ? false : this.getXmlIdClassRef().classNameTouches(pos);
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java
index 64b0d04..96fd4f8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java
@@ -1768,6 +1768,12 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
if (result != null) {
return result;
}
+ if (this.targetClassTouches(pos)) {
+ return this.getCandidateClassNames();
+ }
+ if (this.mapKeyClassTouches(pos)) {
+ return this.getCandidateClassNames();
+ }
if (this.mapKeyNameTouches(pos)) {
return this.getCandidateMapKeyNames();
}
@@ -1791,9 +1797,26 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
}
return null;
}
-
+
+ @SuppressWarnings("unchecked")
+ protected Iterable<String> getCandidateClassNames() {
+ return new CompositeIterable<String>(
+ MappingTools.getSortedJavaClassNames(getJavaProject()),
+ MappingTools.getPrimaryBasicTypeNames()
+ );
+ }
+
+ protected boolean targetClassTouches(int pos) {
+ return this.xmlAttributeMapping.targetClassTouches(pos);
+ }
+
+ protected boolean mapKeyClassTouches(int pos) {
+ return this.xmlAttributeMapping.getMapKeyClass() == null ? false :
+ this.xmlAttributeMapping.getMapKeyClass().classNameTouches(pos);
+ }
+
protected boolean mapKeyNameTouches(int pos) {
- return this.xmlAttributeMapping.mapKeyNameTouches(pos);
+ return this.getXmlMapKey() == null ? false : this.getXmlMapKey().mapKeyNameTouches(pos);
}
// ********** abstract owner **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlMultiRelationshipMapping.java
index 53a7fb2..8654b43 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlMultiRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlMultiRelationshipMapping.java
@@ -1130,17 +1130,8 @@ public abstract class AbstractXmlMultiRelationshipMapping extends AbstractXmlRel
return getAttributeCodeAssistTextRange(JPA.MAPPED_BY);
}
- public TextRange getMapKeyNameCodeAssistTextRange() {
- return getAttributeCodeAssistTextRange(JPA.MAP_KEY);
- }
-
public boolean mappedByTouches(int pos) {
TextRange textRange = this.getMappedByCodeAssistTextRange();
return (textRange!= null) && textRange.touches(pos);
}
-
- public boolean mapKeyNameTouches(int pos) {
- TextRange textRange = this.getMapKeyNameCodeAssistTextRange();
- return (textRange != null) && textRange.touches(pos);
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlRelationshipMapping.java
index c7e73f0..aaa62df 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlRelationshipMapping.java
@@ -406,4 +406,14 @@ public abstract class AbstractXmlRelationshipMapping extends AbstractXmlAttribut
return new ReplaceEdit(offset, packageLength, newPackageName);
}
+ // *********** content assist ************
+
+ public TextRange getTargetEntityCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(JPA.TARGET_ENTITY);
+ }
+
+ public boolean targetEntityTouches(int pos) {
+ TextRange textRange = this.getTargetEntityCodeAssistTextRange();
+ return (textRange != null) && (textRange.touches(pos));
+ }
} // RelationshipMapping
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/MapKey.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/MapKey.java
index c172ec5..53abbea 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/MapKey.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/MapKey.java
@@ -14,6 +14,7 @@ import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.core.resource.xml.EBaseObject;
import org.eclipse.jpt.common.core.resource.xml.EBaseObjectImpl;
import org.eclipse.wst.common.internal.emf.resource.Translator;
@@ -218,4 +219,14 @@ public class MapKey extends EBaseObjectImpl implements EBaseObject
return new Translator(JPA.NAME, OrmPackage.eINSTANCE.getMapKey_Name(), Translator.DOM_ATTRIBUTE);
}
+ // ********** content assist ***************
+
+ public TextRange getMapKeyNameCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(JPA.NAME);
+ }
+
+ public boolean mapKeyNameTouches(int pos) {
+ TextRange textRange = this.getMapKeyNameCodeAssistTextRange();
+ return (textRange != null) && textRange.touches(pos);
+ }
} // MapKey
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlClassReference.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlClassReference.java
index 361bd1b..c965557 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlClassReference.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlClassReference.java
@@ -252,4 +252,15 @@ public class XmlClassReference extends EBaseObjectImpl implements EBaseObject
return new ReplaceEdit(offset, packageLength, newPackageName);
}
+ // ********** content assist ***************
+
+ public TextRange getClassNameCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(JPA.CLASS);
+ }
+
+ public boolean classNameTouches(int pos) {
+ TextRange textRange = this.getClassNameCodeAssistTextRange();
+ return (textRange != null) && textRange.touches(pos);
+ }
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlElementCollection.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlElementCollection.java
index ab7a997..97b8f76 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlElementCollection.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlElementCollection.java
@@ -1695,13 +1695,12 @@ public class XmlElementCollection extends AbstractXmlAttributeMapping implements
// ********** content assist ***************
- public TextRange getMapKeyNameCodeAssistTextRange() {
- return getAttributeCodeAssistTextRange(JPA.MAP_KEY);
+ public TextRange getTargetClassCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(JPA2_0.TARGET_CLASS);
}
- public boolean mapKeyNameTouches(int pos) {
- TextRange textRange = this.getMapKeyNameCodeAssistTextRange();
- return (textRange != null) && textRange.touches(pos);
+ public boolean targetClassTouches(int pos) {
+ TextRange textRange = this.getTargetClassCodeAssistTextRange();
+ return (textRange != null) && (textRange.touches(pos));
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java
index 61ba35a..efa7cc1 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java
@@ -23,8 +23,8 @@ import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrappe
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.jpa.core.context.DiscriminatorType;
import org.eclipse.jpt.jpa.core.context.Generator;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedDiscriminatorColumn;
import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
+import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedDiscriminatorColumn;
import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
import org.eclipse.jpt.jpa.core.context.orm.OrmXml;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
@@ -702,4 +702,19 @@ public class EclipseLinkEntityMappingsImpl
super.validate(messages, reporter);
this.converterContainer.validate(messages, reporter);
}
+
+ // ********** completion proposals **********
+
+ @Override
+ public Iterable<String> getCompletionProposals(int pos) {
+ Iterable<String> result = super.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ result = this.converterContainer.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ return null;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmElementCollectionMapping2_0.java
index 0fbdd72..e54f532 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmElementCollectionMapping2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmElementCollectionMapping2_0.java
@@ -14,16 +14,19 @@ import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
import org.eclipse.jpt.common.core.internal.utility.JDTTools;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.jpa.core.context.orm.OrmConverter;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.AbstractOrmElementCollectionMapping2_0;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkAccessType;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkElementCollectionMapping2_0;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmConvertibleMapping;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLink2_0JpaPlatformFactory;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages;
@@ -200,4 +203,39 @@ public class EclipseLinkOrmElementCollectionMapping2_0
protected TextRange getAttributeTypeTextRange() {
return this.getValidationTextRange(this.xmlAttributeMapping.getAttributeTypeTextRange());
}
+
+ // ********** completion proposals **********
+
+ @Override
+ public Iterable<String> getCompletionProposals(int pos) {
+ Iterable<String> result = super.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ result = this.converterContainer.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ if (this.attributeTypeTouches(pos)) {
+ return this.getCandidateAttributeTypeNames();
+ }
+ return null;
+ }
+
+ protected boolean attributeTypeTouches(int pos) {
+ return this.xmlAttributeMapping.attributeTypeTouches(pos);
+ }
+
+ protected Iterable<String> getCandidateAttributeTypeNames() {
+ return MappingTools.getCollectionTypeNames();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected Iterable<String> getCandidateClassNames() {
+ return new CompositeIterable<String>(
+ super.getCandidateClassNames(),
+ CollectionTools.sort(((EclipseLinkPersistenceUnit) this.getPersistenceUnit()).getEclipseLinkDynamicPersistentTypeNames())
+ );
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkArrayMapping2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkArrayMapping2_3.java
index c48948a..c235051 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkArrayMapping2_3.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkArrayMapping2_3.java
@@ -12,6 +12,7 @@ package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm;
import java.util.List;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.jpa.core.context.Converter;
@@ -27,6 +28,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmLobConverter;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator;
@@ -39,6 +41,7 @@ import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkArrayMapping2_3;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmConvertibleMapping;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlArray;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.XmlAttributes_2_3;
import org.eclipse.text.edits.ReplaceEdit;
@@ -367,6 +370,37 @@ public class OrmEclipseLinkArrayMapping2_3
if (result != null) {
return result;
}
+ result = this.converterContainer.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ if (this.targetClassTouches(pos)) {
+ return this.getCandidateTargetClassNames();
+ }
+ if (this.attributeTypeTouches(pos)) {
+ return this.getcandidateAttributeTypeNames();
+ }
return null;
}
+
+ protected boolean attributeTypeTouches(int pos) {
+ return this.xmlAttributeMapping.attributeTypeTouches(pos);
+ }
+
+ protected boolean targetClassTouches(int pos) {
+ return this.xmlAttributeMapping.targetClassTouches(pos);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Iterable<String> getCandidateTargetClassNames() {
+ return new CompositeIterable<String>(
+ MappingTools.getSortedJavaClassNames(getJavaProject()),
+ MappingTools.getPrimaryBasicTypeNames(),
+ CollectionTools.sort(((EclipseLinkPersistenceUnit) this.getPersistenceUnit()).getEclipseLinkDynamicPersistentTypeNames())
+ );
+ }
+
+ protected Iterable<String> getcandidateAttributeTypeNames() {
+ return MappingTools.getCollectionTypeNames();
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapping.java
index 7bb026f..5e918ce 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapping.java
@@ -198,4 +198,30 @@ public class OrmEclipseLinkBasicMapping
protected TextRange getAttributeTypeTextRange() {
return this.getValidationTextRange(this.xmlAttributeMapping.getAttributeTypeTextRange());
}
+
+ // ********** completion proposals **********
+
+ @Override
+ public Iterable<String> getCompletionProposals(int pos) {
+ Iterable<String> result = super.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ result = this.converterContainer.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ if (this.attributeTypeTouches(pos)) {
+ return this.getCandidateAttributeTypeNames();
+ }
+ return null;
+ }
+
+ protected boolean attributeTypeTouches(int pos) {
+ return this.xmlAttributeMapping.attributeTypeTouches(pos);
+ }
+
+ protected Iterable<String> getCandidateAttributeTypeNames() {
+ return MappingTools.getAllBasicTypeNames();
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverterContainerImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverterContainerImpl.java
index c3689e0..76bff7f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverterContainerImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverterContainerImpl.java
@@ -616,4 +616,39 @@ public class OrmEclipseLinkConverterContainerImpl
public int getNumberSupportedConverters() {
return this.owner.getNumberSupportedConverters();
}
+
+ // ********** completion proposals **********
+
+ @Override
+ public Iterable<String> getCompletionProposals(int pos) {
+ Iterable<String> result = super.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ for (OrmEclipseLinkCustomConverter converter : this.customConverterContainer.getContextElements()) {
+ result = converter.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ }
+ for (OrmEclipseLinkStructConverter converter : this.structConverterContainer.getContextElements()) {
+ result = converter.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ }
+ for (OrmEclipseLinkObjectTypeConverter converter : this.objectTypeConverterContainer.getContextElements()) {
+ result = converter.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ }
+ for (OrmEclipseLinkTypeConverter converter : this.typeConverterContainer.getContextElements()) {
+ result = converter.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ }
+ return null;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomConverter.java
index 3e22dd0..bd38dc8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomConverter.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomConverter.java
@@ -12,6 +12,7 @@ package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm;
import org.eclipse.jdt.core.IType;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.context.JpaContextNode;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomConverter;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkCustomConverter;
@@ -83,4 +84,26 @@ public class OrmEclipseLinkCustomConverter
super.convertFrom(javaConverter);
this.setConverterClass(javaConverter.getFullyQualifiedConverterClass());
}
+
+ // ********** completion proposals **********
+
+ @Override
+ public Iterable<String> getCompletionProposals(int pos) {
+ Iterable<String> result = super.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ if (this.converterClassNameTouches(pos)) {
+ return this.getCandidateClassNames();
+ }
+ return null;
+ }
+
+ protected Iterable<String> getCandidateClassNames() {
+ return MappingTools.getSortedJavaClassNames(this.getJavaProject());
+ }
+
+ protected boolean converterClassNameTouches(int pos) {
+ return this.xmlConverter.converterClassTouches(pos);
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomizer.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomizer.java
index 6b0bd7b..7f262a6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomizer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomizer.java
@@ -19,6 +19,7 @@ import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference;
@@ -316,4 +317,26 @@ public class OrmEclipseLinkCustomizer
XmlClassReference xmlClassRef = this.getXmlCustomizerClassRef();
return (xmlClassRef == null) ? null : xmlClassRef.getClassNameTextRange();
}
+
+ // ********** completion proposals **********
+
+ @Override
+ public Iterable<String> getCompletionProposals(int pos) {
+ Iterable<String> result = super.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ if (this.customizerClassTouches(pos)) {
+ return this.getCandidateClassNames();
+ }
+ return null;
+ }
+
+ protected Iterable<String> getCandidateClassNames() {
+ return MappingTools.getSortedJavaClassNames(this.getJavaProject());
+ }
+
+ protected boolean customizerClassTouches(int pos) {
+ return this.getXmlCustomizerClassRef()== null? false : this.getXmlCustomizerClassRef().classNameTouches(pos);
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddableImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddableImpl.java
index 2580880..7ca058f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddableImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddableImpl.java
@@ -14,6 +14,7 @@ import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
import org.eclipse.jpt.common.core.internal.utility.JDTTools;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.NotNullFilter;
import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
@@ -29,6 +30,7 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkEmbeddab
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmPersistentType;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkEmbeddable;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkTypeMappingValidator;
@@ -276,4 +278,34 @@ public class OrmEclipseLinkEmbeddableImpl
protected TextRange getParentClassTextRange() {
return this.getValidationTextRange(this.xmlTypeMapping.getParentClassTextRange());
}
+
+ // ********** completion proposals **********
+
+ @Override
+ public Iterable<String> getCompletionProposals(int pos) {
+ Iterable<String> result = super.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ result = this.customizer.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ result = this.converterContainer.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ if (this.xmlTypeMapping.parentClassTouches(pos)) {
+ return this.getCandidateParentClassNames();
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Iterable<String> getCandidateParentClassNames() {
+ return new CompositeIterable<String>(
+ this.getCandidateClassNames(),
+ CollectionTools.sort(((EclipseLinkPersistenceUnit) this.getPersistenceUnit()).getEclipseLinkDynamicPersistentTypeNames())
+ );
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddedIdMapping.java
index 3d9643a..066bfbd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddedIdMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddedIdMapping.java
@@ -13,10 +13,14 @@ import java.util.List;
import org.eclipse.jdt.core.IType;
import org.eclipse.jpt.common.core.internal.utility.JDTTools;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.AbstractOrmEmbeddedIdMapping;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkAccessType;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEmbeddedId;
@@ -90,4 +94,30 @@ public class OrmEclipseLinkEmbeddedIdMapping
protected TextRange getAttributeTypeTextRange() {
return this.getValidationTextRange(this.xmlAttributeMapping.getAttributeTypeTextRange());
}
+
+ // ********** completion proposals **********
+
+ @Override
+ public Iterable<String> getCompletionProposals(int pos) {
+ Iterable<String> result = super.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ if (this.attributeTypeTouches(pos)) {
+ return this.getCandidateAttributeTypeNames();
+ }
+ return null;
+ }
+
+ protected boolean attributeTypeTouches(int pos) {
+ return this.xmlAttributeMapping.attributeTypeTouches(pos);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Iterable<String> getCandidateAttributeTypeNames() {
+ return new CompositeIterable<String>(
+ MappingTools.getSortedJavaClassNames(getJavaProject()),
+ CollectionTools.sort(((EclipseLinkPersistenceUnit) this.getPersistenceUnit()).getEclipseLinkDynamicPersistentTypeNames())
+ );
+ }
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddedMapping.java
index bbfb4b7..58574f2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddedMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddedMapping.java
@@ -13,10 +13,14 @@ import java.util.List;
import org.eclipse.jdt.core.IType;
import org.eclipse.jpt.common.core.internal.utility.JDTTools;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.AbstractOrmEmbeddedMapping;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkAccessType;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEmbedded;
@@ -89,4 +93,30 @@ public class OrmEclipseLinkEmbeddedMapping
protected TextRange getAttributeTypeTextRange() {
return this.getValidationTextRange(this.xmlAttributeMapping.getAttributeTypeTextRange());
}
+
+ // ********** completion proposals **********
+
+ @Override
+ public Iterable<String> getCompletionProposals(int pos) {
+ Iterable<String> result = super.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ if (this.attributeTypeTouches(pos)) {
+ return this.getCandidateAttributeTypeNames();
+ }
+ return null;
+ }
+
+ protected boolean attributeTypeTouches(int pos) {
+ return this.xmlAttributeMapping.attributeTypeTouches(pos);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Iterable<String> getCandidateAttributeTypeNames() {
+ return new CompositeIterable<String>(
+ MappingTools.getSortedJavaClassNames(getJavaProject()),
+ CollectionTools.sort(((EclipseLinkPersistenceUnit) this.getPersistenceUnit()).getEclipseLinkDynamicPersistentTypeNames())
+ );
+ }
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java
index d4fa3ec..37a1086 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java
@@ -16,6 +16,7 @@ import org.eclipse.jpt.common.core.internal.utility.JDTTools;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.NotNullFilter;
import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
@@ -40,6 +41,7 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmPersistent
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkEntity;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkMultitenancy2_3;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLink2_3JpaPlatformFactory;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkJpaPlatformVersion;
@@ -458,6 +460,7 @@ public class OrmEclipseLinkEntityImpl
// ********** completion proposals **********
+
@Override
public Iterable<String> getCompletionProposals(int pos) {
Iterable<String> result = super.getCompletionProposals(pos);
@@ -468,7 +471,32 @@ public class OrmEclipseLinkEntityImpl
if (result != null) {
return result;
}
+ result = this.customizer.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ result = this.converterContainer.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ if (this.xmlTypeMapping.parentClassTouches(pos)) {
+ return this.getCandidateParentClassNames();
+ }
+ if (this.classExtractorTouches(pos)) {
+ return this.getCandidateClassNames();
+ }
return null;
}
+ @SuppressWarnings("unchecked")
+ protected Iterable<String> getCandidateParentClassNames() {
+ return new CompositeIterable<String>(
+ super.getCandidateClassNames(),
+ CollectionTools.sort(((EclipseLinkPersistenceUnit) this.getPersistenceUnit()).getEclipseLinkDynamicPersistentTypeNames())
+ );
+ }
+
+ protected boolean classExtractorTouches(int pos) {
+ return this.getXmlClassExtractor() == null? false : this.getXmlClassExtractor().classNameTouches(pos);
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkIdMapping.java
index c6373d4..718cbdb 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkIdMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkIdMapping.java
@@ -195,4 +195,30 @@ public class OrmEclipseLinkIdMapping
protected TextRange getAttributeTypeTextRange() {
return this.getValidationTextRange(this.xmlAttributeMapping.getAttributeTypeTextRange());
}
+
+ // ********** completion proposals **********
+
+ @Override
+ public Iterable<String> getCompletionProposals(int pos) {
+ Iterable<String> result = super.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ result = this.converterContainer.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ if (this.attributeTypeTouches(pos)) {
+ return this.getCandidateAttributeTypeNames();
+ }
+ return null;
+ }
+
+ protected boolean attributeTypeTouches(int pos) {
+ return this.xmlAttributeMapping.attributeTypeTouches(pos);
+ }
+
+ protected Iterable<String> getCandidateAttributeTypeNames() {
+ return MappingTools.getPrimaryBasicTypeNames();
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToManyMapping.java
index 0910c4d..1bec5b2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToManyMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToManyMapping.java
@@ -14,15 +14,18 @@ import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
import org.eclipse.jpt.common.core.internal.utility.JDTTools;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmManyToManyMapping;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkAccessType;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkManyToManyMapping;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmConvertibleMapping;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlManyToMany;
@@ -179,4 +182,48 @@ public class OrmEclipseLinkManyToManyMapping
protected TextRange getAttributeTypeTextRange() {
return this.getValidationTextRange(this.xmlAttributeMapping.getAttributeTypeTextRange());
}
+
+ // ********** completion proposals **********
+
+ @Override
+ public Iterable<String> getCompletionProposals(int pos) {
+ Iterable<String> result = super.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ result = this.converterContainer.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ if (this.attributeTypeTouches(pos)) {
+ return this.getCandidateAttributeTypeNames();
+ }
+ return null;
+ }
+
+ protected boolean attributeTypeTouches(int pos) {
+ return this.xmlAttributeMapping.attributeTypeTouches(pos);
+ }
+
+ protected Iterable<String> getCandidateAttributeTypeNames() {
+ return MappingTools.getCollectionTypeNames();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected Iterable<String> getCandidateTargetEntityClassNames() {
+ return new CompositeIterable<String>(
+ super.getCandidateTargetEntityClassNames(),
+ ((EclipseLinkPersistenceUnit) this.getPersistenceUnit()).getEclipseLinkDynamicPersistentTypeNames()
+ );
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected Iterable<String> getCandidateMapKeyClassNames() {
+ return new CompositeIterable<String>(
+ super.getCandidateMapKeyClassNames(),
+ CollectionTools.sort(((EclipseLinkPersistenceUnit) this.getPersistenceUnit()).getEclipseLinkDynamicPersistentTypeNames())
+ );
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToOneMapping.java
index 381c08a..28874d5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToOneMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToOneMapping.java
@@ -10,10 +10,13 @@
package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm;
import java.util.List;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmManyToOneMapping;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkRelationshipMapping;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlManyToOne;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -60,4 +63,15 @@ public class OrmEclipseLinkManyToOneMapping
super.validate(messages, reporter);
// TODO - join fetch validation
}
+
+ // ********** completion proposals **********
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected Iterable<String> getCandidateTargetEntityClassNames() {
+ return new CompositeIterable<String>(
+ super.getCandidateTargetEntityClassNames(),
+ CollectionTools.sort(((EclipseLinkPersistenceUnit) this.getPersistenceUnit()).getEclipseLinkDynamicPersistentTypeNames())
+ );
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java
index 28de7d3..790aeeb 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java
@@ -14,6 +14,7 @@ import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
import org.eclipse.jpt.common.core.internal.utility.JDTTools;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.NotNullFilter;
import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
@@ -36,6 +37,7 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmPersistent
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkMappedSuperclass;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkMultitenancy2_3;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLink2_3JpaPlatformFactory;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkJpaPlatformVersion;
@@ -416,6 +418,25 @@ public class OrmEclipseLinkMappedSuperclassImpl
if (result != null) {
return result;
}
+ result = this.customizer.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ result = this.converterContainer.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ if (this.xmlTypeMapping.parentClassTouches(pos)) {
+ return this.getCandidateParentClassNames();
+ }
return null;
}
+
+ @SuppressWarnings("unchecked")
+ protected Iterable<String> getCandidateParentClassNames() {
+ return new CompositeIterable<String>(
+ this.getCandidateClassNames(),
+ CollectionTools.sort(((EclipseLinkPersistenceUnit) this.getPersistenceUnit()).getEclipseLinkDynamicPersistentTypeNames())
+ );
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkObjectTypeConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkObjectTypeConverter.java
index 6092247..0feb37a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkObjectTypeConverter.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkObjectTypeConverter.java
@@ -25,8 +25,10 @@ import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.jpa.core.context.JpaContextNode;
import org.eclipse.jpt.jpa.core.context.JpaNamedContextNode;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConversionValue;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkObjectTypeConverter;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkConversionValue;
@@ -283,7 +285,6 @@ public class OrmEclipseLinkObjectTypeConverter
return this.getConversionValuesSize();
}
-
// ********** default object value **********
public String getDefaultObjectValue() {
@@ -482,4 +483,43 @@ public class OrmEclipseLinkObjectTypeConverter
this.addConversionValue().convertFrom(value);
}
}
+
+ // ********** completion proposals **********
+
+ @Override
+ public Iterable<String> getCompletionProposals(int pos) {
+ Iterable<String> result = super.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ if (this.objectTypeTouches(pos)) {
+ return this.getCandidateTypeNames();
+ }
+ if (this.dataTypeTouches(pos)) {
+ return this.getCandidateTypeNames();
+ }
+ return null;
+ }
+
+ protected boolean objectTypeTouches(int pos) {
+ return this.xmlConverter.objectTypeTouches(pos);
+ }
+
+ protected boolean dataTypeTouches(int pos) {
+ return this.xmlConverter.dataTypeTouches(pos);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Iterable<String> getCandidateTypeNames() {
+ return new CompositeIterable<String>(
+ MappingTools.getPrimaryBasicTypeNamesWithoutPrimitives(),
+ MappingTools.getBasicArrayTypeNames(),
+ //Add java enums to cover the case where object type is a user defined Enum
+ MappingTools.getSortedJavaEnumNames(this.getJavaProject())
+ );
+ }
+
+ protected boolean defaultObjectValueTouches(int pos) {
+ return this.xmlConverter.defaultObjectValueTouches(pos);
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToManyMapping.java
index 4468c91..fd7efae 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToManyMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToManyMapping.java
@@ -14,9 +14,11 @@ import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
import org.eclipse.jpt.common.core.internal.utility.JDTTools;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmOneToManyMapping;
import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOneToManyRelationship2_0;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkAccessType;
@@ -26,6 +28,7 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkPrivateOwned;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmConvertibleMapping;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmOneToManyRelationship2_0;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlOneToMany;
@@ -210,4 +213,48 @@ public class OrmEclipseLinkOneToManyMapping
protected TextRange getAttributeTypeTextRange() {
return this.getValidationTextRange(this.xmlAttributeMapping.getAttributeTypeTextRange());
}
+
+ // ********** completion proposals **********
+
+ @Override
+ public Iterable<String> getCompletionProposals(int pos) {
+ Iterable<String> result = super.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ result = this.converterContainer.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ if (this.attributeTypeTouches(pos)) {
+ return this.getCandidateAttributeTypeNames();
+ }
+ return null;
+ }
+
+ protected boolean attributeTypeTouches(int pos) {
+ return this.xmlAttributeMapping.attributeTypeTouches(pos);
+ }
+
+ protected Iterable<String> getCandidateAttributeTypeNames() {
+ return MappingTools.getCollectionTypeNames();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected Iterable<String> getCandidateTargetEntityClassNames() {
+ return new CompositeIterable<String>(
+ super.getCandidateTargetEntityClassNames(),
+ CollectionTools.sort(((EclipseLinkPersistenceUnit) this.getPersistenceUnit()).getEclipseLinkDynamicPersistentTypeNames())
+ );
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected Iterable<String> getCandidateMapKeyClassNames() {
+ return new CompositeIterable<String>(
+ super.getCandidateMapKeyClassNames(),
+ CollectionTools.sort(((EclipseLinkPersistenceUnit) this.getPersistenceUnit()).getEclipseLinkDynamicPersistentTypeNames())
+ );
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToOneMapping.java
index fba1268..bde0711 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToOneMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToOneMapping.java
@@ -10,11 +10,14 @@
package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm;
import java.util.List;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmOneToOneMapping;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkOneToOneMapping;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkPrivateOwned;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlOneToOne;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -73,4 +76,15 @@ public class OrmEclipseLinkOneToOneMapping
super.validate(messages, reporter);
// TODO - private owned, join fetch validation
}
+
+ // ********** completion proposals **********
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected Iterable<String> getCandidateTargetEntityClassNames() {
+ return new CompositeIterable<String>(
+ super.getCandidateTargetEntityClassNames(),
+ CollectionTools.sort(((EclipseLinkPersistenceUnit) this.getPersistenceUnit()).getEclipseLinkDynamicPersistentTypeNames())
+ );
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkStructConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkStructConverter.java
index c6ee760..3bb5ec2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkStructConverter.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkStructConverter.java
@@ -12,6 +12,7 @@ package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm;
import org.eclipse.jdt.core.IType;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.context.JpaContextNode;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkStructConverter;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkStructConverter;
@@ -83,4 +84,26 @@ public class OrmEclipseLinkStructConverter
super.convertFrom(javaConverter);
this.setConverterClass(javaConverter.getConverterClass());
}
+
+ // ********** completion proposals **********
+
+ @Override
+ public Iterable<String> getCompletionProposals(int pos) {
+ Iterable<String> result = super.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ if (this.converterClassNameTouches(pos)) {
+ return this.getCandidateClassNames();
+ }
+ return null;
+ }
+
+ protected Iterable<String> getCandidateClassNames() {
+ return MappingTools.getSortedJavaClassNames(this.getJavaProject());
+ }
+
+ protected boolean converterClassNameTouches(int pos) {
+ return this.xmlConverter.converterClassTouches(pos);
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkStructureMapping2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkStructureMapping2_3.java
index eb9be0e..9943a67 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkStructureMapping2_3.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkStructureMapping2_3.java
@@ -9,11 +9,15 @@
******************************************************************************/
package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping;
import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkStructureMapping2_3;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.Attributes;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlStructure;
@@ -60,4 +64,30 @@ public class OrmEclipseLinkStructureMapping2_3
public void removeXmlAttributeMappingFrom(org.eclipse.jpt.jpa.core.resource.orm.Attributes xmlAttributes) {
((Attributes) xmlAttributes).getStructures().remove(this.xmlAttributeMapping);
}
+
+ // ********** completion proposals **********
+
+ @Override
+ public Iterable<String> getCompletionProposals(int pos) {
+ Iterable<String> result = super.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ if (this.attributeTypeTouches(pos)) {
+ return this.getCandidateAttributeTypeNames();
+ }
+ return null;
+ }
+
+ protected boolean attributeTypeTouches(int pos) {
+ return this.xmlAttributeMapping.attributeTypeTouches(pos);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Iterable<String> getCandidateAttributeTypeNames() {
+ return new CompositeIterable<String>(
+ MappingTools.getSortedJavaClassNames(getJavaProject()),
+ CollectionTools.sort(((EclipseLinkPersistenceUnit) this.getPersistenceUnit()).getEclipseLinkDynamicPersistentTypeNames())
+ );
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkTransformationMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkTransformationMapping.java
index 8bb804a..a297d85 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkTransformationMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkTransformationMapping.java
@@ -9,11 +9,15 @@
******************************************************************************/
package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping;
import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTransformationMapping;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.Attributes;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTransformation;
@@ -60,4 +64,32 @@ public class OrmEclipseLinkTransformationMapping
public void removeXmlAttributeMappingFrom(org.eclipse.jpt.jpa.core.resource.orm.Attributes xmlAttributes) {
((Attributes) xmlAttributes).getTransformations().remove(this.xmlAttributeMapping);
}
+
+ // ********** completion proposals **********
+
+ @Override
+ public Iterable<String> getCompletionProposals(int pos) {
+ Iterable<String> result = super.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ if (this.attributeTypeTouches(pos)) {
+ return this.getCandidateAttributeTypeNames();
+ }
+ return null;
+ }
+
+ protected boolean attributeTypeTouches(int pos) {
+ return this.xmlAttributeMapping.attributeTypeTouches(pos);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Iterable<String> getCandidateAttributeTypeNames() {
+ return new CompositeIterable<String>(
+ MappingTools.getSortedJavaClassNames(getJavaProject()),
+ MappingTools.getPrimaryBasicTypeNames(),
+ MappingTools.getCollectionTypeNames(),
+ CollectionTools.sort(((EclipseLinkPersistenceUnit) this.getPersistenceUnit()).getEclipseLinkDynamicPersistentTypeNames())
+ );
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkTypeConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkTypeConverter.java
index a1762ab..6ac3681 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkTypeConverter.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkTypeConverter.java
@@ -12,13 +12,16 @@ package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
import org.eclipse.jpt.jpa.core.context.JpaContextNode;
import org.eclipse.jpt.jpa.core.context.JpaNamedContextNode;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTypeConverter;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkTypeConverter;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlTypeConverter;
import org.eclipse.text.edits.ReplaceEdit;
@@ -266,4 +269,39 @@ public class OrmEclipseLinkTypeConverter
this.setDataType(javaConverter.getFullyQualifiedDataType());
this.setObjectType(javaConverter.getFullyQualifiedObjectType());
}
+
+ // ********** completion proposals **********
+
+ @Override
+ public Iterable<String> getCompletionProposals(int pos) {
+ Iterable<String> result = super.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ if (this.objectTypeTouches(pos)) {
+ return this.getCandidateTypeNames();
+ }
+ if (this.dataTypeTouches(pos)) {
+ return this.getCandidateTypeNames();
+ }
+ return null;
+ }
+
+ protected boolean objectTypeTouches(int pos) {
+ return this.xmlConverter.objectTypeTouches(pos);
+ }
+
+ protected boolean dataTypeTouches(int pos) {
+ return this.xmlConverter.dataTypeTouches(pos);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Iterable<String> getCandidateTypeNames() {
+ return new CompositeIterable<String>(
+ MappingTools.getSortedJavaClassNames(getJavaProject()),
+ MappingTools.getPrimaryBasicTypeNames(),
+ MappingTools.getCollectionTypeNames(),
+ CollectionTools.sort(((EclipseLinkPersistenceUnit) this.getPersistenceUnit()).getEclipseLinkDynamicPersistentTypeNames())
+ );
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVariableOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVariableOneToOneMapping.java
index 0e7351c..e0e6887 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVariableOneToOneMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVariableOneToOneMapping.java
@@ -11,6 +11,7 @@ package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm;
import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping;
import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkVariableOneToOneMapping;
@@ -44,4 +45,26 @@ public class OrmEclipseLinkVariableOneToOneMapping
public void removeXmlAttributeMappingFrom(org.eclipse.jpt.jpa.core.resource.orm.Attributes xmlAttributes) {
((Attributes) xmlAttributes).getVariableOneToOnes().remove(this.xmlAttributeMapping);
}
+
+ // ********** completion proposals **********
+
+ @Override
+ public Iterable<String> getCompletionProposals(int pos) {
+ Iterable<String> result = super.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ if (this.targetInterfaceTouches(pos)) {
+ return this.getCandidateTargetInterfaceNames();
+ }
+ return null;
+ }
+
+ protected boolean targetInterfaceTouches(int pos) {
+ return this.xmlAttributeMapping.targetInterfaceTouches(pos);
+ }
+
+ protected Iterable<String> getCandidateTargetInterfaceNames() {
+ return MappingTools.getSortedJavaInterfaceNames(getJavaProject());
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVersionMapping.java
index 036b8b0..2116852 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVersionMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVersionMapping.java
@@ -9,8 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm;
+import java.sql.Timestamp;
+import java.util.ArrayList;
import java.util.List;
-
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
import org.eclipse.jpt.common.core.internal.utility.JDTTools;
@@ -206,4 +207,38 @@ public class OrmEclipseLinkVersionMapping
protected TextRange getAttributeTypeTextRange() {
return this.getValidationTextRange(this.xmlAttributeMapping.getAttributeTypeTextRange());
}
+
+ // ********** completion proposals **********
+
+ @Override
+ public Iterable<String> getCompletionProposals(int pos) {
+ Iterable<String> result = super.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ result = this.converterContainer.getCompletionProposals(pos);
+ if (result != null) {
+ return result;
+ }
+ if (this.attributeTypeTouches(pos)) {
+ return this.getCandidateAttributeTypeNames();
+ }
+ return null;
+ }
+
+ protected boolean attributeTypeTouches(int pos) {
+ return this.xmlAttributeMapping.attributeTypeTouches(pos);
+ }
+
+ protected Iterable<String> getCandidateAttributeTypeNames() {
+ List<String> names = new ArrayList<String>();
+ names.add(int.class.getName());
+ names.add(Integer.class.getSimpleName());
+ names.add(short.class.getName());
+ names.add(Short.class.getSimpleName());
+ names.add(long.class.getName());
+ names.add(Long.class.getSimpleName());
+ names.add(Timestamp.class.getName());
+ return names;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlArray.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlArray.java
index 105a4a6..4c6c17b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlArray.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlArray.java
@@ -1301,6 +1301,24 @@ public class XmlArray extends AbstractXmlAttributeMapping implements XmlAttribut
return (textRange != null) && (textRange.touches(pos));
}
+ protected TextRange getAttributeTypeCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink2_3.ARRAY__ATTRIBUTE_TYPE);
+ }
+
+ public boolean attributeTypeTouches(int pos) {
+ TextRange textRange = this.getAttributeTypeCodeAssistTextRange();
+ return (textRange != null) && (textRange.touches(pos));
+ }
+
+ public TextRange getTargetClassCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink2_3.ARRAY__TARGET_CLASS);
+ }
+
+ public boolean targetClassTouches(int pos) {
+ TextRange textRange = this.getTargetClassCodeAssistTextRange();
+ return (textRange != null) && (textRange.touches(pos));
+ }
+
// ******** virtual attribute ************
public void setVirtualAttributeTypes(String attributeType, String targetClass) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlBasic.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlBasic.java
index b91bb27..4ea7fea 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlBasic.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlBasic.java
@@ -1755,6 +1755,15 @@ public class XmlBasic extends org.eclipse.jpt.jpa.core.resource.orm.XmlBasic imp
return (textRange != null) && (textRange.touches(pos));
}
+ protected TextRange getAttributeTypeCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink2_1.ATTRIBUTE_TYPE);
+ }
+
+ public boolean attributeTypeTouches(int pos) {
+ TextRange textRange = this.getAttributeTypeCodeAssistTextRange();
+ return (textRange != null) && (textRange.touches(pos));
+ }
+
// ******** virtual attribute ************
public void setVirtualAttributeTypes(String attributeType, String targetType) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlBasicCollection.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlBasicCollection.java
index f73e7f0..48c088e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlBasicCollection.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlBasicCollection.java
@@ -529,4 +529,15 @@ public class XmlBasicCollection extends AbstractXmlAttributeMapping implements X
public void setVirtualAttributeTypes(String attributeType, String targetType) {
this.setAttributeType(attributeType);
}
+
+ // *********** content assist ************
+
+ protected TextRange getAttributeTypeCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink2_1.ATTRIBUTE_TYPE);
+ }
+
+ public boolean attributeTypeTouches(int pos) {
+ TextRange textRange = this.getAttributeTypeCodeAssistTextRange();
+ return (textRange != null) && (textRange.touches(pos));
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlBasicMap.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlBasicMap.java
index d755c8b..59a542e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlBasicMap.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlBasicMap.java
@@ -529,4 +529,15 @@ public class XmlBasicMap extends AbstractXmlAttributeMapping implements XmlAttri
public void setVirtualAttributeTypes(String attributeType, String targetType) {
this.setAttributeType(attributeType);
}
+
+ // *********** content assist ************
+
+ protected TextRange getAttributeTypeCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink2_1.ATTRIBUTE_TYPE);
+ }
+
+ public boolean attributeTypeTouches(int pos) {
+ TextRange textRange = this.getAttributeTypeCodeAssistTextRange();
+ return (textRange != null) && (textRange.touches(pos));
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlConverter.java
index 4461506..eebfd52 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlConverter.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlConverter.java
@@ -253,4 +253,14 @@ public class XmlConverter extends XmlNamedConverter
return new ReplaceEdit(offset, packageLength, newPackageName);
}
+ // ********** content assist ***************
+
+ public TextRange getConverterClassCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink.CONVERTER__CLASS);
+ }
+
+ public boolean converterClassTouches(int pos) {
+ TextRange textRange = this.getConverterClassCodeAssistTextRange();
+ return (textRange != null) && textRange.touches(pos);
+ }
} // XmlConverter
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlElementCollection.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlElementCollection.java
index 18ebb3f..255ad31 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlElementCollection.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlElementCollection.java
@@ -2405,6 +2405,15 @@ public class XmlElementCollection extends org.eclipse.jpt.jpa.core.resource.orm.
return (textRange != null) && (textRange.touches(pos));
}
+ protected TextRange getAttributeTypeCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink2_1.ATTRIBUTE_TYPE);
+ }
+
+ public boolean attributeTypeTouches(int pos) {
+ TextRange textRange = this.getAttributeTypeCodeAssistTextRange();
+ return (textRange != null) && (textRange.touches(pos));
+ }
+
// ******** virtual attribute ************
public void setVirtualAttributeTypes(String attributeType, String targetClass) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEmbeddable.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEmbeddable.java
index f24a9aa..04d6f2e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEmbeddable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEmbeddable.java
@@ -1715,4 +1715,14 @@ public class XmlEmbeddable extends org.eclipse.jpt.jpa.core.resource.orm.XmlEmbe
return XmlNoSql.buildTranslator(EclipseLink2_4.NO_SQL, EclipseLinkOrmV2_4Package.eINSTANCE.getXmlEmbeddable_2_4_NoSql());
}
+ // *********** content assist ************
+
+ public TextRange getParentClassCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink2_1.PARENT_CLASS);
+ }
+
+ public boolean parentClassTouches(int pos) {
+ TextRange textRange = this.getParentClassCodeAssistTextRange();
+ return (textRange != null) && (textRange.touches(pos));
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEmbedded.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEmbedded.java
index 3db0bea..50f3183 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEmbedded.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEmbedded.java
@@ -569,4 +569,15 @@ public class XmlEmbedded extends org.eclipse.jpt.jpa.core.resource.orm.XmlEmbedd
this.setAttributeType(attributeType);
}
+ // *********** content assist ************
+
+ protected TextRange getAttributeTypeCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink2_1.ATTRIBUTE_TYPE);
+ }
+
+ public boolean attributeTypeTouches(int pos) {
+ TextRange textRange = this.getAttributeTypeCodeAssistTextRange();
+ return (textRange != null) && (textRange.touches(pos));
+ }
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEmbeddedId.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEmbeddedId.java
index 0087894..88825fa 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEmbeddedId.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEmbeddedId.java
@@ -462,4 +462,15 @@ public class XmlEmbeddedId extends org.eclipse.jpt.jpa.core.resource.orm.XmlEmbe
this.setAttributeType(attributeType);
}
+ // *********** content assist ************
+
+ protected TextRange getAttributeTypeCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink2_1.ATTRIBUTE_TYPE);
+ }
+
+ public boolean attributeTypeTouches(int pos) {
+ TextRange textRange = this.getAttributeTypeCodeAssistTextRange();
+ return (textRange != null) && (textRange.touches(pos));
+ }
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEntity.java
index cc3bbe9..4aaa925 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEntity.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEntity.java
@@ -3985,4 +3985,15 @@ public class XmlEntity extends org.eclipse.jpt.jpa.core.resource.orm.XmlEntity i
protected static Translator buildNoSqlTranslator() {
return XmlNoSql.buildTranslator(EclipseLink2_4.NO_SQL, EclipseLinkOrmV2_4Package.eINSTANCE.getXmlEntity_2_4_NoSql());
}
+
+ // *********** content assist ************
+
+ public TextRange getParentClassCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink2_1.PARENT_CLASS);
+ }
+
+ public boolean parentClassTouches(int pos) {
+ TextRange textRange = this.getParentClassCodeAssistTextRange();
+ return (textRange != null) && (textRange.touches(pos));
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlId.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlId.java
index 8aabb7e..a37cb0c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlId.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlId.java
@@ -1309,4 +1309,15 @@ public class XmlId extends org.eclipse.jpt.jpa.core.resource.orm.XmlId implement
public void setVirtualAttributeTypes(String attributeType, String targetType) {
this.setAttributeType(attributeType);
}
+
+ // *********** content assist ************
+
+ protected TextRange getAttributeTypeCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink2_1.ATTRIBUTE_TYPE);
+ }
+
+ public boolean attributeTypeTouches(int pos) {
+ TextRange textRange = this.getAttributeTypeCodeAssistTextRange();
+ return (textRange != null) && (textRange.touches(pos));
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlManyToMany.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlManyToMany.java
index c3e22ad..685591f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlManyToMany.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlManyToMany.java
@@ -2115,4 +2115,15 @@ public class XmlManyToMany extends org.eclipse.jpt.jpa.core.resource.orm.XmlMany
this.setAttributeType(attributeType);
this.setTargetEntity(targetEntity);
}
+
+ // *********** content assist ************
+
+ protected TextRange getAttributeTypeCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink2_1.ATTRIBUTE_TYPE);
+ }
+
+ public boolean attributeTypeTouches(int pos) {
+ TextRange textRange = this.getAttributeTypeCodeAssistTextRange();
+ return (textRange != null) && (textRange.touches(pos));
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlMappedSuperclass.java
index 7428a0a..cd7c996 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlMappedSuperclass.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlMappedSuperclass.java
@@ -4122,4 +4122,15 @@ public class XmlMappedSuperclass extends org.eclipse.jpt.jpa.core.resource.orm.X
protected static Translator buildUuidGeneratorTranslator() {
return XmlUuidGenerator.buildTranslator(EclipseLink2_4.UUID_GENERATOR, EclipseLinkOrmV2_4Package.eINSTANCE.getXmlGeneratorContainer2_4_UuidGenerator());
}
+
+ // *********** content assist ************
+
+ public TextRange getParentClassCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink2_1.PARENT_CLASS);
+ }
+
+ public boolean parentClassTouches(int pos) {
+ TextRange textRange = this.getParentClassCodeAssistTextRange();
+ return (textRange != null) && (textRange.touches(pos));
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlObjectTypeConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlObjectTypeConverter.java
index 003aa31..bea986d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlObjectTypeConverter.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlObjectTypeConverter.java
@@ -22,6 +22,7 @@ import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.jdt.core.IType;
import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.text.edits.ReplaceEdit;
import org.eclipse.wst.common.internal.emf.resource.Translator;
@@ -484,4 +485,32 @@ public class XmlObjectTypeConverter extends XmlNamedConverter
return new ReplaceEdit(offset, packageLength, newPackageName);
}
+ // ********** content assist ***************
+
+ public TextRange getObjectTypeCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink.OBJECT_TYPE_CONVERTER__OBJECT_TYPE);
+ }
+
+ public boolean objectTypeTouches(int pos) {
+ TextRange textRange = this.getObjectTypeCodeAssistTextRange();
+ return (textRange != null) && textRange.touches(pos);
+ }
+
+ public TextRange getDataTypeCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink.OBJECT_TYPE_CONVERTER__DATA_TYPE);
+ }
+
+ public boolean dataTypeTouches(int pos) {
+ TextRange textRange = this.getDataTypeCodeAssistTextRange();
+ return (textRange != null) && textRange.touches(pos);
+ }
+
+ public TextRange getDefaultObjectValueCodeAssistTextRange() {
+ return getElementCodeAssistTextRange(EclipseLink.OBJECT_TYPE_CONVERTER__DEFAULT_OBJECT_VALUE);
+ }
+
+ public boolean defaultObjectValueTouches(int pos) {
+ TextRange textRange = this.getDefaultObjectValueCodeAssistTextRange();
+ return (textRange != null) && textRange.touches(pos);
+ }
} // XmlObjectTypeConverter
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlOneToMany.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlOneToMany.java
index 6203eb5..f612ab7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlOneToMany.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlOneToMany.java
@@ -2278,4 +2278,15 @@ public class XmlOneToMany extends org.eclipse.jpt.jpa.core.resource.orm.XmlOneTo
this.setAttributeType(attributeType);
this.setTargetEntity(targetEntity);
}
+
+ // *********** content assist ************
+
+ protected TextRange getAttributeTypeCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink2_1.ATTRIBUTE_TYPE);
+ }
+
+ public boolean attributeTypeTouches(int pos) {
+ TextRange textRange = this.getAttributeTypeCodeAssistTextRange();
+ return (textRange != null) && (textRange.touches(pos));
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlStructConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlStructConverter.java
index 9b2715f..7d86003 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlStructConverter.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlStructConverter.java
@@ -257,4 +257,15 @@ public class XmlStructConverter extends XmlNamedConverter
int offset = getAttributeNode(EclipseLink.STRUCT_CONVERTER__CONVERTER).getValueRegionStartOffset() + 1; // +1 = opening double quote
return new ReplaceEdit(offset, packageLength, newPackageName);
}
+
+ // ********** content assist ***************
+
+ public TextRange getConverterClassCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink.STRUCT_CONVERTER__CONVERTER);
+ }
+
+ public boolean converterClassTouches(int pos) {
+ TextRange textRange = this.getConverterClassCodeAssistTextRange();
+ return (textRange != null) && textRange.touches(pos);
+ }
} // XmlStructConverter
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlStructure.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlStructure.java
index bbe016f..d083d02 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlStructure.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlStructure.java
@@ -471,4 +471,15 @@ public class XmlStructure extends AbstractXmlAttributeMapping implements XmlAttr
public void setVirtualAttributeTypes(String attributeType, String targetType) {
this.setAttributeType(attributeType);
}
+
+ // *********** content assist ************
+
+ protected TextRange getAttributeTypeCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink2_3.STRUCTURE__ATTRIBUTE_TYPE);
+ }
+
+ public boolean attributeTypeTouches(int pos) {
+ TextRange textRange = this.getAttributeTypeCodeAssistTextRange();
+ return (textRange != null) && (textRange.touches(pos));
+ }
} // XmlStructure
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlTransformation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlTransformation.java
index 02279c2..205a216 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlTransformation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlTransformation.java
@@ -466,4 +466,15 @@ public class XmlTransformation extends AbstractXmlAttributeMapping implements Xm
this.setAttributeType(attributeType);
}
+ // *********** content assist ************
+
+ protected TextRange getAttributeTypeCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink2_1.ATTRIBUTE_TYPE);
+ }
+
+ public boolean attributeTypeTouches(int pos) {
+ TextRange textRange = this.getAttributeTypeCodeAssistTextRange();
+ return (textRange != null) && (textRange.touches(pos));
+ }
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlTypeConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlTypeConverter.java
index 7096edb..b839d9b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlTypeConverter.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlTypeConverter.java
@@ -16,6 +16,7 @@ import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.jdt.core.IType;
import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator;
+import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.text.edits.ReplaceEdit;
import org.eclipse.wst.common.internal.emf.resource.Translator;
@@ -346,4 +347,23 @@ public class XmlTypeConverter extends XmlNamedConverter
return new ReplaceEdit(offset, packageLength, newPackageName);
}
+ // ********** content assist ***************
+
+ public TextRange getObjectTypeCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink.TYPE_CONVERTER__OBJECT_TYPE);
+ }
+
+ public boolean objectTypeTouches(int pos) {
+ TextRange textRange = this.getObjectTypeCodeAssistTextRange();
+ return (textRange != null) && textRange.touches(pos);
+ }
+
+ public TextRange getDataTypeCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink.TYPE_CONVERTER__DATA_TYPE);
+ }
+
+ public boolean dataTypeTouches(int pos) {
+ TextRange textRange = this.getDataTypeCodeAssistTextRange();
+ return (textRange != null) && textRange.touches(pos);
+ }
} // XmlTypeConverter
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlVariableOneToOne.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlVariableOneToOne.java
index 5924728..73a57b8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlVariableOneToOne.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlVariableOneToOne.java
@@ -1379,4 +1379,15 @@ public class XmlVariableOneToOne extends AbstractXmlAttributeMapping implements
this.setTargetInterface(targetInterface);
}
+ // *********** content assist ************
+
+ protected TextRange getTargetInterfaceCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink.VARIABLE_ONE_TO_ONE__TARGET_INTERFACE);
+ }
+
+ public boolean targetInterfaceTouches(int pos) {
+ TextRange textRange = this.getTargetInterfaceCodeAssistTextRange();
+ return (textRange != null) && (textRange.touches(pos));
+ }
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlVersion.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlVersion.java
index 0ff1ffc..cb46b87 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlVersion.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlVersion.java
@@ -987,6 +987,15 @@ public class XmlVersion extends org.eclipse.jpt.jpa.core.resource.orm.XmlVersion
return (textRange != null) && (textRange.touches(pos));
}
+ protected TextRange getAttributeTypeCodeAssistTextRange() {
+ return getAttributeCodeAssistTextRange(EclipseLink2_1.ATTRIBUTE_TYPE);
+ }
+
+ public boolean attributeTypeTouches(int pos) {
+ TextRange textRange = this.getAttributeTypeCodeAssistTextRange();
+ return (textRange != null) && (textRange.touches(pos));
+ }
+
// ******** virtual attribute ************
public void setVirtualAttributeTypes(String attributeType, String targetType) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaXmlCompletionProposalComputer.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaXmlCompletionProposalComputer.java
index b107ac9..7831f10 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaXmlCompletionProposalComputer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaXmlCompletionProposalComputer.java
@@ -77,7 +77,7 @@ public class JpaXmlCompletionProposalComputer extends DefaultJpaXmlCompletionPro
}
// initialize newMatchingString to an empty string to handle the case when user invokes code assist without giving delimiter
- String newMatchString = "";
+ String newMatchString = ""; //$NON-NLS-1$
if ((matchString.length() > 0) && (matchString.startsWith("\"") || matchString.startsWith("'"))) { //$NON-NLS-1$ //$NON-NLS-2$
newMatchString = matchString.substring(1);
}
@@ -89,9 +89,9 @@ public class JpaXmlCompletionProposalComputer extends DefaultJpaXmlCompletionPro
// handle values that include special characters like double-quote or apostrophe
String convertedPossibleValue = null;
- if (matchString.startsWith("\"")) {
+ if (matchString.startsWith("\"")) { //$NON-NLS-1$
convertedPossibleValue = StringTools.convertToXmlStringLiteralQuote(possibleValue);
- } else if (matchString.startsWith("'")) {
+ } else if (matchString.startsWith("'")) { //$NON-NLS-1$
convertedPossibleValue = StringTools.convertToXmlStringLiteralApostrophe(possibleValue);
} else {
// convert to XML string literal with quotes by default
@@ -101,12 +101,12 @@ public class JpaXmlCompletionProposalComputer extends DefaultJpaXmlCompletionPro
CompletionProposal proposal = null;
// give users an additional message if value includes special characters since what is written
// to XML is most likely different from what is shown in the proposal list with this case
- if (possibleValue.startsWith("\"")) {
+ if (possibleValue.startsWith("\"")) { //$NON-NLS-1$
// handle the case when user does ""<invoke code assist here>" trying to get these special values
// User cannot do ""F<invoke code assist here>" or ""F<invoke code assist here>"" trying to
// get these values that are special and start with F because XML would regard the F as the
// start of another attribute since there are two double-quotes exist before F.
- if (matchString.startsWith("\"") && newMatchString.startsWith("\"")) {
+ if (matchString.startsWith("\"") && newMatchString.startsWith("\"")) { //$NON-NLS-1$ //$NON-NLS-2$
proposal = new CompletionProposal(
convertedPossibleValue, rOffset, rLength + 1, convertedPossibleValue.length(), null,
possibleValue, null, JptUiMessages.JpaXmlCompletionProposalComputer_SpecialNameMsg);
@@ -178,14 +178,14 @@ public class JpaXmlCompletionProposalComputer extends DefaultJpaXmlCompletionPro
String convertedPossibleValue = null;
if ((matchString.length() == 0) || StringTools.stringStartsWithIgnoreCase(possibleValue, matchString)) {
- if (possibleValue.startsWith("\"")) {
+ if (possibleValue.startsWith("\"")) { //$NON-NLS-1$
convertedPossibleValue = StringTools.convertToXmlElementStringLiteral(possibleValue);
} else {
convertedPossibleValue = possibleValue;
}
CompletionProposal proposal = null;
- if (possibleValue.startsWith("\"")) {
+ if (possibleValue.startsWith("\"")) { //$NON-NLS-1$
proposal = new CompletionProposal(
convertedPossibleValue, begin, length, convertedPossibleValue.length(),
JptJpaUiPlugin.instance().getImage(JptUiIcons.JPA_CONTENT), possibleValue, null,
@@ -229,7 +229,10 @@ public class JpaXmlCompletionProposalComputer extends DefaultJpaXmlCompletionPro
List<String> list = new ArrayList<String>();
for (JpaStructureNode node : rootStructureNodes) {
- CollectionTools.addAll(list, ((XmlFile.Root) node).getCompletionProposals(documentPosition));
+ Iterable<String> proposals = ((XmlFile.Root) node).getCompletionProposals(documentPosition);
+ if (proposals != null) {
+ CollectionTools.addAll(list, proposals);
+ }
}
return list;
}