Search in sources :

Example 1 with Statemachine

use of org.eclipse.xtext.example.fowlerdsl.statemachine.Statemachine in project xtext-eclipse by eclipse.

the class StatemachineSemanticSequencer method sequence.

@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
    EPackage epackage = semanticObject.eClass().getEPackage();
    ParserRule rule = context.getParserRule();
    Action action = context.getAssignedAction();
    Set<Parameter> parameters = context.getEnabledBooleanParameters();
    if (epackage == StatemachinePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case StatemachinePackage.COMMAND:
                sequence_Command(context, (Command) semanticObject);
                return;
            case StatemachinePackage.EVENT:
                sequence_Event(context, (Event) semanticObject);
                return;
            case StatemachinePackage.STATE:
                sequence_State(context, (State) semanticObject);
                return;
            case StatemachinePackage.STATEMACHINE:
                sequence_Statemachine(context, (Statemachine) semanticObject);
                return;
            case StatemachinePackage.TRANSITION:
                sequence_Transition(context, (Transition) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Statemachine(org.eclipse.xtext.example.fowlerdsl.statemachine.Statemachine) Action(org.eclipse.xtext.Action) Command(org.eclipse.xtext.example.fowlerdsl.statemachine.Command) State(org.eclipse.xtext.example.fowlerdsl.statemachine.State) Transition(org.eclipse.xtext.example.fowlerdsl.statemachine.Transition) Parameter(org.eclipse.xtext.Parameter) Event(org.eclipse.xtext.example.fowlerdsl.statemachine.Event) EPackage(org.eclipse.emf.ecore.EPackage)

Example 2 with Statemachine

use of org.eclipse.xtext.example.fowlerdsl.statemachine.Statemachine in project xtext-eclipse by eclipse.

the class StatemachineFoldingRegionProvider method computeObjectFolding.

@Override
protected void computeObjectFolding(EObject o, IFoldingRegionAcceptor<ITextRegion> foldingRegionAcceptor) {
    if (o instanceof Statemachine) {
        XtextResource res = (XtextResource) o.eResource();
        computeEventsFolding(res, foldingRegionAcceptor);
        computeResetEventsFolding(res, foldingRegionAcceptor);
        computeCommandsFolding(res, foldingRegionAcceptor);
    } else {
        super.computeObjectFolding(o, foldingRegionAcceptor);
    }
}
Also used : Statemachine(org.eclipse.xtext.example.fowlerdsl.statemachine.Statemachine) XtextResource(org.eclipse.xtext.resource.XtextResource)

Aggregations

Statemachine (org.eclipse.xtext.example.fowlerdsl.statemachine.Statemachine)2 EPackage (org.eclipse.emf.ecore.EPackage)1 Action (org.eclipse.xtext.Action)1 Parameter (org.eclipse.xtext.Parameter)1 ParserRule (org.eclipse.xtext.ParserRule)1 Command (org.eclipse.xtext.example.fowlerdsl.statemachine.Command)1 Event (org.eclipse.xtext.example.fowlerdsl.statemachine.Event)1 State (org.eclipse.xtext.example.fowlerdsl.statemachine.State)1 Transition (org.eclipse.xtext.example.fowlerdsl.statemachine.Transition)1 XtextResource (org.eclipse.xtext.resource.XtextResource)1