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; }
protected TemplateData(EObject model) { template = EcoreUtil2.getContainerOfType(model, Codetemplate.class); if (template != null) { templates = EcoreUtil2.getContainerOfType(template, Codetemplates.class); language = templates.getLanguage(); rule = template.getContext(); } }
Codetemplates templates = EcoreUtil2.getContainerOfType(template, Codetemplates.class); if (templates != null && template != null) { Grammar language = templates.getLanguage(); AbstractRule rule = template.getContext(); ContextTypeIdHelper helper = languageRegistry.getContextTypeIdHelper(language);
return; Codetemplates templates = (Codetemplates) resource.getContents().get(0); Grammar grammar = templates.getLanguage(); if (grammar != null && !grammar.eIsProxy()) { TemplateBodyHighlighter highlighter = getHighlighter(grammar);
@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); } } } } }