本文整理汇总了Java中org.eclipse.jface.viewers.CheckboxTableViewer.setContentProvider方法的典型用法代码示例。如果您正苦于以下问题:Java CheckboxTableViewer.setContentProvider方法的具体用法?Java CheckboxTableViewer.setContentProvider怎么用?Java CheckboxTableViewer.setContentProvider使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.viewers.CheckboxTableViewer
的用法示例。
在下文中一共展示了CheckboxTableViewer.setContentProvider方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createNewFilePage
import org.eclipse.jface.viewers.CheckboxTableViewer; //导入方法依赖的package包/类
@Override
protected WizardNewFileCreationPage createNewFilePage() {
return new NewFilePage(getSelection(), fileExt) {
@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.NewExtensionWizard_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.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
refExtensionViewer = new CheckboxTableViewer(table);
refExtensionViewer.setContentProvider(ArrayContentProvider.getInstance());
Collection<String> registeredExtensions = new ArrayList<String>(
OcciRegistry.getInstance().getRegisteredExtensions());
refExtensionViewer.setInput(registeredExtensions);
}
};
}
示例3: 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();
}
示例4: 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
示例5: 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;
}
示例6: 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);
}
示例7: createUserAgentTable
import org.eclipse.jface.viewers.CheckboxTableViewer; //导入方法依赖的package包/类
/**
* createUserAgentTable
*
* @param parent
*/
protected void createUserAgentTable(Composite parent)
{
Label label = new Label(parent, SWT.WRAP);
label.setText(Messages.UserAgentPreferencePage_Select_User_Agents);
label.setLayoutData(GridDataFactory.fillDefaults().span(2, 0).grab(true, true).create());
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(GridLayoutFactory.fillDefaults().create());
composite.setLayoutData(GridDataFactory.fillDefaults().span(2, 0).hint(400, 120).grab(true, true).create());
Table table = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.SINGLE);
table.setFont(parent.getFont());
categoryViewer = new CheckboxTableViewer(table);
categoryViewer.getControl().setFont(parent.getFont());
categoryViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
categoryViewer.setContentProvider(ArrayContentProvider.getInstance());
CategoryLabelProvider categoryLabelProvider = new CategoryLabelProvider(true);
categoryViewer.setLabelProvider(categoryLabelProvider);
categoryViewer.setComparator(new ViewerComparator()
{
@Override
public int compare(Viewer viewer, Object e1, Object e2)
{
if (e1 instanceof IUserAgent && e2 instanceof IUserAgent)
{
IUserAgent ua1 = (IUserAgent) e1;
IUserAgent ua2 = (IUserAgent) e2;
String uaName1 = StringUtil.getStringValue(ua1.getName());
String uaName2 = StringUtil.getStringValue(ua2.getName());
return uaName1.compareToIgnoreCase(uaName2);
}
return super.compare(viewer, e1, e2);
}
});
categoryViewer.setInput(UserAgentManager.getInstance().getAllUserAgents());
}
示例8: 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);
}
示例9: 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);
}
}
示例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: createGrandTotalArea
import org.eclipse.jface.viewers.CheckboxTableViewer; //导入方法依赖的package包/类
private void createGrandTotalArea( Composite content )
{
CLabel grandTotalLabel = new CLabel( content, SWT.NONE );
grandTotalLabel.setText( Messages.getString( "AggregationDialog.Label.Grand" ) ); //$NON-NLS-1$
if ( axis == ICrosstabConstants.ROW_AXIS_TYPE )
{
grandTotalLabel.setImage( CrosstabUIHelper.getImage( CrosstabUIHelper.ROW_GRAND_TOTAL_IMAGE ) );
}
else if ( axis == ICrosstabConstants.COLUMN_AXIS_TYPE )
{
grandTotalLabel.setImage( CrosstabUIHelper.getImage( CrosstabUIHelper.COLUMN_GRAND_TOTAL_IMAGE ) );
}
Table table = new Table( content, SWT.SINGLE
| SWT.BORDER
| SWT.H_SCROLL
| SWT.V_SCROLL
| SWT.FULL_SELECTION
| SWT.CHECK );
table.setLinesVisible( false );
table.setHeaderVisible( true );
GridData gd = new GridData( GridData.FILL_BOTH );
gd.minimumHeight = 200;
table.setLayoutData( gd );
grandTableViewer = new CheckboxTableViewer( table );
GrandTotalProvider provider = new GrandTotalProvider( grandTableViewer,crosstab, axis );
String[] columnNames = provider.getColumnNames( );
int[] columnWidths = provider.columnWidths( );
for ( int i = 0; i < columnNames.length; i++ )
{
TableColumn column = new TableColumn( table, SWT.LEFT );
column.setText( columnNames[i] );
column.setWidth( columnWidths[i] );
}
grandTableViewer.setUseHashlookup( true );
grandTableViewer.setColumnProperties( provider.getColumnNames( ) );
grandTableViewer.setCellEditors( provider.getCellEditors( ) );
grandTableViewer.setCellModifier( provider );
grandTableViewer.setCellEditors( provider.getCellEditors() );
grandTableViewer.setContentProvider( provider );
grandTableViewer.setLabelProvider( provider );
grandTableViewer.setCellModifier( provider );
}
示例12: createSubTotalArea
import org.eclipse.jface.viewers.CheckboxTableViewer; //导入方法依赖的package包/类
private void createSubTotalArea( Composite content )
{
CLabel subTotalLabel = new CLabel( content, SWT.NONE );
subTotalLabel.setText( Messages.getString( "AggregationDialog.Label.Sub" ) ); //$NON-NLS-1$
if ( axis == ICrosstabConstants.ROW_AXIS_TYPE )
{
subTotalLabel.setImage( CrosstabUIHelper.getImage( CrosstabUIHelper.ROW_SUB_TOTAL_IMAGE ) );
}
else if ( axis == ICrosstabConstants.COLUMN_AXIS_TYPE )
{
subTotalLabel.setImage( CrosstabUIHelper.getImage( CrosstabUIHelper.COLUMN_SUB_TOTAL_IMAGE ) );
}
Table table = new Table( content, SWT.SINGLE
| SWT.BORDER
| SWT.H_SCROLL
| SWT.V_SCROLL
| SWT.FULL_SELECTION
| SWT.CHECK );
table.setLinesVisible( false );
table.setHeaderVisible( true );
GridData gd = new GridData( GridData.FILL_BOTH );
gd.minimumHeight = 200;
table.setLayoutData( gd );
subTableViewer = new CheckboxTableViewer( table );
SubTotalProvider provider = new SubTotalProvider( subTableViewer,crosstab,axis );
String[] columnNames = provider.getColumnNames( );
int[] columnWidths = provider.columnWidths( );
for ( int i = 0; i < columnNames.length; i++ )
{
TableColumn column = new TableColumn( table, SWT.LEFT );
column.setText( columnNames[i] );
column.setWidth( columnWidths[i] );
}
subTableViewer.setUseHashlookup( true );
subTableViewer.setColumnProperties( provider.getColumnNames( ) );
subTableViewer.setCellEditors( provider.getCellEditors( ) );
subTableViewer.setContentProvider( provider );
subTableViewer.setLabelProvider( provider );
subTableViewer.setCellModifier( provider );
}
示例13: createDialogArea
import org.eclipse.jface.viewers.CheckboxTableViewer; //导入方法依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
container.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout layout = new GridLayout(2, false);
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
container.setLayout(layout);
/*
*
* createFirstName(container); createLastName(container);
*/
table = new Table(container, SWT.CHECK | SWT.SINGLE | SWT.H_SCROLL
| SWT.V_SCROLL | SWT.FULL_SELECTION);
String[] colLabels = getColumnLabels();
int columnWidth[] = getColumnWidth();
SortListener sortListener = new SortListener();
TableColumn[] cols = new TableColumn[colLabels.length];
for (int i = 0; i < colLabels.length; i++) {
cols[i] = new TableColumn(table, SWT.NONE);
cols[i].setWidth(columnWidth[i]);
cols[i].setText(colLabels[i]);
cols[i].setData(new Integer(i));
cols[i].addSelectionListener(sortListener);
}
GridData gridDataTable = new GridData();
gridDataTable.horizontalAlignment = GridData.FILL;
gridDataTable.verticalAlignment = GridData.FILL;
gridDataTable.grabExcessHorizontalSpace = true;
gridDataTable.grabExcessVerticalSpace = true;
table.setLayoutData(gridDataTable);
table.setHeaderVisible(true);
table.setLinesVisible(true);
tableViewer = new CheckboxTableViewer(table);
tableViewer.setContentProvider(new ViewContentProvider());
tableViewer.setLabelProvider(new ViewLabelProvider());
tableViewer.setSorter(new Sorter());
tableViewer.setInput(this);
return area;
}
示例14: createDialogArea
import org.eclipse.jface.viewers.CheckboxTableViewer; //导入方法依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
container.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout layout = new GridLayout(2, false);
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
container.setLayout(layout);
table = new Table(container, SWT.CHECK | SWT.SINGLE | SWT.H_SCROLL
| SWT.V_SCROLL | SWT.FULL_SELECTION);
String[] colLabels = getColumnLabels();
int columnWidth[] = getColumnWidth();
SortListener sortListener = new SortListener();
TableColumn[] cols = new TableColumn[colLabels.length];
for (int i = 0; i < colLabels.length; i++) {
cols[i] = new TableColumn(table, SWT.NONE);
cols[i].setWidth(columnWidth[i]);
cols[i].setText(colLabels[i]);
cols[i].setData(new Integer(i));
cols[i].addSelectionListener(sortListener);
}
GridData gridDataTable = new GridData();
gridDataTable.horizontalAlignment = GridData.FILL;
gridDataTable.verticalAlignment = GridData.FILL;
gridDataTable.grabExcessHorizontalSpace = true;
gridDataTable.grabExcessVerticalSpace = true;
table.setLayoutData(gridDataTable);
table.setHeaderVisible(true);
table.setLinesVisible(true);
tableViewer = new CheckboxTableViewer(table);
tableViewer.setContentProvider(new ViewContentProvider());
tableViewer.setLabelProvider(new ViewLabelProvider());
tableViewer.setSorter(new PatientSorter());
tableViewer.setInput(this);
return area;
}
示例15: createDialogArea
import org.eclipse.jface.viewers.CheckboxTableViewer; //导入方法依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
container.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout layout = new GridLayout(2, false);
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
container.setLayout(layout);
/*
*
* createFirstName(container); createLastName(container);
*/
table = new Table(container, SWT.CHECK | SWT.SINGLE | SWT.H_SCROLL
| SWT.V_SCROLL | SWT.FULL_SELECTION);
String[] colLabels = getColumnLabels();
int columnWidth[] = getColumnWidth();
SortListener sortListener = new SortListener();
TableColumn[] cols = new TableColumn[colLabels.length];
for (int i = 0; i < colLabels.length; i++) {
cols[i] = new TableColumn(table, SWT.NONE);
cols[i].setWidth(columnWidth[i]);
cols[i].setText(colLabels[i]);
cols[i].setData(new Integer(i));
cols[i].addSelectionListener(sortListener);
}
GridData gridDataTable = new GridData();
gridDataTable.horizontalAlignment = GridData.FILL;
gridDataTable.verticalAlignment = GridData.FILL;
gridDataTable.grabExcessHorizontalSpace = true;
gridDataTable.grabExcessVerticalSpace = true;
table.setLayoutData(gridDataTable);
table.setHeaderVisible(true);
table.setLinesVisible(true);
tableViewer = new CheckboxTableViewer(table);
tableViewer.setContentProvider(new ViewContentProvider());
tableViewer.setLabelProvider(new ViewLabelProvider());
tableViewer.setSorter(new Sorter());
tableViewer.setInput(this);
return area;
}