本文整理汇总了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);
}
}
示例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);
}
}
示例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());
}
}