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


Java BidiIterator.previous方法代码示例

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


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

示例1: getLinkedMetaModel

import org.eclipse.xtext.nodemodel.BidiIterator; //导入方法依赖的package包/类
private List<EObject> getLinkedMetaModel(TypeRef context, EReference ref, ILeafNode text) throws IllegalNodeException {
	final ICompositeNode parentNode = text.getParent();
	BidiIterator<INode> iterator = parentNode.getChildren().iterator();
	while(iterator.hasPrevious()) {
		INode child = iterator.previous();
		if (child instanceof ILeafNode) {
			ILeafNode leaf = (ILeafNode) child;
			if (text == leaf)
				return super.getLinkedObjects(context, ref, text);
			if (!(leaf.getGrammarElement() instanceof Keyword) && !leaf.isHidden()) {
				IScope scope = getScope(context, ref);
				return XtextMetamodelReferenceHelper.findBestMetamodelForType(
						context, text.getText(), leaf.getText(), scope);
			}
		}
	}
	return Collections.emptyList();
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:19,代码来源:XtextLinkingService.java

示例2: getTypeRefName

import org.eclipse.xtext.nodemodel.BidiIterator; //导入方法依赖的package包/类
public static String getTypeRefName(TypeRef typeRef) {
	if (typeRef.getClassifier() != null)
		return typeRef.getClassifier().getName();
	final ICompositeNode node = NodeModelUtils.getNode(typeRef);
	if (node != null) {
		final BidiIterator<INode> leafNodes = node.getAsTreeIterable().iterator();
		while (leafNodes.hasPrevious()) {
			INode previous = leafNodes.previous();
			if (previous instanceof ILeafNode && !((ILeafNode) previous).isHidden()) {
				String result = previous.getText();
				if (result != null && result.startsWith("^")) {
					result = result.substring(1);
				}
				return result;
			}
		}
	}
	return null;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:20,代码来源:GrammarUtil.java

示例3: getLength

import org.eclipse.xtext.nodemodel.BidiIterator; //导入方法依赖的package包/类
@Override
public int getLength() {
	BidiIterator<AbstractNode> iter = basicIterator();
	while(iter.hasPrevious()) {
		INode prev = iter.previous();
		if (prev instanceof ILeafNode && !((ILeafNode) prev).isHidden()) {
			int offset = getOffset();
			return prev.getTotalEndOffset() - offset;
		}
	}
	return getTotalLength();
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:13,代码来源:AbstractNode.java

示例4: getEndOffset

import org.eclipse.xtext.nodemodel.BidiIterator; //导入方法依赖的package包/类
/**
 * @since 2.5
 */
@Override
public int getEndOffset() {
	BidiIterator<AbstractNode> iter = basicIterator();
	while(iter.hasPrevious()) {
		INode prev = iter.previous();
		if (prev instanceof ILeafNode && !((ILeafNode) prev).isHidden()) {
			return prev.getTotalEndOffset();
		}
	}
	return getTotalEndOffset();
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:15,代码来源:AbstractNode.java

示例5: collectNodesEnclosingChangeRegion

import org.eclipse.xtext.nodemodel.BidiIterator; //导入方法依赖的package包/类
private void collectNodesEnclosingChangeRegion(ICompositeNode parent, Range range,
		List<ICompositeNode> nodesEnclosingRegion) {
	nodesEnclosingRegion.add(parent);
	BidiIterator<INode> iterator = parent.getChildren().iterator();
	while(iterator.hasPrevious()) {
		INode prev = iterator.previous();
		if (prev instanceof ICompositeNode) {
			if (nodeEnclosesRegion((ICompositeNode) prev, range)) {
				collectNodesEnclosingChangeRegion((ICompositeNode) prev, range, nodesEnclosingRegion);
				break;
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:15,代码来源:PartialParsingHelper.java

示例6: collectNodesEnclosingChangeRegion

import org.eclipse.xtext.nodemodel.BidiIterator; //导入方法依赖的package包/类
private void collectNodesEnclosingChangeRegion(final ICompositeNode parent, final Range range, final List<ICompositeNode> nodesEnclosingRegion) {
  nodesEnclosingRegion.add(parent);
  BidiIterator<INode> iterator = parent.getChildren().iterator();
  while (iterator.hasPrevious()) {
    INode prev = iterator.previous();
    if (prev instanceof ICompositeNode) {
      if (nodeEnclosesRegion((ICompositeNode) prev, range)) {
        collectNodesEnclosingChangeRegion((ICompositeNode) prev, range, nodesEnclosingRegion);
        break;
      }
    }
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:14,代码来源:FixedPartialParsingHelper.java


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