diff options
author | bvosburgh | 2010-01-19 19:36:17 +0000 |
---|---|---|
committer | bvosburgh | 2010-01-19 19:36:17 +0000 |
commit | 62085289e47c5915e30047daeb594ccb4a7135c5 (patch) | |
tree | 15e671e5bd8938396c7512384a9ed3620502cc65 /jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java | |
parent | 04d8fcd7a4df6c52abeecb2066633d4565c7f04b (diff) | |
download | webtools.dali-62085289e47c5915e30047daeb594ccb4a7135c5.tar.gz webtools.dali-62085289e47c5915e30047daeb594ccb4a7135c5.tar.xz webtools.dali-62085289e47c5915e30047daeb594ccb4a7135c5.zip |
[233567] rework sync between resource model and AST
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.java | 23 |
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) { |