### Eclipse Workspace Patch 1.0 #P org.eclipse.rap.rwt Index: META-INF/MANIFEST.MF =================================================================== RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/META-INF/MANIFEST.MF,v retrieving revision 1.45 diff -u -r1.45 MANIFEST.MF --- META-INF/MANIFEST.MF 15 Feb 2009 17:25:18 -0000 1.45 +++ META-INF/MANIFEST.MF 26 Feb 2009 14:07:58 -0000 @@ -9,7 +9,8 @@ Bundle-Localization: plugin Bundle-Vendor: %Bundle-Vendor Import-Package: javax.servlet;version="[2.3.0,2.5.0]", - javax.servlet.http;version="[2.3.0,2.5.0]" + javax.servlet.http;version="[2.3.0,2.5.0]", + org.eclipse.core.runtime Export-Package: org.apache.batik.css.parser;x-internal:=true, org.apache.batik.util.io;x-internal:=true, org.eclipse.rwt, Index: src/org/eclipse/rwt/internal/lifecycle/EntryPointManager.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/lifecycle/EntryPointManager.java,v retrieving revision 1.9 diff -u -r1.9 EntryPointManager.java --- src/org/eclipse/rwt/internal/lifecycle/EntryPointManager.java 12 Jun 2008 13:12:18 -0000 1.9 +++ src/org/eclipse/rwt/internal/lifecycle/EntryPointManager.java 26 Feb 2009 14:07:58 -0000 @@ -15,6 +15,7 @@ import java.util.HashMap; import java.util.Map; +import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.rwt.internal.service.ContextProvider; import org.eclipse.rwt.internal.util.ParamCheck; import org.eclipse.rwt.lifecycle.IEntryPoint; @@ -54,6 +55,20 @@ } } + public static void register( final String name, final IConfigurationElement configElement ) { + synchronized( registry ) { + ParamCheck.notNull( name, "name" ); + ParamCheck.notNull( configElement, "configElement" ); + if( registry.containsKey( name ) ) { + String text = "An entry point named ''{0}'' already exists."; + String msg = MessageFormat.format( text, new Object[] { name } ); + throw new IllegalArgumentException( msg ); + } + registry.put( name, configElement ); + } + } + + public static void deregister( final String name ) { synchronized( registry ) { ParamCheck.notNull( name, "name" ); @@ -65,10 +80,10 @@ registry.remove( name ); } } - + public static int createUI( final String name ) { IEntryPoint entryPoint; - Class clazz; + Object registeredObject; ParamCheck.notNull( name, "name" ); synchronized( registry ) { if( !registry.containsKey( name ) ) { @@ -76,22 +91,38 @@ String msg = MessageFormat.format( text, new Object[] { name } ); throw new IllegalArgumentException( msg ); } - clazz = ( Class )registry.get( name ); + registeredObject = registry.get( name ); } // no synchronization during instance creation to avoid lock in case // of expensive constructor operations - try { - entryPoint = ( IEntryPoint )clazz.newInstance(); - } catch( Exception e ) { - String text = "Failed to instantiate ''{0}''."; - Object[] args = new Object[] { clazz.getName() }; - String msg = MessageFormat.format( text, args ); - throw new EntryPointInstantiationException( msg, e ) ; - } + if (registeredObject instanceof IConfigurationElement) { + IConfigurationElement configElement = ( IConfigurationElement )registeredObject; + try { + entryPoint = ( IEntryPoint )configElement.createExecutableExtension("class"); + } catch( Exception e ) { + String text = "Failed to instantiate ''{0}''."; + Object[] args = new Object[] { configElement.getAttribute("class") }; + String msg = MessageFormat.format( text, args ); + throw new EntryPointInstantiationException( msg, e ) ; + } + } + else { + Class clazz = ( Class )registeredObject; + try { + entryPoint = ( IEntryPoint )clazz.newInstance(); + } catch( Exception e ) { + String text = "Failed to instantiate ''{0}''."; + Object[] args = new Object[] { clazz.getName() }; + String msg = MessageFormat.format( text, args ); + throw new EntryPointInstantiationException( msg, e ) ; + } + } + ContextProvider.getSession().setAttribute( CURRENT_ENTRY_POINT, name ); return entryPoint.createUI(); } + public static String getCurrentEntryPoint() { ISessionStore session = ContextProvider.getSession(); return ( String )session.getAttribute( CURRENT_ENTRY_POINT );