1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
/*
* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; version 2 of the
* License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef _DB_REVERSE_ENGINEER_SCRIPT_H_
#define _DB_REVERSE_ENGINEER_SCRIPT_H_
#include "grtui/grt_wizard_plugin.h"
#include "grtui/wizard_progress_page.h"
#include "grtui/wizard_finished_page.h"
#include "db_rev_eng_be.h"
#include "mforms/fs_object_selector.h"
#include "mforms/table.h"
#include "mforms/label.h"
#include "mforms/selector.h"
#include "mforms/checkbox.h"
using namespace grtui;
using namespace mforms;
namespace ScriptImport {
/**
* Wizard page for setting up the import.
*/
class ImportInputPage : public WizardPage
{
private:
Table _table;
Label _heading;
Label _caption;
FsObjectSelector _file_selector;
Label _file_codeset_caption;
Selector _file_codeset_sel;
CheckBox _autoplace_check;
void fill_encodings_list();
public:
ImportInputPage(WizardPlugin *form);
void file_changed();
virtual bool allow_next();
virtual std::string next_button_caption();
void gather_options(bool advancing);
};
/**
* Wizard page that shows the progress of the current import operation.
*/
class ImportProgressPage : public WizardProgressPage
{
private:
Sql_import _import_be;
TaskRow *_auto_place_task;
boost::function<void (bool,std::string)> _finished_cb;
bool _auto_place;
bool _done;
public:
ImportProgressPage(WizardForm *form, const boost::function<void (bool,std::string)> &finished_cb);
void import_objects_finished(grt::ValueRef value);
bool import_objects();
bool verify_results();
bool place_objects();
virtual bool allow_back();
virtual void enter(bool advancing);
virtual void tasks_finished(bool success);
std::string get_summary();
};
/**
* The actual import wizard comprising the pages declared above and some additional stuff.
*/
class WbPluginSQLImport : public WizardPlugin
{
private:
ImportInputPage *_input_page;
ImportProgressPage *_progress_page;
WizardFinishedPage *_finish_page;
public:
WbPluginSQLImport(grt::Module *module);
void update_summary(bool success, const std::string &summary);
};
}; // namespace ScriptImport
grtui::WizardPlugin *createImportScriptWizard(grt::Module *module, db_CatalogRef catalog);
#endif // _DB_REVERSE_ENGINEER_SCRIPT_H_
|