col.setLabelProvider(new ColumnLabelProvider() { @Override public void update(final ViewerCell cell) { cell.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_DARK_GREEN)); final int index = cell.getColumnIndex(); final TableItem item = (TableItem) cell.getItem(); Display.getCurrent().timerExec(1000, new Runnable() { public void run() { //make sure table is not disposed item.setBackground(index, Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); } }); } });
@Override public void update ( final ViewerCell cell ) { final ConfigurationDescriptor cfg = (ConfigurationDescriptor)cell.getElement (); switch ( cell.getColumnIndex () ) { case 0: cell.setText ( cfg.getConfigurationInformation ().getId () ); break; case 1: cell.setText ( "" + cfg.getConfigurationInformation ().getState () ); break; } if ( cfg.getConfigurationInformation ().getErrorInformation () != null ) { cell.setBackground ( Display.getCurrent ().getSystemColor ( SWT.COLOR_RED ) ); } else { cell.setBackground ( null ); } super.update ( cell ); }
private void removeSelectionInformation(Event event, ViewerCell cell) { // GC gc = event.gc; // gc.setBackground(cell.getViewerRow().getBackground( // cell.getColumnIndex())); // gc.setForeground(cell.getViewerRow().getForeground( // cell.getColumnIndex())); // gc.fillRectangle(cell.getBounds()); // event.detail &= ~SWT.SELECTED; Color cellBackground = null; Color cellForeground = null; CellLabelProvider labelProvider = viewer.getLabelProvider( cell.getColumnIndex() ); if( labelProvider instanceof ColumnLabelProvider ) { ColumnLabelProvider columnLabelProvider = ( ColumnLabelProvider )labelProvider; cellBackground = columnLabelProvider.getBackground( cell.getElement() ); cellForeground = columnLabelProvider.getForeground( cell.getElement() ); } cell.setBackground( cellBackground ); cell.setForeground( cellForeground ); }
@Override public void update(ViewerCell cell) { Object element = cell.getElement(); cell.setText(getText(element)); Image image = getImage(element); cell.setImage(image); cell.setBackground(getBackground(element)); cell.setForeground(getForeground(element)); cell.setFont(getFont(element)); }
@Override public void update(ViewerCell cell) { Object element = cell.getElement(); cell.setText(getText(element)); Image image = getImage(element); cell.setImage(image); cell.setBackground(getBackground(element)); cell.setForeground(getForeground(element)); cell.setFont(getFont(element)); }
public void update(ViewerCell cell) { Object element = cell.getElement(); cell.setText(getText(element)); Image image = getImage(element); cell.setImage(image); cell.setBackground(getBackground(element)); cell.setForeground(getForeground(element)); cell.setFont(getFont(element)); }
@Override public void update(ViewerCell cell) { Object element = cell.getElement(); StyledString styledString = getStyledText(element); String newText= styledString.toString(); StyleRange[] oldStyleRanges= cell.getStyleRanges(); StyleRange[] newStyleRanges= isOwnerDrawEnabled() ? styledString.getStyleRanges() : null; if (!Arrays.equals(oldStyleRanges, newStyleRanges)) { cell.setStyleRanges(newStyleRanges); if (cell.getText().equals(newText)) { // make sure there will be a refresh from a change cell.setText(""); //$NON-NLS-1$ } } cell.setText(newText); cell.setImage(getImage(element)); cell.setFont(getFont(element)); cell.setForeground(getForeground(element)); cell.setBackground(getBackground(element)); // no super call required. changes on item will trigger the refresh. }
@Override public void update(ViewerCell cell) { Object element = cell.getElement(); StyledString styledString = getStyledText(element); String newText= styledString.toString(); StyleRange[] oldStyleRanges= cell.getStyleRanges(); StyleRange[] newStyleRanges= isOwnerDrawEnabled() ? styledString.getStyleRanges() : null; if (!Arrays.equals(oldStyleRanges, newStyleRanges)) { cell.setStyleRanges(newStyleRanges); if (cell.getText().equals(newText)) { // make sure there will be a refresh from a change cell.setText(""); //$NON-NLS-1$ } } cell.setText(newText); cell.setImage(getImage(element)); cell.setFont(getFont(element)); cell.setForeground(getForeground(element)); cell.setBackground(getBackground(element)); // no super call required. changes on item will trigger the refresh. }
cell.setFont(getFont(element, index)); cell.setForeground(getForeground(element, index)); cell.setBackground(getBackground(element, index));
private void applyViewerLabel(ViewerCell cell, ViewerLabel label) { if (label.hasNewText()) { cell.setText(label.getText()); } if (label.hasNewImage()) { cell.setImage(label.getImage()); } if (colorProvider!= null || label.hasNewBackground()) { cell.setBackground(label.getBackground()); } if (colorProvider!= null || label.hasNewForeground()) { cell.setForeground(label.getForeground()); } if (fontProvider!= null || label.hasNewFont()) { cell.setFont(label.getFont()); } } }
private void applyViewerLabel(ViewerCell cell, ViewerLabel label) { if (label.hasNewText()) { cell.setText(label.getText()); } if (label.hasNewImage()) { cell.setImage(label.getImage()); } if (colorProvider!= null || label.hasNewBackground()) { cell.setBackground(label.getBackground()); } if (colorProvider!= null || label.hasNewForeground()) { cell.setForeground(label.getForeground()); } if (fontProvider!= null || label.hasNewFont()) { cell.setFont(label.getFont()); } } }
private void applyViewerLabel(ViewerCell cell, ViewerLabel label) { if (label.hasNewText()) { cell.setText(label.getText()); } if (label.hasNewImage()) { cell.setImage(label.getImage()); } if (colorProvider!= null || label.hasNewBackground()) { cell.setBackground(label.getBackground()); } if (colorProvider!= null || label.hasNewForeground()) { cell.setForeground(label.getForeground()); } if (fontProvider!= null || label.hasNewFont()) { cell.setFont(label.getFont()); } } }
public void update(ViewerCell cell) { Object element = cell.getElement(); int index = cell.getColumnIndex(); if (tableLabelProvider == null) { cell.setText(getLabelProvider().getText(element)); cell.setImage(getLabelProvider().getImage(element)); } else { cell.setText(tableLabelProvider.getColumnText(element, index)); cell.setImage(tableLabelProvider.getColumnImage(element, index)); } if (tableColorProvider == null) { if (getColorProvider() != null) { cell.setBackground(getColorProvider().getBackground(element)); cell.setForeground(getColorProvider().getForeground(element)); } } else { cell.setBackground(tableColorProvider .getBackground(element, index)); cell.setForeground(tableColorProvider .getForeground(element, index)); } if (tableFontProvider == null) { if (getFontProvider() != null) cell.setFont(getFontProvider().getFont(element)); } else cell.setFont(tableFontProvider.getFont(element, index)); }
@Override public void update(ViewerCell cell) { Object element = cell.getElement(); int index = cell.getColumnIndex(); if (tableLabelProvider == null) { cell.setText(getLabelProvider().getText(element)); cell.setImage(getLabelProvider().getImage(element)); } else { cell.setText(tableLabelProvider.getColumnText(element, index)); cell.setImage(tableLabelProvider.getColumnImage(element, index)); } if (tableColorProvider == null) { if (getColorProvider() != null) { cell.setBackground(getColorProvider().getBackground(element)); cell.setForeground(getColorProvider().getForeground(element)); } } else { cell.setBackground(tableColorProvider .getBackground(element, index)); cell.setForeground(tableColorProvider .getForeground(element, index)); } if (tableFontProvider == null) { if (getFontProvider() != null) cell.setFont(getFontProvider().getFont(element)); } else cell.setFont(tableFontProvider.getFont(element, index)); }
@Override public void update(ViewerCell cell) { Object element = cell.getElement(); int index = cell.getColumnIndex(); if (tableLabelProvider == null) { cell.setText(getLabelProvider().getText(element)); cell.setImage(getLabelProvider().getImage(element)); } else { cell.setText(tableLabelProvider.getColumnText(element, index)); cell.setImage(tableLabelProvider.getColumnImage(element, index)); } if (tableColorProvider == null) { if (getColorProvider() != null) { cell.setBackground(getColorProvider().getBackground(element)); cell.setForeground(getColorProvider().getForeground(element)); } } else { cell.setBackground(tableColorProvider .getBackground(element, index)); cell.setForeground(tableColorProvider .getForeground(element, index)); } if (tableFontProvider == null) { if (getFontProvider() != null) cell.setFont(getFontProvider().getFont(element)); } else cell.setFont(tableFontProvider.getFont(element, index)); }
@Override public void update(ViewerCell cell) { Object element = cell.getElement(); if (!(element instanceof ItemsListSeparator) && provider instanceof IStyledLabelProvider) { IStyledLabelProvider styledLabelProvider = (IStyledLabelProvider) provider; StyledString styledString = getStyledText(element, styledLabelProvider); cell.setText(styledString.getString()); cell.setStyleRanges(styledString.getStyleRanges()); cell.setImage(styledLabelProvider.getImage(element)); } else { cell.setText(getText(element)); cell.setImage(getImage(element)); } cell.setFont(getFont(element)); cell.setForeground(getForeground(element)); cell.setBackground(getBackground(element)); super.update(cell); }
cell.setBackground( background ); cell.setForeground( foreground );
cell.setImage(image); if (colorProvider != null) { cell.setBackground(getBackground(element)); cell.setForeground(getForeground(element));
cell.setImage(image); if (colorProvider != null) { cell.setBackground(getBackground(element)); cell.setForeground(getForeground(element));
cell.setImage(image); if (colorProvider != null) { cell.setBackground(getBackground(element)); cell.setForeground(getForeground(element));