Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAttributeOverridesAnnotation.java')
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAttributeOverridesAnnotation.java51
1 files changed, 28 insertions, 23 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAttributeOverridesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAttributeOverridesAnnotation.java
index 21eb002c3d..eb0f103439 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAttributeOverridesAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAttributeOverridesAnnotation.java
@@ -9,9 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.resource.java.source;
+import java.util.ListIterator;
import java.util.Vector;
-import org.eclipse.jdt.core.dom.Annotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
@@ -22,7 +22,7 @@ import org.eclipse.jpt.core.resource.java.NestableAttributeOverrideAnnotation;
import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.core.utility.jdt.Member;
import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
/**
* javax.persistence.AttributeOverrides
@@ -60,53 +60,58 @@ public final class SourceAttributeOverridesAnnotation
// ********** AnnotationContainer implementation **********
+ public String getContainerAnnotationName() {
+ return this.getAnnotationName();
+ }
+
+ public org.eclipse.jdt.core.dom.Annotation getContainerAstAnnotation(CompilationUnit astRoot) {
+ return this.getAstAnnotation(astRoot);
+ }
+
public String getElementName() {
return JPA.ATTRIBUTE_OVERRIDES__VALUE;
}
- public String getNestedAnnotationName() {
+ public String getNestableAnnotationName() {
return AttributeOverrideAnnotation.ANNOTATION_NAME;
}
- public Iterable<NestableAttributeOverrideAnnotation> getNestedAnnotations() {
- return new LiveCloneIterable<NestableAttributeOverrideAnnotation>(this.attributesOverrides);
+ public ListIterator<NestableAttributeOverrideAnnotation> nestedAnnotations() {
+ return new CloneListIterator<NestableAttributeOverrideAnnotation>(this.attributesOverrides);
}
- public int getNestedAnnotationsSize() {
+ public int nestedAnnotationsSize() {
return this.attributesOverrides.size();
}
- public NestableAttributeOverrideAnnotation addNestedAnnotation() {
- return this.addNestedAnnotation(this.attributesOverrides.size());
- }
-
- private NestableAttributeOverrideAnnotation addNestedAnnotation(int index) {
- NestableAttributeOverrideAnnotation attributeOverride = this.buildAttributeOverride(index);
+ public NestableAttributeOverrideAnnotation addNestedAnnotationInternal() {
+ NestableAttributeOverrideAnnotation attributeOverride = this.buildAttributeOverride(this.attributesOverrides.size());
this.attributesOverrides.add(attributeOverride);
return attributeOverride;
}
- public void syncAddNestedAnnotation(Annotation astAnnotation) {
- int index = this.attributesOverrides.size();
- NestableAttributeOverrideAnnotation attributeOverride = this.addNestedAnnotation(index);
- attributeOverride.initialize((CompilationUnit) astAnnotation.getRoot());
- this.fireItemAdded(ATTRIBUTE_OVERRIDES_LIST, index, attributeOverride);
- }
-
private NestableAttributeOverrideAnnotation buildAttributeOverride(int index) {
return SourceAttributeOverrideAnnotation.buildNestedAttributeOverride(this, this.member, index, this.daa);
}
- public NestableAttributeOverrideAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
+ public void nestedAnnotationAdded(int index, NestableAttributeOverrideAnnotation nestedAnnotation) {
+ this.fireItemAdded(ATTRIBUTE_OVERRIDES_LIST, index, nestedAnnotation);
+ }
+
+ public NestableAttributeOverrideAnnotation moveNestedAnnotationInternal(int targetIndex, int sourceIndex) {
return CollectionTools.move(this.attributesOverrides, targetIndex, sourceIndex).get(targetIndex);
}
- public NestableAttributeOverrideAnnotation removeNestedAnnotation(int index) {
+ public void nestedAnnotationMoved(int targetIndex, int sourceIndex) {
+ this.fireItemMoved(ATTRIBUTE_OVERRIDES_LIST, targetIndex, sourceIndex);
+ }
+
+ public NestableAttributeOverrideAnnotation removeNestedAnnotationInternal(int index) {
return this.attributesOverrides.remove(index);
}
- public void syncRemoveNestedAnnotations(int index) {
- this.removeItemsFromList(index, this.attributesOverrides, ATTRIBUTE_OVERRIDES_LIST);
+ public void nestedAnnotationRemoved(int index, NestableAttributeOverrideAnnotation nestedAnnotation) {
+ this.fireItemRemoved(ATTRIBUTE_OVERRIDES_LIST, index, nestedAnnotation);
}
}

Back to the top