/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Grammar getLanguage() { if (language != null && language.eIsProxy()) { InternalEObject oldLanguage = (InternalEObject)language; language = (Grammar)eResolveProxy(oldLanguage); if (language != oldLanguage) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, TemplatesPackage.CODETEMPLATES__LANGUAGE, oldLanguage, language)); } } return language; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Grammar getLanguage() { if (language != null && language.eIsProxy()) { InternalEObject oldLanguage = (InternalEObject)language; language = (Grammar)eResolveProxy(oldLanguage); if (language != oldLanguage) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, TemplatesPackage.CODETEMPLATES__LANGUAGE, oldLanguage, language)); } } return language; }
public IScope scope_Codetemplate_context(Codetemplate template, EReference reference) { Codetemplates root = EcoreUtil2.getContainerOfType(template, Codetemplates.class); if (root != null && root.getLanguage() != null) { Grammar grammar = root.getLanguage(); if (!grammar.eIsProxy()) { LinkedHashSet<AbstractRule> usedRules = Sets.newLinkedHashSet(); new UsedRulesFinder(usedRules).compute(grammar); return Scopes.scopeFor(Iterables.filter(usedRules, ParserRule.class)); } } return IScope.NULLSCOPE; }
public IScope scope_Codetemplate_context(Codetemplate template, EReference reference) { Codetemplates root = EcoreUtil2.getContainerOfType(template, Codetemplates.class); if (root != null && root.getLanguage() != null) { Grammar grammar = root.getLanguage(); if (!grammar.eIsProxy()) { LinkedHashSet<AbstractRule> usedRules = Sets.newLinkedHashSet(); new UsedRulesFinder(usedRules).compute(grammar); return Scopes.scopeFor(Iterables.filter(usedRules, ParserRule.class)); } } return IScope.NULLSCOPE; }
Codetemplates templates = (Codetemplates) resource.getContents().get(0); Grammar grammar = templates.getLanguage(); if (grammar != null && !grammar.eIsProxy()) { TemplateBodyHighlighter highlighter = getHighlighter(grammar); if (highlighter != null) {
@Override public void completeCodetemplate_KeywordContext(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { Codetemplate template = EcoreUtil2.getContainerOfType(model, Codetemplate.class); if (template != null) { Codetemplates templates = EcoreUtil2.getContainerOfType(template, Codetemplates.class); if (templates != null) { Grammar language = templates.getLanguage(); if (language != null && !language.eIsProxy()) { Set<String> keywords = GrammarUtil.getAllKeywords(language); for(String keyword: keywords) { String proposalText = keyword; proposalText = getValueConverter().toString(proposalText, ((RuleCall)assignment.getTerminal()).getRule().getName()); StyledString displayText = new StyledString(proposalText).append(" - Keyword", StyledString.QUALIFIER_STYLER); ICompletionProposal proposal = createCompletionProposal(proposalText, displayText, null, context); getPriorityHelper().adjustCrossReferencePriority(proposal, context.getPrefix()); if (proposal instanceof ConfigurableCompletionProposal) { ((ConfigurableCompletionProposal) proposal).setPriority(((ConfigurableCompletionProposal) proposal).getPriority() - 1); } acceptor.accept(proposal); } } } } }