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/jdtutility/FieldAttribute.java')
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/FieldAttribute.java22
1 files changed, 21 insertions, 1 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/FieldAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/FieldAttribute.java
index 62f6360582..fa229f3c79 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/FieldAttribute.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/FieldAttribute.java
@@ -14,6 +14,7 @@ import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.FieldDeclaration;
import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.IVariableBinding;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
import org.eclipse.jpt.utility.internal.CommandExecutorProvider;
@@ -27,6 +28,10 @@ public class FieldAttribute extends Attribute {
public FieldAttribute(IField field, CommandExecutorProvider modifySharedDocumentCommandExecutorProvider) {
super(field, modifySharedDocumentCommandExecutorProvider);
}
+
+ public FieldAttribute(IField field, CommandExecutorProvider modifySharedDocumentCommandExecutorProvider, AnnotationEditFormatter annotationEditFormatter) {
+ super(field, modifySharedDocumentCommandExecutorProvider, annotationEditFormatter);
+ }
@Override
public IField getJdtMember() {
@@ -51,7 +56,22 @@ public class FieldAttribute extends Attribute {
return null;
}
-
+ private VariableDeclarationFragment fragment(CompilationUnit astRoot) {
+ FieldDeclaration fieldDeclaration = bodyDeclaration(astRoot);
+ for (VariableDeclarationFragment fragment : this.fragments(fieldDeclaration)) {
+ if (fragment.getName().getFullyQualifiedName().equals(getName())) {
+ return fragment;
+ }
+ }
+ //TODO could this ever happen, should I throw an exception instead?
+ return null;
+ }
+
+ @Override
+ public IVariableBinding binding(CompilationUnit astRoot) {
+ return fragment(astRoot).resolveBinding();
+ }
+
// ********** Attribute implementation **********
@Override

Back to the top