Java Code Examples for org.eclipse.swt.widgets.Table#setToolTipText()
The following examples show how to use
org.eclipse.swt.widgets.Table#setToolTipText() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ColumnBrowserWidget.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * Create a column that displays data */ private void createTable() { final Table table = new Table(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); new TableColumn(table, SWT.LEFT); table.setLayoutData(new RowData(150, 175)); columns.add(table); addTableListeners(table); if (super.getBackground() != null && super.getBackground().getRed() != 240 && super.getBackground().getGreen() != 240 && super.getBackground().getBlue() != 240) { table.setBackground(super.getBackground()); } table.setBackgroundImage(super.getBackgroundImage()); table.setBackgroundMode(super.getBackgroundMode()); table.setCursor(super.getCursor()); table.setFont(super.getFont()); table.setForeground(super.getForeground()); table.setMenu(super.getMenu()); table.setToolTipText(super.getToolTipText()); }
Example 2
Source File: SetupOptionsPage.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** @return table created with the provided data and tool tip, or {@code null} if no data. */ private static Table createTable(Composite parent, Map<String, String> data, String toolTipText, String label) { if (data == null || data.isEmpty()) return null; new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR).setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); new Label(parent, SWT.NONE).setText(label); Table table = new Table(parent, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION); table.setLinesVisible(true); table.setHeaderVisible(true); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); table.setToolTipText(toolTipText); TableColumn nameColumn = new TableColumn(table, SWT.NONE); nameColumn.setText("name"); TableColumn locationColumn = new TableColumn(table, SWT.NONE); locationColumn.setText("Location"); TableItem defaultItem = new TableItem(table, SWT.NONE); defaultItem.setText(0, "default"); defaultItem.setText(1, "default settings"); data.forEach((path, name) -> { TableItem item = new TableItem(table, SWT.NONE); item.setText(0, name); item.setText(1, path); }); table.getColumn(0).pack(); table.getColumn(1).pack(); table.pack(true); return table; }
Example 3
Source File: FilterTableControl.java From depan with Apache License 2.0 | 5 votes |
public FilterTableControl(Composite parent) { super(parent, SWT.NONE); setLayout(Widgets.buildContainerLayout(1)); filterViewer = new TableViewer(this, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI ); // Set up layout properties. Table filterTable = filterViewer.getTable(); filterTable.setLayoutData(Widgets.buildGrabFillData()); // Initialize the table. filterTable.setHeaderVisible(true); filterTable.setToolTipText("Node Filter Editor"); EditColTableDef.setupTable(TABLE_DEF, filterTable); CellEditor[] cellEditors = new CellEditor[TABLE_DEF.length]; cellEditors[INDEX_NAME] = new TextCellEditor(filterTable); cellEditors[INDEX_SUMMARY] = new NodeFilterCellEditor(filterTable); // Configure table properties. filterViewer.setCellEditors(cellEditors); filterViewer.setLabelProvider(LABEL_PROVIDER); filterViewer.setColumnProperties(EditColTableDef.getProperties(TABLE_DEF)); filterViewer.setCellModifier(new ControlCellModifier()); // Since the order is significant, no sorting capabilities. // Avoid setInput() invocations that come with // TableContentProvider.initViewer filterViewer.setContentProvider(ArrayContentProvider.getInstance()); }
Example 4
Source File: NodeKindTableControl.java From depan with Apache License 2.0 | 5 votes |
/** * Create the ElementKindPicker, with all the usual sub-controls. * * @param parent containing controls * @param style standard style bits */ public NodeKindTableControl(Composite parent) { super(parent, SWT.NONE); setLayout(Widgets.buildContainerLayout(1)); // Setup selection button bar Composite buttonBar = configButtonBar(this); buttonBar.setLayoutData( new GridData(SWT.LEFT, SWT.CENTER, false, false)); // Configure the table viewer kindViewer = new TableViewer( this, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL); // Set up layout properties. Table elementKindTable = kindViewer.getTable(); elementKindTable.setLayoutData(Widgets.buildGrabFillData()); // Initialize the table. elementKindTable.setHeaderVisible(true); elementKindTable.setToolTipText("Node Kind Selector"); EditColTableDef.setupTable(TABLE_DEF, elementKindTable); // Configure the table viewer kindViewer.setLabelProvider(LABEL_PROVIDER); kindViewer.setColumnProperties(EditColTableDef.getProperties(TABLE_DEF)); configSorters(elementKindTable); setSortColumn(elementKindTable.getColumn(0), 0, SWT.DOWN); kindViewer.setContentProvider(new ArrayContentProvider()); }
Example 5
Source File: EdgeDisplayTableControl.java From depan with Apache License 2.0 | 5 votes |
public EdgeDisplayTableControl(Composite parent) { super(parent, SWT.NONE); setLayout(Widgets.buildContainerLayout(1)); propViewer = new TableViewer(this, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER | SWT.V_SCROLL); // Layout embedded table Table propTable = propViewer.getTable(); propTable.setLayoutData(Widgets.buildGrabFillData()); // initialize the table propTable.setHeaderVisible(true); propTable.setToolTipText("Edge Display Properties"); EditColTableDef.setupTable(TABLE_DEF, propTable); // Configure cell editing CellEditor[] cellEditors = new CellEditor[TABLE_DEF.length]; cellEditors[INDEX_NAME] = null; cellEditors[INDEX_HEAD] = null; cellEditors[INDEX_TAIL] = null; cellEditors[INDEX_COLOR] = new ColorCellEditor(propTable); cellEditors[INDEX_STYLE] = new ComboBoxCellEditor(propTable, toString(EdgeDisplayProperty.LineStyle.values(), true)); cellEditors[INDEX_ARROWHEAD] = new ComboBoxCellEditor(propTable, toString(EdgeDisplayProperty.ArrowheadStyle.values(), true)); propViewer.setCellEditors(cellEditors); propViewer.setLabelProvider(new EdgeDisplayLabelProvider()); propViewer.setColumnProperties(EditColTableDef.getProperties(TABLE_DEF)); propViewer.setCellModifier(new EdgeDisplayCellModifier()); propViewer.setContentProvider(ArrayContentProvider.getInstance()); configSorters(propTable); }
Example 6
Source File: RelationDisplayTableControl.java From depan with Apache License 2.0 | 5 votes |
public RelationDisplayTableControl(Composite parent) { super(parent, SWT.NONE); setLayout(Widgets.buildContainerLayout(1)); propViewer = new TableViewer(this, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER | SWT.V_SCROLL); // Layout embedded table Table propTable = propViewer.getTable(); propTable.setLayoutData(Widgets.buildGrabFillData()); // initialize the table propTable.setHeaderVisible(true); propTable.setToolTipText("Relations Display Properties"); EditColTableDef.setupTable(TABLE_DEF, propTable); // Configure cell editing CellEditor[] cellEditors = new CellEditor[TABLE_DEF.length]; cellEditors[INDEX_NAME] = null; cellEditors[INDEX_SOURCE] = null; cellEditors[INDEX_COLOR] = new ColorCellEditor(propTable); cellEditors[INDEX_STYLE] = new ComboBoxCellEditor(propTable, toString(EdgeDisplayProperty.LineStyle.values(), true)); cellEditors[INDEX_ARROWHEAD] = new ComboBoxCellEditor(propTable, toString(EdgeDisplayProperty.ArrowheadStyle.values(), true)); propViewer.setCellEditors(cellEditors); propViewer.setLabelProvider(new EdgeDisplayLabelProvider()); propViewer.setColumnProperties(EditColTableDef.getProperties(TABLE_DEF)); propViewer.setCellModifier(new EdgeDisplayCellModifier()); // TODO: Add column sorters, filters? configSorters(propTable); // Configure content last: use updateTable() to render relations propViewer.setContentProvider(ArrayContentProvider.getInstance()); }
Example 7
Source File: EdgeMatcherTableControl.java From depan with Apache License 2.0 | 5 votes |
public EdgeMatcherTableControl(Composite parent) { super(parent, SWT.NONE); setLayout(Widgets.buildContainerLayout(1)); viewer = new TableViewer(this, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL); // Layout embedded table Table relationTable = viewer.getTable(); relationTable.setLayoutData(Widgets.buildGrabFillData()); // initialize the table relationTable.setHeaderVisible(true); relationTable.setToolTipText("Edge Matcher Definition"); EditColTableDef.setupTable(TABLE_DEF, relationTable); CellEditor[] cellEditors = new CellEditor[TABLE_DEF.length]; cellEditors[INDEX_RELATION] = null; cellEditors[INDEX_FORWARD] = new CheckboxCellEditor(relationTable); cellEditors[INDEX_BACKWARD] = new CheckboxCellEditor(relationTable); // cell content viewer.setCellEditors(cellEditors); viewer.setLabelProvider(new CellLabelProvider()); viewer.setColumnProperties(EditColTableDef.getProperties(TABLE_DEF)); viewer.setCellModifier(new CellModifier()); viewer.setContentProvider(ArrayContentProvider.getInstance()); viewer.setComparator(new AlphabeticSorter(new ViewerObjectToString() { @Override public String getString(Object object) { if (object instanceof Relation) { return ((Relation) object).toString(); } return object.toString(); } })); }
Example 8
Source File: RelationSetTableControl.java From depan with Apache License 2.0 | 5 votes |
public RelationSetTableControl(Composite parent) { super(parent, SWT.NONE); setLayout(Widgets.buildContainerLayout(1)); // Layout embedded table relSetViewer = new TableViewer(this, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER | SWT.V_SCROLL); // Set up layout properties Table relSetTable = relSetViewer.getTable(); relSetTable.setLayoutData(Widgets.buildGrabFillData()); // initialize the table relSetTable.setHeaderVisible(true); relSetTable.setToolTipText("List of Relations"); EditColTableDef.setupTable(TABLE_DEF, relSetTable); // Configure cell editing CellEditor[] cellEditors = new CellEditor[TABLE_DEF.length]; cellEditors[INDEX_NAME] = null; cellEditors[INDEX_SOURCE] = null; cellEditors[INDEX_VISIBLE] = new CheckboxCellEditor(relSetTable); // Configure table properties. relSetViewer.setCellEditors(cellEditors); relSetViewer.setLabelProvider(new ControlLabelProvider()); relSetViewer.setColumnProperties(EditColTableDef.getProperties(TABLE_DEF)); relSetViewer.setCellModifier(new ControlCellModifier()); relSetViewer.setContentProvider(ArrayContentProvider.getInstance()); configSorters(relSetTable); }
Example 9
Source File: ExpressionBuilder.java From birt with Eclipse Public License 1.0 | 4 votes |
private void initTable( TableViewer tableViewer, boolean leafOnly ) { final Table table = tableViewer.getTable( ); GridData gd = new GridData( GridData.FILL_BOTH ); gd.heightHint = 150; table.setLayoutData( gd ); table.setToolTipText( null ); final TableColumn column = new TableColumn( table, SWT.NONE ); column.setWidth( 200 ); table.getShell( ).addControlListener( new ControlAdapter( ) { public void controlResized( ControlEvent e ) { Display.getCurrent( ).asyncExec( new Runnable( ) { public void run( ) { if ( column != null && !column.isDisposed( ) ) { column.setWidth( table.getSize( ).x > 204 ? table.getSize( ).x - 4 : 200 ); } } } ); } } ); table.addMouseTrackListener( new MouseTrackAdapter( ) { public void mouseHover( MouseEvent event ) { Widget widget = event.widget; if ( widget == table ) { Point pt = new Point( event.x, event.y ); TableItem item = table.getItem( pt ); if ( item == null ) { table.setToolTipText( null ); } else { table.setToolTipText( provider.getTooltipText( item.getData( ) ) ); } } } } ); tableViewer.setLabelProvider( new ExpressionLabelProvider( ) ); tableViewer.setContentProvider( new TableContentProvider( tableViewer, leafOnly ) ); tableViewer.addSelectionChangedListener( selectionListener ); tableViewer.addDoubleClickListener( doubleClickListener ); }
Example 10
Source File: ColumnBrowserWidget.java From nebula with Eclipse Public License 2.0 | 3 votes |
/** * Sets the receiver's tool tip text to the argument, which may be null * indicating that the default tool tip for the control will be shown. For a * control that has a default tool tip, such as the Tree control on Windows, * setting the tool tip text to an empty string replaces the default, causing no * tool tip text to be shown. * <p> * The mnemonic indicator (character '&') is not displayed in a tool tip. To * display a single '&' in the tool tip, the character '&' can be * escaped by doubling it in the string. * </p> * * @param string the new tool tip text (or null) * * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been * disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the * thread that created the receiver</li> * </ul> * @see org.eclipse.swt.widgets.Control#setToolTipText(java.lang.String) */ @Override public void setToolTipText(final String tooltipText) { super.setToolTipText(tooltipText); for (final Table column : columns) { column.setToolTipText(tooltipText); } }