@Override public void update(ViewerCell cell) { cell.setText(getText(cell.getElement())); Color color = getForeground(cell.getElement()); if (color != null) { cell.setForeground(color); } } }
@Override public void update(ViewerCell cell) { cell.setText(getText(cell.getElement())); Color color = getForeground(cell.getElement()); if (color != null) { cell.setForeground(color); } } }
public class ColorColumnLabelProvider extends ColumnLabelProvider { @Override public void update(ViewerCell cell) { Object element = cell.getElement(); if(element instanceof AplotResultsDataModel.ResultsData) { AplotResultsDataModel.ResultsData p = (AplotResultsDataModel.ResultsData) element; cell.setForeground(YOUR_COLOR); switch(cell.getColumnIndex()) { case 0: cell.setText(p.YOUR_FIRST_TEXT); break; case 1: cell.setText(p.YOUR_SECOND_TEXT); break; case ... } } } }
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.setImage(getColumnImage(element, index)); 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)); }
cell.setForeground( foreground );
@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); }
if (colorProvider != null) { cell.setBackground(getBackground(element)); cell.setForeground(getForeground(element));
if (colorProvider != null) { cell.setBackground(getBackground(element)); cell.setForeground(getForeground(element));