Search in sources :

Example 1 with Mode

use of org.eclipse.xtext.resource.locationprovidertest.Mode in project xtext-core by eclipse.

the class TransitionImpl method setDestination.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setDestination(Mode newDestination) {
    Mode oldDestination = destination;
    destination = newDestination;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, LocationprovidertestPackage.TRANSITION__DESTINATION, oldDestination, destination));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) Mode(org.eclipse.xtext.resource.locationprovidertest.Mode)

Example 2 with Mode

use of org.eclipse.xtext.resource.locationprovidertest.Mode in project xtext-core by eclipse.

the class TransitionImpl method setSource.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setSource(Mode newSource) {
    Mode oldSource = source;
    source = newSource;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, LocationprovidertestPackage.TRANSITION__SOURCE, oldSource, source));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) Mode(org.eclipse.xtext.resource.locationprovidertest.Mode)

Example 3 with Mode

use of org.eclipse.xtext.resource.locationprovidertest.Mode in project xtext-core by eclipse.

the class LocationProviderTestLanguageSemanticSequencer 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 == LocationprovidertestPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case LocationprovidertestPackage.BUS:
                if (rule == grammarAccess.getBusRule()) {
                    sequence_Bus(context, (Bus) semanticObject);
                    return;
                } else if (rule == grammarAccess.getComponentRule()) {
                    sequence_Bus_Component(context, (Bus) semanticObject);
                    return;
                } else
                    break;
            case LocationprovidertestPackage.DATA:
                sequence_Data(context, (Data) semanticObject);
                return;
            case LocationprovidertestPackage.ELEMENT:
                sequence_Element(context, (Element) semanticObject);
                return;
            case LocationprovidertestPackage.MODE:
                sequence_Mode(context, (Mode) semanticObject);
                return;
            case LocationprovidertestPackage.MODEL:
                sequence_Model(context, (Model) semanticObject);
                return;
            case LocationprovidertestPackage.PORT:
                sequence_Port(context, (Port) semanticObject);
                return;
            case LocationprovidertestPackage.PROCESSOR:
                if (rule == grammarAccess.getComponentRule()) {
                    sequence_Component_Processor(context, (Processor) semanticObject);
                    return;
                } else if (rule == grammarAccess.getProcessorRule()) {
                    sequence_Processor(context, (Processor) semanticObject);
                    return;
                } else
                    break;
            case LocationprovidertestPackage.TRANSITION:
                sequence_Transition(context, (Transition) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Bus(org.eclipse.xtext.resource.locationprovidertest.Bus) Action(org.eclipse.xtext.Action) Processor(org.eclipse.xtext.resource.locationprovidertest.Processor) Element(org.eclipse.xtext.resource.locationprovidertest.Element) Mode(org.eclipse.xtext.resource.locationprovidertest.Mode) Port(org.eclipse.xtext.resource.locationprovidertest.Port) Data(org.eclipse.xtext.resource.locationprovidertest.Data) EPackage(org.eclipse.emf.ecore.EPackage) Model(org.eclipse.xtext.resource.locationprovidertest.Model) Transition(org.eclipse.xtext.resource.locationprovidertest.Transition) Parameter(org.eclipse.xtext.Parameter)

Example 4 with Mode

use of org.eclipse.xtext.resource.locationprovidertest.Mode in project xtext-core by eclipse.

the class LocationInFileProviderTest method testBug353969_03.

@Test
public void testBug353969_03() throws Exception {
    Bus b = (Bus) model.getComponents().get(1);
    EList<Mode> modes = b.getMode();
    assertEquals(2, modes.size());
    Mode mb1 = modes.get(0);
    ITextRegionWithLineInformation mb1FullRegion = (ITextRegionWithLineInformation) locationInFileProvider.getFullTextRegion(mb1);
    assertEquals(modelAsString.indexOf("mode mb1;"), mb1FullRegion.getOffset());
    assertEquals("mode mb1;".length(), mb1FullRegion.getLength());
    assertEquals(8, mb1FullRegion.getLineNumber());
    assertEquals(8, mb1FullRegion.getEndLineNumber());
    ITextRegionWithLineInformation mb1SignificantRegion = (ITextRegionWithLineInformation) locationInFileProvider.getSignificantTextRegion(mb1);
    assertEquals(modelAsString.indexOf("mb1;"), mb1SignificantRegion.getOffset());
    assertEquals("mb1".length(), mb1SignificantRegion.getLength());
    assertEquals(8, mb1SignificantRegion.getLineNumber());
    assertEquals(8, mb1SignificantRegion.getEndLineNumber());
}
Also used : Bus(org.eclipse.xtext.resource.locationprovidertest.Bus) ITextRegionWithLineInformation(org.eclipse.xtext.util.ITextRegionWithLineInformation) Mode(org.eclipse.xtext.resource.locationprovidertest.Mode) Test(org.junit.Test)

Example 5 with Mode

use of org.eclipse.xtext.resource.locationprovidertest.Mode in project xtext-core by eclipse.

the class LocationInFileProviderTest method testBug353969_04.

@Test
public void testBug353969_04() throws Exception {
    Bus b = (Bus) model.getComponents().get(1);
    EList<Mode> modes = b.getMode();
    assertEquals(2, modes.size());
    Mode mb2 = modes.get(1);
    ITextRegionWithLineInformation mb2FullRegion = (ITextRegionWithLineInformation) locationInFileProvider.getFullTextRegion(mb2);
    assertEquals(modelAsString.indexOf("mode mb2;"), mb2FullRegion.getOffset());
    assertEquals("mode mb2;".length(), mb2FullRegion.getLength());
    assertEquals(9, mb2FullRegion.getLineNumber());
    assertEquals(9, mb2FullRegion.getEndLineNumber());
    ITextRegionWithLineInformation mb2SignificantRegion = (ITextRegionWithLineInformation) locationInFileProvider.getSignificantTextRegion(mb2);
    assertEquals(modelAsString.indexOf("mb2;"), mb2SignificantRegion.getOffset());
    assertEquals("mb2".length(), mb2SignificantRegion.getLength());
    assertEquals(9, mb2SignificantRegion.getLineNumber());
    assertEquals(9, mb2SignificantRegion.getEndLineNumber());
}
Also used : Bus(org.eclipse.xtext.resource.locationprovidertest.Bus) ITextRegionWithLineInformation(org.eclipse.xtext.util.ITextRegionWithLineInformation) Mode(org.eclipse.xtext.resource.locationprovidertest.Mode) Test(org.junit.Test)

Aggregations

Mode (org.eclipse.xtext.resource.locationprovidertest.Mode)7 ITextRegionWithLineInformation (org.eclipse.xtext.util.ITextRegionWithLineInformation)4 Test (org.junit.Test)4 Bus (org.eclipse.xtext.resource.locationprovidertest.Bus)3 Processor (org.eclipse.xtext.resource.locationprovidertest.Processor)3 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)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 Data (org.eclipse.xtext.resource.locationprovidertest.Data)1 Element (org.eclipse.xtext.resource.locationprovidertest.Element)1 Model (org.eclipse.xtext.resource.locationprovidertest.Model)1 Port (org.eclipse.xtext.resource.locationprovidertest.Port)1 Transition (org.eclipse.xtext.resource.locationprovidertest.Transition)1