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