use of org.obeonetwork.dsl.typeslibrary.NativeType in project InformationSystem by ObeoNetwork.
the class NativeTypesLibraryPropertiesEditionComponent method updateSemanticModel.
/**
* {@inheritDoc}
* @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updateSemanticModel(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
*/
public void updateSemanticModel(final IPropertiesEditionEvent event) {
NativeTypesLibrary nativeTypesLibrary = (NativeTypesLibrary) semanticObject;
if (TypeslibraryViewsRepository.NativeTypesLibrary.Properties.name == event.getAffectedEditor()) {
nativeTypesLibrary.setName((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
}
if (TypeslibraryViewsRepository.NativeTypesLibrary.Properties.nativeTypes == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.ADD) {
EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, nativeTypesSettings, editingContext.getAdapterFactory());
PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt(semanticObject, PropertiesEditingProvider.class);
if (provider != null) {
PropertiesEditingPolicy policy = provider.getPolicy(context);
if (policy instanceof CreateEditingPolicy) {
policy.execute();
}
}
} else if (event.getKind() == PropertiesEditionEvent.EDIT) {
EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(editingContext, this, (EObject) event.getNewValue(), editingContext.getAdapterFactory());
PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt((EObject) event.getNewValue(), PropertiesEditingProvider.class);
if (provider != null) {
PropertiesEditingPolicy editionPolicy = provider.getPolicy(context);
if (editionPolicy != null) {
editionPolicy.execute();
}
}
} else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
nativeTypesSettings.removeFromReference((EObject) event.getNewValue());
} else if (event.getKind() == PropertiesEditionEvent.MOVE) {
nativeTypesSettings.move(event.getNewIndex(), (NativeType) event.getNewValue());
}
}
}
use of org.obeonetwork.dsl.typeslibrary.NativeType in project InformationSystem by ObeoNetwork.
the class H2DataBaseBuilder method createTypeInstance.
@Override
protected TypeInstance createTypeInstance(NativeTypesLibrary nativeTypesLibrary, String columnType, int columnSize, int decimalDigits) {
String bkpColumnType = columnType;
if (columnSize > 0) {
columnType += "(%n";
}
if (decimalDigits > 0) {
columnType += ",%p";
}
columnType += ")";
NativeType nativeType = nativeTypesLibrary.findTypeByName(columnType);
if (nativeType == null) {
columnType = bkpColumnType;
}
return super.createTypeInstance(nativeTypesLibrary, columnType, columnSize, decimalDigits);
}
use of org.obeonetwork.dsl.typeslibrary.NativeType in project InformationSystem by ObeoNetwork.
the class PostGresDataBaseBuilder method createTypeInstance.
@Override
protected TypeInstance createTypeInstance(NativeTypesLibrary nativeTypesLibrary, String columnType, int columnSize, int decimalDigits) {
String bkpColumnType = columnType;
if (columnSize > 0) {
columnType += "(%n";
}
if (decimalDigits > 0) {
columnType += ",%p";
}
columnType += ")";
NativeType nativeType = nativeTypesLibrary.findTypeByName(columnType);
if (nativeType == null) {
columnType = bkpColumnType;
}
return super.createTypeInstance(nativeTypesLibrary, columnType, columnSize, decimalDigits);
}
use of org.obeonetwork.dsl.typeslibrary.NativeType in project InformationSystem by ObeoNetwork.
the class CreationUtils method createTypeInstance.
public static TypeInstance createTypeInstance(NativeTypesLibrary nativeTypesLibrary, String columnType, int columnSize, int decimalDigits) {
NativeType nativeType = nativeTypesLibrary.findTypeByName(columnType);
if (nativeType == null) {
System.err.println("createTypeInstance : native type [" + columnType + "] not found.");
}
TypeInstance typeInstance = TypesLibraryFactory.eINSTANCE.createTypeInstance();
typeInstance.setNativeType(nativeType);
typeInstance.setLength(columnSize);
typeInstance.setPrecision(decimalDigits);
return typeInstance;
}
Aggregations