Author: scabanovich
Date: 2012-01-25 16:27:23 -0500 (Wed, 25 Jan 2012)
New Revision: 38189
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderDefaultBeanExtension.java
Log:
Code improvent: default bean extension is to be obtained by static helper method
getExtension(CDICoreNature) rather than by common getExtensionByRuntime with runtime id
which may change.
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 2012-01-25
19:12:41 UTC (rev 38188)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderDefaultBeanExtension.java 2012-01-25
21:27:23 UTC (rev 38189)
@@ -24,6 +24,7 @@
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.CDICoreNature;
import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.core.CDIUtil;
import org.jboss.tools.cdi.core.IBean;
@@ -71,9 +72,22 @@
*
*/
public class CDISeamSolderDefaultBeanExtension implements ICDIExtension,
IProcessAnnotatedTypeFeature, IAmbiguousBeanResolverFeature, IValidatorFeature,
IBeanKeyProvider, IBeanStoreFeature {
+ private static String ID =
"org.jboss.solder.bean.defaultbean.DefaultBeanExtension"; //$NON-NLS-1$
+ private static String ID_30 =
"org.jboss.seam.solder.bean.defaultbean.DefaultBeanExtension"; //$NON-NLS-1$
protected Map<String, Set<IBean>> defaultBeansByKey = new HashMap<String,
Set<IBean>>();
+ public static CDISeamSolderDefaultBeanExtension getExtension(CDICoreNature project) {
+ ICDIExtension result = project.getExtensionManager().getExtensionByRuntime(ID);
+ if(result == null) {
+ result = project.getExtensionManager().getExtensionByRuntime(ID_30);
+ }
+ if(result instanceof CDISeamSolderDefaultBeanExtension) {
+ return (CDISeamSolderDefaultBeanExtension)result;
+ }
+ return null;
+ }
+
protected Version getVersion() {
return Version.instance;
}
Show replies by date