org.eclipse.core.runtime.IExecutableExtension Java Examples

The following examples show how to use org.eclipse.core.runtime.IExecutableExtension. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConfigurationElement.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public Object createExecutableExtension( String propertyName )
		throws CoreException
{
	String value = attributes.get( propertyName );
	if ( value != null )
	{
		try
		{
			Class<?> clazz = Class.forName( value );
			Object inst = clazz.newInstance( );

			if( inst instanceof IExecutableExtension )
			{
			    ((IExecutableExtension)inst).setInitializationData( 
			            this, propertyName, null ); // TODO support adapter data
			}
			return inst;
		}
		catch ( Exception e )
		{
			throw new CoreException( new Status( IStatus.ERROR,
					"org.eclipse.birt.core", 0, e.getMessage( ), e ) ); //$NON-NLS-1$
		}
	}
	return null;
}
 
Example #2
Source File: N4ExecutableExtensionFactory.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public final Object create() throws CoreException {
	try {
		final Class<?> clazz = getClassLoader().loadClass(clazzName);
		final Injector injector = getInjector();
		final Object result = injector.getInstance(clazz);
		if (result instanceof IExecutableExtension) {
			((IExecutableExtension) result).setInitializationData(config, null, null);
		}
		return result;
	} catch (final Exception e) {
		throw new CoreException(new Status(ERROR, getBundleId(),
				nullToEmpty(e.getMessage()) + " ExtensionFactory: " + getClass().getName(), e));
	}
}