use of org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy in project InformationSystem by ObeoNetwork.
the class StateMachineStateMachinePropertiesEditionComponent 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) {
StateMachine stateMachine = (StateMachine) semanticObject;
if (StatemachineViewsRepository.StateMachine_.Properties.description == event.getAffectedEditor()) {
stateMachine.setDescription((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
}
if (StatemachineViewsRepository.StateMachine_.Properties.keywords == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.SET) {
stateMachine.getKeywords().clear();
stateMachine.getKeywords().addAll(((EList) event.getNewValue()));
}
}
if (StatemachineViewsRepository.StateMachine_.Properties.name == event.getAffectedEditor()) {
stateMachine.setName((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
}
if (StatemachineViewsRepository.StateMachine_.Properties.regions == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.ADD) {
EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, regionsSettings, 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) {
regionsSettings.removeFromReference((EObject) event.getNewValue());
} else if (event.getKind() == PropertiesEditionEvent.MOVE) {
regionsSettings.move(event.getNewIndex(), (Region) event.getNewValue());
}
}
}
use of org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy in project InformationSystem by ObeoNetwork.
the class TransitionTransitionPropertiesEditionComponent 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) {
Transition transition = (Transition) semanticObject;
if (StatemachineViewsRepository.Transition.Properties.description == event.getAffectedEditor()) {
transition.setDescription((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
}
if (StatemachineViewsRepository.Transition.Properties.keywords == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.SET) {
transition.getKeywords().clear();
transition.getKeywords().addAll(((EList) event.getNewValue()));
}
}
if (StatemachineViewsRepository.Transition.Properties.guard == event.getAffectedEditor()) {
transition.setGuard((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
}
if (StatemachineViewsRepository.Transition.Properties.from == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.SET) {
fromSettings.setToReference((AbstractState) event.getNewValue());
} else if (event.getKind() == PropertiesEditionEvent.ADD) {
EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, fromSettings, 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();
}
}
}
}
if (StatemachineViewsRepository.Transition.Properties.to == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.SET) {
toSettings.setToReference((AbstractState) event.getNewValue());
} else if (event.getKind() == PropertiesEditionEvent.ADD) {
EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, toSettings, 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();
}
}
}
}
}
use of org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy in project InformationSystem by ObeoNetwork.
the class TaskPropertiesEditionPartImpl method editUses.
/**
*/
protected void editUses(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();
uses.refresh();
}
}
}
use of org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy in project InformationSystem by ObeoNetwork.
the class TaskReferencePropertiesEditionPartImpl method editIncomingTransitions.
/**
*/
protected void editIncomingTransitions(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();
incomingTransitions.refresh();
}
}
}
use of org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy in project InformationSystem by ObeoNetwork.
the class UseCasePropertiesEditionPartImpl method editDomainClasses.
/**
*/
protected void editDomainClasses(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();
domainClasses.refresh();
}
}
}
Aggregations