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/SourceBaseNamedQueryAnnotation.java')
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseNamedQueryAnnotation.java82
1 files changed, 41 insertions, 41 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseNamedQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseNamedQueryAnnotation.java
index 33c866bca1..af425a45db 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseNamedQueryAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseNamedQueryAnnotation.java
@@ -31,7 +31,6 @@ import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
import org.eclipse.jpt.core.utility.jdt.Type;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
/**
@@ -158,8 +157,8 @@ abstract class SourceBaseNamedQueryAnnotation
return new CloneListIterator<QueryHintAnnotation>(this.hints);
}
- Iterable<NestableQueryHintAnnotation> getNestableHints() {
- return new LiveCloneIterable<NestableQueryHintAnnotation>(this.hints);
+ ListIterator<NestableQueryHintAnnotation> nestableHints() {
+ return new CloneListIterator<NestableQueryHintAnnotation>(this.hints);
}
public int hintsSize() {
@@ -170,32 +169,21 @@ abstract class SourceBaseNamedQueryAnnotation
return this.hints.get(index);
}
- public int indexOfHint(QueryHintAnnotation hint) {
- return this.hints.indexOf(hint);
+ public int indexOfHint(QueryHintAnnotation queryHint) {
+ return this.hints.indexOf(queryHint);
}
public NestableQueryHintAnnotation addHint(int index) {
return (NestableQueryHintAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.hintsContainer);
}
- NestableQueryHintAnnotation addHint_() {
- return this.addHint_(this.hints.size());
- }
-
- private NestableQueryHintAnnotation addHint_(int index) {
- NestableQueryHintAnnotation hint = this.buildHint(index);
+ NestableQueryHintAnnotation addHintInternal() {
+ NestableQueryHintAnnotation hint = this.buildQueryHint(this.hints.size());
this.hints.add(hint);
return hint;
}
- void syncAddHint(Annotation astAnnotation) {
- int index = this.hints.size();
- NestableQueryHintAnnotation hint = this.addHint_(index);
- hint.initialize((CompilationUnit) astAnnotation.getRoot());
- this.fireItemAdded(HINTS_LIST, index, hint);
- }
-
- abstract NestableQueryHintAnnotation buildHint(int index);
+ abstract NestableQueryHintAnnotation buildQueryHint(int index);
void hintAdded(int index, NestableQueryHintAnnotation hint) {
this.fireItemAdded(HINTS_LIST, index, hint);
@@ -205,20 +193,24 @@ abstract class SourceBaseNamedQueryAnnotation
AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.hintsContainer);
}
- NestableQueryHintAnnotation moveHint_(int targetIndex, int sourceIndex) {
+ NestableQueryHintAnnotation moveHintInternal(int targetIndex, int sourceIndex) {
return CollectionTools.move(this.hints, targetIndex, sourceIndex).get(targetIndex);
}
+ void hintMoved(int targetIndex, int sourceIndex) {
+ this.fireItemMoved(HINTS_LIST, targetIndex, sourceIndex);
+ }
+
public void removeHint(int index) {
AnnotationContainerTools.removeNestedAnnotation(index, this.hintsContainer);
}
- NestableQueryHintAnnotation removeHint_(int index) {
+ NestableQueryHintAnnotation removeHintInternal(int index) {
return this.hints.remove(index);
}
- void syncRemoveHints(int index) {
- this.removeItemsFromList(index, this.hints, HINTS_LIST);
+ void hintRemoved(int index, NestableQueryHintAnnotation hint) {
+ this.fireItemRemoved(HINTS_LIST, index, hint);
}
abstract String getHintsElementName();
@@ -234,9 +226,9 @@ abstract class SourceBaseNamedQueryAnnotation
BaseNamedQueryAnnotation oldQuery = (BaseNamedQueryAnnotation) oldAnnotation;
this.setName(oldQuery.getName());
this.setQuery(oldQuery.getQuery());
- for (QueryHintAnnotation oldHint : CollectionTools.iterable(oldQuery.hints())) {
- NestableQueryHintAnnotation newHint = this.addHint(oldQuery.indexOfHint(oldHint));
- newHint.initializeFrom((NestableQueryHintAnnotation) oldHint);
+ for (QueryHintAnnotation oldQueryHint : CollectionTools.iterable(oldQuery.hints())) {
+ NestableQueryHintAnnotation newQueryHint = this.addHint(oldQuery.indexOfHint(oldQueryHint));
+ newQueryHint.initializeFrom((NestableQueryHintAnnotation) oldQueryHint);
}
}
@@ -261,7 +253,11 @@ abstract class SourceBaseNamedQueryAnnotation
class HintsAnnotationContainer
implements AnnotationContainer<NestableQueryHintAnnotation>
{
- public Annotation getAstAnnotation(CompilationUnit astRoot) {
+ public String getContainerAnnotationName() {
+ return SourceBaseNamedQueryAnnotation.this.getAnnotationName();
+ }
+
+ public Annotation getContainerAstAnnotation(CompilationUnit astRoot) {
return SourceBaseNamedQueryAnnotation.this.getAstAnnotation(astRoot);
}
@@ -269,36 +265,40 @@ abstract class SourceBaseNamedQueryAnnotation
return SourceBaseNamedQueryAnnotation.this.getHintsElementName();
}
- public String getNestedAnnotationName() {
+ public String getNestableAnnotationName() {
return QueryHintAnnotation.ANNOTATION_NAME;
}
- public Iterable<NestableQueryHintAnnotation> getNestedAnnotations() {
- return SourceBaseNamedQueryAnnotation.this.getNestableHints();
+ public ListIterator<NestableQueryHintAnnotation> nestedAnnotations() {
+ return SourceBaseNamedQueryAnnotation.this.nestableHints();
}
- public int getNestedAnnotationsSize() {
+ public int nestedAnnotationsSize() {
return SourceBaseNamedQueryAnnotation.this.hintsSize();
}
- public NestableQueryHintAnnotation addNestedAnnotation() {
- return SourceBaseNamedQueryAnnotation.this.addHint_();
+ public NestableQueryHintAnnotation addNestedAnnotationInternal() {
+ return SourceBaseNamedQueryAnnotation.this.addHintInternal();
+ }
+
+ public void nestedAnnotationAdded(int index, NestableQueryHintAnnotation nestedAnnotation) {
+ SourceBaseNamedQueryAnnotation.this.hintAdded(index, nestedAnnotation);
}
- public void syncAddNestedAnnotation(Annotation astAnnotation) {
- SourceBaseNamedQueryAnnotation.this.syncAddHint(astAnnotation);
+ public NestableQueryHintAnnotation moveNestedAnnotationInternal(int targetIndex, int sourceIndex) {
+ return SourceBaseNamedQueryAnnotation.this.moveHintInternal(targetIndex, sourceIndex);
}
- public NestableQueryHintAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
- return SourceBaseNamedQueryAnnotation.this.moveHint_(targetIndex, sourceIndex);
+ public void nestedAnnotationMoved(int targetIndex, int sourceIndex) {
+ SourceBaseNamedQueryAnnotation.this.hintMoved(targetIndex, sourceIndex);
}
- public NestableQueryHintAnnotation removeNestedAnnotation(int index) {
- return SourceBaseNamedQueryAnnotation.this.removeHint_(index);
+ public NestableQueryHintAnnotation removeNestedAnnotationInternal(int index) {
+ return SourceBaseNamedQueryAnnotation.this.removeHintInternal(index);
}
- public void syncRemoveNestedAnnotations(int index) {
- SourceBaseNamedQueryAnnotation.this.syncRemoveHints(index);
+ public void nestedAnnotationRemoved(int index, NestableQueryHintAnnotation nestedAnnotation) {
+ SourceBaseNamedQueryAnnotation.this.hintRemoved(index, nestedAnnotation);
}
@Override

Back to the top