當前位置: 首頁>>代碼示例>>Java>>正文


Java IGrammarAccess.getGrammar方法代碼示例

本文整理匯總了Java中org.eclipse.xtext.IGrammarAccess.getGrammar方法的典型用法代碼示例。如果您正苦於以下問題:Java IGrammarAccess.getGrammar方法的具體用法?Java IGrammarAccess.getGrammar怎麽用?Java IGrammarAccess.getGrammar使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.xtext.IGrammarAccess的用法示例。


在下文中一共展示了IGrammarAccess.getGrammar方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: Collector

import org.eclipse.xtext.IGrammarAccess; //導入方法依賴的package包/類
@Inject
public Collector(IGrammarAccess grammarAccess) {
	Grammar grammar = grammarAccess.getGrammar();
	List<ParserRule> parserRules = GrammarUtil.allParserRules(grammar);
	List<UnorderedGroup> groups = Lists.newArrayList();
	for(ParserRule rule: parserRules) {
		Iterator<EObject> iter = rule.eAllContents();
		while(iter.hasNext()) {
			EObject next = iter.next();
			if (next instanceof UnorderedGroup) {
				groups.add((UnorderedGroup) next);
			}
		}
	}
	this.groups = ImmutableList.copyOf(groups);
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:17,代碼來源:UnorderedGroupHelper.java

示例2: getAllLanguages

import org.eclipse.xtext.IGrammarAccess; //導入方法依賴的package包/類
/**
 * Gets the all languages available in the workbench.
 *
 * @return set of all languages
 */
public Set<String> getAllLanguages() {
  Set<String> languages = new HashSet<String>();
  for (String extension : Registry.INSTANCE.getExtensionToFactoryMap().keySet()) {
    final URI dummyUri = URI.createURI("foo:/foo." + extension);
    IResourceServiceProvider resourceServiceProvider = Registry.INSTANCE.getResourceServiceProvider(dummyUri);
    // By checking that description manager is AbstractCachingResourceDescriptionManager we exclude technical languages of the framework
    if (resourceServiceProvider != null && resourceServiceProvider.getResourceDescriptionManager() instanceof AbstractCachingResourceDescriptionManager) {
      try {
        IGrammarAccess grammarAccess = resourceServiceProvider.get(IGrammarAccess.class);
        if (grammarAccess != null && grammarAccess.getGrammar() != null) {
          languages.add(grammarAccess.getGrammar().getName());
        }
      } catch (ConfigurationException e) {
        // Will happen if no binding for IGrammarAccess was present.
      }
    }
  }
  return languages;
}
 
開發者ID:dsldevkit,項目名稱:dsl-devkit,代碼行數:25,代碼來源:CheckCfgUtil.java

示例3: setGrammar

import org.eclipse.xtext.IGrammarAccess; //導入方法依賴的package包/類
@Inject
protected void setGrammar(IGrammarAccess grammar) {
	this.grammar = grammar.getGrammar();
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:5,代碼來源:ConcreteSyntaxConstraintProvider.java

示例4: RuleNames

import org.eclipse.xtext.IGrammarAccess; //導入方法依賴的package包/類
@Inject
public RuleNames(IGrammarAccess grammarAccess) {
	this(grammarAccess.getGrammar(), false);
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:5,代碼來源:RuleNames.java

示例5: setGrammar

import org.eclipse.xtext.IGrammarAccess; //導入方法依賴的package包/類
@Inject
public void setGrammar(IGrammarAccess grammarAccess) {
	this.grammar = grammarAccess.getGrammar();
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:5,代碼來源:AbstractDeclarativeValueConverterService.java

示例6: GrammarAccessHelper

import org.eclipse.xtext.IGrammarAccess; //導入方法依賴的package包/類
public GrammarAccessHelper(final IGrammarAccess grammarAccess) {
  super(grammarAccess.getGrammar());
  this.grammarAccess = grammarAccess;
}
 
開發者ID:dsldevkit,項目名稱:dsl-devkit,代碼行數:5,代碼來源:GrammarAccessHelper.java


注:本文中的org.eclipse.xtext.IGrammarAccess.getGrammar方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。