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


Java IOutlineNode.getChildren方法代码示例

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


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

示例1: openOutlineView

import org.eclipse.xtext.ui.editor.outline.IOutlineNode; //导入方法依赖的package包/类
protected void openOutlineView() throws PartInitException, InterruptedException {
	outlineView = editor.getEditorSite().getPage().showView("org.eclipse.ui.views.ContentOutline");
	executeAsyncDisplayJobs();
	Object adapter = editor.getAdapter(IContentOutlinePage.class);
	assertTrue(adapter instanceof OutlinePage);
	outlinePage = new SyncableOutlinePage((OutlinePage) adapter);
	outlinePage.resetSyncer();
	try {
		outlinePage.waitForUpdate(EXPECTED_TIMEOUT);
	} catch (TimeoutException e) {
		System.out.println("Expected timeout exceeded: " + EXPECTED_TIMEOUT);// timeout is OK here
	}
	treeViewer = outlinePage.getTreeViewer();
	assertSelected(treeViewer);
	assertExpanded(treeViewer);
	assertTrue(treeViewer.getInput() instanceof IOutlineNode);
	IOutlineNode rootNode = (IOutlineNode) treeViewer.getInput();
	List<IOutlineNode> children = rootNode.getChildren();
	assertEquals(1, children.size());
	modelNode = children.get(0);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:22,代码来源:AbstractOutlineWorkbenchTest.java

示例2: findNode

import org.eclipse.xtext.ui.editor.outline.IOutlineNode; //导入方法依赖的package包/类
/**
 * Recursively searches for a node with the given name and type.
 *
 * @param node
 *          a root node of a subtree where the desired node is searched for
 * @param nodeName
 *          the name of the node to search, must not be {@code null}
 * @param nodeType
 *          the name of the type of the node to search, may be {@code null} if only the name of the node is to be tested
 * @return
 *         a node with the given name and type (if specified). If such a node is not found, returns null.
 */
private IOutlineNode findNode(final IOutlineNode node, final String nodeName, final String nodeType) {
  IOutlineNode fieldNode = null;
  String[] textParts = node.getText().toString().split(":");

  if (nodeName.equals(textParts[0].trim()) && (nodeType == null || (textParts.length > 1 && nodeType.equals(textParts[1].trim())))) {
    fieldNode = node;
  } else {
    List<IOutlineNode> children = node.getChildren();
    for (IOutlineNode child : children) {
      fieldNode = findNode(child, nodeName, nodeType);
      if (fieldNode != null) {
        break;
      }
    }
  }

  return fieldNode;
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:31,代码来源:AbstractOutlineTest.java

示例3: findBestNode

import org.eclipse.xtext.ui.editor.outline.IOutlineNode; //导入方法依赖的package包/类
protected IOutlineNode findBestNode(IOutlineNode input, ITextRegion selectedTextRegion) {
	ITextRegion textRegion = input.getFullTextRegion();
	if (textRegion == null || textRegion.contains(selectedTextRegion)) {
		IOutlineNode currentBestNode = input;
		for (IOutlineNode child : input.getChildren()) {
			IOutlineNode candidate = findBestNode(child, selectedTextRegion);
			if (candidate != null
					&& (currentBestNode.getFullTextRegion() == null || currentBestNode.getFullTextRegion()
							.getLength() >= candidate.getFullTextRegion().getLength())) {
				currentBestNode = candidate;
			}
		}
		return currentBestNode;
	}
	return null;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:17,代码来源:OutlineWithEditorLinker.java

示例4: isEquivalentIndex

import org.eclipse.xtext.ui.editor.outline.IOutlineNode; //导入方法依赖的package包/类
protected boolean isEquivalentIndex(IOutlineNode node1, IOutlineNode node2) {
	IOutlineNode parent1 = node1.getParent();
	IOutlineNode parent2 = node2.getParent();
	if (parent1 == null && parent2 == null)
		return true;
	if (parent1 != null && parent2 != null) {
		List<IOutlineNode> siblings1 = parent1.getChildren();
		List<IOutlineNode> siblings2 = parent2.getChildren();
		int index1 = siblings1.indexOf(node1);
		int index2 = siblings2.indexOf(node2);
		// same siblings =>  same index
		// sibling inserted after => same index
		// sibling inserted before => same # of following siblings
		if (index1 == index2 || siblings1.size() - index1 == siblings2.size() - index2)
			return true;
	}
	return false;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:19,代码来源:IOutlineNodeComparer.java

示例5: buildOutlineMap

import org.eclipse.xtext.ui.editor.outline.IOutlineNode; //导入方法依赖的package包/类
/**
 * Traverse the outline tree node recursively and build up the outlineMap.
 *
 * @param node
 *          the outline tree node to traverse.
 */
private void buildOutlineMap(final IOutlineNode node) {
  addToOutlineMap(node);
  // add node's children
  List<IOutlineNode> children = node.getChildren();
  for (IOutlineNode child : children) {
    buildOutlineMap(child);
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:15,代码来源:AbstractOutlineTest.java

示例6: restoreChildrenSelectionAndExpansion

import org.eclipse.xtext.ui.editor.outline.IOutlineNode; //导入方法依赖的package包/类
protected void restoreChildrenSelectionAndExpansion(IOutlineNode parent, Resource resource, OutlineTreeState formerState, OutlineTreeState newState) {
	List<IOutlineNode> children = parent.getChildren();
	for(IOutlineNode child: children) {
		if(containsUsingComparer(formerState.getExpandedNodes(), child)) {
			restoreChildrenSelectionAndExpansion(child, resource, formerState, newState);
			newState.addExpandedNode(child);
		}
		if(containsUsingComparer(formerState.getSelectedNodes(), child)) {
			newState.addSelectedNode(child);
		}
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:13,代码来源:OutlineRefreshJob.java

示例7: addChildren

import org.eclipse.xtext.ui.editor.outline.IOutlineNode; //导入方法依赖的package包/类
protected void addChildren(List<IOutlineNode> nodes, List<IOutlineNode> allChildren, int depth) {
	for (IOutlineNode node : nodes) {
		List<IOutlineNode> children = node.getChildren();
		if (depth > 1) {
			allChildren.addAll(children);
			addChildren(children, allChildren, depth - 1);
		}
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:10,代码来源:OutlinePage.java

示例8: traverseChildren

import org.eclipse.xtext.ui.editor.outline.IOutlineNode; //导入方法依赖的package包/类
private void traverseChildren(IOutlineNode node) {
	for (IOutlineNode child : node.getChildren()) {
		traverseChildren(child);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:6,代码来源:OutlineXpectMethod.java

示例9: outlineRepresentChildren

import org.eclipse.xtext.ui.editor.outline.IOutlineNode; //导入方法依赖的package包/类
private void outlineRepresentChildren(IOutlineNode node,
		StringBuffer buffer, int tabs) {
	for (IOutlineNode child : node.getChildren()) {
		outlineStringRepresentation(child, buffer, tabs);
	}
}
 
开发者ID:eclipse,项目名称:xsemantics,代码行数:7,代码来源:AbstractOutlineWorkbenchTest.java


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