本文整理汇总了Java中org.eclipse.xtext.EcoreUtil2.eAllContents方法的典型用法代码示例。如果您正苦于以下问题:Java EcoreUtil2.eAllContents方法的具体用法?Java EcoreUtil2.eAllContents怎么用?Java EcoreUtil2.eAllContents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtext.EcoreUtil2
的用法示例。
在下文中一共展示了EcoreUtil2.eAllContents方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rewriteKeywords
import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
private static void rewriteKeywords(AbstractRule rule, N4JSKeywords keywords,
ImmutableMap.Builder<AbstractElement, Integer> builder) {
for (EObject obj : EcoreUtil2.eAllContents(rule.getAlternatives())) {
if (obj instanceof Keyword) {
Keyword keyword = (Keyword) obj;
Integer type = keywords.getTokenType(keyword);
if (type != null) {
if (keyword.eContainer() instanceof EnumLiteralDeclaration) {
builder.put((AbstractElement) keyword.eContainer(), type);
} else {
builder.put(keyword, type);
}
}
}
}
}
示例2: rewriteTypeReferences
import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
private static void rewriteTypeReferences(N4JSGrammarAccess ga,
ImmutableMap.Builder<AbstractElement, Integer> builder) {
for (ParserRule rule : GrammarUtil.allParserRules(ga.getGrammar())) {
for (EObject obj : EcoreUtil2.eAllContents(rule.getAlternatives())) {
if (obj instanceof Assignment) {
Assignment assignment = (Assignment) obj;
AbstractElement terminal = assignment.getTerminal();
if (terminal instanceof RuleCall) {
AbstractRule calledRule = ((RuleCall) terminal).getRule();
EClassifier classifier = calledRule.getType().getClassifier();
if (classifier instanceof EClass
&& TypeRefsPackage.Literals.TYPE_REF.isSuperTypeOf((EClass) classifier)) {
builder.put(assignment, TYPE_REF_TOKEN);
}
}
}
}
}
}
示例3: rewriteIdentifiers
import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
private static void rewriteIdentifiers(N4JSGrammarAccess ga,
ImmutableMap.Builder<AbstractElement, Integer> builder) {
ImmutableSet<AbstractRule> identifierRules = ImmutableSet.of(
ga.getBindingIdentifierRule(),
ga.getIdentifierNameRule(),
ga.getIDENTIFIERRule());
for (ParserRule rule : GrammarUtil.allParserRules(ga.getGrammar())) {
for (EObject obj : EcoreUtil2.eAllContents(rule.getAlternatives())) {
if (obj instanceof Assignment) {
Assignment assignment = (Assignment) obj;
AbstractElement terminal = assignment.getTerminal();
int type = InternalN4JSParser.RULE_IDENTIFIER;
if (terminal instanceof CrossReference) {
terminal = ((CrossReference) terminal).getTerminal();
type = IDENTIFIER_REF_TOKEN;
}
if (terminal instanceof RuleCall) {
AbstractRule calledRule = ((RuleCall) terminal).getRule();
if (identifierRules.contains(calledRule)) {
builder.put(assignment, type);
}
}
}
}
}
}
示例4: rewriteNumberLiterals
import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
private static void rewriteNumberLiterals(N4JSGrammarAccess ga,
ImmutableMap.Builder<AbstractElement, Integer> builder) {
for (ParserRule rule : GrammarUtil.allParserRules(ga.getGrammar())) {
for (EObject obj : EcoreUtil2.eAllContents(rule.getAlternatives())) {
if (obj instanceof Assignment) {
Assignment assignment = (Assignment) obj;
AbstractElement terminal = assignment.getTerminal();
if (terminal instanceof RuleCall) {
AbstractRule calledRule = ((RuleCall) terminal).getRule();
EClassifier classifier = calledRule.getType().getClassifier();
if (classifier == EcorePackage.Literals.EBIG_DECIMAL) {
builder.put(assignment, NUMBER_LITERAL_TOKEN);
}
}
}
}
}
}