X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=eclipse%2Fruntime%2Forg.argeo.eclipse.ui%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Feclipse%2Fspring%2FSpringExtensionFactory.java;h=d8ec9d77a0f317c05ed3fa0d8466c1ddc05ff83b;hb=1d5afdce3e91054f07ddd3c98309c363b4cf1d46;hp=f20e1d1249f70c8e3a73fddaee6226ac9ee0e95d;hpb=24652d1f8e6e8293ebae76121f0369a262ba503a;p=lgpl%2Fargeo-commons.git diff --git a/eclipse/runtime/org.argeo.eclipse.ui/src/main/java/org/argeo/eclipse/spring/SpringExtensionFactory.java b/eclipse/runtime/org.argeo.eclipse.ui/src/main/java/org/argeo/eclipse/spring/SpringExtensionFactory.java index f20e1d124..d8ec9d77a 100644 --- a/eclipse/runtime/org.argeo.eclipse.ui/src/main/java/org/argeo/eclipse/spring/SpringExtensionFactory.java +++ b/eclipse/runtime/org.argeo.eclipse.ui/src/main/java/org/argeo/eclipse/spring/SpringExtensionFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Mathieu Baudier + * Copyright (C) 2007-2012 Mathieu Baudier * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.argeo.eclipse.spring; import org.argeo.ArgeoException; @@ -63,9 +62,9 @@ public class SpringExtensionFactory implements IExecutableExtensionFactory, public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { String bundleSymbolicName = config.getContributor().getName(); - ApplicationContext appContext = ApplicationContextTracker + ApplicationContext applicationContext = ApplicationContextTracker .getApplicationContext(bundleSymbolicName); - if (appContext == null) + if (applicationContext == null) throw new ArgeoException( "Cannot find application context for bundle " + bundleSymbolicName); @@ -75,7 +74,15 @@ public class SpringExtensionFactory implements IExecutableExtensionFactory, throw new ArgeoException("Cannot find bean name for extension " + config); - this.bean = appContext.getBean(beanName); + if (!applicationContext.containsBean(beanName)) { + if (beanName.startsWith(bundleSymbolicName)) + beanName = beanName.substring(bundleSymbolicName.length() + 1); + } + + if (!applicationContext.containsBean(beanName)) + throw new ArgeoException("No bean with name '" + beanName + "'"); + + this.bean = applicationContext.getBean(beanName); if (this.bean instanceof IExecutableExtension) { ((IExecutableExtension) this.bean).setInitializationData(config, propertyName, data);