コード例 #1
0
void Cmd::executeExec() {
    MMSPluginService service(datasource);
    string import=cmdline["import"];
    MMSPluginData *data = NULL;

    if(import.empty()) {
    	cons.printError("No import plugin is given to execute. See cmd --help for further information.");
    	exit(1);
    }

    if(isdigit(import.c_str()))
    	data = service.getPluginByID(atoi(import.c_str()));
    else
    	data = service.getPluginByName(import);


    if(data!=NULL) {
        if(data->getType()->getName() != PT_IMPORT_PLUGIN) {
            char text[1024];
            sprintf(text, "Plugin with name or id %s is not an import plugin. ", import.c_str());
            cons.printError(text);
            exit(1);
        }
        MMSImportPluginHandler myhandler = MMSImportPluginHandler(*data, true);
         myhandler.invokeInitialize(NULL);

         char text[1024];
         sprintf(text,"executing import %s. ", data->getName().c_str());
         cons.linefeed();
         cons.printText(text);

         myhandler.invokeExecute(NULL);
         sprintf(text,"import %s sucessfully executed. ", data->getName().c_str());
         cons.printText(text);


    } else {
        char text[1024];
        sprintf(text, "Import plugin with name or id %s not found.", import.c_str());
        cons.printError(text);
        exit(1);
    }

}
コード例 #2
0
ファイル: mmsswitcher.cpp プロジェクト: RomTok/disco-light
void MMSSwitcher::setMenuItemValues(MMSWidget *item) {
	// get the plugin data
	if (!item) return;
	MMSPluginData *plugindata = (MMSPluginData *)item->getBinData();

	// set the plugin name
	MMSLabelWidget *pluginName = dynamic_cast<MMSLabelWidget*>(item->findWidget(SWITCHER_MENU_PLUGINNAME));
    if (pluginName) pluginName->setText(plugindata->getName());

    // set the plugin title
    MMSLabelWidget *pluginTitle = dynamic_cast<MMSLabelWidget*>(item->findWidget(SWITCHER_MENU_PLUGINTITLE));
    if (pluginTitle) pluginTitle->setText(plugindata->getTitle());

    // set the plugin icon
    MMSImageWidget *pluginIcon = dynamic_cast<MMSImageWidget*>(item->findWidget(SWITCHER_MENU_PLUGINICON));
    if (pluginIcon) {
        string path;
        string name;

        name = plugindata->getIcon();
		if (!searchingForImage(plugindata->getPath(), name, &path))
            if (!path.empty())
            	pluginIcon->setImage(path, name);
            else
				pluginIcon->setImageName(name);
		else
            pluginIcon->setImageName("plugin_icon.png");

        name = plugindata->getSelectedIcon();
		if (!searchingForImage(plugindata->getPath(), name, &path))
            if (!path.empty())
            	pluginIcon->setSelImage(path, name);
            else
				pluginIcon->setSelImageName(name);
		else
            pluginIcon->setSelImageName("plugin_icon_s.png");
    }
}