當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。