Search in sources :

Example 1 with ERXmlContainer

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

the class ImportERDataDialog method okPressed.

@Override
protected void okPressed() {
    if (isERWinFile()) {
        container = new ERXmlContainer();
        container.parse(erSchema.getCubridDatabase(), doc, null);
    }
    super.okPressed();
}
Also used : ERXmlContainer(com.cubrid.common.ui.cubrid.database.erwin.ERXmlContainer)

Example 2 with ERXmlContainer

use of com.cubrid.common.ui.cubrid.database.erwin.ERXmlContainer 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

ERXmlContainer (com.cubrid.common.ui.cubrid.database.erwin.ERXmlContainer)2 TableSchema (com.cubrid.common.ui.compare.schema.model.TableSchema)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