Set<EOModelVerificationFailure> failures = new HashSet<EOModelVerificationFailure>();
IContainer parentContainer = (IContainer) _parentResource;
IFolder existingModelFolder = parentContainer.getFolder(new Path(_modelName + ".eomodeld"));
if (existingModelFolder.exists()) {
failures.add(new EOModelVerificationFailure(null, "There's already a model in " + existingModelFolder.getLocation().toOSString() + ".", true, null));
EOModelErrorDialog errors = new EOModelErrorDialog(Display.getDefault().getActiveShell(), failures);
errors.open();
return;
}
boolean createModelGroup = false;
EOModelGroup modelGroup = new EOModelGroup();
try {
IEOModelGroupFactory.Utility.loadModelGroup(_parentResource, modelGroup, failures, true, existingModelFolder.getLocation().toFile().toURL(), new NullProgressMonitor());
} catch (Exception e) {
failures.clear();
failures.add(new EOModelVerificationFailure(null, "Creating empty EOModelGroup for this model because " + e.getMessage(), true, e));
modelGroup = new EOModelGroup();
createModelGroup = true;
EOModelErrorDialog errors = new EOModelErrorDialog(Display.getDefault().getActiveShell(), failures);
errors.open();
}
EOModel model = new EOModel(_modelName);
EODatabaseConfig databaseConfig = new EODatabaseConfig("Default");
databaseConfig.setAdaptorName(_adaptorName);