Display.getDefault().syncExec(new Runnable() {
public void run() {
getShell().setCursor(getWaitCursor());
}
});
IEOSQLGenerator sqlGenerator = IEOSQLGeneratorFactory.Utility.sqlGeneratorFactory().sqlGenerator(_model, getEntityNames(), selectedDatabaseConfig, getEOModelClassLoader(), runInEntityModeler);
String url = selectedDatabaseConfig.getURL();
char commandSeparatorChar;
// yes. This sucks.
if (url != null && url.toLowerCase().contains("oracle")) {
commandSeparatorChar = '/';
} else {
commandSeparatorChar = ';';
}
List<String> statements = SQLUtils.splitSQLStatements(allSql, commandSeparatorChar);
setCancel(false);
for (int statementsNum = 0; !_cancel && statementsNum < statements.size(); statementsNum++) {
String statement = statements.get(statementsNum);
statement = statement.trim().replaceAll("[\n\r]", " ");
if (statement.length() > 0) {
try {
sqlGenerator.executeSQL(statement);
} catch (final Throwable t) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
MessageDialog dialog = new MessageDialog(getShell(), "Error", null, StringUtils.getErrorMessage(t) + "\n\nThere was an error, do you want to cancel the rest of the script?", MessageDialog.QUESTION, new String[] { "Cancel", "Continue" }, 0);
int results = dialog.open();