Search in sources :

Example 1 with InitialState

use of org.obeonetwork.dsl.statemachine.InitialState in project InformationSystem by ObeoNetwork.

the class InitialStateInitialStatePropertiesEditionComponent 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) {
    InitialState initialState = (InitialState) semanticObject;
    if (StatemachineViewsRepository.InitialState.Properties.description == event.getAffectedEditor()) {
        initialState.setDescription((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
    }
    if (StatemachineViewsRepository.InitialState.Properties.keywords == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.SET) {
            initialState.getKeywords().clear();
            initialState.getKeywords().addAll(((EList) event.getNewValue()));
        }
    }
    if (StatemachineViewsRepository.InitialState.Properties.incomingTransitions == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            if (event.getNewValue() instanceof Transition) {
                incomingTransitionsSettings.addToReference((EObject) event.getNewValue());
            }
        } else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
            incomingTransitionsSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            incomingTransitionsSettings.move(event.getNewIndex(), (Transition) event.getNewValue());
        }
    }
    if (StatemachineViewsRepository.InitialState.Properties.outcomingTransitions == event.getAffectedEditor()) {
        if (event.getKind() == PropertiesEditionEvent.ADD) {
            if (event.getNewValue() instanceof Transition) {
                outcomingTransitionsSettings.addToReference((EObject) event.getNewValue());
            }
        } else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
            outcomingTransitionsSettings.removeFromReference((EObject) event.getNewValue());
        } else if (event.getKind() == PropertiesEditionEvent.MOVE) {
            outcomingTransitionsSettings.move(event.getNewIndex(), (Transition) event.getNewValue());
        }
    }
}
Also used : BasicEList(org.eclipse.emf.common.util.BasicEList) EList(org.eclipse.emf.common.util.EList) InitialState(org.obeonetwork.dsl.statemachine.InitialState) EObject(org.eclipse.emf.ecore.EObject) Transition(org.obeonetwork.dsl.statemachine.Transition)

Example 2 with InitialState

use of org.obeonetwork.dsl.statemachine.InitialState in project InformationSystem by ObeoNetwork.

the class InitialStateInitialStatePropertiesEditionComponent 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);
        final InitialState initialState = (InitialState) elt;
        final InitialStatePropertiesEditionPart initialStatePart = (InitialStatePropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(StatemachineViewsRepository.InitialState.Properties.description))
            initialStatePart.setDescription(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, initialState.getDescription()));
        if (isAccessible(StatemachineViewsRepository.InitialState.Properties.keywords))
            initialStatePart.setKeywords(initialState.getKeywords());
        if (isAccessible(StatemachineViewsRepository.InitialState.Properties.incomingTransitions)) {
            incomingTransitionsSettings = new ReferencesTableSettings(initialState, StateMachinePackage.eINSTANCE.getAbstractState_IncomingTransitions());
            initialStatePart.initIncomingTransitions(incomingTransitionsSettings);
        }
        if (isAccessible(StatemachineViewsRepository.InitialState.Properties.outcomingTransitions)) {
            outcomingTransitionsSettings = new ReferencesTableSettings(initialState, StateMachinePackage.eINSTANCE.getAbstractState_OutcomingTransitions());
            initialStatePart.initOutcomingTransitions(outcomingTransitionsSettings);
        }
        if (isAccessible(StatemachineViewsRepository.InitialState.Properties.incomingTransitions)) {
            initialStatePart.addFilterToIncomingTransitions(new EObjectFilter(StateMachinePackage.Literals.TRANSITION));
        // Start of user code for additional businessfilters for incomingTransitions
        // End of user code
        }
        if (isAccessible(StatemachineViewsRepository.InitialState.Properties.outcomingTransitions)) {
            initialStatePart.addFilterToOutcomingTransitions(new EObjectFilter(StateMachinePackage.Literals.TRANSITION));
        // Start of user code for additional businessfilters for outcomingTransitions
        // End of user code
        }
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : EObjectFilter(org.eclipse.emf.eef.runtime.impl.filters.EObjectFilter) ReferencesTableSettings(org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings) InitialState(org.obeonetwork.dsl.statemachine.InitialState) InitialStatePropertiesEditionPart(org.obeonetwork.dsl.statemachine.parts.InitialStatePropertiesEditionPart)

Aggregations

InitialState (org.obeonetwork.dsl.statemachine.InitialState)2 BasicEList (org.eclipse.emf.common.util.BasicEList)1 EList (org.eclipse.emf.common.util.EList)1 EObject (org.eclipse.emf.ecore.EObject)1 EObjectFilter (org.eclipse.emf.eef.runtime.impl.filters.EObjectFilter)1 ReferencesTableSettings (org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings)1 Transition (org.obeonetwork.dsl.statemachine.Transition)1 InitialStatePropertiesEditionPart (org.obeonetwork.dsl.statemachine.parts.InitialStatePropertiesEditionPart)1