[jbosstools-commits] JBoss Tools SVN: r42162 - trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/impl.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Thu Jun 21 20:29:50 EDT 2012
Author: scabanovich
Date: 2012-06-21 20:29:49 -0400 (Thu, 21 Jun 2012)
New Revision: 42162
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/impl/AnnotationDeclaration.java
Log:
JBIDE-10611
https://issues.jboss.org/browse/JBIDE-10611
Compute members immediately - or as-you-type model will have updated values.
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/impl/AnnotationDeclaration.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/impl/AnnotationDeclaration.java 2012-06-22 00:28:45 UTC (rev 42161)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/java/impl/AnnotationDeclaration.java 2012-06-22 00:29:49 UTC (rev 42162)
@@ -10,6 +10,9 @@
******************************************************************************/
package org.jboss.tools.common.java.impl;
+import java.util.HashMap;
+import java.util.Map;
+
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.Flags;
@@ -34,11 +37,23 @@
*/
public class AnnotationDeclaration implements IAnnotationDeclaration {
protected IJavaAnnotation annotation;
+ protected Map<String, Object> values;
public AnnotationDeclaration() {}
public void setDeclaration(IJavaAnnotation annotation) {
this.annotation = annotation;
+ IMemberValuePair[] pairs = getMemberValuePairs();
+ if(pairs.length > 0) {
+ values = new HashMap<String, Object>();
+ for (IMemberValuePair pair: pairs) {
+ String name = pair.getMemberName();
+ Object value = resolveMemberValue(pair);
+ if(value != null) {
+ values.put(name, value);
+ }
+ }
+ }
}
public IJavaAnnotation getDeclaration() {
@@ -55,13 +70,13 @@
public Object getMemberValue(String name) {
if(name == null) name = "value"; //$NON-NLS-1$
- IMemberValuePair[] pairs = getMemberValuePairs();
- for (IMemberValuePair pair: pairs) {
- if(name.equals(pair.getMemberName())) {
- return resolveMemberValue(pair);
- }
- }
- return null;
+// IMemberValuePair[] pairs = getMemberValuePairs();
+// for (IMemberValuePair pair: pairs) {
+// if(name.equals(pair.getMemberName())) {
+// return resolveMemberValue(pair);
+// }
+// }
+ return values == null ? null : values.get(name);
}
public IMember getParentMember() {
More information about the jbosstools-commits
mailing list