use of org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy in project InformationSystem by ObeoNetwork.
the class FinalStateFinalStatePropertiesEditionComponent 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) {
FinalState finalState = (FinalState) semanticObject;
if (FlowViewsRepository.FinalState.Properties.description == event.getAffectedEditor()) {
finalState.setDescription((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
}
if (FlowViewsRepository.FinalState.Properties.actions == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.ADD) {
EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, actionsSettings, 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) {
actionsSettings.removeFromReference((EObject) event.getNewValue());
} else if (event.getKind() == PropertiesEditionEvent.MOVE) {
actionsSettings.move(event.getNewIndex(), (FlowAction) event.getNewValue());
}
}
if (FlowViewsRepository.FinalState.Properties.name == event.getAffectedEditor()) {
finalState.setName((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
}
}
use of org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy in project InformationSystem by ObeoNetwork.
the class DtoPropertiesEditionPartImpl method editAssociatedTypes.
/**
*/
protected void editAssociatedTypes(EObject element) {
EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(propertiesEditionComponent.getEditingContext(), propertiesEditionComponent, element, adapterFactory);
PropertiesEditingProvider provider = (PropertiesEditingProvider) adapterFactory.adapt(element, PropertiesEditingProvider.class);
if (provider != null) {
PropertiesEditingPolicy policy = provider.getPolicy(context);
if (policy != null) {
policy.execute();
associatedTypes.refresh();
}
}
}
use of org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy 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());
}
}
}
use of org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy in project InformationSystem by ObeoNetwork.
the class EnumerationEnumerationPropertiesEditionComponent 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) {
Enumeration enumeration = (Enumeration) semanticObject;
if (EnvironmentViewsRepository.Enumeration.Properties.name == event.getAffectedEditor()) {
enumeration.setName((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
}
if (EnvironmentViewsRepository.Enumeration.Properties.literals == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.ADD) {
EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, literalsSettings, 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) {
literalsSettings.removeFromReference((EObject) event.getNewValue());
} else if (event.getKind() == PropertiesEditionEvent.MOVE) {
literalsSettings.move(event.getNewIndex(), (Literal) event.getNewValue());
}
}
if (EnvironmentViewsRepository.Enumeration.Properties.description == event.getAffectedEditor()) {
enumeration.setDescription((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
}
}
use of org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy in project InformationSystem by ObeoNetwork.
the class UserDefinedTypesLibraryPropertiesEditionComponent 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) {
UserDefinedTypesLibrary userDefinedTypesLibrary = (UserDefinedTypesLibrary) semanticObject;
if (TypeslibraryViewsRepository.UserDefinedTypesLibrary.Properties.name == event.getAffectedEditor()) {
userDefinedTypesLibrary.setName((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
}
if (TypeslibraryViewsRepository.UserDefinedTypesLibrary.Properties.userDefinedTypes == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.ADD) {
EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, userDefinedTypesSettings, 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) {
userDefinedTypesSettings.removeFromReference((EObject) event.getNewValue());
} else if (event.getKind() == PropertiesEditionEvent.MOVE) {
userDefinedTypesSettings.move(event.getNewIndex(), (UserDefinedType) event.getNewValue());
}
}
}
Aggregations