Search in sources :

Example 1 with ERwinImportDialog

use of com.cubrid.common.ui.cubrid.database.erwin.dialog.ERwinImportDialog in project cubrid-manager by CUBRID.

the class ImportERwinAction method run.

public void run() {
    // FIXME logic code move to core module
    int selected = 0;
    int logined = 0;
    Object[] objects = getSelectedObj();
    if (objects instanceof Object[]) {
        for (Object object : objects) {
            if (object instanceof CubridDatabase) {
                selected++;
                CubridDatabase database = (CubridDatabase) object;
                if (database.isLogined()) {
                    logined++;
                }
            }
        }
    }
    if (selected > 1) {
        CommonUITool.openWarningBox(com.cubrid.common.ui.cubrid.database.erwin.Messages.errERwinSelectOneDbToImport);
        return;
    }
    if (selected <= 0) {
        CommonUITool.openWarningBox(com.cubrid.common.ui.cubrid.database.erwin.Messages.errERwinSelectImportDbToImport);
        return;
    }
    if (logined <= 0) {
        CommonUITool.openWarningBox(com.cubrid.common.ui.cubrid.database.erwin.Messages.errERwinSelectLoginedDbToImport);
        return;
    }
    Object[] obj = getSelectedObj();
    if (obj == null || obj.length != 1) {
        return;
    }
    if (!(obj[0] instanceof CubridDatabase)) {
        return;
    }
    database = (CubridDatabase) obj[0];
    ERwinImportDialog dialog = new ERwinImportDialog(getShell(), database);
    int returnvalue = dialog.open();
    if (returnvalue != IDialogConstants.OK_ID) {
        return;
    }
    ERXmlContainer container = dialog.getContainer();
    if (container.getErrMsg() != null && !container.getErrMsg().equals("")) {
        CommonUITool.openErrorBox(container.getErrMsg());
        return;
    }
    Map<String, TableSchema> tableSchema = container.getTableSchemas();
    Map<String, ERWinSchemaInfo> schemaInfos = container.getSchemaInfos();
    String modelName = container.getDatabaseName();
    createCompareModel(modelName, tableSchema, schemaInfos);
}
Also used : TableSchema(com.cubrid.common.ui.compare.schema.model.TableSchema) ERXmlContainer(com.cubrid.common.ui.cubrid.database.erwin.ERXmlContainer) ERWinSchemaInfo(com.cubrid.common.ui.cubrid.database.erwin.model.ERWinSchemaInfo) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) ERwinImportDialog(com.cubrid.common.ui.cubrid.database.erwin.dialog.ERwinImportDialog)

Aggregations

TableSchema (com.cubrid.common.ui.compare.schema.model.TableSchema)1 ERXmlContainer (com.cubrid.common.ui.cubrid.database.erwin.ERXmlContainer)1 ERwinImportDialog (com.cubrid.common.ui.cubrid.database.erwin.dialog.ERwinImportDialog)1 ERWinSchemaInfo (com.cubrid.common.ui.cubrid.database.erwin.model.ERWinSchemaInfo)1 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)1