diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OverrideImpl.java')
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OverrideImpl.java | 92 |
1 files changed, 0 insertions, 92 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OverrideImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OverrideImpl.java deleted file mode 100644 index bd76ba56d6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OverrideImpl.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 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. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter; -import org.eclipse.jpt.core.resource.java.JPA; -import org.eclipse.jpt.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.core.resource.java.NestableAnnotation; -import org.eclipse.jpt.core.resource.java.OverrideAnnotation; -import org.eclipse.jpt.core.utility.TextRange; -import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.core.utility.jdt.Member; - -public abstract class OverrideImpl - extends AbstractResourceAnnotation<Member> - implements OverrideAnnotation -{ - // hold this so we can get the 'name' text range - private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter; - - private final AnnotationElementAdapter<String> nameAdapter; - - private String name; - - - protected OverrideImpl(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { - super(parent, member, daa, annotationAdapter); - this.nameDeclarationAdapter = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JPA.ATTRIBUTE_OVERRIDE__NAME, false); // false = do not remove annotation when empty - this.nameAdapter = new ShortCircuitAnnotationElementAdapter<String>(getMember(),this.nameDeclarationAdapter); - } - - public void initialize(CompilationUnit astRoot) { - this.name = this.name(astRoot); - } - - public IndexedAnnotationAdapter getIndexedAnnotationAdapter() { - return (IndexedAnnotationAdapter) super.getAnnotationAdapter(); - } - - public void moveAnnotation(int newIndex) { - getIndexedAnnotationAdapter().moveAnnotation(newIndex); - } - - public void initializeFrom(NestableAnnotation oldAnnotation) { - OverrideAnnotation oldOverride = (OverrideAnnotation) oldAnnotation; - setName(oldOverride.getName()); - } - - //************ AttriubteOverride implementation **************** - public String getName() { - return this.name; - } - - public void setName(String newName) { - if (attributeValueHasNotChanged(this.name, newName)) { - return; - } - String oldName = this.name; - this.name = newName; - this.nameAdapter.setValue(newName); - firePropertyChanged(OverrideAnnotation.NAME_PROPERTY, oldName, newName); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.nameDeclarationAdapter, astRoot); - } - - public boolean nameTouches(int pos, CompilationUnit astRoot) { - return this.elementTouches(this.nameDeclarationAdapter, pos, astRoot); - } - - public void updateFromJava(CompilationUnit astRoot) { - this.setName(this.name(astRoot)); - } - - protected String name(CompilationUnit astRoot) { - return this.nameAdapter.getValue(astRoot); - } -} |