Author: vyemialyanchyk
Date: 2008-10-16 06:31:27 -0400 (Thu, 16 Oct 2008)
New Revision: 10874
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/reveng/TablePropertiesBlock.java
Log:
JBIDE-2784
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/reveng/TablePropertiesBlock.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/reveng/TablePropertiesBlock.java 2008-10-16
10:26:40 UTC (rev 10873)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/reveng/TablePropertiesBlock.java 2008-10-16
10:31:27 UTC (rev 10874)
@@ -26,6 +26,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.TreeSet;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
@@ -163,7 +164,27 @@
Map tables = new HashMap();
Map columns = new HashMap();
- if(lds!=null) {
+ if (lds == null) {
+ String tableName = "", namePrefix = "TABLE_"; //$NON-NLS-1$
//$NON-NLS-2$
+ IRevEngTable retable = editor.getReverseEngineeringDefinition().createTable();
+ retable.setCatalog(""); //$NON-NLS-1$
+ retable.setSchema(""); //$NON-NLS-1$
+ TreeSet ts = new TreeSet();
+ IRevEngTable[] retables = editor.getReverseEngineeringDefinition().getTables();
+ char separartor = '%';
+ for (int i = 0; i < retables.length; i++) {
+ ts.add(retables[i].getCatalog() + separartor + retables[i].getSchema() +
+ separartor + retables[i].getName());
+ }
+ String strCatalogSchema = retable.getCatalog() + separartor + retable.getSchema() +
separartor;
+ int i = 0;
+ do {
+ tableName = namePrefix + (i++);
+ } while (ts.contains(strCatalogSchema + tableName));
+ retable.setName(tableName);
+ editor.getReverseEngineeringDefinition().addTable(retable);
+ }
+ else {
dialog.setTitle(MapperMessages.TablePropertiesBlock_add_tables_columns);
dialog.setMessage(MapperMessages.TablePropertiesBlock_select_tables_columns);
dialog.setInput(lds);