本文整理汇总了Java中org.eclipse.swt.widgets.TreeItem.getItems方法的典型用法代码示例。如果您正苦于以下问题:Java TreeItem.getItems方法的具体用法?Java TreeItem.getItems怎么用?Java TreeItem.getItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.TreeItem
的用法示例。
在下文中一共展示了TreeItem.getItems方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillCheckedList
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
private void fillCheckedList(TreeItem parent, List<String> csSourceData) {
if (csSourceData != null && !csSourceData.isEmpty()) {
TreeItem[] items = null;
if (parent == null) {
items = checkboxTreeViewer.getTree().getItems();
}
else {
items = parent.getItems();
TVObject tvo = (TVObject) parent.getData();
String tvoSourceData = tvo.getSourceData();
if (csSourceData.contains(tvoSourceData)) {
int index = csSourceData.indexOf(tvoSourceData);
if (index == 0)
checkedList.add(0,tvo);
else
checkedList.add(tvo);
}
}
for (int i=0; i<items.length; i++) {
fillCheckedList(items[i], csSourceData);
}
}
}
示例2: findModelItem
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
private TVObject findModelItem(TreeItem parent, String modelPath) {
if (modelPath != null && !modelPath.isEmpty()) {
TreeItem[] items = null;
items = parent == null ? modelTreeViewer.getTree().getItems() : parent.getItems();
for (int i=0; i<items.length; i++) {
TreeItem treeItem = items[i];
TVObject tvo = (TVObject) treeItem.getData();
if (tvo != null) {
String tvoSourcePath = tvo.getSourcePath().replaceAll("\\?\\.", ".");
if (modelPath.startsWith(tvoSourcePath.replaceFirst("root", ""))) {
if (modelPath.equals(tvoSourcePath.replaceFirst("root", ""))) {
return tvo;
}
return findModelItem(items[i], modelPath);
}
}
}
}
return null;
}
示例3: getSelectedItems
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
private void getSelectedItems(TreeItem[] items, List<Node> selectedItems) {
if (items == null) {
return;
}
for (TreeItem item : items) {
Node parent = new Node(item.getText(), true);
TreeItem[] children = item.getItems();
if (children != null) {
boolean selected = false;
for (TreeItem child : children) {
if (child.getChecked()) {
parent.addChild(new Node(child.getText(), false));
selected = true;
}
}
if (selected) {
nodeListManager.addSelectedNode(parent);
}
}
}
}
示例4: expandAll
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
public void expandAll(TreeItem treeItem) {
TreeItem[] treeItems = treeItem.getItems();
treeItem.setExpanded(true);
for (TreeItem sub : treeItems) {
expandAll(sub);
}
}
示例5: setDirectoryExpandedStates
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
/**
* Change the "expanded" state of the node.
*/
protected void setDirectoryExpandedStates(TreeItem treeItem, boolean expand) {
treeItem.setExpanded(expand);
TreeItem[] treeItems = treeItem.getItems();
for (int i=0; i<treeItems.length; i++) {
setDirectoryExpandedStates(treeItems[i], expand);
}
}
示例6: searchForMoreNodes
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
/**
* Recursive support method for the refreshing of the directory tree: Search for
* nodes that the current item has as subitems, invoke the recursive search of
* them and finally refresh them.
* @param item The TreeItem to process.
*/
private void searchForMoreNodes(TreeItem item) {
TreeItem[] items = item.getItems();
for (int a = 0; a < items.length; a++) {
// Recursion.
if (!(items[a].getData() instanceof JarFileEntry))
searchForMoreNodes(items[a]);
}
refreshNode(item);
}
示例7: selectAllSubItems
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
private void selectAllSubItems(TreeItem selectedTreeItem) {
TreeItem[] selection = selectedTreeItem.getItems();
for (int i = 0; i < selection.length; i++) {
selection[i].setChecked(selectedTreeItem.getChecked());
selectAllSubItems(selection[i]);
}
}
示例8: selectAllParentItems
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
private void selectAllParentItems(TreeItem selectedTreeItem) {
TreeItem parentTreeItem = selectedTreeItem.getParentItem();
// 当有一个未被选中的时候,取消父节点的选择,当全部选中,则父节点选中
if (parentTreeItem != null) {
TreeItem[] parentSubItems = parentTreeItem.getItems();
boolean allChecked = true;
boolean isGrayed = false;
for (int i = 0; i < parentSubItems.length; i++) {
allChecked = parentSubItems[i].getChecked();
if (!allChecked) {
break;
}
}
for (int i = 0; i < parentSubItems.length; i++) {
if (parentSubItems[i].getChecked()) {
isGrayed = true;
break;
}
}
if (isGrayed && allChecked) {
parentTreeItem.setChecked(allChecked);
parentTreeItem.setGrayed(!isGrayed);
}
if (!allChecked) {
parentTreeItem.setChecked(isGrayed);
parentTreeItem.setGrayed(isGrayed);
}
selectAllParentItems(parentTreeItem);
}
}
示例9: dispose
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
private void dispose(TreeItem item) {
if (item != null) {
if (item.getItems() != null) {
for (TreeItem child : item.getItems()) {
dispose(child);
}
}
}
item.getImage().dispose();
item.dispose();
}
示例10: visitTreeItem
import org.eclipse.swt.widgets.TreeItem; //导入方法依赖的package包/类
protected void visitTreeItem(TreeItem treeItem, NodeStats stats) {
SchemaNode node = (SchemaNode) treeItem.getData();
if (node != null) {
stats.count(node.getAvroNode());
TreeItem[] items = treeItem.getItems();
for (TreeItem item : items) {
visitTreeItem(item, stats);
}
}
}