"!" + details + "!",
UIManagerEvent.MT_YES | UIManagerEvent.MT_NO );
if ( res != UIManagerEvent.MT_YES ){
throw( new MetaSearchException( "User declined the template" ));
}
}
// if local template then we try to use the id as is otherwise we emsure that
// it is a local one
if ( id >= 0 && id < Integer.MAX_VALUE ){
id = getLocalTemplateID();
engine.setId( id );
}
engine.setSource( Engine.ENGINE_SOURCE_LOCAL );
engine.setSelectionState( Engine.SEL_STATE_MANUAL_SELECTED );
meta_search.addEngine( engine );
if ( warn_user ){
UIManager ui_manager = StaticUtilities.getUIManager( 120*1000 );
String details = MessageText.getString(
"metasearch.addtemplate.done.desc",
new String[]{ engine.getName() });
ui_manager.showMessageBox(
"metasearch.addtemplate.done.title",
"!" + details + "!",
UIManagerEvent.MT_OK );
}
return( engine );
}catch( Throwable e ){
if ( warn_user ){
UIManager ui_manager = StaticUtilities.getUIManager( 120*1000 );
String details = MessageText.getString(
"metasearch.addtemplate.failed.desc",
new String[]{ Debug.getNestedExceptionMessage(e) });
ui_manager.showMessageBox(
"metasearch.addtemplate.failed.title",
"!" + details + "!",
UIManagerEvent.MT_OK );
}
throw( new MetaSearchException( "Failed to add engine", e ));
}
}