Author: dgeraskov
Date: 2010-03-19 10:08:16 -0400 (Fri, 19 Mar 2010)
New Revision: 20930
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/IReverseEngineeringDefinition.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ReverseEngineeringDefinitionImpl.java
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/model/DOMReverseEngineeringDefinition.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6074
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/IReverseEngineeringDefinition.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/IReverseEngineeringDefinition.java 2010-03-19
13:03:34 UTC (rev 20929)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/IReverseEngineeringDefinition.java 2010-03-19
14:08:16 UTC (rev 20930)
@@ -58,7 +58,10 @@
void addTable(IRevEngTable retable);
void removeTable(IRevEngTable retable);
void removeColumn(IRevEngColumn recolumn);
+ void removePrimaryKey(IRevEngPrimaryKey reprimaryKey);
+ void removeGenerator(IRevEngGenerator regenerator);
+ void removeParameter(IRevEngParameter reparam);
IRevEngColumn createColumn();
- IRevEngColumn createKeyColumn();
+ IRevEngColumn createKeyColumn();
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ReverseEngineeringDefinitionImpl.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ReverseEngineeringDefinitionImpl.java 2010-03-19
13:03:34 UTC (rev 20929)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ReverseEngineeringDefinitionImpl.java 2010-03-19
14:08:16 UTC (rev 20930)
@@ -27,6 +27,9 @@
import java.util.List;
import org.hibernate.eclipse.console.model.IRevEngColumn;
+import org.hibernate.eclipse.console.model.IRevEngGenerator;
+import org.hibernate.eclipse.console.model.IRevEngParameter;
+import org.hibernate.eclipse.console.model.IRevEngPrimaryKey;
import org.hibernate.eclipse.console.model.IRevEngTable;
import org.hibernate.eclipse.console.model.IReverseEngineeringDefinition;
import org.hibernate.eclipse.console.model.ITableFilter;
@@ -164,7 +167,19 @@
public void removeColumn(IRevEngColumn recolumn) {
}
+
+ public void removeGenerator(IRevEngGenerator regenerator) {
+
+ }
+ public void removeParameter(IRevEngParameter reparam) {
+
+ }
+
+ public void removePrimaryKey(IRevEngPrimaryKey reprimaryKey) {
+
+ }
+
public IRevEngColumn createColumn() {
return null;
}
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 2010-03-19
13:03:34 UTC (rev 20929)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/reveng/TablePropertiesBlock.java 2010-03-19
14:08:16 UTC (rev 20930)
@@ -58,6 +58,9 @@
import org.eclipse.ui.forms.widgets.Section;
import org.hibernate.cfg.reveng.TableIdentifier;
import org.hibernate.eclipse.console.model.IRevEngColumn;
+import org.hibernate.eclipse.console.model.IRevEngGenerator;
+import org.hibernate.eclipse.console.model.IRevEngParameter;
+import org.hibernate.eclipse.console.model.IRevEngPrimaryKey;
import org.hibernate.eclipse.console.model.IRevEngTable;
import org.hibernate.eclipse.console.model.IReverseEngineeringDefinition;
import org.hibernate.eclipse.console.workbench.DeferredContentProvider;
@@ -268,13 +271,30 @@
updateSelection = true;
}
editor.getReverseEngineeringDefinition().removeTable(retable);
- }
- else if (obj instanceof IRevEngColumn) {
+ } else if (obj instanceof IRevEngColumn) {
IRevEngColumn recolumn = (IRevEngColumn)obj;
if (recolumn instanceof RevEngColumnAdapter) {
updateSelection = true;
}
editor.getReverseEngineeringDefinition().removeColumn(recolumn);
+ } else if (obj instanceof IRevEngPrimaryKey) {
+ IRevEngPrimaryKey reprimaryKey = (IRevEngPrimaryKey)obj;
+ if (reprimaryKey instanceof RevEngPrimaryKeyAdapter) {
+ updateSelection = true;
+ }
+ editor.getReverseEngineeringDefinition().removePrimaryKey(reprimaryKey);
+ } else if (obj instanceof IRevEngGenerator) {
+ IRevEngGenerator regenerator = (IRevEngGenerator)obj;
+ if (regenerator instanceof RevEngGeneratorAdapter) {
+ updateSelection = true;
+ }
+ editor.getReverseEngineeringDefinition().removeGenerator(regenerator);
+ } else if (obj instanceof IRevEngParameter) {
+ IRevEngParameter reparam = (IRevEngParameter)obj;
+ if (reparam instanceof RevEngParamAdapter) {
+ updateSelection = true;
+ }
+ editor.getReverseEngineeringDefinition().removeParameter(reparam);
}
}
if (updateSelection) {
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/model/DOMReverseEngineeringDefinition.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/model/DOMReverseEngineeringDefinition.java 2010-03-19
13:03:34 UTC (rev 20929)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/model/DOMReverseEngineeringDefinition.java 2010-03-19
14:08:16 UTC (rev 20930)
@@ -351,27 +351,34 @@
}
public void removeTable(IRevEngTable retable) {
- if (retable instanceof RevEngTableAdapter) {
- RevEngTableAdapter tf = (RevEngTableAdapter) retable;
- Node parentNode = tf.getNode().getParentNode();
- Node previousSibling = tf.getNode().getPreviousSibling();
- if (DOMModelUtil.isWhiteSpace(previousSibling)) {
- parentNode.removeChild(previousSibling);
- }
- parentNode.removeChild(tf.getNode());
- DOMModelUtil.formatNode(parentNode);
- }
+ removeDomAdapterNode(retable);
}
public void removeColumn(IRevEngColumn recolumn) {
- if (recolumn instanceof RevEngColumnAdapter) {
- RevEngColumnAdapter cf = (RevEngColumnAdapter) recolumn;
- Node parentNode = cf.getNode().getParentNode();
- Node previousSibling = cf.getNode().getPreviousSibling();
+ removeDomAdapterNode(recolumn);
+ }
+
+ public void removeGenerator(IRevEngGenerator regenerator) {
+ removeDomAdapterNode(regenerator);
+ }
+
+ public void removeParameter(IRevEngParameter reparam) {
+ removeDomAdapterNode(reparam);
+ }
+
+ public void removePrimaryKey(IRevEngPrimaryKey reprimaryKey) {
+ removeDomAdapterNode(reprimaryKey);
+ }
+
+ private void removeDomAdapterNode(Object node){
+ if (node instanceof DOMAdapter) {
+ DOMAdapter pf = (DOMAdapter) node;
+ Node parentNode = pf.getNode().getParentNode();
+ Node previousSibling = pf.getNode().getPreviousSibling();
if (DOMModelUtil.isWhiteSpace(previousSibling)) {
parentNode.removeChild(previousSibling);
}
- parentNode.removeChild(cf.getNode());
+ parentNode.removeChild(pf.getNode());
DOMModelUtil.formatNode(parentNode);
}
}