use of org.eclipse.emf.eef.runtime.context.impl.TypedEReferencePropertiesEditingContext in project InformationSystem by ObeoNetwork.
the class MetadataCptPropertiesEditionComponent method updateSemanticModel.
/**
* {@inheritDoc}
* @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updateSemanticModel(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
* @generated NOT
*/
public void updateSemanticModel(final IPropertiesEditionEvent event) {
ObeoDSMObject obeoDSMObject = (ObeoDSMObject) semanticObject;
if (EnvironmentViewsRepository.Metadatas.Properties.metadata == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.ADD) {
EReferencePropertiesEditionContext context = new TypedEReferencePropertiesEditingContext(editingContext, this, metadataSettings, EnvironmentPackage.Literals.ANNOTATION, editingContext.getAdapterFactory());
/*
* Generated code below, but it leads to NPE when clicking on the add button
*
EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, metadataSettings, editingContext.getAdapterFactory());
context.addInstanciableTypeFilter(new InstanciableTypeFilter() {
public boolean select(EClass instanciableType) {
return EnvironmentPackage.Literals.ANNOTATION == instanciableType;
}
});
*/
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) {
metadataSettings.removeFromReference((EObject) event.getNewValue());
} else if (event.getKind() == PropertiesEditionEvent.MOVE) {
metadataSettings.move(event.getNewIndex(), (MetaData) event.getNewValue());
}
}
}
Aggregations