use of org.eclipse.emf.ecore.EPackage in project xtext-core by eclipse.
the class NoJdtTestLanguageSemanticSequencer 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 == NoJdtPackage.eINSTANCE)
switch(semanticObject.eClass().getClassifierID()) {
case NoJdtPackage.GREETING:
sequence_Greeting(context, (Greeting) semanticObject);
return;
case NoJdtPackage.MODEL:
sequence_Model(context, (Model) semanticObject);
return;
}
if (errorAcceptor != null)
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
use of org.eclipse.emf.ecore.EPackage in project xtext-core by eclipse.
the class ChangeSerializerWithEmfTest method testChangeInXML.
@Test
public void testChangeInXML() {
final InMemoryURIHandler fs = new InMemoryURIHandler();
StringConcatenation _builder = new StringConcatenation();
_builder.append("#21 MyPackage.MyClass1");
Pair<String, String> _mappedTo = Pair.<String, String>of("inmemory:/file1.pstl", _builder.toString());
this._changeSerializerTestHelper.operator_add(fs, _mappedTo);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
_builder_1.newLine();
_builder_1.append("<ecore:EPackage xmi:version=\"2.0\" xmlns:xmi=\"http://www.omg.org/XMI\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("xmlns:ecore=\"http://www.eclipse.org/emf/2002/Ecore\" name=\"MyPackage\">");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("<eClassifiers xsi:type=\"ecore:EClass\" name=\"MyClass1\"/>");
_builder_1.newLine();
_builder_1.append("</ecore:EPackage>");
_builder_1.newLine();
Pair<String, String> _mappedTo_1 = Pair.<String, String>of("inmemory:/file2.ecore", _builder_1.toString());
this._changeSerializerTestHelper.operator_add(fs, _mappedTo_1);
final ResourceSet rs = this._changeSerializerTestHelper.createResourceSet(fs);
final EPackage model = this._changeSerializerTestHelper.<EPackage>contents(rs, "inmemory:/file2.ecore", EPackage.class);
final ChangeSerializer serializer = this.serializerProvider.get();
final IChangeSerializer.IModification<EPackage> _function = (EPackage it) -> {
EClassifier _head = IterableExtensions.<EClassifier>head(model.getEClassifiers());
((EClass) _head).setName("NewClass");
};
serializer.<EPackage>addModification(model, _function);
Collection<IEmfResourceChange> _endRecordChangesToTextDocuments = this._changeSerializerTestHelper.endRecordChangesToTextDocuments(serializer);
StringConcatenation _builder_2 = new StringConcatenation();
_builder_2.append("---------------------------- inmemory:/file2.ecore -----------------------------");
_builder_2.newLine();
_builder_2.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
_builder_2.newLine();
_builder_2.append("<ecore:EPackage xmi:version=\"2.0\" xmlns:xmi=\"http://www.omg.org/XMI\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"");
_builder_2.newLine();
_builder_2.append(" ");
_builder_2.append("xmlns:ecore=\"http://www.eclipse.org/emf/2002/Ecore\" name=\"MyPackage\">");
_builder_2.newLine();
_builder_2.append(" ");
_builder_2.append("<eClassifiers xsi:type=\"ecore:EClass\" name=\"NewClass\"/>");
_builder_2.newLine();
_builder_2.append("</ecore:EPackage>");
_builder_2.newLine();
_builder_2.append("--------------------------------------------------------------------------------");
_builder_2.newLine();
_builder_2.append("----------------- inmemory:/file1.pstl (syntax: <offset|text>) -----------------");
_builder_2.newLine();
_builder_2.append("#21 <4:18|MyPackage.NewClass>");
_builder_2.newLine();
_builder_2.append("--------------------------------------------------------------------------------");
_builder_2.newLine();
_builder_2.append("4 18 \"MyPackage.MyClass1\" -> \"MyPackage.NewClass\"");
_builder_2.newLine();
this._changeSerializerTestHelper.operator_tripleEquals(_endRecordChangesToTextDocuments, _builder_2);
}
use of org.eclipse.emf.ecore.EPackage in project xtext-core by eclipse.
the class PartialContentAssistTestLanguageSemanticSequencer 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 == PartialContentAssistTestLanguagePackage.eINSTANCE)
switch(semanticObject.eClass().getClassifierID()) {
case PartialContentAssistTestLanguagePackage.PROPERTY:
sequence_Property(context, (Property) semanticObject);
return;
case PartialContentAssistTestLanguagePackage.TYPE_DECLARATION:
sequence_TypeDeclaration(context, (TypeDeclaration) semanticObject);
return;
}
if (errorAcceptor != null)
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
use of org.eclipse.emf.ecore.EPackage in project xtext-core by eclipse.
the class PartialSerializationTestLanguageSemanticSequencer 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 == EcorePackage.eINSTANCE)
switch(semanticObject.eClass().getClassifierID()) {
case EcorePackage.ECLASS:
sequence_EClassDecl(context, (EClass) semanticObject);
return;
}
else if (epackage == PartialSerializationTestLanguagePackage.eINSTANCE)
switch(semanticObject.eClass().getClassifierID()) {
case PartialSerializationTestLanguagePackage.ECLASS_REF:
sequence_EClassRef(context, (EClassRef) semanticObject);
return;
case PartialSerializationTestLanguagePackage.IMPORT:
sequence_Import(context, (Import) semanticObject);
return;
case PartialSerializationTestLanguagePackage.MANDATORY_CHILD:
sequence_MandatoryChild(context, (MandatoryChild) semanticObject);
return;
case PartialSerializationTestLanguagePackage.MANDATORY_CHILD_LIST:
sequence_MandatoryChildList(context, (MandatoryChildList) semanticObject);
return;
case PartialSerializationTestLanguagePackage.MANDATORY_VALUE:
sequence_MandatoryValue(context, (MandatoryValue) semanticObject);
return;
case PartialSerializationTestLanguagePackage.MANY_MANDATORY_VALUES:
sequence_ManyMandatoryValues(context, (ManyMandatoryValues) semanticObject);
return;
case PartialSerializationTestLanguagePackage.MANY_VALUES:
sequence_ManyOptionalValues(context, (ManyValues) semanticObject);
return;
case PartialSerializationTestLanguagePackage.MODEL:
sequence_Model(context, (Model) semanticObject);
return;
case PartialSerializationTestLanguagePackage.NODE:
sequence_Node(context, (Node) semanticObject);
return;
case PartialSerializationTestLanguagePackage.OPTIONAL_CHILD:
sequence_OptionalChild(context, (OptionalChild) semanticObject);
return;
case PartialSerializationTestLanguagePackage.OPTIONAL_CHILD_LIST:
sequence_OptionalChildList(context, (OptionalChildList) semanticObject);
return;
case PartialSerializationTestLanguagePackage.OPTIONAL_VALUE:
sequence_OptionalValue(context, (OptionalValue) semanticObject);
return;
}
if (errorAcceptor != null)
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
use of org.eclipse.emf.ecore.EPackage in project xtext-core by eclipse.
the class Bug385636SemanticSequencer 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 == Bug385636Package.eINSTANCE)
switch(semanticObject.eClass().getClassifierID()) {
case Bug385636Package.DEFINE_VARIABLE:
sequence_DefineVariable(context, (DefineVariable) semanticObject);
return;
case Bug385636Package.DEFINE_VARIABLES:
sequence_DefineVariables(context, (DefineVariables) semanticObject);
return;
case Bug385636Package.EXPRESSION_EQUAL:
sequence_Statement(context, (Expression_Equal) semanticObject);
return;
case Bug385636Package.EXPRESSION_LARGER_EQUAL:
sequence_Statement(context, (Expression_Larger_Equal) semanticObject);
return;
case Bug385636Package.EXPRESSION_NOT_EQUAL:
sequence_Statement(context, (Expression_Not_Equal) semanticObject);
return;
case Bug385636Package.EXPRESSION_NOT_GREATER:
sequence_Statement(context, (Expression_Not_Greater) semanticObject);
return;
case Bug385636Package.EXPRESSION_NOT_LESS:
sequence_Statement(context, (Expression_Not_Less) semanticObject);
return;
case Bug385636Package.EXPRESSION_SMALLER:
sequence_Statement(context, (Expression_Smaller) semanticObject);
return;
case Bug385636Package.EXPRESSION_SMALLER_EQUAL:
sequence_Statement(context, (Expression_Smaller_Equal) semanticObject);
return;
case Bug385636Package.EXPRESSION_VARIABLE_NAME:
sequence_Expression_VariableName(context, (Expression_VariableName) semanticObject);
return;
case Bug385636Package.NVARIABLE_ACCESS:
sequence_NVariableAccess(context, (NVariableAccess) semanticObject);
return;
case Bug385636Package.PROGRAM:
sequence_Program(context, (Program) semanticObject);
return;
}
if (errorAcceptor != null)
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Aggregations