本文整理汇总了Java中org.eclipse.jface.viewers.CheckboxTableViewer.addSelectionChangedListener方法的典型用法代码示例。如果您正苦于以下问题:Java CheckboxTableViewer.addSelectionChangedListener方法的具体用法?Java CheckboxTableViewer.addSelectionChangedListener怎么用?Java CheckboxTableViewer.addSelectionChangedListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.viewers.CheckboxTableViewer
的用法示例。
在下文中一共展示了CheckboxTableViewer.addSelectionChangedListener方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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());
}
}
示例3: createControl
import org.eclipse.jface.viewers.CheckboxTableViewer; //导入方法依赖的package包/类
@Override
public void createControl(Composite parent) {
super.createControl(parent);
Composite control = (Composite) getControl();
Composite extensionGroup = new Composite(control, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
extensionGroup.setLayout(layout);
extensionGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label refOccieLabel = new Label(extensionGroup, SWT.NONE);
refOccieLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true));
refOccieLabel.setText(Messages.NewConnectorWizard_RefExtensionLabel);
refOccieLabel.setFont(parent.getFont());
Composite composite = new Composite(extensionGroup, SWT.NULL);
GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
composite.setLayoutData(layoutData);
TableColumnLayout tableLayout = new TableColumnLayout();
composite.setLayout(tableLayout);
Table table = new Table(composite,
SWT.CHECK | SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
refExtensionViewer = new CheckboxTableViewer(table);
refExtensionViewer.setContentProvider(ArrayContentProvider.getInstance());
refExtensionViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
setPageComplete(validatePage());
}
});
Collection<String> registeredExtensions = new ArrayList<String>(
OcciRegistry.getInstance().getRegisteredExtensions());
// removed the OCCI core extension as it is added by default.
registeredExtensions.remove(OcciCoreConstants.OCCI_CORE_SCHEME);
refExtensionViewer.setInput(registeredExtensions);
}
示例4: createLanguagePackFilteredListArea
import org.eclipse.jface.viewers.CheckboxTableViewer; //导入方法依赖的package包/类
private void createLanguagePackFilteredListArea(Composite parent) {
fLanguagePackListLabel = new Label(parent, SWT.NONE);
fLanguagePackListLabel.setText(Messages.getString("BuildToolWizardConfigurationPage_IgnoreListLabel")); //$NON-NLS-1$
GridData gdLabel = new GridData(GridData.FILL_HORIZONTAL);
gdLabel.widthHint = LABEL_WIDTH;
gdLabel.horizontalIndent = LIST_LABEL_INDENT;
gdLabel.verticalIndent = LIST_SEPARATOR;
fLanguagePackListLabel.setLayoutData(gdLabel);
Composite listComposite = new Composite(parent, SWT.NONE);
listComposite.setLayout(new GridLayout(2, false));
listComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
Table table = new Table(listComposite, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
table.setLayout(new TableLayout());
GridData data = new GridData(GridData.FILL_BOTH);
data.heightHint = VIEWER_HEIGHT;
data.widthHint = VIEWER_WIDTH;
table.setLayoutData(data);
fLanguagePackResourceIgnoreViewer = new CheckboxTableViewer(table);
fLanguagePackResourceIgnoreViewer.setLabelProvider(new LabelProvider());
fLanguagePackResourceIgnoreViewer.setContentProvider(new IgnoreListContentProvider());
fLanguagePackResourceIgnoreViewer.setInput(fModelIgnoreTable.getModels());
fLanguagePackResourceIgnoreViewer.setComparator(new ViewerComparator());
fLanguagePackResourceIgnoreViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
// Enable button only if there's a selection
if (event.getSelection().isEmpty()) {
fRemoveLanguagePackFilterButton.setEnabled(false);
} else {
fRemoveLanguagePackFilterButton.setEnabled(true);
}
}
});
// By default, all pre-defined patterns are checked
fLanguagePackResourceIgnoreViewer.setAllChecked(true);
createLanguagePackFilteredListControlButtonsArea(listComposite);
}
示例5: createCoverageReportFilteredListArea
import org.eclipse.jface.viewers.CheckboxTableViewer; //导入方法依赖的package包/类
private void createCoverageReportFilteredListArea(Composite parent) {
fCoverageReportListLabel = new Label(parent, SWT.NONE);
fCoverageReportListLabel.setText(Messages.getString("BuildToolWizardConfigurationPage_FilterListLabel")); //$NON-NLS-1$
GridData gdLabel = new GridData(GridData.FILL_HORIZONTAL);
gdLabel.widthHint = LABEL_WIDTH;
gdLabel.horizontalIndent = LIST_LABEL_INDENT;
gdLabel.verticalIndent = LIST_SEPARATOR;
fCoverageReportListLabel.setLayoutData(gdLabel);
Composite listComposite = new Composite(parent, SWT.NONE);
listComposite.setLayout(new GridLayout(2, false));
listComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
Table table = new Table(listComposite, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
table.setLayout(new TableLayout());
GridData data = new GridData(GridData.FILL_BOTH);
data.heightHint = VIEWER_HEIGHT;
data.widthHint = VIEWER_WIDTH;
table.setLayoutData(data);
fCoverageReportResourceFilterViewer = new CheckboxTableViewer(table);
fCoverageReportResourceFilterViewer.setLabelProvider(new LabelProvider());
fCoverageReportResourceFilterViewer.setContentProvider(new ExcludeListContentProvider());
fCoverageReportResourceFilterViewer.setInput(fModelResourceExclusionTable.getModels());
fCoverageReportResourceFilterViewer.setComparator(new ViewerComparator());
fCoverageReportResourceFilterViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
// Enable button only if there's a selection
if (event.getSelection().isEmpty()) {
fRemoveCoverageReportFilterButton.setEnabled(false);
} else {
fRemoveCoverageReportFilterButton.setEnabled(true);
}
}
});
// By default, all pre-defined filters are checked
fCoverageReportResourceFilterViewer.setAllChecked(true);
// Create an area with buttons for adding/removing resource patterns, and for selecting/deselecting all
createExcludeListControlButtonArea(listComposite);
IDialogSettings settings = getDialogSettings();
for(String filter : not_null(settings.getArray(EXCLUDE_LIST), new String[]{})){
addCoverageReportFilter(filter, false);
}
for(String checked : not_null(settings.getArray(EXCLUDE_LIST_CHECKED), new String[]{})){
addCoverageReportFilter(checked, true);
}
}