当前位置: 首页>>代码示例>>Java>>正文


Java TableColumn.addSelectionListener方法代码示例

本文整理汇总了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);
}
 
开发者ID:AndreasWBartels,项目名称:libraries,代码行数:20,代码来源:TableViewerFactory.java

示例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 ) );

}
 
开发者ID:AndreasWBartels,项目名称:libraries,代码行数:25,代码来源:RelationsTableViewerFactory.java

示例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);
}
 
开发者ID:AndreasWBartels,项目名称:libraries,代码行数:20,代码来源:TypesTableViewerFactory.java

示例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));
    }
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:19,代码来源:ResultPage.java

示例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();
           }
      });
  }
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:16,代码来源:PerformanceView.java

示例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);
}
 
开发者ID:nresare,项目名称:javapasswordsafe,代码行数:8,代码来源:PasswordSafeJFace.java

示例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;
}
 
开发者ID:Albertus82,项目名称:EarthquakeBulletin,代码行数:10,代码来源:ResultsTable.java

示例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);
}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:66,代码来源:SearchDialog.java

示例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);

	}
 
开发者ID:turnus,项目名称:turnus,代码行数:49,代码来源:OperatorsCostEditor.java

示例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);
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:76,代码来源:SearchDialog.java


注:本文中的org.eclipse.swt.widgets.TableColumn.addSelectionListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。