use of org.obeonetwork.dsl.database.parts.ColumnPropertiesEditionPart in project InformationSystem by ObeoNetwork.
the class CustomColumnPropertiesEditionComponent 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) {
super.initPart(key, kind, elt, allResource);
setInitializing(true);
if (editingPart != null && key == partKey) {
final ColumnPropertiesEditionPart basePart = (ColumnPropertiesEditionPart) editingPart;
updateTypeFieldsVisibility((Column) elt, basePart);
}
setInitializing(false);
}
use of org.obeonetwork.dsl.database.parts.ColumnPropertiesEditionPart in project InformationSystem by ObeoNetwork.
the class ColumnPropertiesEditionComponent 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(typeSettings);
((CompositePropertiesEditionPart) editingPart).getSettings().add(lengthSettings);
((CompositePropertiesEditionPart) editingPart).getSettings().add(precisionSettings);
((CompositePropertiesEditionPart) editingPart).getSettings().add(literalsSettings);
}
final Column column = (Column) elt;
final ColumnPropertiesEditionPart columnPart = (ColumnPropertiesEditionPart) editingPart;
// init values
if (isAccessible(DatabaseViewsRepository.Column.Properties.name))
columnPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, column.getName()));
if (isAccessible(DatabaseViewsRepository.Column.Properties.NullablePkAndUnique.nullable)) {
columnPart.setNullable(column.isNullable());
}
if (isAccessible(DatabaseViewsRepository.Column.Properties.NullablePkAndUnique.primaryKey)) {
columnPart.setPrimaryKey(column.isInPrimaryKey());
}
if (isAccessible(DatabaseViewsRepository.Column.Properties.NullablePkAndUnique.unique)) {
columnPart.setUnique(column.isUnique());
}
if (isAccessible(DatabaseViewsRepository.Column.Properties.Sequence.autoincrement)) {
columnPart.setAutoincrement(column.isAutoincrement());
}
if (isAccessible(DatabaseViewsRepository.Column.Properties.Sequence.sequence_)) {
// init part
sequenceSettings = new EObjectFlatComboSettings(column, DatabasePackage.eINSTANCE.getColumn_Sequence());
columnPart.initSequence(sequenceSettings);
// set the button mode
columnPart.setSequenceButtonMode(ButtonsModeEnum.BROWSE);
}
if (isAccessible(DatabaseViewsRepository.Column.Properties.defaultValue))
columnPart.setDefaultValue(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, column.getDefaultValue()));
if (isAccessible(DatabaseViewsRepository.Column.Properties.comments))
columnPart.setComments(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, column.getComments()));
if (typeSettings.getSignificantObject() != null && isAccessible(DatabaseViewsRepository.Column.Properties.type)) {
columnPart.initType(EEFUtils.choiceOfValues(typeSettings.getSignificantObject(), TypesLibraryPackage.eINSTANCE.getTypeInstance_NativeType()), typeSettings.getValue());
}
if (lengthSettings.getValue() != null && isAccessible(DatabaseViewsRepository.Column.Properties.TypeAttributes.length))
columnPart.setLength(EEFConverterUtil.convertToString(EcorePackage.Literals.EINTEGER_OBJECT, lengthSettings.getValue()));
if (precisionSettings.getValue() != null && isAccessible(DatabaseViewsRepository.Column.Properties.TypeAttributes.precision))
columnPart.setPrecision(EEFConverterUtil.convertToString(EcorePackage.Literals.EINTEGER_OBJECT, precisionSettings.getValue()));
if (literalsSettings.getSignificantObject() != null && isAccessible(DatabaseViewsRepository.Column.Properties.literals)) {
columnPart.setLiterals((EList<?>) literalsSettings.getValue());
}
if (isAccessible(DatabaseViewsRepository.Column.Properties.Sequence.sequence_)) {
columnPart.addFilterToSequence(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) {
// $NON-NLS-1$
return (element instanceof String && element.equals("")) || (element instanceof Sequence);
}
});
// Start of user code for additional businessfilters for sequence
// End of user code
}
// Start of user code for additional businessfilters for type
// End of user code
// init values for referenced views
// init filters for referenced views
}
setInitializing(false);
}
Aggregations