Object selectedObject = getSelectedObject();
EOModel model = EOModelUtils.getRelatedModel(selectedObject);
if (model == null) {
MessageDialog.openError(getWindow().getShell(), "Select a Model", "Select a model to reverse engineer into.");
} else {
EODatabaseConfig activeDatabaseConfig = model.getActiveDatabaseConfig();
ClassLoader eomodelClassLoader = IEOClassLoaderFactory.Utility.createClassLoader(model);
IEOSQLReverseEngineer reverseEngineer = IEOSQLReverseEngineerFactory.Utility.reverseEngineerFactory().reverseEngineer(activeDatabaseConfig, eomodelClassLoader);
List<String> tableNames = reverseEngineer.reverseEngineerTableNames();
ListSelectionDialog dlg = new ListSelectionDialog(getWindow().getShell(), tableNames, new StringContentProvider(), new StringLabelProvider(), "Select the tables to reverse engineer:");