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/SourceBaseEnumeratedAnnotation.java')
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java23
1 files changed, 13 insertions, 10 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java
index 9f3360aa86..cd14ba5636 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,7 +11,7 @@ package org.eclipse.jpt.core.internal.resource.java.source;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationElementAdapter;
import org.eclipse.jpt.core.resource.java.EnumType;
import org.eclipse.jpt.core.resource.java.EnumeratedAnnotation;
import org.eclipse.jpt.core.resource.java.JavaResourceNode;
@@ -37,15 +37,15 @@ public abstract class SourceBaseEnumeratedAnnotation
protected SourceBaseEnumeratedAnnotation(JavaResourceNode parent, Attribute attribute, DeclarationAnnotationAdapter daa) {
super(parent, attribute, daa);
this.valueDeclarationAdapter = new EnumDeclarationAnnotationElementAdapter(daa, getValueElementName(), false);
- this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, this.valueDeclarationAdapter);
+ this.valueAdapter = new MemberAnnotationElementAdapter<String>(attribute, this.valueDeclarationAdapter);
}
public void initialize(CompilationUnit astRoot) {
this.value = this.buildValue(astRoot);
}
- public void update(CompilationUnit astRoot) {
- this.setValue(this.buildValue(astRoot));
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncValue(this.buildValue(astRoot));
}
@Override
@@ -62,13 +62,16 @@ public abstract class SourceBaseEnumeratedAnnotation
}
public void setValue(EnumType value) {
- if (this.attributeValueHasNotChanged(this.value, value)) {
- return;
+ if (this.attributeValueHasChanged(this.value, value)) {
+ this.value = value;
+ this.valueAdapter.setValue(EnumType.toJavaAnnotationValue(value));
}
+ }
+
+ private void syncValue(EnumType astValue) {
EnumType old = this.value;
- this.value = value;
- this.valueAdapter.setValue(EnumType.toJavaAnnotationValue(value));
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ this.value = astValue;
+ this.firePropertyChanged(VALUE_PROPERTY, old, astValue);
}
private EnumType buildValue(CompilationUnit astRoot) {

Back to the top