當前位置: 首頁>>代碼示例>>Java>>正文


Java CheckboxTableViewer.setChecked方法代碼示例

本文整理匯總了Java中org.eclipse.jface.viewers.CheckboxTableViewer.setChecked方法的典型用法代碼示例。如果您正苦於以下問題:Java CheckboxTableViewer.setChecked方法的具體用法?Java CheckboxTableViewer.setChecked怎麽用?Java CheckboxTableViewer.setChecked使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jface.viewers.CheckboxTableViewer的用法示例。


在下文中一共展示了CheckboxTableViewer.setChecked方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateSelectAllCheckState

import org.eclipse.jface.viewers.CheckboxTableViewer; //導入方法依賴的package包/類
/**
 * Updates the tri-state "select all" element based on the size of the set
 * of currently checked (non-special) items in the table. If all non-special
 * items are checked, the "select all" box is checked and ungrayed. If no
 * non-special items are checked, the "select all" box is unchecked and
 * ungrayed. If some but not all non-special items are checked, the
 * "select all" box is checked and grayed.
 */
private void updateSelectAllCheckState() {
    final CheckboxTableViewer viewer = ((CheckboxTableViewer) getViewer());

    // Use the filtered (non-special items removed) counts
    final int checkedCount = getValidCheckedProjectsCount();
    final int elementCount = removeNotValidVC(getProjects()).length;

    if (checkedCount == elementCount && elementCount > 0) {
        viewer.setChecked(SELECT_ALL_SPECIAL_PROJECT_INFO, true);
        viewer.setGrayed(SELECT_ALL_SPECIAL_PROJECT_INFO, false);
    } else if (checkedCount == 0) {
        viewer.setChecked(SELECT_ALL_SPECIAL_PROJECT_INFO, false);
        viewer.setGrayed(SELECT_ALL_SPECIAL_PROJECT_INFO, false);
    } else {
        viewer.setChecked(SELECT_ALL_SPECIAL_PROJECT_INFO, true);
        viewer.setGrayed(SELECT_ALL_SPECIAL_PROJECT_INFO, true);
    }
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:27,代碼來源:TeamProjectTable.java

示例2: inputChanged

import org.eclipse.jface.viewers.CheckboxTableViewer; //導入方法依賴的package包/類
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
{
	if (Objects.equals(oldInput, newInput)) return;
	
	this.input = (FlagInput) newInput;
	
	CheckboxTableViewer cViewer = (CheckboxTableViewer) viewer;
	for(int i = 0; i < names.length; i++)
	{
		if (input == null)
			cViewer.setChecked(names[i], false);
		else
			cViewer.setChecked(names[i], (input.getFlag() & (1 << i)) != 0);
	}
}
 
開發者ID:TheWhiteShadow3,項目名稱:cuina,代碼行數:17,代碼來源:TileFlagPanel.java

示例3: createViewer

import org.eclipse.jface.viewers.CheckboxTableViewer; //導入方法依賴的package包/類
public void createViewer(Composite parent)
{
	tab = new Table(parent, SWT.CHECK | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
	viewer = new CheckboxTableViewer(tab);
	viewer.setLabelProvider(new DataSourceTableLabelProvider());
	tab.setHeaderVisible(true);
	tab.setLinesVisible(true);
	makeTableColumns(tab);		
	
	/* add a listener for selection changes, which tells the data sources 
	 * which ones are selected. This is not currently used, because selecting
	 * the drop-down menu immediately de-selects all the rows; so you 
	 * cannot make a drop-down menu item (or even its enablement) depend on the selected rows. 
	 * A brilliant catch-22.
	 */ 
	viewer.addSelectionChangedListener(new ISelectionChangedListener() {
		public void selectionChanged(SelectionChangedEvent event) {
			// de-select all data sources
			for (Iterator<DataSource> it = dataSources.iterator();it.hasNext();)
				it.next().setIsSelected(false);
			// select only those in the selection
			for (Iterator<?> is = ((IStructuredSelection)event.getSelection()).iterator();is.hasNext();)
				((DataSource)is.next()).setIsSelected(true);
		}
	});

	//  populate the viewer with any existing Data sources, remembered by init(..)from the last session
	for (Iterator <DataSource> it = dataSources.iterator();it.hasNext();)
	{
		DataSource qs = it.next();
		viewer.add(qs);
		viewer.setChecked(qs, qs.isActive());
	}
}
 
開發者ID:openmapsoftware,項目名稱:mappingtools,代碼行數:35,代碼來源:DataSourceView.java


注:本文中的org.eclipse.jface.viewers.CheckboxTableViewer.setChecked方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。