本文整理汇总了Java中org.eclipse.swt.widgets.Tree.getItems方法的典型用法代码示例。如果您正苦于以下问题:Java Tree.getItems方法的具体用法?Java Tree.getItems怎么用?Java Tree.getItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.Tree
的用法示例。
在下文中一共展示了Tree.getItems方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeAndDisplayStats
import org.eclipse.swt.widgets.Tree; //导入方法依赖的package包/类
protected void computeAndDisplayStats(AvroSchemaEditor editor) {
SchemaViewer masterViewer = editor.getContentPart().getSchemaViewer(AvroContext.Kind.MASTER);
TreeViewer treeViewer = masterViewer.getTreeViewer();
AvroNode inputNode = (AvroNode) treeViewer.getInput();
NodeType inputType = inputNode.getType();
String name = AttributeUtil.getNameFromAttribute(inputNode);
NodeStats stats = new NodeStats("Compute stats of " + inputType.toString().toLowerCase()
+ " " + name + " from editor " + editor.getName());
stats.start();
Tree tree = treeViewer.getTree();
TreeItem[] items = tree.getItems();
for (TreeItem item : items) {
visitTreeItem(item, stats);
}
stats.finish();
AvroSchemaLogger.logStats(stats, false);
}
示例2: getSelections
import org.eclipse.swt.widgets.Tree; //导入方法依赖的package包/类
public static Vector<String> getSelections(Tree tree,String prj){
Vector<String> vecFiles = new Vector<String>();
TreeItem[] tiRoot = tree.getItems();
for(int i = 0;i<tiRoot.length;i++){
if(tiRoot[i].getText().equals(prj))
if(tiRoot[i].getChecked() == true){
//Scripts
TreeItem tiScript = tiRoot[i].getItems()[2];
TreeItem[] tiCases = tiScript.getItems();
for(int j =0;j<tiCases.length;j++)
if(tiCases[j].getChecked()){
vecFiles.add(System.getProperty("user.dir") +
"/workspace/"+tiRoot[i].getText()+"/Scripts/"+tiCases[j].getText());
}
}else
break;
else
continue;
}
return vecFiles;
}
示例3: updatePageComplete
import org.eclipse.swt.widgets.Tree; //导入方法依赖的package包/类
private void updatePageComplete(Tree tree) {
TreeItem[] rootItems = tree.getItems();
nodeListManager.clearSelectedNodeList();
getSelectedItems(rootItems, nodeListManager.getSelectedNodeList());
if (nodeListManager.getSelectedNodeList().size() > 0) {
setPageComplete(true);
} else {
setPageComplete(false);
}
}
示例4: getSiblings
import org.eclipse.swt.widgets.Tree; //导入方法依赖的package包/类
private TreeItem[] getSiblings(TreeItem currentItem) {
Tree tree = viewer.getTree();
TreeItem parentItem = currentItem.getParentItem();
if (parentItem != null)
return parentItem.getItems();
return tree.getItems();
}
示例5: getCurrentItem
import org.eclipse.swt.widgets.Tree; //导入方法依赖的package包/类
private TreeItem getCurrentItem(boolean forward) {
Tree tree = viewer.getTree();
TreeItem[] selection = tree.getSelection();
if (selection.length == 0) {
selection = tree.getItems();
}
TreeItem nextItem = null;
if (selection.length > 0) {
nextItem = forward ? selection[0] : selection[selection.length - 1];
}
return nextItem;
}
示例6: getNodeByName
import org.eclipse.swt.widgets.Tree; //导入方法依赖的package包/类
public static TreeItem getNodeByName(Tree tree,String prj){
if(tree == null)
return null;
TreeItem[] tiRoot = tree.getItems();
for(int i = 0;i<tiRoot.length;i++){
if(tiRoot[i].getText().equals(prj)){
return tiRoot[i];
}
}
return null;
}
示例7: getSelectElements
import org.eclipse.swt.widgets.Tree; //导入方法依赖的package包/类
public static Vector<TreeItem> getSelectElements(Tree tree){
Vector<TreeItem> vecTreeItem = new Vector();
TreeItem[] tiRoot = tree.getItems();
for(int i = 0;i<tiRoot.length;i++){
getSelection(vecTreeItem,tiRoot[i]);
}
return vecTreeItem;
}
示例8: setContents
import org.eclipse.swt.widgets.Tree; //导入方法依赖的package包/类
/**
* Sets the contents.
*
* @param contents
* the new contents
*/
public void setContents(Object contents) {
if (getViewer().getEditPartFactory() != null){
getViewer().setContents(contents);
}
if (outline instanceof Tree) {
Tree tree = (Tree) outline;
if (!tree.isDisposed() && tree.getItems() != null && tree.getItems().length > 0)
tree.getItem(0).setExpanded(true);
}
}
示例9: setFilterText
import org.eclipse.swt.widgets.Tree; //导入方法依赖的package包/类
public void setFilterText(String filterText) {
editPartFactory.setFilterText(filterText);
viewer.setContents(diagram);
final Tree tree = (Tree) viewer.getControl();
final TreeItem[] items = tree.getItems();
expand(items);
final TreeItem[] tableItems = items[0].getItems();
if (tableItems.length >= 1) {
tree.setSelection(tableItems[0]);
}
}
示例10: selectSelection
import org.eclipse.swt.widgets.Tree; //导入方法依赖的package包/类
public void selectSelection() {
final IStructuredSelection sel = (IStructuredSelection) getViewer().getSelection();
Object firstElement = sel.getFirstElement();
if (firstElement instanceof ERDiagramOutlineEditPart) {
final Tree tree = (Tree) viewer.getControl();
final TreeItem[] items = tree.getItems();
expand(items);
final TreeItem[] tableItems = items[0].getItems();
if (tableItems.length >= 1) {
final Object data = tableItems[0].getData();
firstElement = data;
}
}
if (firstElement instanceof TableOutlineEditPart) {
final Object model = ((TableOutlineEditPart) firstElement).getModel();
final ERTable table = (ERTable) model;
final MainDiagramEditor editor = ((MainDiagramEditor) diagram.getEditor().getActiveEditor());
if (!diagram.isVirtual()) {
editor.reveal(table);
return;
}
final ERVirtualDiagram erModel = table.getDiagram().findModelByTable(table);
if (erModel != null) {
final OpenERModelCommand command = new OpenERModelCommand(diagram, erModel);
command.setTable(table.toMaterialize());
command.execute(); // コマンドスタックには積まないで実行する。ファイル編集中にしないため。
// TODO ymd アウトラインツリー上の仮想ダイアグラムを選択するためにのみある。
// この処理があることで、クイックアウトライン検索→テーブル選択がバグるのでコメントにした。不要なことを確信したら、削除する。
// final ERDiagramOutlineEditPart contents =
// (ERDiagramOutlineEditPart) diagram.getEditor().getOutlinePage().getViewer().getContents();
// if (contents != null) {
// final ERVirtualDiagramSetOutlineEditPart virtualDiagramSetOutlineEditPart =
// (ERVirtualDiagramSetOutlineEditPart) contents.getChildren().get(0);
// @SuppressWarnings("unchecked")
// final List<ERVirtualDiagramOutlineEditPart> parts = virtualDiagramSetOutlineEditPart.getChildren();
// for (final ERVirtualDiagramOutlineEditPart part : parts) {
// if (part.getModel().equals(erModel)) {
// final ISelection selection = new StructuredSelection(part);
// diagram.getEditor().getOutlinePage().setSelection(selection);
// }
// }
// }
} else {
// ここでrevealしないと、メインダイアグラムでtableが選択不可状態になる。理由は分からない。
editor.reveal(table);
Activator.showMessageDialog("\"" + table.getPhysicalName() + "\"does not exist on the virtual diagram.");
}
}
}