本文整理匯總了Java中org.eclipse.swt.widgets.TableColumn.addSelectionListener方法的典型用法代碼示例。如果您正苦於以下問題:Java TableColumn.addSelectionListener方法的具體用法?Java TableColumn.addSelectionListener怎麽用?Java TableColumn.addSelectionListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.TableColumn
的用法示例。
在下文中一共展示了TableColumn.addSelectionListener方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createColumns
import org.eclipse.swt.widgets.TableColumn; //導入方法依賴的package包/類
private void createColumns(final TableViewer tableViewer) {
final String[] titles = { "Icon", "Name", "Small", "Medium", "Large", "Source", "Class" };
final int[] bounds = { 40, 200, 60, 60, 60, 200, 200 };
for (int i = 0; i < titles.length; i++) {
final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
tableViewer.setSorter(new TableViewerSorter(titles));
viewerColumn.setLabelProvider(new TableCellLabelProvider());
final TableColumn column = viewerColumn.getColumn();
column.addSelectionListener(new ColumnSelectionListener(column, tableViewer));
column.setText(titles[i]);
column.setWidth(bounds[i]);
column.setResizable(true);
column.setMoveable(false);
}
final Table table = tableViewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.RECREATE);
}
示例2: createColumns
import org.eclipse.swt.widgets.TableColumn; //導入方法依賴的package包/類
private void createColumns(final TableViewer tableViewer) {
final String[] titles = { "Relation", "Type", "Name" };
final int[] bounds = { 120, 100, 200 };
for (int i = 0; i < titles.length; i++) {
final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
tableViewer.setSorter(new TableViewerSorter(titles));
viewerColumn.setLabelProvider(new TableCellLabelProvider());
final TableColumn column = viewerColumn.getColumn();
column.addSelectionListener(new ColumnSelectionListener(column, tableViewer));
column.setText(titles[i]);
column.setWidth(bounds[i]);
column.setResizable(true);
column.setMoveable(false);
}
final Table table = tableViewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.RECREATE);
// Object[] projectsToSelect = openProjects.toArray();
// IViewPart view = window.getActivePage().showView( "org.eclipse.jdt.ui.PackageExplorer" );
// view.getSite().getSelectionProvider().setSelection( new StructuredSelection( projectsToSelect ) );
}
示例3: createColumns
import org.eclipse.swt.widgets.TableColumn; //導入方法依賴的package包/類
private void createColumns(final TableViewer tableViewer) {
final String[] titles = { "Class" };
final int[] bounds = { 120, 100, 200 };
for (int i = 0; i < titles.length; i++) {
final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
tableViewer.setSorter(new TableViewerSorter(titles));
viewerColumn.setLabelProvider(new TableCellLabelProvider());
final TableColumn column = viewerColumn.getColumn();
column.addSelectionListener(new ColumnSelectionListener(column, tableViewer));
column.setText(titles[i]);
column.setWidth(bounds[i]);
column.setResizable(true);
column.setMoveable(false);
}
final Table table = tableViewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.RECREATE);
}
示例4: createTableColumns
import org.eclipse.swt.widgets.TableColumn; //導入方法依賴的package包/類
/**
* @param stateTable
*/
public static void createTableColumns(Table stateTable, ResultPage page)
{
// create table headers
for (int i = 0; i < columnTitles.length; i++)
{
TableColumn column = new TableColumn(stateTable, SWT.NULL);
column.setWidth(columnWidths[i]);
column.setText(columnTitles[i]);
// The following statement attaches a listener to the column
// header. See the ResultPageColumnListener comments.
column.addSelectionListener(new ResultPageColumnListener(i, page));
}
}
示例5: setColumnsName
import org.eclipse.swt.widgets.TableColumn; //導入方法依賴的package包/類
private void setColumnsName (TableViewer tv) {
for (int i = 0; i < ColumnsConst.COLUMNS.length; i++) {
TableColumn col = new TableColumn(tv.getTable(), SWT.LEFT );
col.setText(ColumnsConst.COLUMNS[i]);
col.setData(new Integer (i));
col.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
TableColumn tc = (TableColumn)event.getSource();
Integer index = (Integer)tc.getData();
((PerformanceStatsViewerSorter) tv.getComparator()).doSort(index);
tv.refresh();
}
});
}
}
示例6: addTableColumn
import org.eclipse.swt.widgets.TableColumn; //導入方法依賴的package包/類
private void addTableColumn(final int column, final String headerText, final String preferenceKey) {
final TableColumn tableColumn = new TableColumn(table, SWT.NONE);
tableColumn.setWidth(100);
tableColumn.setText(Messages.getString(headerText));
tableColumn.addSelectionListener(new TableColumnSelectionAdaptor(tableViewer, column));
WidgetPreferences.tuneTableColumn(tableColumn, getClass(), preferenceKey);
}
示例7: createTableViewerColumn
import org.eclipse.swt.widgets.TableColumn; //導入方法依賴的package包/類
private TableViewerColumn createTableViewerColumn(final String title, final int colNumber) {
final TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
final TableColumn column = viewerColumn.getColumn();
column.setText(title);
column.setResizable(true);
column.setMoveable(true);
column.addSelectionListener(createSelectionAdapter(column, colNumber));
return viewerColumn;
}
示例8: createResultGroup
import org.eclipse.swt.widgets.TableColumn; //導入方法依賴的package包/類
private void createResultGroup(final TabFolder tabFolder) {
final TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
tabItem.setText(ResourceString.getResourceString("label.search.result"));
final GridData gridData = new GridData();
gridData.grabExcessVerticalSpace = true;
gridData.verticalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
gridData.horizontalAlignment = SWT.FILL;
resultTable = new Table(tabFolder, SWT.NONE | SWT.FULL_SELECTION | SWT.MULTI);
resultTable.setHeaderVisible(true);
resultTable.setLayoutData(gridData);
resultTable.setLinesVisible(true);
resultTable.addSelectionListener(new SelectionAdapter() {
/**
* {@inheritDoc}
*/
@Override
public void widgetSelected(final SelectionEvent e) {
final int index = resultTable.getSelectionIndex();
if (index == -1) {
replaceButton.setEnabled(false);
replaceCombo.setEnabled(false);
} else {
replaceButton.setEnabled(true);
replaceCombo.setEnabled(true);
final SearchResultRow searchResultRow = searchResult.getRows().get(index);
final Object object = searchResultRow.getTargetNode();
if (object != null) {
focus(object);
}
}
}
});
final TableColumn tableColumn0 = new TableColumn(resultTable, SWT.LEFT);
tableColumn0.setWidth(250);
tableColumn0.setText(ResourceString.getResourceString("label.search.result.table.path"));
tableColumn0.addSelectionListener(new SearchResultSortListener(SearchResult.SORT_TYPE_PATH));
final TableColumn tableColumn1 = new TableColumn(resultTable, SWT.LEFT);
tableColumn1.setWidth(100);
tableColumn1.setText(ResourceString.getResourceString("label.search.result.table.type"));
tableColumn1.addSelectionListener(new SearchResultSortListener(SearchResult.SORT_TYPE_TYPE));
final TableColumn tableColumn2 = new TableColumn(resultTable, SWT.LEFT);
tableColumn2.setWidth(200);
tableColumn2.setText(ResourceString.getResourceString("label.search.result.table.name"));
tableColumn2.addSelectionListener(new SearchResultSortListener(SearchResult.SORT_TYPE_NAME));
final TableColumn tableColumn3 = new TableColumn(resultTable, SWT.LEFT);
tableColumn3.setWidth(200);
tableColumn3.setText(ResourceString.getResourceString("label.search.result.table.value"));
tableColumn3.addSelectionListener(new SearchResultSortListener(SearchResult.SORT_TYPE_VALUE));
tabItem.setControl(resultTable);
}
示例9: createPartControl
import org.eclipse.swt.widgets.TableColumn; //導入方法依賴的package包/類
public void createPartControl(Composite parent) {
final Composite tContainer = new Composite(parent, SWT.NONE);
tContainer.setLayout(new GridLayout());
// build the table and its accessories
table = new Table(tContainer, SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
viewer = new TableViewer(table);
comparator = new ContentComparator();
viewer.setComparator(comparator);
// set table layout
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.grabExcessVerticalSpace = true;
gridData.horizontalSpan = 3;
table.setLayoutData(gridData);
table.setLinesVisible(true);
table.setHeaderVisible(true);
// add table column: operator
final TableColumn column1 = new TableColumn(table, SWT.LEFT, OPERATOR);
column1.setText(columnNames[OPERATOR]);
column1.setWidth(400);
column1.addSelectionListener(getSelectionAdapter(column1, OPERATOR));
column1.setResizable(false);
// add table column: cost
final TableColumn column2 = new TableColumn(table, SWT.LEFT, COST);
column2.setText(columnNames[COST]);
column2.setWidth(200);
column2.addSelectionListener(getSelectionAdapter(column2, COST));
column2.setResizable(false);
// create the table viewer
viewer.setUseHashlookup(true);
viewer.setColumnProperties(columnNames);
viewer.setContentProvider(new ContentProvider());
viewer.setLabelProvider(new TableLabelProvider());
// Create the cell editors
CellEditor[] editors = new CellEditor[columnNames.length];
editors[COST] = new TextCellEditor(table);
// set the editors
viewer.setCellEditors(editors);
viewer.setCellModifier(new CellModifier());
viewer.setInput(operatorCosts);
}
示例10: createResultGroup
import org.eclipse.swt.widgets.TableColumn; //導入方法依賴的package包/類
private void createResultGroup(TabFolder tabFolder) {
TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
tabItem.setText(ResourceString.getResourceString("label.search.result"));
GridData gridData = new GridData();
gridData.grabExcessVerticalSpace = true;
gridData.verticalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
gridData.horizontalAlignment = SWT.FILL;
this.resultTable = new Table(tabFolder, SWT.NONE | SWT.FULL_SELECTION
| SWT.MULTI);
this.resultTable.setHeaderVisible(true);
this.resultTable.setLayoutData(gridData);
this.resultTable.setLinesVisible(true);
this.resultTable.addSelectionListener(new SelectionAdapter() {
/**
* {@inheritDoc}
*/
@Override
public void widgetSelected(SelectionEvent e) {
int index = resultTable.getSelectionIndex();
if (index == -1) {
replaceButton.setEnabled(false);
replaceCombo.setEnabled(false);
} else {
replaceButton.setEnabled(true);
replaceCombo.setEnabled(true);
SearchResultRow searchResultRow = searchResult.getRows()
.get(index);
Object object = searchResultRow.getTargetNode();
if (object != null) {
focus(object);
}
}
}
});
TableColumn tableColumn0 = new TableColumn(resultTable, SWT.LEFT);
tableColumn0.setWidth(250);
tableColumn0.setText(ResourceString
.getResourceString("label.search.result.table.path"));
tableColumn0.addSelectionListener(new SearchResultSortListener(
SearchResult.SORT_TYPE_PATH));
TableColumn tableColumn1 = new TableColumn(resultTable, SWT.LEFT);
tableColumn1.setWidth(100);
tableColumn1.setText(ResourceString
.getResourceString("label.search.result.table.type"));
tableColumn1.addSelectionListener(new SearchResultSortListener(
SearchResult.SORT_TYPE_TYPE));
TableColumn tableColumn2 = new TableColumn(resultTable, SWT.LEFT);
tableColumn2.setWidth(200);
tableColumn2.setText(ResourceString
.getResourceString("label.search.result.table.name"));
tableColumn2.addSelectionListener(new SearchResultSortListener(
SearchResult.SORT_TYPE_NAME));
TableColumn tableColumn3 = new TableColumn(this.resultTable, SWT.LEFT);
tableColumn3.setWidth(200);
tableColumn3.setText(ResourceString
.getResourceString("label.search.result.table.value"));
tableColumn3.addSelectionListener(new SearchResultSortListener(
SearchResult.SORT_TYPE_VALUE));
tabItem.setControl(this.resultTable);
}