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


Java Tree类代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.Tree的典型用法代码示例。如果您正苦于以下问题:Java Tree类的具体用法?Java Tree怎么用?Java Tree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: removeSelectedPackage

import org.eclipse.swt.widgets.Tree; //导入依赖的package包/类
private void removeSelectedPackage(SelectionEvent e, TreeViewer treeViewer) {
	Tree tree = getTree(e);
	if (tree == null) {
		return;
	}
	TreeItem[] selection = tree.getSelection();
	if (selection != null && selection.length > 0) {
		for (TreeItem item : selection) {
			TreeItem parent = item.getParentItem();
			if (parent == null) {
				removePackage(item);
				updatePageComplete(tree);
			} else {
				alert("请选择要删除的包!");
			}
		}
	} else {
		alert("请选择要删除的包!");
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:21,代码来源:SelectClassPage.java

示例2: setSortColumn

import org.eclipse.swt.widgets.Tree; //导入依赖的package包/类
private void setSortColumn(
    TreeColumn column, int colIndex, int direction) {

  ViewerComparator sorter = buildColumnSorter(colIndex);
  if (SWT.UP == direction) {
    sorter = new InverseSorter(sorter);
  }

  Tree tree = propViewer.getTree();
  tree.setSortColumn(column);
  tree.setSortDirection(direction);

  propViewer.setComparator(sorter);
}
 
开发者ID:google,项目名称:depan,代码行数:15,代码来源:NodeStatsTableControl.java

示例3: CustomElementSelectionForm

import org.eclipse.swt.widgets.Tree; //导入依赖的package包/类
/**
 * Create the composite.
 */
public CustomElementSelectionForm(Composite parent, int style) {
	super(parent, style);
	setLayout(new GridLayout(2, false));

	treeViewer = new TreeViewer(this, SWT.BORDER);
	Tree tree = getTreeViewer().getTree();

	// Set a minimum height to prevent weird dialog dimensions
	tree.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(2, 1).minSize(0, 200).create());

	elementLabel = new Label(this, SWT.NONE);
	elementLabel.setLayoutData(GridDataFactory.swtDefaults().create());
	elementLabel.setText("New Label");

	elementInput = new SuffixText(this, SWT.BORDER);// new Text(this, SWT.BORDER);
	elementInput.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:21,代码来源:CustomElementSelectionForm.java

示例4: createViewer

import org.eclipse.swt.widgets.Tree; //导入依赖的package包/类
@Override
protected TreeViewer createViewer(final Composite parent, final AbstractColumnLayout columnLayout,
		final int style) {
	final TreeViewer viewer = new TreeViewer(parent, virual ? (style | VIRTUAL) : style);
	final Tree tree = viewer.getTree();
	tree.setLinesVisible(linesVisible);
	tree.setHeaderVisible(headerVisible);

	int columnIndex = 0;
	for (final String columnLabel : columnLabels) {

		final TreeViewerColumn viewerColumn = new TreeViewerColumn(viewer, NONE);
		final TreeColumn column = viewerColumn.getColumn();
		columnLayout.setColumnData(column, createColumnLayoutData(columnIndex));
		column.setText(columnLabel);
		column.setMoveable(moveable);

		columnIndex++;
	}

	return viewer;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:23,代码来源:TreeViewerBuilder.java

示例5: shouldCreateToolTip

import org.eclipse.swt.widgets.Tree; //导入依赖的package包/类
@Override
protected boolean shouldCreateToolTip(final Event e) {
	this.lastDescriptor = null;
	if (e.widget instanceof Tree) {
		final Tree tree = (Tree) e.widget;
		final TreeItem item = tree.getItem(new Point(e.x, e.y));

		if (null != item && item.getData() instanceof ResultNode) {
			final ResultNode node = (ResultNode) item.getData();
			if (node.getElement() instanceof TestCase) {
				final URI uri = ((TestCase) node.getElement()).getURI();
				if (null != uri) {
					final StyledTextDescriptor descriptor = getDescriptor(uri);
					if (null != descriptor) {
						this.lastDescriptor = descriptor;
					}
				}
			}
		}
	}

	return null != this.lastDescriptor;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:24,代码来源:TestResultsView.java

示例6: createColumns

import org.eclipse.swt.widgets.Tree; //导入依赖的package包/类
protected void createColumns ( final Tree tree )
{
    final TreeColumn typeFilterColumn = new TreeColumn ( tree, SWT.NONE );
    typeFilterColumn.setText ( getString ( "_UI_TypeFilterColumn_label" ) ); //$NON-NLS-1$
    typeFilterColumn.setResizable ( true );
    typeFilterColumn.setWidth ( 200 );

    final TreeColumn idFilterColumn = new TreeColumn ( tree, SWT.NONE );
    idFilterColumn.setText ( getString ( "_UI_IdFilterColumn_label" ) ); //$NON-NLS-1$
    idFilterColumn.setResizable ( true );
    idFilterColumn.setWidth ( 200 );

    final TreeColumn actionFilterColumn = new TreeColumn ( tree, SWT.NONE );
    actionFilterColumn.setText ( getString ( "_UI_ActionFilterColumn_label" ) ); //$NON-NLS-1$
    actionFilterColumn.setResizable ( true );
    actionFilterColumn.setWidth ( 200 );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:18,代码来源:SecurityEditor.java

示例7: createHandler

import org.eclipse.swt.widgets.Tree; //导入依赖的package包/类
/**
 * Creates and returns a new IGazeHandler object from the specified object
 * and partRef, or returns null if no handler object is defined for that object.
 */
public static IGazeHandler createHandler(Object target,
        IWorkbenchPartReference partRef) {
	
	// create gaze handler for a StyledText widget within an EditorPart
    if (target instanceof StyledText &&
            partRef instanceof IEditorReference) {
        return new StyledTextGazeHandler(target); //can go back to using partRef
    
    } else if (target instanceof Browser) {
    	//create gaze handler for a Browser Stack overflow and Bug Report widget
    	//cannot get associated partRef
    	return new BrowserGazeHandler(target);

    } else if (target instanceof Tree &&
    		partRef instanceof IViewReference &&
    		partRef.getTitle().equals("Project Explorer")) {
    	//create gaze handler for a Project Explorer Tree
        return new ProjectExplorerGazeHandler(target, partRef);
    }

    return null;
}
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:27,代码来源:GazeHandlerFactory.java

示例8: 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);
	
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:24,代码来源:CountTreeItemsHandler.java

示例9: reloadViewer

import org.eclipse.swt.widgets.Tree; //导入依赖的package包/类
@Override
public void reloadViewer() {

	final Tree tree = _tourViewer.getTree();
	tree.setRedraw(false);
	{
		final Object[] expandedElements = _tourViewer.getExpandedElements();
		final ISelection selection = _tourViewer.getSelection();

		_tourViewer.setInput(_rootItem = new TVICatalogRootItem(this));

		_tourViewer.setExpandedElements(expandedElements);
		_tourViewer.setSelection(selection);
	}
	tree.setRedraw(true);
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:17,代码来源:TourCatalogView.java

示例10: constrainShellSize

import org.eclipse.swt.widgets.Tree; //导入依赖的package包/类
@Override
protected void constrainShellSize() {
	super.constrainShellSize();
	if (Util.isCocoa()) {
		final Tree tree = getTreeViewer().getTree();
		final FontDescriptor treeFontDescriptor = FontDescriptor.createFrom(JFaceResources.getBannerFont()).setStyle(SWT.NORMAL);
		final Font treeFont = treeFontDescriptor.createFont(tree.getDisplay());
		updateTreeFont(treeFont);
		tree.addDisposeListener(new DisposeListener() {
			@Override
			public void widgetDisposed(DisposeEvent e) {
				treeFontDescriptor.destroyFont(treeFont);
			}
		});
	}
}
 
开发者ID:Albertus82,项目名称:JFaceUtils,代码行数:17,代码来源:EnhancedPreferenceDialog.java

示例11: copyTree

import org.eclipse.swt.widgets.Tree; //导入依赖的package包/类
/**
 * ツリーの選択されている部分をヘッダー付きでクリップボードにコピーします
 * 
 * @param header ヘッダー
 * @param tree ツリー
 */
public static void copyTree(String[] header, Tree tree) {
    TreeItem[] treeItems = tree.getSelection();
    StringBuilder sb = new StringBuilder();
    sb.append(StringUtils.join(header, "\t"));
    sb.append("\r\n");
    for (TreeItem column : treeItems) {
        String[] columns = new String[header.length];
        for (int i = 0; i < header.length; i++) {
            columns[i] = column.getText(i);
        }
        sb.append(StringUtils.join(columns, "\t"));
        sb.append("\r\n");
    }
    Clipboard clipboard = new Clipboard(Display.getDefault());
    clipboard.setContents(new Object[] { sb.toString() }, new Transfer[] { TextTransfer.getInstance() });
}
 
开发者ID:sanaehirotaka,项目名称:logbook,代码行数:23,代码来源:TreeToClipboardAdapter.java

示例12: createTreeViewer

import org.eclipse.swt.widgets.Tree; //导入依赖的package包/类
/**
 * Creates tree viewer to manage content
 * 
 * @param parent
 *            parent control
 */
private void createTreeViewer(Composite parent) {
	int style = SWT.H_SCROLL | SWT.V_SCROLL;
	// Create the tree
	Tree widget = new Tree(parent, style);
	// Configure the layout
	GridData data = new GridData(GridData.FILL_BOTH);
	data.heightHint = widget.getItemHeight() * 12;
	widget.setLayoutData(data);

	treeViewer = new TreeViewer(widget);
	namePatternFilter = new QuickOutlineNamePatternFilter();
	treeViewer.addFilter(namePatternFilter);
	treeContentProvider = getContentProvider();
	treeViewer.setContentProvider(treeContentProvider);
	treeLabelProvider = getLabelProvider();
	treeViewer.setLabelProvider(treeLabelProvider);
	treeViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
	treeViewer.setUseHashlookup(true);
	treeViewer.setInput(getInitialInput());
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:27,代码来源:AbstractInformationControl.java

示例13: createObjectsNavigator

import org.eclipse.swt.widgets.Tree; //导入依赖的package包/类
private void createObjectsNavigator(Composite parent) {
	objectsNavigator = new TreeViewer(parent, SWT.BORDER);
	Tree tree = objectsNavigator.getTree();
	tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	objectsNavigator
			.setContentProvider(new ObjectsNavigatorContentProvider());
	objectsNavigator.setLabelProvider(new ObjectsNavigatorLabelProvider());

	objectsNavigator
			.addSelectionChangedListener(new ISelectionChangedListener() {

				public void selectionChanged(SelectionChangedEvent event) {
					Object selItem = ((IStructuredSelection) event
							.getSelection()).getFirstElement();
					if (selItem instanceof ObjectCategoryItem) {
						updateDetailsPanel((ObjectCategoryItem) selItem);
					}
				}
			});
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:21,代码来源:JavaExpressionEditorComposite.java

示例14: getExpandTreePaths

import org.eclipse.swt.widgets.Tree; //导入依赖的package包/类
/**
 * getExpandTreePaths
 *  
 * @param tree
 * @param selectedItem
 * @return TreePath[]
 */
public static TreePath[] getExpandTreePaths(Tree tree, TreeItem selectedItem) {
    ArrayList<Object> items = new ArrayList<Object>();
    internalCollectTreeItems(items, tree);
    ArrayList<Object> result = new ArrayList<Object>();

    for (Iterator<Object> it = items.iterator(); it.hasNext();) {
        Item item = (Item) it.next();
        // if (item == selectedItem) {
        TreePath treePath = getTreePathFromItem(item);
        if (treePath != null) {
            result.add(treePath);
        }
        // }
    }

    return (TreePath[]) result.toArray(new TreePath[items.size()]);
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:25,代码来源:TreeItemUtil.java

示例15: findObjectAtExcluding

import org.eclipse.swt.widgets.Tree; //导入依赖的package包/类
/**
 * @see org.eclipse.gef.EditPartViewer#findObjectAtExcluding(Point, Collection, EditPartViewer.Conditional)
 */
@Override
public EditPart findObjectAtExcluding(Point pt, Collection exclude, Conditional condition) {
  if (getControl() == null)
    return null;

  final Tree tree = getTreeControl();
  Rectangle area = tree.getClientArea();
  if (pt.x < area.x || pt.y < area.y || pt.x >= area.x + area.width || pt.y >= area.y + area.height)
    return null;

  EditPart result = null;
  TreeItem tie = tree.getItem(new org.eclipse.swt.graphics.Point(pt.x, pt.y));

  if (tie != null) {
    result = (EditPart) tie.getData();
  } else if (tree.getData() instanceof EditPart) {
    result = (EditPart) tree.getData();
  }
  while (result != null) {
    if ((condition == null || condition.evaluate(result)) && !exclude.contains(result))
      return result;
    result = result.getParent();
  }
  return null;
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:29,代码来源:PaletteTreeViewer.java


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