org.eclipse.core.commands.AbstractParameterValueConverter Java Examples

The following examples show how to use org.eclipse.core.commands.AbstractParameterValueConverter. 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: CommandUtils.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public static Parameterization createParameter( Command command,
		String parameterId, Object value ) throws NotDefinedException,
		ExecutionException, ParameterValueConversionException
{
	ParameterType parameterType = command.getParameterType( parameterId );
	if ( parameterType == null )
	{
		throw new ExecutionException( "Command does not have a parameter type for the given parameter" ); //$NON-NLS-1$
	}

	IParameter param = command.getParameter( parameterId );
	AbstractParameterValueConverter valueConverter = parameterType.getValueConverter( );
	if ( valueConverter == null )
	{
		throw new ExecutionException( "Command does not have a value converter" ); //$NON-NLS-1$
	}

	String valueString = valueConverter.convertToString( value );
	Parameterization parm = new Parameterization( param, valueString );
	return parm;
}