当前位置: 首页>>代码示例>>Java>>正文


Java ITextRegion.merge方法代码示例

本文整理汇总了Java中org.eclipse.xtext.util.ITextRegion.merge方法的典型用法代码示例。如果您正苦于以下问题:Java ITextRegion.merge方法的具体用法?Java ITextRegion.merge怎么用?Java ITextRegion.merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.xtext.util.ITextRegion的用法示例。


在下文中一共展示了ITextRegion.merge方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createRegion

import org.eclipse.xtext.util.ITextRegion; //导入方法依赖的package包/类
/**
 * @since 2.3
 */
protected ITextRegion createRegion(List<INode> nodes, RegionDescription query) {
	if (query == RegionDescription.FULL || query == RegionDescription.SIGNIFICANT)
		return createRegion(nodes);
	ITextRegion result = ITextRegion.EMPTY_REGION;
	for (INode node : nodes) {
		for(INode leafNode: node.getLeafNodes()) {
			if (!isHidden(leafNode, query)) {
				ITextRegionWithLineInformation region = leafNode.getTextRegionWithLineInformation();
				if (region.getLength() != 0) {
					result = result.merge(toZeroBasedRegion(region));
				}
			}
		}
	}
	return result;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:20,代码来源:DefaultLocationInFileProvider.java

示例2: write

import org.eclipse.xtext.util.ITextRegion; //导入方法依赖的package包/类
protected ITextRegion write(AbstractToken token, WsMergerStream out, ITextRegion location) throws IOException {
	ITextRegion currentLocation = location;
	INode node = token.getNode();
	if (node != null) {
		currentLocation = currentLocation.merge(node.getTextRegion());
	}
	if (!token.getTokensForSemanticChildren().isEmpty()) {
		for (AbstractToken t : token.getTokensForSemanticChildren())
			currentLocation = write(t, out, currentLocation);
	} else {
		if (token instanceof CommentToken)
			out.writeComment((ILeafNode) node);
		else {
			String val = token.serialize(node);
			if (val != null) {
				if (token instanceof AssignmentToken)
					out.writeSemantic(((AssignmentToken) token).getAssignmentElement(), val, node);
				else
					out.writeSemantic(token.getGrammarElement(), val, node);
			}
		}
	}
	return currentLocation;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:25,代码来源:AbstractParseTreeConstructor.java

示例3: createEStructuralFeatureNode

import org.eclipse.xtext.util.ITextRegion; //导入方法依赖的package包/类
/**
 * Creates a new structural feature node with a given image description and label.
 *
 * @param parentNode
 *          the parent {@link IOutlineNode}
 * @param owner
 *          a valid model element as {@link EObject}
 * @param feature
 *          a structural feature {@link EStructuralFeature}
 * @param image
 *          an image descriptor {@link ImageDescriptor}
 * @param text
 *          the label text
 * @param isLeaf
 *          true if feature is a leaf
 * @return newly created structural feature node
 */
protected EStructuralFeatureNode createEStructuralFeatureNode(final IOutlineNode parentNode, final EObject owner, final EStructuralFeature feature, final ImageDescriptor image, final Object text, final boolean isLeaf) {
  boolean isFeatureSet = owner.eIsSet(feature);
  EStructuralFeatureNode eStructuralFeatureNode = new EStructuralFeatureNode(owner, feature, parentNode, image, text, isLeaf || !isFeatureSet);
  if (isFeatureSet) {
    ITextRegion region = getLocationInFileProvider().getFullTextRegion(owner, feature, 0);
    if (feature.isMany()) {
      int numValues = ((Collection<?>) owner.eGet(feature)).size();
      ITextRegion fullTextRegion = getLocationInFileProvider().getFullTextRegion(owner, feature, numValues - 1);
      if (fullTextRegion != null) {
        region = region.merge(fullTextRegion);
      }
    }
    eStructuralFeatureNode.setTextRegion(region);
  }
  return eStructuralFeatureNode;
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:34,代码来源:AbstractOutlineTreeProvider.java


注:本文中的org.eclipse.xtext.util.ITextRegion.merge方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。