use of org.obeonetwork.dsl.database.parts.PrimaryKeyPropertiesEditionPart in project InformationSystem by ObeoNetwork.
the class PrimaryKeyPropertiesEditionComponent method initPart.
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject,
* org.eclipse.emf.ecore.resource.ResourceSet)
*/
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
setInitializing(true);
if (editingPart != null && key == partKey) {
editingPart.setContext(elt, allResource);
final PrimaryKey primaryKey = (PrimaryKey) elt;
final PrimaryKeyPropertiesEditionPart primaryKeyPart = (PrimaryKeyPropertiesEditionPart) editingPart;
// init values
if (isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.name))
primaryKeyPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, primaryKey.getName()));
if (isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.columns)) {
columnsSettings = new ReferencesTableSettings(primaryKey, DatabasePackage.eINSTANCE.getPrimaryKey_Columns());
primaryKeyPart.initColumns(columnsSettings);
}
if (isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.comments))
primaryKeyPart.setComments(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, primaryKey.getComments()));
if (isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.columns)) {
primaryKeyPart.addFilterToColumns(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof EObject)
return (!primaryKeyPart.isContainedInColumnsTable((EObject) element));
return element instanceof String && element.equals("");
}
});
primaryKeyPart.addFilterToColumns(new EObjectStrictFilter(DatabasePackage.Literals.COLUMN));
// Start of user code for additional businessfilters for columns
// End of user code
}
// init values for referenced views
// init filters for referenced views
}
setInitializing(false);
}
use of org.obeonetwork.dsl.database.parts.PrimaryKeyPropertiesEditionPart in project InformationSystem by ObeoNetwork.
the class TablePrimaryKeyPropertiesEditionComponent method initPart.
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject,
* org.eclipse.emf.ecore.resource.ResourceSet)
*/
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
setInitializing(true);
if (editingPart != null && key == partKey) {
editingPart.setContext(elt, allResource);
if (editingPart instanceof CompositePropertiesEditionPart) {
((CompositePropertiesEditionPart) editingPart).getSettings().add(pkNameSettings);
((CompositePropertiesEditionPart) editingPart).getSettings().add(pkColumnsSettings);
((CompositePropertiesEditionPart) editingPart).getSettings().add(pkCommentsSettings);
}
final Table table = (Table) elt;
final PrimaryKeyPropertiesEditionPart primaryKeyPart = (PrimaryKeyPropertiesEditionPart) editingPart;
// init values
if (pkNameSettings.getValue() != null && isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.name))
primaryKeyPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, pkNameSettings.getValue()));
if (isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.columns)) {
pkColumnsSettings = new ReferencesTableSettings(table, DatabasePackage.eINSTANCE.getTable_PrimaryKey(), DatabasePackage.eINSTANCE.getPrimaryKey_Columns());
primaryKeyPart.initColumns(pkColumnsSettings);
}
if (pkCommentsSettings.getValue() != null && isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.comments))
primaryKeyPart.setComments(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, pkCommentsSettings.getValue()));
if (isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.columns)) {
primaryKeyPart.addFilterToColumns(new EObjectStrictFilter(DatabasePackage.Literals.COLUMN));
// Start of user code for additional businessfilters for pkColumns
// End of user code
}
// init values for referenced views
// init filters for referenced views
}
setInitializing(false);
}
Aggregations