diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceIdClassAnnotation.java')
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceIdClassAnnotation.java | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceIdClassAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceIdClassAnnotation.java index 84842a898d..dc8d773eac 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceIdClassAnnotation.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceIdClassAnnotation.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. @@ -12,7 +12,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.ConversionDeclarationAnnotationElementAdapter; import org.eclipse.jpt.core.internal.utility.jdt.JDTTools; -import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter; +import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationElementAdapter; import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; import org.eclipse.jpt.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; import org.eclipse.jpt.core.resource.java.IdClassAnnotation; @@ -42,7 +42,7 @@ public final class SourceIdClassAnnotation public SourceIdClassAnnotation(JavaResourcePersistentType parent, Type type) { super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(type, VALUE_ADAPTER); + this.valueAdapter = new MemberAnnotationElementAdapter<String>(type, VALUE_ADAPTER); } public String getAnnotationName() { @@ -54,9 +54,9 @@ public final class SourceIdClassAnnotation this.fullyQualifiedClassName = this.buildFullyQualifiedClassName(astRoot); } - public void update(CompilationUnit astRoot) { - this.setValue(this.buildValue(astRoot)); - this.setFullyQualifiedClassName(this.buildFullyQualifiedClassName(astRoot)); + public void synchronizeWith(CompilationUnit astRoot) { + this.syncValue(this.buildValue(astRoot)); + this.syncFullyQualifiedClassName(this.buildFullyQualifiedClassName(astRoot)); } @Override @@ -73,13 +73,16 @@ public final class SourceIdClassAnnotation } public void setValue(String value) { - if (this.attributeValueHasNotChanged(this.value, value)) { - return; + if (this.attributeValueHasChanged(this.value, value)) { + this.value = value; + this.valueAdapter.setValue(value); } + } + + private void syncValue(String astValue) { String old = this.value; - this.value = value; - this.valueAdapter.setValue(value); - this.firePropertyChanged(VALUE_PROPERTY, old, value); + this.value = astValue; + this.firePropertyChanged(VALUE_PROPERTY, old, astValue); } private String buildValue(CompilationUnit astRoot) { @@ -95,10 +98,10 @@ public final class SourceIdClassAnnotation return this.fullyQualifiedClassName; } - private void setFullyQualifiedClassName(String fullyQualifiedClassName) { + private void syncFullyQualifiedClassName(String astFullyQualifiedClassName) { String old = this.fullyQualifiedClassName; - this.fullyQualifiedClassName = fullyQualifiedClassName; - this.firePropertyChanged(FULLY_QUALIFIED_CLASS_NAME_PROPERTY, old, fullyQualifiedClassName); + this.fullyQualifiedClassName = astFullyQualifiedClassName; + this.firePropertyChanged(FULLY_QUALIFIED_CLASS_NAME_PROPERTY, old, astFullyQualifiedClassName); } private String buildFullyQualifiedClassName(CompilationUnit astRoot) { |