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);
model.addDatabaseConfig(databaseConfig);
modelGroup.addModel(model);
modelGroup.setEditingModelName(_modelName);
ProjectFrameworkAdapter frameworkAdapter = (ProjectFrameworkAdapter)_parentResource.getProject().getAdapter(ProjectFrameworkAdapter.class);
// add adaptor framework
if (!"None".equals(_adaptorName) && !"".equals(_adaptorName)) {
frameworkAdapter.addFrameworks(frameworkAdapter.getAdaptorFrameworks().get(_adaptorName));
}
if (!"None".equals(_pluginName) && !"".equals(_pluginName)) {
IEclipseFramework pluginFramework = frameworkAdapter.getPluginFrameworks().get(_pluginName);
frameworkAdapter.addFrameworks(pluginFramework);
String selectedPrototypeEntityName = "EO" + _adaptorName + _pluginName + "Prototypes";
EOEntity selectedPrototypeEntity = modelGroup.getEntityNamed(selectedPrototypeEntityName);
if (selectedPrototypeEntity != null) {
EODatabaseConfig activeConfig = model.getActiveDatabaseConfig();
if (activeConfig != null) {
activeConfig.setPrototype(selectedPrototypeEntity);
}