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);
}
Aggregations