List of usage examples for org.eclipse.jface.viewers CheckboxTableViewer setGrayed
public boolean setGrayed(Object element, boolean state)
From source file:com.microsoft.tfs.client.common.ui.controls.TeamProjectTable.java
License:Open Source License
/** * 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. */// ww w. j a v a2s . co m 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); } }