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


Java AbstractElement.eContainer方法代碼示例

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


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

示例1: getElementDescription

import org.eclipse.xtext.AbstractElement; //導入方法依賴的package包/類
private List<String> getElementDescription(final AbstractElement element) {
  final ArrayList<String> result = new ArrayList<String>();
  AbstractElement container = element;
  while ((container != null)) {
    {
      result.addAll(0, this.getSingleElementDescription(container));
      final EObject eContainer = container.eContainer();
      AbstractElement _xifexpression = null;
      if ((eContainer instanceof AbstractElement)) {
        _xifexpression = ((AbstractElement)eContainer);
      } else {
        _xifexpression = null;
      }
      container = _xifexpression;
    }
  }
  return result;
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:19,代碼來源:GrammarAccessExtensions.java

示例2: getAdjustedRequiredRuleNames

import org.eclipse.xtext.AbstractElement; //導入方法依賴的package包/類
/**
 * @since 2.14
 */
protected String[][] getAdjustedRequiredRuleNames(Param param, AbstractElement elementToParse,
		String originalRuleName) {
	String adjustedRuleName = adjustRuleName(originalRuleName, param);
	if (!(GrammarUtil.isOptionalCardinality(elementToParse)
			|| GrammarUtil.isOneOrMoreCardinality(elementToParse))) {
		return new String[][] { { adjustedRuleName } };
	}
	EObject container = elementToParse.eContainer();
	if (container instanceof Group) {
		Group group = (Group) container;
		List<AbstractElement> filteredElements = getFilteredElements(group.getElements(), param);
		int idx = filteredElements.indexOf(elementToParse) + 1;
		if (idx != filteredElements.size()) {
			String adjustedSecondRule = getAdjustedSecondRule(param, group, idx);
			return getRuleNamesInGroup(param, elementToParse, adjustedRuleName, adjustedSecondRule);
		}
	}
	return new String[][] { { adjustedRuleName } };
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:23,代碼來源:RequiredRuleNameComputer.java

示例3: hasMandatoryFollowElements

import org.eclipse.xtext.AbstractElement; //導入方法依賴的package包/類
private boolean hasMandatoryFollowElements(final AbstractElement lastParsedElement) {
  if (lastParsedElement.eContainer() instanceof AbstractElement) {
    AbstractElement directParent = (AbstractElement) lastParsedElement.eContainer();
    if (directParent instanceof Group) {
      Group group = (Group) directParent;
      int idx = group.getElements().indexOf(lastParsedElement) + 1;
      for (int i = idx; i < group.getElements().size(); i++) {
        if (isMandatory(group.getElements().get(i))) {
          return true;
        }
      }
    }
    return hasMandatoryFollowElements(directParent);
  }
  return false;
}
 
開發者ID:dsldevkit,項目名稱:dsl-devkit,代碼行數:17,代碼來源:FixedPartialParsingHelper.java

示例4: getEnclosingSingleElementGroup

import org.eclipse.xtext.AbstractElement; //導入方法依賴的package包/類
/**
 * Return the containing group if it contains exactly one element.
 */
protected AbstractElement getEnclosingSingleElementGroup(AbstractElement elementToParse) {
	EObject container = elementToParse.eContainer();
	if (container instanceof Group) {
		if (((Group) container).getElements().size() == 1) {
			return (AbstractElement) container;
		}
	}
	return null;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:13,代碼來源:PatchedRequiredRuleNameComputer.java

示例5: getElementDescription

import org.eclipse.xtext.AbstractElement; //導入方法依賴的package包/類
private static List<String> getElementDescription(AbstractElement element) {
	final ArrayList<String> result = new ArrayList<String>();
	AbstractElement container = element;
	while (container != null) {
		result.addAll(0, getSingleElementDescription(container));
		container = container.eContainer() instanceof AbstractElement ? (AbstractElement) container
				.eContainer()
				: null;
	}
	return result;
}
 
開發者ID:eclipse,項目名稱:xtext-extras,代碼行數:12,代碼來源:GrammarAccessUtil.java

示例6: hasMandatoryFollowElements

import org.eclipse.xtext.AbstractElement; //導入方法依賴的package包/類
private boolean hasMandatoryFollowElements(AbstractElement lastParsedElement) {
	if (lastParsedElement.eContainer() instanceof AbstractElement) {
		AbstractElement directParent = (AbstractElement) lastParsedElement.eContainer();
		if (directParent instanceof Group) {
			Group group = (Group) directParent;
			int idx = group.getElements().indexOf(lastParsedElement) + 1;
			for (int i = idx; i < group.getElements().size(); i++) {
				if (isMandatory(group.getElements().get(i)))
					return true;
			}
		}
		return hasMandatoryFollowElements(directParent);
	}
	return false;
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:16,代碼來源:PartialParsingHelper.java

示例7: filter

import org.eclipse.xtext.AbstractElement; //導入方法依賴的package包/類
@Override
public boolean filter(AbstractElement grammarElement) {
	if (grammarElement.eContainer() instanceof AbstractRule)
		return false;
	if (EcoreUtil2.getContainerOfType(grammarElement.eContainer(), Assignment.class) != null)
		return true;

	return false;
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:10,代碼來源:TreeConstructionNFAProvider.java

示例8: loadElementParentStatement

import org.eclipse.xtext.AbstractElement; //導入方法依賴的package包/類
protected String loadElementParentStatement(final AbstractElement ele) {
  String _xifexpression = null;
  EObject _eContainer = ele.eContainer();
  if ((_eContainer instanceof AbstractElement)) {
    EObject _eContainer_1 = ele.eContainer();
    _xifexpression = this.gaElementAccessorLocalVarName(((AbstractElement) _eContainer_1));
  } else {
    _xifexpression = "rule";
  }
  return _xifexpression;
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:12,代碼來源:GrammarAccessFragment2.java

示例9: getEnclosingSingleElementGroup

import org.eclipse.xtext.AbstractElement; //導入方法依賴的package包/類
/**
 * Return the containing group if it contains exactly one element.
 * 
 * @since 2.14
 */
protected AbstractElement getEnclosingSingleElementGroup(AbstractElement elementToParse) {
	EObject container = elementToParse.eContainer();
	if (container instanceof Group) {
		if (((Group) container).getElements().size() == 1) {
			return (AbstractElement) container;
		}
	}
	return null;
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:15,代碼來源:RequiredRuleNameComputer.java

示例10: getRequiredRuleNames

import org.eclipse.xtext.AbstractElement; //導入方法依賴的package包/類
@SuppressWarnings("restriction")
@Override
public String[][] getRequiredRuleNames(Param param) {
	if (isFiltered(param)) {
		return EMPTY_ARRAY;
	}
	AbstractElement elementToParse = param.elementToParse;
	String ruleName = param.ruleName;
	if (ruleName == null) {
		if (elementToParse instanceof RuleCall) {
			RuleCall call = (RuleCall) elementToParse;
			if (call.getRule() instanceof ParserRule) {
				String antlrRuleName = getRuleNames().getAntlrRuleName(call.getRule());
				if (!call.getArguments().isEmpty()) {
					Set<Parameter> context = param.getAssignedParametes();
					Set<Parameter> arguments = getAssignedArguments(call, context);
					int config = getParameterConfig(arguments);
					antlrRuleName = getRuleNames().getAntlrRuleName(call.getRule(), config);
				}
				return new String[][] { { antlrRuleName } };
			}
		}
		return EMPTY_ARRAY;
	}
	String adjustedRuleName = adjustRuleName(ruleName, param);
	if (!(GrammarUtil.isOptionalCardinality(elementToParse)
			|| GrammarUtil.isOneOrMoreCardinality(elementToParse))) {
		return new String[][] { { adjustedRuleName } };
	}
	if ((elementToParse.eContainer() instanceof Group)) {
		List<AbstractElement> tokens = getFilteredElements(((Group) elementToParse.eContainer()).getElements(),
				param);
		int idx = tokens.indexOf(elementToParse) + 1;
		if (idx != tokens.size()) {
			String secondRule = param.getBaseRuleName((AbstractElement) elementToParse.eContainer());
			secondRule = secondRule.substring(0, secondRule.lastIndexOf('_') + 1) + idx;
			String adjustedSecondRule = adjustRuleName(secondRule, param);
			if (GrammarUtil.isMultipleCardinality(elementToParse))
				return new String[][] { { adjustedRuleName }, { adjustedRuleName, adjustedSecondRule } };
			return new String[][] { { adjustedRuleName, adjustedSecondRule } };
		}
	}
	// Fix is here. Original method returns the original ruleName instead of the adjusted rule name.
	return new String[][] { { adjustedRuleName } };
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:46,代碼來源:PatchedRequiredRuleNameComputer.java

示例11: getParent

import org.eclipse.xtext.AbstractElement; //導入方法依賴的package包/類
@Override
public AbstractElement getParent(AbstractElement ele) {
	EObject cnt = ele.eContainer();
	return cnt instanceof AbstractElement ? (AbstractElement) cnt : null;
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:6,代碼來源:CfgAdapter.java


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