use of org.eclipse.swt.widgets.TreeItem in project cogtool by cogtool.
the class ProjectUIModel method recoverTreeItem.
protected void recoverTreeItem(TreeItem rowToDelete) {
if (rowHook != null) {
rowHook.onRowDeletion(rowToDelete);
}
// Need to call getData BEFORE calling dispose, otherwise a
// widgetIsDisposed error is created.
taskTreeItems.remove(rowToDelete.getData());
TreeItem deletedRowParent = rowToDelete.getParentItem();
rowToDelete.dispose();
if (deletedRowParent != null) {
redisplayResults(deletedRowParent);
}
}
use of org.eclipse.swt.widgets.TreeItem in project cogtool by cogtool.
the class ProjectUIModel method installUndertakings.
// setGroupAlertHandlers
protected void installUndertakings() {
Iterator<AUndertaking> undertakings = project.getUndertakings().iterator();
while (undertakings.hasNext()) {
AUndertaking undertaking = undertakings.next();
TreeItem row = new TreeItem(tree, SWT.NONE);
populateRow(undertaking, row);
}
}
use of org.eclipse.swt.widgets.TreeItem in project cogtool by cogtool.
the class TreeItemUpdater method updateTreeItems.
protected void updateTreeItems(TreeItem[] items, Iterator<? extends T> objects) {
for (int i = 0; i < items.length; i++) {
if (objects.hasNext()) {
T o = objects.next();
String text = getObjectText(o);
if (!(text.equals(items[i].getText()))) {
items[i].setText(text);
items[i].setData(o);
}
TreeItem[] subrows = items[i].getItems();
Iterator<C> childObjects = getObjectChildren(o);
TreeItemUpdater<C, ?> updater = getChildUpdater(items[i]);
if (updater != null) {
updater.updateTreeItems(subrows, childObjects);
}
} else {
items[i].dispose();
}
}
populateExtraItems(objects);
}
use of org.eclipse.swt.widgets.TreeItem in project GT by Tencent.
the class CopyAllFromTreeViewAction method getContents.
/**
* 获取treeview控件的所有数据
* @return
*/
private StringBuffer getContents() {
StringBuffer sb = new StringBuffer();
int columnCount = viewer.getTree().getColumnCount();
// 表头
for (TreeColumn column : viewer.getTree().getColumns()) {
sb.append(column.getText());
sb.append(SourceDataItem.SPLIT);
}
sb.deleteCharAt(sb.length() - 1);
sb.append("\r\n");
for (TreeItem tableItem : viewer.getTree().getItems()) {
parseTree(tableItem, columnCount, sb);
}
return sb;
}
use of org.eclipse.swt.widgets.TreeItem in project GT by Tencent.
the class CopyAllFromTreeViewAction method parseTree.
/*
* 递归解析树
* @param parent
* @param sb
*/
private void parseTree(TreeItem curItem, int columnCount, StringBuffer sb) {
if (null == curItem.getData()) {
return;
}
// 打层次点"."
int deep = calcDeep(curItem);
for (int i = 0; i < deep; i++) {
sb.append('.');
}
// 内容
for (int i = 0; i < columnCount; i++) {
sb.append(curItem.getText(i));
sb.append(SourceDataItem.SPLIT);
}
sb.deleteCharAt(sb.length() - 1);
sb.append("\r\n");
for (TreeItem item : curItem.getItems()) {
parseTree(item, columnCount, sb);
}
}
Aggregations