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


Java ViewerComparator.sort方法代码示例

本文整理汇总了Java中org.eclipse.jface.viewers.ViewerComparator.sort方法的典型用法代码示例。如果您正苦于以下问题:Java ViewerComparator.sort方法的具体用法?Java ViewerComparator.sort怎么用?Java ViewerComparator.sort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jface.viewers.ViewerComparator的用法示例。


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

示例1: selectSavedItem

import org.eclipse.jface.viewers.ViewerComparator; //导入方法依赖的package包/类
/**
 * Selects the saved item in the tree of preference pages. If it cannot do this it saves the first one.
 */
protected void selectSavedItem() {
	IPreferenceNode node = findNodeMatching(getSelectedNodePreference());
	if (node == null) {
		IPreferenceNode[] nodes = preferenceManager.getRootSubNodes();
		ViewerComparator comparator = getTreeViewer().getComparator();
		if (comparator != null)	{
			comparator.sort(null, nodes);
		}			
		for (int i = 0; i < nodes.length; i++) {
			IPreferenceNode selectedNode = nodes[i];
			if (selectedNode != null) {
				node = selectedNode;
				break;
			}
		}
	}
	if (node != null) {
		getTreeViewer().setSelection(new StructuredSelection(node), true);
		// Keep focus in tree. See bugs 2692, 2621, and 6775.
		getTreeViewer().getControl().setFocus();
		boolean expanded = getTreeViewer().getExpandedState(node);
		getTreeViewer().setExpandedState(node, !expanded);
	}
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:28,代码来源:ProjectSettingDialog.java

示例2: add

import org.eclipse.jface.viewers.ViewerComparator; //导入方法依赖的package包/类
@Override
public void add(Object[] elements) {
	ViewerComparator sorter = getComparator();

	// Use a Set in case we are getting something added that exists
	Set<Object> newItems = new HashSet<>(elements.length);

	Control[] existingChildren = control.getChildren();
	for (int i = 0; i < existingChildren.length; i++) {
		if (existingChildren[i].getData() != null)
			newItems.add(existingChildren[i].getData());
	}

	for (int i = 0; i < elements.length; i++) {
		if (elements[i] != null)
			newItems.add(elements[i]);
	}

	JobTreeElement[] infos = new JobTreeElement[newItems.size()];
	newItems.toArray(infos);

	if (sorter != null) {
		sorter.sort(this, infos);
	}

	// Update with the new elements to prevent flash
	for (int i = 0; i < existingChildren.length; i++) {
		((ProgressInfoItem) existingChildren[i]).dispose();
	}

	int totalSize = Math.min(newItems.size(), MAX_DISPLAYED);

	for (int i = 0; i < totalSize; i++) {
		ProgressInfoItem item = createNewItem(infos[i]);
		item.setColor(i);
	}

	control.layout(true);
	updateForShowingProgress();
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:41,代码来源:DetailedProgressViewer.java

示例3: setProjectViewerSelectionAfterDeletion

import org.eclipse.jface.viewers.ViewerComparator; //导入方法依赖的package包/类
private void setProjectViewerSelectionAfterDeletion() {
	Object[] children = getProjects();
	if (children.length > 0) {
		ViewerComparator comparator = projectViewer.getComparator();
		comparator.sort(projectViewer, children);
		IStructuredSelection selection = new StructuredSelection(
				children[0]);
		projectViewer.setSelection(selection);
		handleSelectionChanged(selection);
	}
}
 
开发者ID:angelozerr,项目名称:jsbuild-eclipse,代码行数:12,代码来源:JSBuildFileView.java

示例4: selectSavedItem

import org.eclipse.jface.viewers.ViewerComparator; //导入方法依赖的package包/类
/**
 * Selects the saved item in the tree of preference pages. If it cannot do
 * this it saves the first one.
 */
protected void selectSavedItem() {
	IPreferenceNode node = findNodeMatching(getSelectedNodePreference());
	if (node == null) {
		IPreferenceNode[] nodes = preferenceManager.getRootSubNodes();
		ViewerComparator comparator = getTreeViewer().getComparator();
		if (comparator != null)	{
			comparator.sort(null, nodes);
		}
		ViewerFilter[] filters = getTreeViewer().getFilters();
		for (int i = 0; i < nodes.length; i++) {
			IPreferenceNode selectedNode = nodes[i];
			// See if it passes all filters
			for (int j = 0; j < filters.length; j++) {
				if (!filters[j].select(this.treeViewer, preferenceManager
						.getRoot(), selectedNode)) {
					selectedNode = null;
					break;
				}
			}
			// if it passes all filters select it
			if (selectedNode != null) {
				node = selectedNode;
				break;
			}
		}
	}
	if (node != null) {
		getTreeViewer().setSelection(new StructuredSelection(node), true);
		// Keep focus in tree. See bugs 2692, 2621, and 6775.
		getTreeViewer().getControl().setFocus();
	}
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:37,代码来源:PreferenceDialog.java


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