本文整理匯總了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();
}
示例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;
}
示例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();
}
示例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();
}
示例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;
}
}
}
}
示例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;
}
}
}
}