use of org.hibernate.eclipse.console.model.IRevEngParameter in project jbosstools-hibernate by jbosstools.
the class TablePropertiesBlock method doDelete.
protected void doDelete() {
ISelection sel = viewer.getSelection();
if (sel.isEmpty() || !(sel instanceof TreeSelection)) {
return;
}
boolean updateSelection = false;
TreeSelection ts = (TreeSelection) sel;
List<?> list = ts.toList();
for (Iterator<?> it = list.iterator(); it.hasNext(); ) {
Object obj = it.next();
if (obj instanceof IRevEngTable) {
IRevEngTable retable = (IRevEngTable) obj;
if (retable instanceof RevEngTableAdapter) {
updateSelection = true;
}
editor.getReverseEngineeringDefinition().removeTable(retable);
} 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) {
// if it possible select first item
TreeItem[] treeItems = viewer.getTree().getItems();
if (treeItems.length > 0) {
viewer.getTree().setSelection(treeItems[0]);
}
}
}
use of org.hibernate.eclipse.console.model.IRevEngParameter in project jbosstools-hibernate by jbosstools.
the class ParamDetailsPage method selectionChanged.
public void selectionChanged(IFormPart part, ISelection selection) {
IRevEngParameter newParam = (IRevEngParameter) ((IStructuredSelection) selection).getFirstElement();
if (param != null) {
param.removePropertyChangeListener(this);
}
if (newParam != null) {
newParam.addPropertyChangeListener(this);
}
param = newParam;
update();
}
Aggregations