Search in sources :

Example 1 with TemplateBody

use of org.eclipse.xtext.ui.codetemplates.templates.TemplateBody in project xtext-eclipse by eclipse.

the class SingleCodetemplateSemanticSequencer 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 == TemplatesPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case TemplatesPackage.CODETEMPLATE:
                sequence_Codetemplate(context, (Codetemplate) semanticObject);
                return;
            case TemplatesPackage.CODETEMPLATES:
                sequence_Codetemplates(context, (Codetemplates) semanticObject);
                return;
            case TemplatesPackage.DOLLAR:
                sequence_Dollar(context, (Dollar) semanticObject);
                return;
            case TemplatesPackage.LITERAL:
                sequence_Literal(context, (Literal) semanticObject);
                return;
            case TemplatesPackage.TEMPLATE_BODY:
                sequence_TemplateBody(context, (TemplateBody) semanticObject);
                return;
            case TemplatesPackage.VARIABLE:
                sequence_Variable(context, (Variable) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) Codetemplates(org.eclipse.xtext.ui.codetemplates.templates.Codetemplates) Variable(org.eclipse.xtext.ui.codetemplates.templates.Variable) Dollar(org.eclipse.xtext.ui.codetemplates.templates.Dollar) Codetemplate(org.eclipse.xtext.ui.codetemplates.templates.Codetemplate) Literal(org.eclipse.xtext.ui.codetemplates.templates.Literal) Parameter(org.eclipse.xtext.Parameter) TemplateBody(org.eclipse.xtext.ui.codetemplates.templates.TemplateBody) EPackage(org.eclipse.emf.ecore.EPackage)

Example 2 with TemplateBody

use of org.eclipse.xtext.ui.codetemplates.templates.TemplateBody in project xtext-eclipse by eclipse.

the class CodetemplatesSemanticSequencer 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 == TemplatesPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case TemplatesPackage.CODETEMPLATE:
                sequence_Codetemplate(context, (Codetemplate) semanticObject);
                return;
            case TemplatesPackage.CODETEMPLATES:
                sequence_Codetemplates(context, (Codetemplates) semanticObject);
                return;
            case TemplatesPackage.DOLLAR:
                sequence_Dollar(context, (Dollar) semanticObject);
                return;
            case TemplatesPackage.LITERAL:
                sequence_Literal(context, (Literal) semanticObject);
                return;
            case TemplatesPackage.TEMPLATE_BODY:
                sequence_TemplateBody(context, (TemplateBody) semanticObject);
                return;
            case TemplatesPackage.VARIABLE:
                sequence_Variable(context, (Variable) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) Codetemplates(org.eclipse.xtext.ui.codetemplates.templates.Codetemplates) Variable(org.eclipse.xtext.ui.codetemplates.templates.Variable) Dollar(org.eclipse.xtext.ui.codetemplates.templates.Dollar) Codetemplate(org.eclipse.xtext.ui.codetemplates.templates.Codetemplate) Literal(org.eclipse.xtext.ui.codetemplates.templates.Literal) Parameter(org.eclipse.xtext.Parameter) TemplateBody(org.eclipse.xtext.ui.codetemplates.templates.TemplateBody) EPackage(org.eclipse.emf.ecore.EPackage)

Example 3 with TemplateBody

use of org.eclipse.xtext.ui.codetemplates.templates.TemplateBody in project xtext-eclipse by eclipse.

the class AbstractTemplateProposalConflictHelper method initTokenSource.

@Override
protected void initTokenSource(String text, TokenSource tokenSource, ContentAssistContext context) {
    EObject currentModel = context.getLastCompleteNode().getSemanticElement();
    Variable variable = currentModel != null ? EcoreUtil2.getContainerOfType(currentModel, Variable.class) : null;
    TemplateBody body = currentModel != null ? EcoreUtil2.getContainerOfType(currentModel, TemplateBody.class) : null;
    Lexer lexer = (Lexer) tokenSource;
    CharStream stream = new ANTLRStringStream(text);
    lexer.setCharStream(stream);
    initLexer(lexer, body != null, variable != null);
}
Also used : ANTLRStringStream(org.antlr.runtime.ANTLRStringStream) Lexer(org.eclipse.xtext.parser.antlr.Lexer) Variable(org.eclipse.xtext.ui.codetemplates.templates.Variable) EObject(org.eclipse.emf.ecore.EObject) TemplateBody(org.eclipse.xtext.ui.codetemplates.templates.TemplateBody) CharStream(org.antlr.runtime.CharStream)

Example 4 with TemplateBody

use of org.eclipse.xtext.ui.codetemplates.templates.TemplateBody in project xtext-eclipse by eclipse.

the class CodetemplateImpl method basicSetBody.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetBody(TemplateBody newBody, NotificationChain msgs) {
    TemplateBody oldBody = body;
    body = newBody;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TemplatesPackage.CODETEMPLATE__BODY, oldBody, newBody);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) TemplateBody(org.eclipse.xtext.ui.codetemplates.templates.TemplateBody)

Aggregations

TemplateBody (org.eclipse.xtext.ui.codetemplates.templates.TemplateBody)4 Variable (org.eclipse.xtext.ui.codetemplates.templates.Variable)3 EPackage (org.eclipse.emf.ecore.EPackage)2 Action (org.eclipse.xtext.Action)2 Parameter (org.eclipse.xtext.Parameter)2 ParserRule (org.eclipse.xtext.ParserRule)2 Codetemplate (org.eclipse.xtext.ui.codetemplates.templates.Codetemplate)2 Codetemplates (org.eclipse.xtext.ui.codetemplates.templates.Codetemplates)2 Dollar (org.eclipse.xtext.ui.codetemplates.templates.Dollar)2 Literal (org.eclipse.xtext.ui.codetemplates.templates.Literal)2 ANTLRStringStream (org.antlr.runtime.ANTLRStringStream)1 CharStream (org.antlr.runtime.CharStream)1 EObject (org.eclipse.emf.ecore.EObject)1 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1 Lexer (org.eclipse.xtext.parser.antlr.Lexer)1