本文整理汇总了Java中org.eclipse.jface.viewers.CheckboxTableViewer.addCheckStateListener方法的典型用法代码示例。如果您正苦于以下问题:Java CheckboxTableViewer.addCheckStateListener方法的具体用法?Java CheckboxTableViewer.addCheckStateListener怎么用?Java CheckboxTableViewer.addCheckStateListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.viewers.CheckboxTableViewer
的用法示例。
在下文中一共展示了CheckboxTableViewer.addCheckStateListener方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeTable
import org.eclipse.jface.viewers.CheckboxTableViewer; //导入方法依赖的package包/类
protected TableViewer makeTable(final Composite parent) {
CheckboxTableViewer tableViewer = CheckboxTableViewer.newCheckList(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK);
tableViewer.setContentProvider(new ArrayContentProvider());
tableViewer.setInput(markerList);
tableViewer.setLabelProvider(getLabelProvider());
tableViewer.addSelectionChangedListener(event -> {
Object marker = ((StructuredSelection) event.getSelection()).getFirstElement();
if(marker instanceof IMarker) {
openEditor((IMarker) marker);
}
});
tableViewer.addCheckStateListener(getCheckStateListener());
return tableViewer;
}
示例2: createTableViewer
import org.eclipse.jface.viewers.CheckboxTableViewer; //导入方法依赖的package包/类
@Override
protected TableViewer createTableViewer() {
final CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList(this, SWT.MULTI | SWT.H_SCROLL
| SWT.V_SCROLL | SWT.BORDER);
viewer.setCheckStateProvider(checkStateProvider);
viewer.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
if (((ManifestItem) event.getElement()).isBuiltIn()) {
viewer.setChecked(event.getElement(), !event.getChecked());
} else {
((ManifestItem) event.getElement()).setOptional(!event.getChecked());
fireDependenciesChangedListener();
}
}
});
return viewer;
}
示例3: PathsProvider
import org.eclipse.jface.viewers.CheckboxTableViewer; //导入方法依赖的package包/类
protected PathsProvider(TableViewer viewer, FindbugsPropertyPage propertyPage) {
this.propertyPage = propertyPage;
this.paths = new ArrayList<IPathElement>();
this.viewer = viewer;
if(viewer instanceof CheckboxTableViewer) {
CheckboxTableViewer tv = (CheckboxTableViewer) viewer;
// tv.setCheckStateProvider(this);
tv.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
boolean checked = event.getChecked();
IPathElement element = (IPathElement) event.getElement();
element.setEnabled(checked);
handleContendChanged();
}
});
}
this.control = viewer.getTable();
listeners = new ListenerList();
viewer.setContentProvider(this);
}
示例4: createPartControl
import org.eclipse.jface.viewers.CheckboxTableViewer; //导入方法依赖的package包/类
/**
* Callback to create the viewer and initialize it.
*/
public void createPartControl(Composite parent) {
table = new Table(parent, SWT.CHECK | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION );
viewer = new CheckboxTableViewer(table);
ICheckStateListener listener = new CheckStateListener();
viewer.addCheckStateListener(listener);
table.setHeaderVisible(true);
table.setLinesVisible(true);
qrSorter = new RowSorter(viewer, this);
viewer.setSorter(qrSorter);
String[] properties = setColumnHeaders();
// define a property name for each column (which is the column header)
viewer.setColumnProperties(properties);
// define the cell editors for each column (only the business name and value column editors work)
editors = editors(table, properties.length);
viewer.setCellEditors(editors);
// define how the editors get and change the values shown in the cells
viewer.setCellModifier(new CellModifier());
// make the actions that will be items on the menu of this view
makeActions();
// attach the menu to this view
contributeToActionBars();
}
示例5: WorkItemCheckinTable
import org.eclipse.jface.viewers.CheckboxTableViewer; //导入方法依赖的package包/类
public WorkItemCheckinTable(final Composite parent, final int style, final String viewDataKey) {
super(parent, checkStyle(style), WorkItemCheckinInfo.class, viewDataKey);
TableColumnData[] columnData;
/*
* Historic changeset details: note that SWT.READ_ONLY is set for
* shelveset details, but we want the check-in action column
*/
if ((style & SWT.READ_ONLY) == SWT.READ_ONLY && (style & CHECKIN_ACTION) == 0) {
columnData = new TableColumnData[] {
new TableColumnData(Messages.getString("WorkItemCheckinTable.ColumnNameType"), 100, 0.4F, "type"), //$NON-NLS-1$ //$NON-NLS-2$
new TableColumnData(Messages.getString("WorkItemCheckinTable.ColumnNameId"), 75, 0.02F, "id"), //$NON-NLS-1$ //$NON-NLS-2$
new TableColumnData(Messages.getString("WorkItemCheckinTable.ColumnNameTitle"), 100, 0.9F, "title"), //$NON-NLS-1$ //$NON-NLS-2$
new TableColumnData(Messages.getString("WorkItemCheckinTable.ColumnNameState"), 100, 0.04F, "state") //$NON-NLS-1$ //$NON-NLS-2$
};
}
/* Pending checkins OR shelveset details */
else {
columnData = new TableColumnData[] {
new TableColumnData(Messages.getString("WorkItemCheckinTable.ColumnNameType"), 100, 0.03F, "type"), //$NON-NLS-1$ //$NON-NLS-2$
new TableColumnData(Messages.getString("WorkItemCheckinTable.ColumnNameId"), 75, 0.01F, "id"), //$NON-NLS-1$ //$NON-NLS-2$
new TableColumnData(Messages.getString("WorkItemCheckinTable.ColumnNameTitle"), 100, 0.9F, "title"), //$NON-NLS-1$ //$NON-NLS-2$
new TableColumnData(Messages.getString("WorkItemCheckinTable.ColumnNameState"), 100, 0.03F, "state"), //$NON-NLS-1$ //$NON-NLS-2$
new TableColumnData(Messages.getString("WorkItemCheckinTable.ColumnNameAction"), 100, 0.03F, "action") //$NON-NLS-1$ //$NON-NLS-2$
};
}
setupTable(true, true, columnData);
setUseViewerDefaults();
setEnableTooltips(true);
if ((style & SWT.READ_ONLY) == 0) {
final CheckboxTableViewer viewer = (CheckboxTableViewer) getViewer();
new WorkItemActionCellEditor(viewer);
viewer.addCheckStateListener(new WorkItemCheckListener());
}
}
示例6: createMemberTable
import org.eclipse.jface.viewers.CheckboxTableViewer; //导入方法依赖的package包/类
private void createMemberTable(final Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
GridLayout layout = new GridLayout(1, false);
layout.marginWidth= 0;
layout.marginHeight= 0;
composite.setLayout(layout);
final Table table= new Table(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.CHECK);
table.setLinesVisible(true);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
table.setLayoutData(gridData);
final GridData gd= new GridData(GridData.FILL_BOTH);
gd.heightHint= SWTUtil.getTableHeightHint(table, 6);
composite.setLayoutData(gd);
fTableViewer= new CheckboxTableViewer(table);
fTableViewer.setUseHashlookup(true);
fTableViewer.setContentProvider(new ArrayContentProvider());
fTableViewer.setLabelProvider(fLabelProvider);
fTableViewer.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(final CheckStateChangedEvent event) {
updateWizardPage(null, true);
}
});
setTableInput();
}
示例7: createTableViewer
import org.eclipse.jface.viewers.CheckboxTableViewer; //导入方法依赖的package包/类
@Override
protected TableViewer createTableViewer(Composite parent) {
Table table= new Table(parent, SWT.CHECK | getListStyle());
table.setFont(parent.getFont());
CheckboxTableViewer tableViewer= new CheckboxTableViewer(table);
tableViewer.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent e) {
doCheckStateChanged(e);
}
});
return tableViewer;
}
示例8: createTableViewer
import org.eclipse.jface.viewers.CheckboxTableViewer; //导入方法依赖的package包/类
protected CheckboxTableViewer createTableViewer(Composite parent) {
final CheckboxTableViewer result= CheckboxTableViewer.newCheckList(parent, SWT.BORDER | SWT.MULTI);
result.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
GrayedCheckedModelElement element= (GrayedCheckedModelElement)event.getElement();
result.setGrayed(element, false);
if (event.getChecked()) {
element.select();
} else {
element.deselect();
}
result.update(element, null);
}
});
GridData data= new GridData(GridData.FILL_BOTH);
data.heightHint= convertHeightInCharsToPixels(20);
data.widthHint= convertWidthInCharsToPixels(50);
result.getTable().setLayoutData(data);
result.addFilter(new Filter());
result.setLabelProvider(new GrayedCheckedModelLabelProvider());
result.setSorter(new GrayedCheckModelElementSorter());
result.setContentProvider(new GrayedCheckedModelContentProvider());
result.setInput(fModel);
result.setCheckedElements(fModel.getChecked());
result.setGrayedElements(fModel.getGrayed());
return result;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:32,代码来源:ConfigureWorkingSetAssignementAction.java
示例9: drawLibrarySelector
import org.eclipse.jface.viewers.CheckboxTableViewer; //导入方法依赖的package包/类
private CheckboxTableViewer drawLibrarySelector(Composite parent,
ProjectPreferences prefs, String label) {
// group surrounds the box w/ a thin line
Group projectsGroup = new Group(parent, SWT.NONE);
projectsGroup.setText(label);
GridData gdProjects = new GridData(GridData.FILL_BOTH);
//gdProjects.horizontalSpan = 2;
projectsGroup.setLayoutData(gdProjects);
projectsGroup.setLayout(new GridLayout(1, false));
// main table to hold the library entries
Table librariesTable = new Table(projectsGroup ,SWT.CHECK | SWT.BORDER | SWT.V_SCROLL);
librariesTable.setHeaderVisible(false);
TableColumn col1 = new TableColumn(librariesTable, SWT.NONE);
col1.setWidth(200);
//col1.setText("Processing Library");
TableLayout tableLayout = new TableLayout();
librariesTable.setLayout(tableLayout);
GridData viewerData = new GridData(GridData.FILL_BOTH);
viewerData.horizontalSpan = 2;
viewerData.heightHint = VIEWER_HEIGHT_HINT;
// jface component to deal w/ data in table and checkboxes
CheckboxTableViewer viewer = new CheckboxTableViewer(librariesTable);
viewer.getControl().setLayoutData(viewerData);
viewer.setContentProvider(new SelectedLibrariesContentProvider());
viewer.setLabelProvider(new SelectedLibrariesLabelProvider());
//showDiscoveredLibraries();
viewer.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
validate_listener.validate();
//saveConfiguration();
}
});
return viewer;
}
示例10: createSummaryFiledViewer
import org.eclipse.jface.viewers.CheckboxTableViewer; //导入方法依赖的package包/类
private void createSummaryFiledViewer( Composite dialogArea )
{
Table table = new Table( dialogArea, SWT.BORDER
| SWT.SINGLE
| SWT.H_SCROLL
| SWT.V_SCROLL
| SWT.FULL_SELECTION
| SWT.CHECK );
table.setLinesVisible( true );
table.setHeaderVisible( true );
GridData gd = new GridData( GridData.FILL_BOTH );
gd.heightHint = 250;
table.setLayoutData( gd );
summaryFieldViewer = new CheckboxTableViewer( table );
SummaryFieldProvider provider = new SummaryFieldProvider( );
for ( int i = 0; i < columnNames.length; i++ )
{
TableColumn column = new TableColumn( table, SWT.LEFT );
column.setText( columnNames[i] );
column.setWidth( columnWidth[i] );
}
ComboBoxCellEditor comboCell = new ComboBoxCellEditor( table,
new String[0],
SWT.READ_ONLY );
// TextCellEditor textCell = new TextCellEditor(table, SWT.NONE);
cellEditor = new CellEditor[]{
null, comboCell
};
summaryFieldViewer.setColumnProperties( columnNames );
summaryFieldViewer.setCellEditors( cellEditor );
summaryFieldViewer.setCellModifier( cellModifier );
summaryFieldViewer.setUseHashlookup( true );
summaryFieldViewer.setContentProvider( provider );
summaryFieldViewer.setLabelProvider( provider );
summaryFieldViewer.addCheckStateListener( new ICheckStateListener( ) {
public void checkStateChanged( CheckStateChangedEvent event )
{
MeasureInfo info = (MeasureInfo) event.getElement( );
if ( event.getChecked( ) )
{
info.setShow( true );
}
else
{
info.setShow( false );
}
checkOKButtonStatus( );
}
} );
}
示例11: addCheckedTableViewer
import org.eclipse.jface.viewers.CheckboxTableViewer; //导入方法依赖的package包/类
private CheckboxTableViewer addCheckedTableViewer(FormToolkit toolkit,
Composite composite) {
TableColumnLayout tableColumnLayout = new TableColumnLayout();
composite.setLayout(tableColumnLayout);
final CheckboxTableViewer checkboxTableViewer = CheckboxTableViewer
.newCheckList(composite, SWT.BORDER | SWT.FULL_SELECTION
| SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
Table table = checkboxTableViewer.getTable();
// table.setHeaderVisible(true);
toolkit.paintBordersFor(table);
// TableColumn tableColumn = new TableColumn(table, SWT.NONE);
// tableColumn.setText("Select All");
// tableColumn.setImage(new Image(Display.getCurrent(),
// "icons/checkbox.gif"));
//
// tableColumnLayout.setColumnData(tableColumn, new ColumnWeightData(20,
// 150, true));
// tableColumn.setWidth(150);
GridDataFactory.fillDefaults().grab(true, true).applyTo(table);
// addSelectAllListener(table, tableItem);
checkboxTableViewer.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
boolean checked = event.getChecked();
Object ele = event.getElement();
if (Constant.SELECTALL.equalsIgnoreCase(ele.toString())) {
if (checked) {
checkboxTableViewer.setAllChecked(true);
} else
checkboxTableViewer.setAllChecked(false);
}
}
});
return checkboxTableViewer;
// friendsViewer = CheckboxTableViewer.newCheckList(friendsComposite,
// SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
//
// Table friendsTable = friendsViewer.getTable();
// friendsTable.setHeaderVisible(true);
// friendsTable.setLinesVisible(true);
// TableColumn friendNameColumn = new TableColumn(friendsTable,
// SWT.NONE);
// friendNameColumn.setText("Name");
// friendsColumnLayout.setColumnData(friendNameColumn,
// new ColumnWeightData(1));
//
// GridDataFactory.fillDefaults().grab(true, true)
// .applyTo(friendsViewer.getTable());
}