/**
* @see ScriptableFunctionBase#execute(Object, Object[])
*/
public Object execute( Object thiz, Object[] args ) {
ApplicationIndicatorRegistry reg = ApplicationIndicatorRegistry.getInstance();
EncodedImage image = EncodedImage.getEncodedImageResource( (String) args[ 0 ] );
if( image == null ) {
throw new IllegalArgumentException( "Icon was not found." );
}
try {
ApplicationIcon icon = new ApplicationIcon( image );
if( reg.getApplicationIndicator() != null ) {
reg.unregister();
}
ApplicationIndicator indicator;
if( args.length > 1 ) {
// Set icon and value
indicator = reg.register( icon, false, false );
indicator.set( icon, ( (Integer) args[ 1 ] ).intValue() );
} else {
// Set icon only
indicator = reg.register( icon, true, false );
indicator.setIcon( icon );
}
indicator.setVisible( true );
} catch( IllegalArgumentException e ) {