JBoss Tools SVN: r35782 - in trunk/cdi/tests/org.jboss.tools.cdi.core.test: projects/CDITest1/src/cdi/test/observers and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-10-18 20:23:21 -0400 (Tue, 18 Oct 2011)
New Revision: 35782
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest1/src/cdi/test/observers/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest1/src/cdi/test/observers/BaseDecoratedInterface.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest1/src/cdi/test/observers/CDIBeanTest.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest2/src/cdi/test/observers/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest2/src/cdi/test/observers/TestBean.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/DependentProjectTest.java
Log:
JBIDE-9904
https://issues.jboss.org/browse/JBIDE-9904
CDIProject.findObservedEvents(IParameter) improved. Tests are added.
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest1/src/cdi/test/observers/BaseDecoratedInterface.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest1/src/cdi/test/observers/BaseDecoratedInterface.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest1/src/cdi/test/observers/BaseDecoratedInterface.java 2011-10-19 00:23:21 UTC (rev 35782)
@@ -0,0 +1,5 @@
+package cdi.test.observers;
+
+public interface BaseDecoratedInterface {
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest1/src/cdi/test/observers/BaseDecoratedInterface.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest1/src/cdi/test/observers/CDIBeanTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest1/src/cdi/test/observers/CDIBeanTest.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest1/src/cdi/test/observers/CDIBeanTest.java 2011-10-19 00:23:21 UTC (rev 35782)
@@ -0,0 +1,9 @@
+package cdi.test.observers;
+
+import javax.enterprise.event.Observes;
+
+public class CDIBeanTest {
+ public void method(@Observes BaseDecoratedInterface event) {
+
+ }
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest1/src/cdi/test/observers/CDIBeanTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest2/src/cdi/test/observers/TestBean.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest2/src/cdi/test/observers/TestBean.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest2/src/cdi/test/observers/TestBean.java 2011-10-19 00:23:21 UTC (rev 35782)
@@ -0,0 +1,9 @@
+package cdi.test.observers;
+
+import javax.enterprise.event.Event;
+import javax.inject.Inject;
+
+public class TestBean implements BaseDecoratedInterface {
+ @Inject
+ Event<TestBean> event;
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest2/src/cdi/test/observers/TestBean.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/DependentProjectTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/DependentProjectTest.java 2011-10-19 00:22:55 UTC (rev 35781)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/DependentProjectTest.java 2011-10-19 00:23:21 UTC (rev 35782)
@@ -23,6 +23,7 @@
import org.jboss.tools.cdi.core.IClassBean;
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.core.IInjectionPointField;
+import org.jboss.tools.cdi.core.IObserverMethod;
import org.jboss.tools.cdi.core.IProducer;
import org.jboss.tools.cdi.core.IProducerMethod;
import org.jboss.tools.cdi.core.IQualifier;
@@ -372,6 +373,22 @@
assertEquals(1, bs3.size());
}
+ public void testFindObservedEvents() throws CoreException {
+ ICDIProject cdi1 = CDICorePlugin.getCDIProject(project1, true);
+ Set<IBean> bs = cdi1.getBeans(new Path("/CDITest1/src/cdi/test/observers/CDIBeanTest.java"));
+ assertFalse(bs.isEmpty());
+ IBean b = bs.iterator().next();
+ assertTrue(b instanceof IClassBean);
+ IClassBean cb = (IClassBean)b;
+ Set<IObserverMethod> ms = cb.getObserverMethods();
+ assertEquals(1, ms.size());
+ IObserverMethod m = ms.iterator().next();
+ Set<IInjectionPoint> ps = cdi1.findObservedEvents(m.getObservedParameters().iterator().next());
+ assertEquals(1, ps.size());
+ IInjectionPoint p = ps.iterator().next();
+ assertTrue(p.getDeclaringProject() == CDICorePlugin.getCDIProject(project2, true));
+ }
+
public void testCleanDependentProject() throws CoreException, IOException {
ICDIProject cdi2 = CDICorePlugin.getCDIProject(project2, true);
boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
13 years, 2 months
JBoss Tools SVN: r35781 - trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-10-18 20:22:55 -0400 (Tue, 18 Oct 2011)
New Revision: 35781
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
Log:
JBIDE-9904
https://issues.jboss.org/browse/JBIDE-9904
CDIProject.findObservedEvents(IParameter) improved.
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 2011-10-18 23:59:45 UTC (rev 35780)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2011-10-19 00:22:55 UTC (rev 35781)
@@ -23,18 +23,17 @@
import java.util.TreeSet;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMemberValuePair;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.CDICoreNature;
import org.jboss.tools.cdi.core.CDICorePlugin;
@@ -95,6 +94,7 @@
private Map<IPath, ScopeElement> scopesByPath = new HashMap<IPath, ScopeElement>();
private Set<IBean> allBeans = new HashSet<IBean>();
+ private Set<IBean> declaredBeans = new HashSet<IBean>();
private Map<IPath, Set<IBean>> beansByPath = new HashMap<IPath, Set<IBean>>();
private Map<String, Set<IBean>> beansByName = new HashMap<String, Set<IBean>>();
private Set<IBean> namedBeans = new HashSet<IBean>();
@@ -136,6 +136,10 @@
return allBeans.toArray(new IBean[allBeans.size()]);
}
+ public synchronized Set<IBean> getDeclaredBeans() {
+ return new HashSet<IBean>(declaredBeans);
+ }
+
public List<INodeReference> getAlternativeClasses() {
List<INodeReference> result = new ArrayList<INodeReference>();
synchronized (allBeansXMLData) {
@@ -857,35 +861,55 @@
return result;
}
+ /**
+ * This method looks for observed methods in all the set of related projects.
+ * To this end, it activates all CDI projects in workspace.
+ */
public Set<IObserverMethod> resolveObserverMethods(IInjectionPoint injectionPoint) {
Set<IObserverMethod> result = new HashSet<IObserverMethod>();
-
IParametedType eventType = getEventType(injectionPoint);
-
if(eventType != null) {
synchronized(this) {
- for (IBean ib: allBeans) {
- if(!(ib instanceof IClassBean)) continue;
- IClassBean b = (IClassBean)ib;
- Set<IObserverMethod> ms = b.getObserverMethods();
- for (IObserverMethod m: ms) {
- IObserverMethod om = (IObserverMethod)m;
- Set<IParameter> params = om.getObservedParameters();
- if(!params.isEmpty()) {
- IParameter param = params.iterator().next();
- IParametedType paramType = param.getType();
- if(((ParametedType)eventType).isAssignableTo((ParametedType)paramType, true)
- && areMatchingEventQualifiers(param, injectionPoint)) {
- result.add(om);
- }
- }
- }
+ for (IBean b: allBeans) {
+ if(b instanceof IClassBean) {
+ collectObserverMethods((IClassBean)b, eventType, injectionPoint, result);
+ }
}
}
}
+ for (IProject p: ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
+ if(p.isAccessible()) {
+ CDICorePlugin.getCDI(p, true);
+ }
+ }
+ CDICoreNature[] ns = getNature().getAllDependentProjects();
+ for (CDICoreNature n: ns) {
+ if(n.getDelegate() instanceof CDIProject) {
+ CDIProject p = (CDIProject)n.getDelegate();
+ for (IBean b: p.getDeclaredBeans()) {
+ if(b instanceof IClassBean) {
+ collectObserverMethods((IClassBean)b, eventType, injectionPoint, result);
+ }
+ }
+ }
+ }
return result;
}
+ private void collectObserverMethods(IClassBean b, IParametedType eventType, IInjectionPoint injectionPoint, Set<IObserverMethod> result) {
+ for (IObserverMethod m: b.getObserverMethods()) {
+ Set<IParameter> params = m.getObservedParameters();
+ if(!params.isEmpty()) {
+ IParameter param = params.iterator().next();
+ IParametedType paramType = param.getType();
+ if(((ParametedType)eventType).isAssignableTo((ParametedType)paramType, true)
+ && areMatchingEventQualifiers(param, injectionPoint)) {
+ result.add(m);
+ }
+ }
+ }
+ }
+
/**
* Returns type parameter of type javax.enterprise.event.Event<T>
* In all other cases returns null.
@@ -911,35 +935,56 @@
return false;
}
+ /**
+ * This method looks for observed events in all the set of related projects.
+ * To this end, it activates all CDI projects in workspace.
+ */
public Set<IInjectionPoint> findObservedEvents(IParameter observedEventParameter) {
Map<IField, IInjectionPoint> result = new HashMap<IField, IInjectionPoint>();
if(observedEventParameter.getBeanMethod() instanceof IObserverMethod) {
- IParametedType paramType = observedEventParameter.getType();
synchronized(this) {
- for (IBean ib: allBeans) {
- if(!(ib instanceof IClassBean)) {
- continue;
+ for (IBean b: allBeans) {
+ if(b instanceof IClassBean) {
+ collectObserverEvents((IClassBean)b, observedEventParameter, result);
}
- IClassBean b = (IClassBean)ib;
- Set<IInjectionPoint> ps = b.getInjectionPoints();
- for (IInjectionPoint p: ps) {
- if(p instanceof IInjectionPointField) {
- IParametedType eventType = getEventType(p);
- if(eventType != null && ((ParametedType)eventType).isAssignableTo((ParametedType)paramType, true)) {
- if(areMatchingEventQualifiers(observedEventParameter, p)) {
- result.put(((IInjectionPointField)p).getField(), p);
- }
- }
+ }
+ }
+ for (IProject p: ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
+ if(p.isAccessible()) {
+ CDICorePlugin.getCDI(p, true);
+ }
+ }
+ CDICoreNature[] ns = getNature().getAllDependentProjects();
+ for (CDICoreNature n: ns) {
+ if(n.getDelegate() instanceof CDIProject) {
+ CDIProject p = (CDIProject)n.getDelegate();
+ for (IBean b: p.getDeclaredBeans()) {
+ if(b instanceof IClassBean) {
+ collectObserverEvents((IClassBean)b, observedEventParameter, result);
}
}
- }
+ }
}
}
return new HashSet<IInjectionPoint>(result.values());
}
+ private void collectObserverEvents(IClassBean b, IParameter observedEventParameter, Map<IField, IInjectionPoint> result) {
+ Set<IInjectionPoint> ps = b.getInjectionPoints();
+ for (IInjectionPoint p: ps) {
+ if(p instanceof IInjectionPointField) {
+ IParametedType eventType = getEventType(p);
+ if(eventType != null && ((ParametedType)eventType).isAssignableTo((ParametedType)observedEventParameter.getType(), true)) {
+ if(areMatchingEventQualifiers(observedEventParameter, p)) {
+ result.put(((IInjectionPointField)p).getField(), p);
+ }
+ }
+ }
+ }
+ }
+
public Set<IBeanMethod> resolveDisposers(IProducerMethod producer) {
Set<IBeanMethod> result = new HashSet<IBeanMethod>();
IClassBean cb = producer.getClassBean();
@@ -1233,6 +1278,7 @@
decorators.clear();
interceptors.clear();
allBeans.clear();
+ declaredBeans.clear();
injectionPointsByType.clear();
}
@@ -1326,6 +1372,9 @@
}
}
allBeans.add(bean);
+ if(bean.getDeclaringProject() == this) {
+ declaredBeans.add(bean);
+ }
}
}
13 years, 2 months
JBoss Tools SVN: r35780 - in trunk/jsf/docs/jsf_tools_ref_guide/en-US: images/jsf_support and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2011-10-18 19:59:45 -0400 (Tue, 18 Oct 2011)
New Revision: 35780
Modified:
trunk/jsf/docs/jsf_tools_ref_guide/en-US/Book_Info.xml
trunk/jsf/docs/jsf_tools_ref_guide/en-US/images/jsf_support/jsf_support_12.png
Log:
updated JSF image as per JBIDE-8417 and "what's new" information
Modified: trunk/jsf/docs/jsf_tools_ref_guide/en-US/Book_Info.xml
===================================================================
--- trunk/jsf/docs/jsf_tools_ref_guide/en-US/Book_Info.xml 2011-10-18 23:21:52 UTC (rev 35779)
+++ trunk/jsf/docs/jsf_tools_ref_guide/en-US/Book_Info.xml 2011-10-18 23:59:45 UTC (rev 35780)
@@ -5,9 +5,9 @@
<title>JSF Tools Reference Guide</title>
<subtitle>Provides information relating to the JSF Tools module.</subtitle>
<productname>JBoss Developer Studio</productname>
- <productnumber>4.1</productnumber>
- <edition>4.1.0</edition>
- <pubsnumber>2</pubsnumber>
+ <productnumber>5.0</productnumber>
+ <edition>5.0.0</edition>
+ <pubsnumber>1</pubsnumber>
<abstract>
<para>The JSF Tools Reference Guide explains how to use the JSF Tools module to develop JSF applications.</para>
</abstract>
Modified: trunk/jsf/docs/jsf_tools_ref_guide/en-US/images/jsf_support/jsf_support_12.png
===================================================================
(Binary files differ)
13 years, 2 months
JBoss Tools SVN: r35779 - in branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US: images/plugins and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2011-10-18 19:21:52 -0400 (Tue, 18 Oct 2011)
New Revision: 35779
Added:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/dali_integration12.png
Modified:
branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Book_Info.xml
Log:
updated for TOOLSDOC-254
Modified: branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Book_Info.xml
===================================================================
--- branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Book_Info.xml 2011-10-18 23:19:49 UTC (rev 35778)
+++ branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/Book_Info.xml 2011-10-18 23:21:52 UTC (rev 35779)
@@ -7,7 +7,7 @@
<productname>JBoss Developer Studio</productname>
<productnumber>4.1</productnumber>
<edition>4.1.0</edition>
- <pubsnumber>1</pubsnumber>
+ <pubsnumber>2</pubsnumber>
<abstract>
<para>
The Hibernate Tools Reference Guide explains how to use the Hibernate Tools to perform reverse engineering, code generation, visualization and interaction with Hibernate.
Added: branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/dali_integration12.png
===================================================================
(Binary files differ)
Property changes on: branches/jbosstools-3.2.x/hibernatetools/docs/reference/en-US/images/plugins/dali_integration12.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
13 years, 2 months
JBoss Tools SVN: r35778 - in trunk/hibernatetools/docs/reference/en-US: images/plugins and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2011-10-18 19:19:49 -0400 (Tue, 18 Oct 2011)
New Revision: 35778
Added:
trunk/hibernatetools/docs/reference/en-US/images/plugins/dali_integration12.png
Modified:
trunk/hibernatetools/docs/reference/en-US/Book_Info.xml
Log:
updated for TOOLSDOC-254
Modified: trunk/hibernatetools/docs/reference/en-US/Book_Info.xml
===================================================================
--- trunk/hibernatetools/docs/reference/en-US/Book_Info.xml 2011-10-18 22:58:27 UTC (rev 35777)
+++ trunk/hibernatetools/docs/reference/en-US/Book_Info.xml 2011-10-18 23:19:49 UTC (rev 35778)
@@ -7,7 +7,7 @@
<productname>JBoss Developer Studio</productname>
<productnumber>4.1</productnumber>
<edition>4.1.0</edition>
- <pubsnumber>1</pubsnumber>
+ <pubsnumber>2</pubsnumber>
<abstract>
<para>
The Hibernate Tools Reference Guide explains how to use the Hibernate Tools to perform reverse engineering, code generation, visualization and interaction with Hibernate.
Added: trunk/hibernatetools/docs/reference/en-US/images/plugins/dali_integration12.png
===================================================================
(Binary files differ)
Property changes on: trunk/hibernatetools/docs/reference/en-US/images/plugins/dali_integration12.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
13 years, 2 months
JBoss Tools SVN: r35777 - trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/preferences.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-10-18 18:58:27 -0400 (Tue, 18 Oct 2011)
New Revision: 35777
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/preferences/CDISeamConfigurationBlockDescriptionProvider.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/preferences/CDISeamPreferencesMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/preferences/CDISeamPreferencesMessages.properties
Log:
JBIDE-9244
https://issues.jboss.org/browse/JBIDE-9244
Implemented validation of default beans (Solder); preferences are added.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/preferences/CDISeamConfigurationBlockDescriptionProvider.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/preferences/CDISeamConfigurationBlockDescriptionProvider.java 2011-10-18 22:57:31 UTC (rev 35776)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/preferences/CDISeamConfigurationBlockDescriptionProvider.java 2011-10-18 22:58:27 UTC (rev 35777)
@@ -1,7 +1,5 @@
package org.jboss.tools.cdi.seam.config.ui.preferences;
-import org.jboss.tools.cdi.core.CDICorePlugin;
-import org.jboss.tools.cdi.core.preferences.CDIPreferences;
import org.jboss.tools.cdi.seam.config.core.CDISeamConfigCorePlugin;
import org.jboss.tools.cdi.seam.config.core.CDISeamConfigPreferences;
import org.jboss.tools.cdi.seam.solder.core.CDISeamSolderCorePlugin;
@@ -34,6 +32,8 @@
{CDISeamSolderPreferences.AMBIGUOUS_GENERIC_CONFIGURATION_POINT, CDISeamPreferencesMessages.CDIValidatorConfigurationBlock_pb_ambiguousGenericConfigurationPoint_label},
{CDISeamSolderPreferences.WRONG_TYPE_OF_GENERIC_CONFIGURATION_POINT, CDISeamPreferencesMessages.CDIValidatorConfigurationBlock_pb_wrongTypeOfGenericConfigurationPoint_label},
{CDISeamSolderPreferences.GENERIC_CONFIGURATION_TYPE_IS_A_GENERIC_BEAN, CDISeamPreferencesMessages.CDIValidatorConfigurationBlock_pb_genericConfigurationTypeIsGenericBean_label},
+ {CDISeamSolderPreferences.DEFAULT_PRODUCER_FIELD_ON_NORMAL_SCOPED_BEAN, CDISeamPreferencesMessages.CDIValidatorConfigurationBlock_pb_defaultProducerFieldOnNormalScopedBean_label},
+ {CDISeamSolderPreferences.IDENTICAL_DEFAULT_BEANS, CDISeamPreferencesMessages.CDIValidatorConfigurationBlock_pb_identicalDefaultBeans_label},
},
CDISeamSolderCorePlugin.PLUGIN_ID
);
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/preferences/CDISeamPreferencesMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/preferences/CDISeamPreferencesMessages.java 2011-10-18 22:57:31 UTC (rev 35776)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/preferences/CDISeamPreferencesMessages.java 2011-10-18 22:58:27 UTC (rev 35777)
@@ -22,6 +22,8 @@
public static String CDIValidatorConfigurationBlock_pb_wrongTypeOfGenericConfigurationPoint_label;
public static String CDIValidatorConfigurationBlock_pb_wrongGenericConfigurationAnnotationReference_label;
public static String CDIValidatorConfigurationBlock_pb_genericConfigurationTypeIsGenericBean_label;
+ public static String CDIValidatorConfigurationBlock_pb_defaultProducerFieldOnNormalScopedBean_label;
+ public static String CDIValidatorConfigurationBlock_pb_identicalDefaultBeans_label;
public static String CDI_SEAM_VALIDATOR_PREFERENCE_PAGE_TITLE;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/preferences/CDISeamPreferencesMessages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/preferences/CDISeamPreferencesMessages.properties 2011-10-18 22:57:31 UTC (rev 35776)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/preferences/CDISeamPreferencesMessages.properties 2011-10-18 22:58:27 UTC (rev 35777)
@@ -13,7 +13,9 @@
##Section Seam Solder
CDIValidatorConfigurationBlock_section_solder=Seam Solder
-CDIValidatorConfigurationBlock_pb_ambiguousGenericConfigurationPoint_label=Duplicate Generic Configuration Point:
-CDIValidatorConfigurationBlock_pb_wrongTypeOfGenericConfigurationPoint_label=Wrong Type of Generic Configuration Point:
-CDIValidatorConfigurationBlock_pb_wrongGenericConfigurationAnnotationReference_label=Wrong Generic Configuration Annotation Reference:
-CDIValidatorConfigurationBlock_pb_genericConfigurationTypeIsGenericBean_label=Generic Configuration Type is a Generic Bean:
\ No newline at end of file
+CDIValidatorConfigurationBlock_pb_ambiguousGenericConfigurationPoint_label=Duplicate generic configuration point:
+CDIValidatorConfigurationBlock_pb_wrongTypeOfGenericConfigurationPoint_label=Wrong type of generic configuration point:
+CDIValidatorConfigurationBlock_pb_wrongGenericConfigurationAnnotationReference_label=Wrong generic configuration annotation reference:
+CDIValidatorConfigurationBlock_pb_genericConfigurationTypeIsGenericBean_label=Generic configuration type is a generic bean:
+CDIValidatorConfigurationBlock_pb_defaultProducerFieldOnNormalScopedBean_label=Default producer field is declared on normal scoped bean:
+CDIValidatorConfigurationBlock_pb_identicalDefaultBeans_label=Two or more default beans with same type and qualifiers:
\ No newline at end of file
13 years, 2 months
JBoss Tools SVN: r35776 - in trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test: src/org/jboss/tools/cdi/seam/solder/core/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-10-18 18:57:31 -0400 (Tue, 18 Oct 2011)
New Revision: 35776
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/defaultbean/DefaultFieldProducerBroken.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/defaultbean/IdenticalDefaultBeans.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/DefaultBeanValidationTest.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/CDISeamSolderCoreAllTests.java
Log:
JBIDE-9244
https://issues.jboss.org/browse/JBIDE-9244
Implemented validation of default beans (Solder). Tests are added.
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/defaultbean/DefaultFieldProducerBroken.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/defaultbean/DefaultFieldProducerBroken.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/defaultbean/DefaultFieldProducerBroken.java 2011-10-18 22:57:31 UTC (rev 35776)
@@ -0,0 +1,20 @@
+package org.jboss.defaultbean;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+import org.jboss.solder.bean.defaultbean.DefaultBean;
+
+@SessionScoped
+public class DefaultFieldProducerBroken implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Produces
+ @DefaultBean(String.class)
+ @Named("defaultbean172817")
+ String s;
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/defaultbean/DefaultFieldProducerBroken.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/defaultbean/IdenticalDefaultBeans.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/defaultbean/IdenticalDefaultBeans.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/defaultbean/IdenticalDefaultBeans.java 2011-10-18 22:57:31 UTC (rev 35776)
@@ -0,0 +1,23 @@
+package org.jboss.defaultbean;
+
+import javax.enterprise.inject.Produces;
+
+import org.jboss.solder.bean.defaultbean.DefaultBean;
+
+(a)DefaultBean(IdenticalDefaultBeans.class)
+@Cozy
+public class IdenticalDefaultBeans {
+
+ @Produces
+ @DefaultBean(IdenticalDefaultBeans.class)
+ @Cozy
+ IdenticalDefaultBeans bean;
+
+ @Produces
+ @DefaultBean(IdenticalDefaultBeans.class)
+ @Cozy
+ IdenticalDefaultBeans createBean() {
+ return null;
+ }
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/src/org/jboss/defaultbean/IdenticalDefaultBeans.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/CDISeamSolderCoreAllTests.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/CDISeamSolderCoreAllTests.java 2011-10-18 22:56:52 UTC (rev 35775)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/CDISeamSolderCoreAllTests.java 2011-10-18 22:57:31 UTC (rev 35776)
@@ -46,6 +46,7 @@
suite31.addTestSuite(MessageLoggerTest.class);
suite31.addTestSuite(ServiceHandlerTest.class);
suite31.addTestSuite(DefaultBeanTest.class);
+ suite31.addTestSuite(DefaultBeanValidationTest.class);
suite31.addTestSuite(UnwrapsTest.class);
suite31.addTestSuite(SeamServletValidationTest.class);
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/DefaultBeanValidationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/DefaultBeanValidationTest.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/DefaultBeanValidationTest.java 2011-10-18 22:57:31 UTC (rev 35776)
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.seam.solder.core.test;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.jboss.tools.cdi.seam.solder.core.validation.SeamSolderValidationMessages;
+import org.jboss.tools.tests.AbstractResourceMarkerTest;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class DefaultBeanValidationTest extends SeamSolderTest {
+
+ public DefaultBeanValidationTest() {}
+
+ public void testBrokenGenericBean() throws CoreException {
+ IFile file = getTestProject().getFile(new Path("src/org/jboss/defaultbean/DefaultFieldProducerBroken.java"));
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, SeamSolderValidationMessages.DEFAULT_PRODUCER_FIELD_ON_NORMAL_SCOPED_BEAN, 16);
+ }
+
+ public void testIdenticalDefaultBeans() throws CoreException {
+ IFile file = getTestProject().getFile(new Path("src/org/jboss/defaultbean/IdenticalDefaultBeans.java"));
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, SeamSolderValidationMessages.IDENTICAL_DEFAULT_BEANS.substring(0, 50) + ".*", 7, 12, 17);
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/src/org/jboss/tools/cdi/seam/solder/core/test/DefaultBeanValidationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 2 months
JBoss Tools SVN: r35775 - in trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core: validation and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-10-18 18:56:52 -0400 (Tue, 18 Oct 2011)
New Revision: 35775
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderDefaultBeanExtension.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderPreferences.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/validation/SeamSolderValidationMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/validation/messages.properties
Log:
JBIDE-9244
https://issues.jboss.org/browse/JBIDE-9244
Implemented validation of default beans (Solder).
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderDefaultBeanExtension.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderDefaultBeanExtension.java 2011-10-18 20:52:33 UTC (rev 35774)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderDefaultBeanExtension.java 2011-10-18 22:56:52 UTC (rev 35775)
@@ -14,23 +14,38 @@
import java.util.List;
import java.util.Set;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IMemberValuePair;
import org.eclipse.jdt.core.IType;
+import org.eclipse.osgi.util.NLS;
import org.jboss.tools.cdi.core.CDIConstants;
+import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.core.IBean;
+import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.core.IClassBean;
import org.jboss.tools.cdi.core.IProducer;
+import org.jboss.tools.cdi.core.IProducerField;
+import org.jboss.tools.cdi.core.IQualifierDeclaration;
import org.jboss.tools.cdi.core.IRootDefinitionContext;
+import org.jboss.tools.cdi.core.IScope;
import org.jboss.tools.cdi.core.extension.ICDIExtension;
import org.jboss.tools.cdi.core.extension.feature.IAmbiguousBeanResolverFeature;
import org.jboss.tools.cdi.core.extension.feature.IProcessAnnotatedTypeFeature;
+import org.jboss.tools.cdi.core.extension.feature.IValidatorFeature;
+import org.jboss.tools.cdi.internal.core.impl.CDIProject;
import org.jboss.tools.cdi.internal.core.impl.definition.AbstractMemberDefinition;
import org.jboss.tools.cdi.internal.core.impl.definition.FieldDefinition;
import org.jboss.tools.cdi.internal.core.impl.definition.MethodDefinition;
import org.jboss.tools.cdi.internal.core.impl.definition.TypeDefinition;
+import org.jboss.tools.cdi.internal.core.validation.CDICoreValidator;
+import org.jboss.tools.cdi.seam.solder.core.validation.SeamSolderValidationMessages;
import org.jboss.tools.common.java.IAnnotationDeclaration;
import org.jboss.tools.common.java.IJavaAnnotation;
+import org.jboss.tools.common.java.IParametedType;
+import org.jboss.tools.common.java.ParametedTypeFactory;
import org.jboss.tools.common.java.impl.AnnotationLiteral;
+import org.jboss.tools.common.preferences.SeverityPreferences;
/**
* Implements support for org.jboss.seam.solder.bean.defaultbean.DefaultBeanExtension.
@@ -44,7 +59,7 @@
* @author Viacheslav Kabanovich
*
*/
-public class CDISeamSolderDefaultBeanExtension implements ICDIExtension, IProcessAnnotatedTypeFeature, IAmbiguousBeanResolverFeature {
+public class CDISeamSolderDefaultBeanExtension implements ICDIExtension, IProcessAnnotatedTypeFeature, IAmbiguousBeanResolverFeature, IValidatorFeature {
protected Version getVersion() {
return Version.instance;
@@ -119,4 +134,58 @@
return result;
}
+ public void validateResource(IFile file, CDICoreValidator validator) {
+ String defaultBeanAnnotationTypeName = getVersion().getDefaultBeanAnnotationTypeName();
+ ICDIProject cdiProject = CDICorePlugin.getCDIProject(file.getProject(), true);
+ Set<IBean> bs = cdiProject.getBeans(file.getFullPath());
+ for (IBean bean: bs) {
+ IAnnotationDeclaration a = bean.getAnnotation(defaultBeanAnnotationTypeName);
+ if(a != null) {
+ if(bean instanceof IProducerField) {
+ IClassBean cb = ((IProducerField) bean).getClassBean();
+ IScope scope = cb.getScope();
+ if(scope != null && scope.isNorlmalScope()) {
+ validator.addError(SeamSolderValidationMessages.DEFAULT_PRODUCER_FIELD_ON_NORMAL_SCOPED_BEAN,
+ CDISeamSolderPreferences.DEFAULT_PRODUCER_FIELD_ON_NORMAL_SCOPED_BEAN, new String[]{}, a, file);
+ }
+ }
+ IQualifierDeclaration[] qs = bean.getQualifierDeclarations().toArray(new IQualifierDeclaration[0]);
+ Set<IParametedType> ts = bean.getLegalTypes();
+ if(ts.size() < 3) {
+ IParametedType type = null;
+ for (IParametedType t: ts) {
+ if(!"java.lang.Object".equals(t.getType().getFullyQualifiedName())) {
+ type = t;
+ }
+ }
+ if(type != null) {
+ Set<IBean> bs2 = cdiProject.getBeans(false, type, qs);
+ StringBuilder otherDefaultBeans = new StringBuilder();
+ for (IBean b: bs2) {
+ try {
+ if(b != bean && b.isAnnotationPresent(defaultBeanAnnotationTypeName)
+ && CDIProject.areMatchingQualifiers(bean.getQualifierDeclarations(), b.getQualifierDeclarations(true))) {
+ if(otherDefaultBeans.length() > 0) {
+ otherDefaultBeans.append(", ");
+ }
+ otherDefaultBeans.append(b.getElementName());
+ }
+ } catch (CoreException e) {
+ CDISeamSolderCorePlugin.getDefault().logError(e);
+ }
+ }
+ if(otherDefaultBeans.length() > 0) {
+ String message = NLS.bind(SeamSolderValidationMessages.IDENTICAL_DEFAULT_BEANS, otherDefaultBeans);
+ validator.addError(message, CDISeamSolderPreferences.IDENTICAL_DEFAULT_BEANS, new String[]{}, a, file);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public SeverityPreferences getSeverityPreferences() {
+ return CDISeamSolderPreferences.getInstance();
+ }
+
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderPreferences.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderPreferences.java 2011-10-18 20:52:33 UTC (rev 35774)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderPreferences.java 2011-10-18 22:56:52 UTC (rev 35775)
@@ -29,6 +29,9 @@
public static final String WRONG_TYPE_OF_GENERIC_CONFIGURATION_POINT = INSTANCE.createSeverityOption("wrongTypeOfGenericConfigurationPoint");
public static final String WRONG_GENERIC_CONFIGURATION_ANNOTATION_REFERENCE = INSTANCE.createSeverityOption("wrongGenericConfigurationAnnotationReference");
public static final String GENERIC_CONFIGURATION_TYPE_IS_A_GENERIC_BEAN = INSTANCE.createSeverityOption("genericConfigurationTypeIsGenericBean");
+
+ public static final String DEFAULT_PRODUCER_FIELD_ON_NORMAL_SCOPED_BEAN = INSTANCE.createSeverityOption("defaultProducerFieldOnNormalScopedBean");
+ public static final String IDENTICAL_DEFAULT_BEANS = INSTANCE.createSeverityOption("identicalDefaultBeans");
public static CDISeamSolderPreferences getInstance() {
return INSTANCE;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/validation/SeamSolderValidationMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/validation/SeamSolderValidationMessages.java 2011-10-18 20:52:33 UTC (rev 35774)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/validation/SeamSolderValidationMessages.java 2011-10-18 22:56:52 UTC (rev 35775)
@@ -26,6 +26,9 @@
public static String WRONG_GENERIC_CONFIGURATION_ANNOTATION_REFERENCE;
public static String GENERIC_CONFIGURATION_TYPE_IS_A_GENERIC_BEAN;
+ public static String DEFAULT_PRODUCER_FIELD_ON_NORMAL_SCOPED_BEAN;
+ public static String IDENTICAL_DEFAULT_BEANS;
+
static {
NLS.initializeMessages(BUNDLE_NAME, SeamSolderValidationMessages.class);
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/validation/messages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/validation/messages.properties 2011-10-18 20:52:33 UTC (rev 35774)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/validation/messages.properties 2011-10-18 22:56:52 UTC (rev 35775)
@@ -2,3 +2,6 @@
WRONG_TYPE_OF_GENERIC_CONFIGURATION_POINT=Type of generic configuration point must be assignable to the generic configuration type.
WRONG_GENERIC_CONFIGURATION_ANNOTATION_REFERENCE=Annotation type mismatch: {0} is not a generic configuration annotation.
GENERIC_CONFIGURATION_TYPE_IS_A_GENERIC_BEAN=Generic configuration types may not be generic beans.
+
+DEFAULT_PRODUCER_FIELD_ON_NORMAL_SCOPED_BEAN=Default producer fields are not allowed on normal scoped beans.
+IDENTICAL_DEFAULT_BEANS=Other default beans have the same type and qualifiers: {0}
13 years, 2 months
JBoss Tools SVN: r35773 - trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-10-18 16:23:51 -0400 (Tue, 18 Oct 2011)
New Revision: 35773
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java
Log:
JBIDE-9368 Dashboard(s) for easy news aggregation, twitter and easy additional/3rd party plugin installation and project template/creation
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java 2011-10-18 20:14:23 UTC (rev 35772)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java 2011-10-18 20:23:51 UTC (rev 35773)
@@ -924,7 +924,7 @@
formText = toolkit.createFormText(composite, false);
formText.setLayoutData(td);
try {
- formText.setText("Problem rendering entry - " + StringEscapeUtils.unescapeXml(se.getMessage()), false, false);
+ formText.setText("Problem rendering entry - " + StringEscapeUtils.unescapeHtml(se.getMessage()), false, false);
} catch (Exception e1) {
JBossCentralActivator.log(se);
}
13 years, 2 months