Codota Logo
ViewerCell
Code IndexAdd Codota to your IDE (free)

How to use
ViewerCell
in
org.eclipse.jface.viewers

Best Java code snippets using org.eclipse.jface.viewers.ViewerCell (Showing top 20 results out of 315)

  • Common ways to obtain ViewerCell
private void myMethod () {
ViewerCell v =
  • Codota IconSWTFocusCellManager sWTFocusCellManager;sWTFocusCellManager.getFocusCell()
  • Codota IconViewerRow viewerRow;viewerRow.getCell(column)
  • Codota IconColumnViewer columnViewer;columnViewer.getColumnViewerEditor().getFocusCell()
  • Smart code suggestions by Codota
}
origin: org.eclipse.pde/org.eclipse.pde.ui

@Override
public void update(ViewerCell cell) {
  switch (cell.getColumnIndex()) {
    case COLUMN_FEATURE_NAME :
      StyledString label = getStyledText(cell.getElement());
      cell.setStyleRanges(label.getStyleRanges());
      cell.setText(label.toString());
      cell.setImage(getColumnImage(cell.getElement(), COLUMN_FEATURE_NAME));
      break;
    case COLUMN_PLUGIN_RESOLUTION :
      cell.setText(getColumnText(cell.getElement(), COLUMN_PLUGIN_RESOLUTION));
      cell.setImage(getColumnImage(cell.getElement(), COLUMN_PLUGIN_RESOLUTION));
      break;
  }
  super.update(cell);
}
origin: org.eclipse.platform/org.eclipse.jface

@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.
}
origin: stackoverflow.com

public void update(ViewerCell cell) {
  TableItem item = (TableItem) cell.getItem();
  Button button;
  if(buttons.containsKey(cell.getElement()))
    button = buttons.get(cell.getElement());
     button = new Button((Composite) cell.getViewerRow().getControl(),SWT.NONE);
    button.setText("Remove");
    buttons.put(cell.getElement(), button);
  editor.setEditor(button , item, cell.getColumnIndex());
  editor.layout();
origin: net.anwiba.eclipse/net.anwiba.eclipse.project.dependencies

 @Override
 public void update(final ViewerCell cell) {
  cell.setText(cell.getElement().toString());
 }
}
origin: stackoverflow.com

 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 ...
      }
    }
  }
}
origin: org.eclipse.platform/org.eclipse.jface

@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));
}
origin: org.eclipse.rap/org.eclipse.rap.jface

public void update(ViewerCell cell) {
  Object element = cell.getElement();
  if(viewerLabelProvider == null && treePathLabelProvider == null){
    cell.setText(getText(element));
    Image image = getImage(element);
    cell.setImage(image);
    if (colorProvider != null) {
      cell.setBackground(getBackground(element));
      cell.setForeground(getForeground(element));
      cell.setFont(getFont(element));
  ViewerLabel label = new ViewerLabel(cell.getText(), cell.getImage());
    TreePath treePath = cell.getViewerRow().getTreePath();
origin: stackoverflow.com

 public class MyStyledLabelProvider extends StyledCellLabelProvider {

private Styler defaultStyler;
public MyStyledLabelProvider () {
    defaultStyler = new Styler() {
      @Override
      public void applyStyles(TextStyle textStyle) {
        textStyle.strikeout = true;
      }
    };
  }

@Override
  public void update(ViewerCell cell) {
    Object element = cell.getElement();
    StyledString styledString = getStyledString(element);
    cell.setText(styledString.toString());
    cell.setStyleRanges(styledString.getStyleRanges());
    super.update(cell);
  }

  @SuppressWarnings("unchecked")
  private StyledString getStyledString(Object element) {
    return new StyledString("Cell string", defaultStyler);
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

/**
 * Update the contents of the cell.
 *
 * @param cell
 */
public void update(ViewerCell cell) {
  cell.setText(getValue((MarkerItem) cell.getElement()));
  cell.setImage(null);
}
origin: stackoverflow.com

public void update(ViewerCell cell) {
  provider.update(cell);
  if (cell.getStyleRanges() == null) {
    cell.setStyleRanges(styleRanges);
  if (cell.getElement() instanceof IValidable) {
    IValidable model = (IValidable) cell.getElement();
    if (!ControllerRegistry.getCurrentViolations().getViolations(model.getModelId(), propertyName).isEmpty()) {
      if (cell.getText().isEmpty()) {
        cell.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
        cell.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage());
      } else {
        if (styleRanges[0].length < cell.getText().length()) {
          styleRanges[0].length = cell.getText().length();
      if (cell.getImage() != null) {
        cell.setImage(null);
      cell.setStyleRanges(null);
origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

  @Override
  public void update(ViewerCell cell) {
    cell.setText(getText(cell.getElement()));
    Color color = getForeground(cell.getElement());
    if (color != null) {
      cell.setForeground(color);
    }
  }
}
origin: org.eclipse.neoscada.hmi/org.eclipse.scada.ca.ui.editor

@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 );
}
origin: org.eclipse.neoscada.hmi/org.eclipse.scada.ca.ui.editor

  @Override
  public void update ( final ViewerCell cell )
  {
    final Map.Entry<?, ?> cfg = (Map.Entry<?, ?>)cell.getElement ();
    switch ( cell.getColumnIndex () )
    {
    case 0:
      cell.setText ( "" + cfg.getKey () );
      break;
    case 1:
      cell.setText ( "" + cfg.getValue () );
      break;
    }
    super.update ( cell );
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

  @Override
  public void update(ViewerCell cell) {
    super.update(cell);
    cell.setImage(getImage(cell.getElement()));
  }
}
origin: org.eclipse.rap/org.eclipse.rap.jface

private boolean isCellEditable(ColumnViewer viewer, ViewerCell cell) {
  ViewerColumn column = viewer.getViewerColumn(cell.getColumnIndex());
  return column != null && column.getEditingSupport() != null
      && column.getEditingSupport().canEdit(cell.getElement());
}
origin: org.eclipse.rap/org.eclipse.rap.jface

  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 );
  }

origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

private boolean waitForPendingDecoration(ViewerCell cell) {
  if (this.decorator == null)
    return false;
  Object element = cell.getElement();
  String oldText = cell.getText();
  boolean isDecorationPending = false;
  if (this.decorator instanceof LabelDecorator) {
    isDecorationPending = !((LabelDecorator) this.decorator)
        .prepareDecoration(element, oldText, getDecorationContext());
  } else if (this.decorator instanceof IDelayedLabelDecorator) {
    isDecorationPending = !((IDelayedLabelDecorator) this.decorator)
        .prepareDecoration(element, oldText);
  }
  if (isDecorationPending && oldText.length() == 0) {
    // item is empty: is shown for the first time: don't wait
    return false;
  }
  return isDecorationPending;
}
origin: org.eclipse.rap/org.eclipse.rap.jface

  public void keyTraversed(TraverseEvent e) {
    if ((feature & DEFAULT) != DEFAULT && e.doit) {
      processTraverseEvent(cell.getColumnIndex(),
          viewer.getViewerRowFromItem(cell
              .getItem()), e);
    }
  }
};
origin: org.eclipse.platform/org.eclipse.jface

private void handleSelection(Event event) {
  if ((event.detail & SWT.CHECK) == 0 && focusCell != null && focusCell.getItem() != event.item
      && event.item != null && ! event.item.isDisposed() ) {
    ViewerRow row = viewer.getViewerRowFromItem(event.item);
    Assert
        .isNotNull(row,
            "Internal Structure invalid. Row item has no row ViewerRow assigned"); //$NON-NLS-1$
    ViewerCell tmp = row.getCell(focusCell.getColumnIndex());
    if (!focusCell.equals(tmp)) {
      setFocusCell(tmp);
    }
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

  @Override
  public void getName(AccessibleEvent event) {
    ViewerCell cell = getFocusCell();
    if (cell == null)
      return;
    ViewerRow row = cell.getViewerRow();
    if (row == null)
      return;
    ViewerColumn viewPart = viewer.getViewerColumn(cell
        .getColumnIndex());
    if (viewPart == null)
      return;
    CellLabelProvider labelProvider = viewPart
        .getLabelProvider();
    if (labelProvider == null)
      return;
    labelProvider.update(cell);
    event.result = cell.getText();
  }
});
org.eclipse.jface.viewersViewerCell

Javadoc

The ViewerCell is the JFace representation of a cell entry in a ViewerRow.

Most used methods

  • getElement
    Get the element this row represents.
  • setText
    Set the text for the cell.
  • setImage
    Set the Image for the cell.
  • setStyleRanges
    Set the style ranges to be applied on the text label Note: Requires StyledCellLabelProvider with own
  • getColumnIndex
    Get the index of the cell.
  • getText
    Return the text for the cell.
  • setBackground
    Set the background color of the cell.
  • setForeground
    Set the foreground color of the cell.
  • getItem
    Return the item for the receiver.
  • setFont
    Set the font of the cell.
  • getViewerRow
  • getBounds
    Get the bounds of the cell.
  • getViewerRow,
  • getBounds,
  • getImage,
  • getStyleRanges,
  • <init>,
  • equals,
  • getControl,
  • getNeighbor,
  • getVisualIndex,
  • isVisible

Popular in Java

  • Updating database using SQL prepared statement
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • requestLocationUpdates (LocationManager)
  • runOnUiThread (Activity)
  • Point (java.awt)
    A point representing a location in (x, y) coordinate space, specified in integer precision.
  • KeyStore (java.security)
    This class represents an in-memory collection of keys and certificates. It manages two types of entr
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.This exception may include information for locating the er
  • Option (scala)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now