Author: scabanovich
Date: 2009-12-11 05:51:59 -0500 (Fri, 11 Dec 2009)
New Revision: 19201
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4943
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java 2009-12-11
07:35:51 UTC (rev 19200)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java 2009-12-11
10:51:59 UTC (rev 19201)
@@ -101,6 +101,8 @@
beans.add(bean);
}
}
+ resolvedBeans.clear();
+ resolvedBeans.addAll(beans);
}
}
if (resolvedBeans != null && !resolvedBeans.isEmpty()) {
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2009-12-11
07:35:51 UTC (rev 19200)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2009-12-11
10:51:59 UTC (rev 19201)
@@ -51,6 +51,7 @@
Map<IPath, Set<IBean>> beansByPath = new HashMap<IPath,
Set<IBean>>();
Map<String, Set<IBean>> beansByName = new HashMap<String,
Set<IBean>>();
+ Set<IBean> namedBeans = new HashSet<IBean>();
public CDIProject() {}
@@ -89,7 +90,9 @@
if(beans == null || beans.isEmpty()) {
return result;
}
- result.addAll(beans);
+ synchronized (beans) {
+ result.addAll(beans);
+ }
if(result.size() == 1 || !attemptToResolveAmbiguousNames) {
return result;
}
@@ -306,8 +309,12 @@
}
public void rebuildBeans() {
- beansByPath.clear();
- beansByName.clear();
+ synchronized (beansByPath) {
+ beansByPath.clear();
+ }
+ synchronized (beansByName) {
+ beansByName.clear();
+ }
List<TypeDefinition> typeDefinitions = n.getDefinitions().getTypeDefinitions();
for (TypeDefinition typeDefinition : typeDefinitions) {
ClassBean bean = null;
@@ -333,17 +340,28 @@
Set<IBean> bs = beansByName.get(name);
if(bs == null) {
bs = new HashSet<IBean>();
- beansByName.put(name, bs);
+ synchronized (beansByName) {
+ beansByName.put(name, bs);
+ }
}
- bs.add(bean);
+ synchronized (bs) {
+ bs.add(bean);
+ }
+ synchronized (namedBeans) {
+ namedBeans.add(bean);
+ }
}
IPath path = bean.getSourcePath();
Set<IBean> bs = beansByPath.get(path);
if(bs == null) {
bs = new HashSet<IBean>();
- beansByPath.put(path, bs);
+ synchronized (beansByPath) {
+ beansByPath.put(path, bs);
+ }
}
- bs.add(bean);
+ synchronized (bs) {
+ bs.add(bean);
+ }
}
/*
@@ -351,7 +369,11 @@
* @see org.jboss.tools.cdi.core.IBeanManager#getNamedBeans()
*/
public Set<IBean> getNamedBeans() {
- // TODO
- return new HashSet<IBean>();
+ Set<IBean> result = new HashSet<IBean>();
+ synchronized (namedBeans) {
+ result.addAll(namedBeans);
+ }
+ return result;
}
+
}
\ No newline at end of file