Search in sources :

Example 1 with MySQLDatabaseExportInfo

use of org.jkiss.dbeaver.ext.mysql.tasks.MySQLDatabaseExportInfo in project dbeaver by serge-rider.

the class MySQLExportWizardPageObjects method saveState.

public void saveState() {
    List<MySQLDatabaseExportInfo> objects = wizard.getSettings().getExportObjects();
    objects.clear();
    for (TableItem item : catalogTable.getItems()) {
        if (item.getChecked()) {
            MySQLCatalog catalog = (MySQLCatalog) item.getData();
            MySQLDatabaseExportInfo info = new MySQLDatabaseExportInfo(catalog, checkedObjects.get(catalog));
            objects.add(info);
        }
    }
}
Also used : MySQLCatalog(org.jkiss.dbeaver.ext.mysql.model.MySQLCatalog) MySQLDatabaseExportInfo(org.jkiss.dbeaver.ext.mysql.tasks.MySQLDatabaseExportInfo)

Example 2 with MySQLDatabaseExportInfo

use of org.jkiss.dbeaver.ext.mysql.tasks.MySQLDatabaseExportInfo in project dbeaver by dbeaver.

the class MySQLExportWizardPageObjects method saveState.

public void saveState() {
    List<MySQLDatabaseExportInfo> objects = wizard.getSettings().getExportObjects();
    objects.clear();
    for (TableItem item : catalogTable.getItems()) {
        if (item.getChecked()) {
            MySQLCatalog catalog = (MySQLCatalog) item.getData();
            MySQLDatabaseExportInfo info = new MySQLDatabaseExportInfo(catalog, checkedObjects.get(catalog));
            objects.add(info);
        }
    }
}
Also used : MySQLCatalog(org.jkiss.dbeaver.ext.mysql.model.MySQLCatalog) MySQLDatabaseExportInfo(org.jkiss.dbeaver.ext.mysql.tasks.MySQLDatabaseExportInfo)

Example 3 with MySQLDatabaseExportInfo

use of org.jkiss.dbeaver.ext.mysql.tasks.MySQLDatabaseExportInfo in project dbeaver by serge-rider.

the class MySQLExportWizardPageObjects method loadSettings.

private void loadSettings() {
    checkedObjects.clear();
    catalogTable.removeAll();
    boolean hasViews = false;
    MySQLDataSource dataSource = null;
    Set<MySQLCatalog> activeCatalogs = new LinkedHashSet<>();
    for (MySQLDatabaseExportInfo info : wizard.getSettings().getExportObjects()) {
        activeCatalogs.add(info.getDatabase());
        dataSource = info.getDatabase().getDataSource();
        if (!CommonUtils.isEmpty(info.getTables())) {
            Set<MySQLTableBase> tables = checkedObjects.computeIfAbsent(info.getDatabase(), k -> new HashSet<>());
            for (MySQLTableBase table : info.getTables()) {
                tables.add(table);
                if (table.isView()) {
                    hasViews = true;
                }
            }
        }
    }
    if (hasViews) {
        wizard.getSettings().setShowViews(true);
        exportViewsCheck.setSelection(true);
    }
    if (dataSource != null) {
        boolean tablesLoaded = false;
        for (MySQLCatalog catalog : dataSource.getCatalogs()) {
            TableItem item = new TableItem(catalogTable, SWT.NONE);
            item.setImage(DBeaverIcons.getImage(DBIcon.TREE_DATABASE));
            item.setText(0, catalog.getName());
            item.setData(catalog);
            if (activeCatalogs.contains(catalog)) {
                item.setChecked(true);
                catalogTable.select(catalogTable.indexOf(item));
                if (!tablesLoaded) {
                    loadTables(catalog);
                    tablesLoaded = true;
                }
            }
        }
    }
    updateState();
}
Also used : MySQLTableBase(org.jkiss.dbeaver.ext.mysql.model.MySQLTableBase) MySQLDataSource(org.jkiss.dbeaver.ext.mysql.model.MySQLDataSource) MySQLCatalog(org.jkiss.dbeaver.ext.mysql.model.MySQLCatalog) MySQLDatabaseExportInfo(org.jkiss.dbeaver.ext.mysql.tasks.MySQLDatabaseExportInfo)

Example 4 with MySQLDatabaseExportInfo

use of org.jkiss.dbeaver.ext.mysql.tasks.MySQLDatabaseExportInfo in project dbeaver by dbeaver.

the class MySQLExportWizardPageObjects method loadSettings.

private void loadSettings() {
    checkedObjects.clear();
    catalogTable.removeAll();
    boolean hasViews = false;
    MySQLDataSource dataSource = null;
    Set<MySQLCatalog> activeCatalogs = new LinkedHashSet<>();
    for (MySQLDatabaseExportInfo info : wizard.getSettings().getExportObjects()) {
        activeCatalogs.add(info.getDatabase());
        dataSource = info.getDatabase().getDataSource();
        if (!CommonUtils.isEmpty(info.getTables())) {
            Set<MySQLTableBase> tables = checkedObjects.computeIfAbsent(info.getDatabase(), k -> new HashSet<>());
            for (MySQLTableBase table : info.getTables()) {
                tables.add(table);
                if (table.isView()) {
                    hasViews = true;
                }
            }
        }
    }
    if (hasViews) {
        wizard.getSettings().setShowViews(true);
        exportViewsCheck.setSelection(true);
    }
    if (dataSource != null) {
        boolean tablesLoaded = false;
        for (MySQLCatalog catalog : dataSource.getCatalogs()) {
            TableItem item = new TableItem(catalogTable, SWT.NONE);
            item.setImage(DBeaverIcons.getImage(DBIcon.TREE_DATABASE));
            item.setText(0, catalog.getName());
            item.setData(catalog);
            if (activeCatalogs.contains(catalog)) {
                item.setChecked(true);
                catalogTable.select(catalogTable.indexOf(item));
                if (!tablesLoaded) {
                    loadTables(catalog);
                    tablesLoaded = true;
                }
            }
        }
    }
    updateState();
}
Also used : MySQLTableBase(org.jkiss.dbeaver.ext.mysql.model.MySQLTableBase) MySQLDataSource(org.jkiss.dbeaver.ext.mysql.model.MySQLDataSource) MySQLCatalog(org.jkiss.dbeaver.ext.mysql.model.MySQLCatalog) MySQLDatabaseExportInfo(org.jkiss.dbeaver.ext.mysql.tasks.MySQLDatabaseExportInfo)

Aggregations

MySQLCatalog (org.jkiss.dbeaver.ext.mysql.model.MySQLCatalog)4 MySQLDatabaseExportInfo (org.jkiss.dbeaver.ext.mysql.tasks.MySQLDatabaseExportInfo)4 MySQLDataSource (org.jkiss.dbeaver.ext.mysql.model.MySQLDataSource)2 MySQLTableBase (org.jkiss.dbeaver.ext.mysql.model.MySQLTableBase)2