[jbosstools-commits] JBoss Tools SVN: r30351 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Apr 6 04:24:22 EDT 2011


Author: dgeraskov
Date: 2011-04-06 04:24:21 -0400 (Wed, 06 Apr 2011)
New Revision: 30351

Modified:
   trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaBasicMappingImpl.java
   trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaIdMappingImpl.java
   trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/IndexImpl.java
   trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaIndex.java
Log:
https://issues.jboss.org/browse/JBIDE-8682
@Index update

Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaBasicMappingImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaBasicMappingImpl.java	2011-04-06 08:21:11 UTC (rev 30350)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaBasicMappingImpl.java	2011-04-06 08:24:21 UTC (rev 30351)
@@ -45,6 +45,8 @@
 	public HibernateJavaBasicMappingImpl(JavaPersistentAttribute parent) {
 		super(parent);
 		this.typeDefContainer = getJpaFactory().buildJavaTypeDefContainer(parent);
+		this.index = this.buildIndex();
+		this.type = this.buildType();
 	}
 
 	/*@Override
@@ -64,8 +66,8 @@
 		super.synchronizeWithResourceModel();
 		this.typeDefContainer.synchronizeWithResourceModel();
 		this.specifiedGenerationTime = this.getResourceGenerationTime();
-		this.initializeIndex();
-		this.initializeType();
+		this.syncIndex();
+		this.syncType();
 	}
 
 	@Override
@@ -73,28 +75,32 @@
 		super.update();
 		this.typeDefContainer.update(this.getResourcePersistentAttribute());
 		this.setGenerationTime_(this.getResourceGenerationTime());
-		this.updateIndex();
-		this.updateType();
+		if (this.index != null){
+			this.index.update();
+		}
+		if (this.type != null){
+			this.type.update();
+		}
 	}
 
 	public HibernateJavaTypeDefContainer getTypeDefContainer() {
 		return this.typeDefContainer;
 	}
 
-	public GeneratedAnnotation getResourceGenerated() {
+	public GeneratedAnnotation getGeneratedAnnotation() {
 		return (GeneratedAnnotation) getResourcePersistentAttribute().getAnnotation(GeneratedAnnotation.ANNOTATION_NAME);
 	}
 
-	public GeneratedAnnotation addResourceGenerated() {
+	public GeneratedAnnotation buildGeneratedAnnotation() {
 		return (GeneratedAnnotation) getResourcePersistentAttribute().addAnnotation(GeneratedAnnotation.ANNOTATION_NAME);
 	}
 
-	public void removeResourceGenerated() {
+	public void removeGeneratedAnnotation() {
 		getResourcePersistentAttribute().removeAnnotation(GeneratedAnnotation.ANNOTATION_NAME);
 	}
 
 	protected GenerationTime getResourceGenerationTime(){
-		GeneratedAnnotation geneatedAnnotation = getResourceGenerated();
+		GeneratedAnnotation geneatedAnnotation = getGeneratedAnnotation();
 		return geneatedAnnotation == null ? null : geneatedAnnotation.getValue();
 	}
 
@@ -106,12 +112,12 @@
 		GenerationTime oldValue = this.specifiedGenerationTime;
 		this.specifiedGenerationTime = newValue;
 		if (newValue != null){
-			GeneratedAnnotation annotation = getResourceGenerated() != null
-			? getResourceGenerated()
-					: addResourceGenerated();
+			GeneratedAnnotation annotation = getGeneratedAnnotation() != null
+			? getGeneratedAnnotation()
+					: buildGeneratedAnnotation();
 			annotation.setValue(newValue);
 		} else {
-			removeResourceGenerated();
+			removeGeneratedAnnotation();
 		}
 		firePropertyChanged(Generated.GENERATION_TIME_PROPERTY, oldValue, newValue);
 	}
@@ -122,144 +128,132 @@
 		firePropertyChanged(Generated.GENERATION_TIME_PROPERTY, oldValue, newGenerationTime);
 	}
 
-	public void removeResourceIndex() {
-		getResourcePersistentAttribute().removeAnnotation(IndexAnnotation.ANNOTATION_NAME);
-	}
-
 	// *** index
-
-	protected void initializeIndex() {
-		IndexAnnotation indexResource = getResourceIndex();
-		if (indexResource != null) {
-			this.index = buildIndex(indexResource);
-		}
+	public JavaIndex getIndex() {
+		return this.index;
 	}
-
-	protected void updateIndex() {
-		IndexAnnotation indexResource = getResourceIndex();
-		if (indexResource == null) {
-			if (getIndex() != null) {
-				setIndex(null);
-			}
-		}
-		else {
-			if (getIndex() == null) {
-				setIndex(buildIndex(indexResource));
-			}
-			else {
-				getIndex().update(indexResource);
-			}
-		}
-	}
-
+	
 	public JavaIndex addIndex() {
 		if (getIndex() != null) {
 			throw new IllegalStateException("index already exists"); //$NON-NLS-1$
 		}
-		this.index = getJpaFactory().buildIndex(this);
-		IndexAnnotation indexResource = (IndexAnnotation) getResourcePersistentAttribute().addAnnotation(IndexAnnotation.ANNOTATION_NAME);
-		this.index.initialize(indexResource);
-		firePropertyChanged(INDEX_PROPERTY, null, this.index);
-		return this.index;
+		IndexAnnotation annotation = this.buildIndexAnnotation();
+		JavaIndex index = this.buildIndex(annotation);
+		this.setIndex(index);
+		return index;
 	}
-
-	public JavaIndex getIndex() {
-		return this.index;
+	
+	protected IndexAnnotation buildIndexAnnotation() {
+		return (IndexAnnotation) this.getResourcePersistentAttribute().addAnnotation(IndexAnnotation.ANNOTATION_NAME);
 	}
-
-	protected void setIndex(JavaIndex newIndex) {
-		JavaIndex oldIndex = this.index;
-		this.index = newIndex;
-		firePropertyChanged(INDEX_PROPERTY, oldIndex, newIndex);
-	}
-
+	
 	public void removeIndex() {
 		if (getIndex() == null) {
 			throw new IllegalStateException("index does not exist, cannot be removed"); //$NON-NLS-1$
 		}
-		JavaIndex oldIndex = this.index;
-		this.index = null;
 		this.getResourcePersistentAttribute().removeAnnotation(IndexAnnotation.ANNOTATION_NAME);
-		firePropertyChanged(INDEX_PROPERTY, oldIndex, null);
+		setIndex(null);
 	}
 
-	protected JavaIndex buildIndex(IndexAnnotation indexResource) {
-		JavaIndex index = getJpaFactory().buildIndex(this);
-		index.initialize(indexResource);
-		return index;
+	protected JavaIndex buildIndex() {
+		IndexAnnotation annotation = getIndexAnnotation();
+		return (annotation == null) ? null : buildIndex(annotation);
 	}
-
-	protected IndexAnnotation getResourceIndex() {
+	
+	protected IndexAnnotation getIndexAnnotation() {
 		return (IndexAnnotation) this.getResourcePersistentAttribute().getAnnotation(IndexAnnotation.ANNOTATION_NAME);
 	}
-
-	// *** type
-
-	protected void initializeType() {
-		TypeAnnotation typeResource = getTypeResource();
-		if (typeResource != null) {
-			this.type = buildType(typeResource);
-		}
+	
+	protected JavaIndex buildIndex(IndexAnnotation annotation) {
+		return this.getJpaFactory().buildIndex(this, annotation);
 	}
 
-	protected void updateType() {
-		TypeAnnotation typeResource = getTypeResource();
-		if (typeResource == null) {
-			if (getType() != null) {
-				setType(null);
+	protected void syncIndex() {
+		IndexAnnotation annotation = getIndexAnnotation();
+		if (annotation == null) {
+			if (getIndex() != null) {
+				setIndex(null);
 			}
 		}
 		else {
-			if (getType() == null) {
-				setType(buildType(typeResource));
+			if ((getIndex() != null) && (getIndex().getIndexAnnotation() == annotation)) {
+				this.index.synchronizeWithResourceModel();
+			} else {
+				this.setIndex(this.buildIndex(annotation));
 			}
-			else {
-				getType().update(typeResource);
-			}
 		}
 	}
 
-	public JavaType addType() {
-		if (getType() != null) {
-			throw new IllegalStateException("type already exists"); //$NON-NLS-1$
-		}
-		this.type = getJpaFactory().buildType(this);
-		TypeAnnotation typeResource = (TypeAnnotation) getResourcePersistentAttribute().addAnnotation(TypeAnnotation.ANNOTATION_NAME);
-		this.type.initialize(typeResource);
-		firePropertyChanged(TYPE_PROPERTY, null, this.type);
-		return this.type;
+	protected void setIndex(JavaIndex newIndex) {
+		JavaIndex oldIndex = this.index;
+		this.index = newIndex;
+		firePropertyChanged(INDEX_PROPERTY, oldIndex, newIndex);
 	}
 
+
+	// ********** type **********
+
 	public JavaType getType() {
 		return this.type;
 	}
 
-	protected void setType(JavaType newType) {
-		JavaType oldType = this.type;
-		this.type = newType;
-		firePropertyChanged(TYPE_PROPERTY, oldType, newType);
+	public JavaType addType() {
+		if (this.type != null) {
+			throw new IllegalStateException("type already exists: " + this.type); //$NON-NLS-1$
+		}
+		TypeAnnotation annotation = this.buildTypeAnnotation();
+		JavaType value = this.buildType(annotation);
+		this.setType(value);
+		return value;
 	}
 
+	protected TypeAnnotation buildTypeAnnotation() {
+		return (TypeAnnotation) this.getResourcePersistentAttribute().addAnnotation(TypeAnnotation.ANNOTATION_NAME);
+	}
+
 	public void removeType() {
-		if (getType() == null) {
-			throw new IllegalStateException("type does not exist, cannot be removed"); //$NON-NLS-1$
+		if (this.type == null) {
+			throw new IllegalStateException("generated value does not exist"); //$NON-NLS-1$
 		}
-		JavaType oldType = this.type;
-		this.type = null;
 		this.getResourcePersistentAttribute().removeAnnotation(TypeAnnotation.ANNOTATION_NAME);
-		firePropertyChanged(TYPE_PROPERTY, oldType, null);
+		this.setType(null);
 	}
 
-	protected JavaType buildType(TypeAnnotation typeResource) {
-		JavaType type = getJpaFactory().buildType(this);
-		type.initialize(typeResource);
-		return type;
+	protected JavaType buildType() {
+		TypeAnnotation annotation = this.getTypeAnnotation();
+		return (annotation == null) ? null : this.buildType(annotation);
 	}
 
-	protected TypeAnnotation getTypeResource() {
+	protected TypeAnnotation getTypeAnnotation() {
 		return (TypeAnnotation) this.getResourcePersistentAttribute().getAnnotation(TypeAnnotation.ANNOTATION_NAME);
 	}
 
+	protected JavaType buildType(TypeAnnotation generatedValueAnnotation) {
+		return this.getJpaFactory().buildType(this, generatedValueAnnotation);
+	}
+
+	protected void syncType() {
+		TypeAnnotation annotation = this.getTypeAnnotation();
+		if (annotation == null) {
+			if (this.type != null) {
+				this.setType(null);
+			}
+		}
+		else {
+			if ((this.type != null) && (this.type.getTypeAnnotation() == annotation)) {
+				this.type.synchronizeWithResourceModel();
+			} else {
+				this.setType(this.buildType(annotation));
+			}
+		}
+	}
+
+	protected void setType(JavaType value) {
+		JavaType old = this.type;
+		this.type = value;
+		this.firePropertyChanged(TYPE_PROPERTY, old, value);
+	}
+
 	/*
 	 * (non-Javadoc)
 	 *

Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaIdMappingImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaIdMappingImpl.java	2011-04-06 08:21:11 UTC (rev 30350)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaIdMappingImpl.java	2011-04-06 08:24:21 UTC (rev 30351)
@@ -42,6 +42,8 @@
 	public HibernateJavaIdMappingImpl(JavaPersistentAttribute parent) {
 		super(parent);
 		this.typeDefContainer = getJpaFactory().buildJavaTypeDefContainer(parent);
+		this.index = this.buildIndex();
+		this.type = this.buildType();
 	}
 
 	@Override
@@ -65,16 +67,20 @@
 	public void synchronizeWithResourceModel() {
 		super.synchronizeWithResourceModel();
 		this.typeDefContainer.synchronizeWithResourceModel();
-		this.initializeIndex();
-		this.initializeType();
+		this.syncIndex();
+		this.syncType();
 	}
 
 	@Override
 	public void update() {
 		super.update();
 		this.typeDefContainer.update(this.getResourcePersistentAttribute());
-		this.updateIndex();
-		this.updateType();
+		if (this.index != null){
+			this.index.update();
+		}
+		if (this.type != null){
+			this.type.update();
+		}
 	}
 
 	@Override
@@ -91,140 +97,133 @@
 		return this.typeDefContainer;
 	}
 
-	// *** index
 
-	protected void initializeIndex() {
-		IndexAnnotation indexResource = getResourceIndex();
-		if (indexResource != null) {
-			this.index = buildIndex(indexResource);
-		}
+	// *** index
+	public JavaIndex getIndex() {
+		return this.index;
 	}
-
-	protected void updateIndex() {
-		IndexAnnotation indexResource = getResourceIndex();
-		if (indexResource == null) {
-			if (getIndex() != null) {
-				setIndex(null);
-			}
-		}
-		else {
-			if (getIndex() == null) {
-				setIndex(buildIndex(indexResource));
-			}
-			else {
-				getIndex().update(indexResource);
-			}
-		}
-	}
-
+	
 	public JavaIndex addIndex() {
 		if (getIndex() != null) {
 			throw new IllegalStateException("index already exists"); //$NON-NLS-1$
 		}
-		this.index = getJpaFactory().buildIndex(this);
-		IndexAnnotation indexResource = (IndexAnnotation) getResourcePersistentAttribute().addAnnotation(IndexAnnotation.ANNOTATION_NAME);
-		this.index.initialize(indexResource);
-		firePropertyChanged(INDEX_PROPERTY, null, this.index);
-		return this.index;
+		IndexAnnotation annotation = this.buildIndexAnnotation();
+		JavaIndex index = this.buildIndex(annotation);
+		this.setIndex(index);
+		return index;
 	}
-
-	public JavaIndex getIndex() {
-		return this.index;
+	
+	protected IndexAnnotation buildIndexAnnotation() {
+		return (IndexAnnotation) this.getResourcePersistentAttribute().addAnnotation(IndexAnnotation.ANNOTATION_NAME);
 	}
-
-	protected void setIndex(JavaIndex newIndex) {
-		JavaIndex oldIndex = this.index;
-		this.index = newIndex;
-		firePropertyChanged(INDEX_PROPERTY, oldIndex, newIndex);
-	}
-
+	
 	public void removeIndex() {
 		if (getIndex() == null) {
 			throw new IllegalStateException("index does not exist, cannot be removed"); //$NON-NLS-1$
 		}
-		JavaIndex oldIndex = this.index;
-		this.index = null;
 		this.getResourcePersistentAttribute().removeAnnotation(IndexAnnotation.ANNOTATION_NAME);
-		firePropertyChanged(INDEX_PROPERTY, oldIndex, null);
+		setIndex(null);
 	}
 
-	protected JavaIndex buildIndex(IndexAnnotation indexResource) {
-		JavaIndex index = getJpaFactory().buildIndex(this);
-		index.initialize(indexResource);
-		return index;
+	protected JavaIndex buildIndex() {
+		IndexAnnotation annotation = getIndexAnnotation();
+		return (annotation == null) ? null : buildIndex(annotation);
 	}
-
-	protected IndexAnnotation getResourceIndex() {
+	
+	protected IndexAnnotation getIndexAnnotation() {
 		return (IndexAnnotation) this.getResourcePersistentAttribute().getAnnotation(IndexAnnotation.ANNOTATION_NAME);
 	}
-
-	// *** type
-
-	protected void initializeType() {
-		TypeAnnotation typeResource = getTypeResource();
-		if (typeResource != null) {
-			this.type = buildType(typeResource);
-		}
+	
+	protected JavaIndex buildIndex(IndexAnnotation annotation) {
+		return this.getJpaFactory().buildIndex(this, annotation);
 	}
 
-	protected void updateType() {
-		TypeAnnotation typeResource = getTypeResource();
-		if (typeResource == null) {
-			if (getType() != null) {
-				setType(null);
+	protected void syncIndex() {
+		IndexAnnotation annotation = getIndexAnnotation();
+		if (annotation == null) {
+			if (getIndex() != null) {
+				setIndex(null);
 			}
 		}
 		else {
-			if (getType() == null) {
-				setType(buildType(typeResource));
+			if ((getIndex() != null) && (getIndex().getIndexAnnotation() == annotation)) {
+				this.index.synchronizeWithResourceModel();
+			} else {
+				this.setIndex(this.buildIndex(annotation));
 			}
-			else {
-				getType().update(typeResource);
-			}
 		}
 	}
 
-	public JavaType addType() {
-		if (getType() != null) {
-			throw new IllegalStateException("type already exists"); //$NON-NLS-1$
-		}
-		this.type = getJpaFactory().buildType(this);
-		TypeAnnotation typeResource = (TypeAnnotation) getResourcePersistentAttribute().addAnnotation(TypeAnnotation.ANNOTATION_NAME);
-		this.type.initialize(typeResource);
-		firePropertyChanged(TYPE_PROPERTY, null, this.type);
-		return this.type;
+	protected void setIndex(JavaIndex newIndex) {
+		JavaIndex oldIndex = this.index;
+		this.index = newIndex;
+		firePropertyChanged(INDEX_PROPERTY, oldIndex, newIndex);
 	}
 
+
+	// ********** type **********
+
 	public JavaType getType() {
 		return this.type;
 	}
 
-	protected void setType(JavaType newType) {
-		JavaType oldType = this.type;
-		this.type = newType;
-		firePropertyChanged(TYPE_PROPERTY, oldType, newType);
+	public JavaType addType() {
+		if (this.type != null) {
+			throw new IllegalStateException("type already exists: " + this.type); //$NON-NLS-1$
+		}
+		TypeAnnotation annotation = this.buildTypeAnnotation();
+		JavaType value = this.buildType(annotation);
+		this.setType(value);
+		return value;
 	}
 
+	protected TypeAnnotation buildTypeAnnotation() {
+		return (TypeAnnotation) this.getResourcePersistentAttribute().addAnnotation(TypeAnnotation.ANNOTATION_NAME);
+	}
+
 	public void removeType() {
-		if (getType() == null) {
-			throw new IllegalStateException("type does not exist, cannot be removed"); //$NON-NLS-1$
+		if (this.type == null) {
+			throw new IllegalStateException("generated value does not exist"); //$NON-NLS-1$
 		}
-		JavaType oldType = this.type;
-		this.type = null;
 		this.getResourcePersistentAttribute().removeAnnotation(TypeAnnotation.ANNOTATION_NAME);
-		firePropertyChanged(TYPE_PROPERTY, oldType, null);
+		this.setType(null);
 	}
 
-	protected JavaType buildType(TypeAnnotation typeResource) {
-		JavaType type = getJpaFactory().buildType(this);
-		type.initialize(typeResource);
-		return type;
+	protected JavaType buildType() {
+		TypeAnnotation annotation = this.getTypeAnnotation();
+		return (annotation == null) ? null : this.buildType(annotation);
 	}
 
-	protected TypeAnnotation getTypeResource() {
+	protected TypeAnnotation getTypeAnnotation() {
 		return (TypeAnnotation) this.getResourcePersistentAttribute().getAnnotation(TypeAnnotation.ANNOTATION_NAME);
 	}
 
+	protected JavaType buildType(TypeAnnotation generatedValueAnnotation) {
+		return this.getJpaFactory().buildType(this, generatedValueAnnotation);
+	}
+
+	protected void syncType() {
+		TypeAnnotation annotation = this.getTypeAnnotation();
+		if (annotation == null) {
+			if (this.type != null) {
+				this.setType(null);
+			}
+		}
+		else {
+			if ((this.type != null) && (this.type.getTypeAnnotation() == annotation)) {
+				this.type.synchronizeWithResourceModel();
+			} else {
+				this.setType(this.buildType(annotation));
+			}
+		}
+	}
+
+	protected void setType(JavaType value) {
+		JavaType old = this.type;
+		this.type = value;
+		this.firePropertyChanged(TYPE_PROPERTY, old, value);
+	}
+
 	@Override
 	public void validate(List<IMessage> messages, IReporter reporter,
 			CompilationUnit astRoot) {

Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/IndexImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/IndexImpl.java	2011-04-06 08:21:11 UTC (rev 30350)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/IndexImpl.java	2011-04-06 08:24:21 UTC (rev 30351)
@@ -26,27 +26,24 @@
  */
 public class IndexImpl extends AbstractJavaJpaContextNode implements JavaIndex {
 	
-	private IndexAnnotation indexResource;
+	private IndexAnnotation annotation;
 	
 	private String name;
 	
 	private String[] columnNames = new String[0];
 
-	public IndexImpl(JavaJpaContextNode parent) {
+	public IndexImpl(JavaJpaContextNode parent, IndexAnnotation annotation) {
 		super(parent);
+		this.annotation = annotation;
+		this.name = annotation.getName();
+		this.columnNames = annotation.getColumnNames();
 	}
 
-	public void initialize(IndexAnnotation indexResource) {
-		this.indexResource = indexResource;
-		this.name = indexResource.getName();
-		this.columnNames = indexResource.getColumnNames();
+	@Override
+	public void synchronizeWithResourceModel() {
+		this.setName_(annotation.getName());
+		this.setColumnNames_(annotation.getColumnNames());
 	}
-	
-	public void update(IndexAnnotation indexResource) {
-		this.indexResource = indexResource;
-		this.setName_(indexResource.getName());
-		this.setColumnNames_(indexResource.getColumnNames());
-	}
 
 	// ***** name
 	
@@ -57,7 +54,7 @@
 	public void setName(String name) {
 		String old = this.name;
 		this.name = name;
-		this.getResourceIndex().setName(name);
+		this.getIndexAnnotation().setName(name);
 		this.firePropertyChanged(INDEX_NAME, old, name);
 	}
 	
@@ -77,7 +74,7 @@
 		if (columnNames == null) columnNames = new String[0];
 		String[] old = this.columnNames;
 		this.columnNames = columnNames;
-		this.getResourceIndex().setColumnNames(columnNames);
+		this.getIndexAnnotation().setColumnNames(columnNames);
 		this.firePropertyChanged(INDEX_COLUMN_NAMES, old, columnNames);
 	}
 	
@@ -87,12 +84,13 @@
 		this.firePropertyChanged(INDEX_COLUMN_NAMES, old, columnNames);
 	}
 	
-	private IndexAnnotation getResourceIndex() {
-		return indexResource;
+	@Override
+	public IndexAnnotation getIndexAnnotation() {
+		return annotation;
 	}
 
 	public TextRange getValidationTextRange(CompilationUnit astRoot) {
-		return this.indexResource.getTextRange(astRoot);
+		return this.annotation.getTextRange(astRoot);
 	}
 
 	public void addColumn(String columnName) {

Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaIndex.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaIndex.java	2011-04-06 08:21:11 UTC (rev 30350)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaIndex.java	2011-04-06 08:24:21 UTC (rev 30351)
@@ -28,10 +28,6 @@
 	void addColumn(String columnName);
 	void removeColumn(String columnName);
 		String INDEX_COLUMN_NAMES = "ColumnNames"; //$NON-NLS-1$
-
-
-	public void initialize(IndexAnnotation indexResource);
-
-	public void update(IndexAnnotation indexResource);
-
+		
+	IndexAnnotation getIndexAnnotation();
 }



More information about the jbosstools-commits mailing list