org.eclipse.jface.viewers.ViewerCell#setText ( )源码实例Demo

下面列出了org.eclipse.jface.viewers.ViewerCell#setText ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: neoscada   文件: ItemCellLabelProvider.java
private void updateAttributePair ( final AttributePair attributePair, final ViewerCell cell )
{
    switch ( cell.getColumnIndex () )
    {
        case 0:
            cell.setText ( attributePair.key );
            break;
        case 2:
            if ( attributePair.value != null )
            {
                cell.setText ( attributePair.value.getType ().name () );
            }
            break;
        case 3:
            if ( attributePair.value != null )
            {
                cell.setText ( attributePair.value.asString ( "<null>" ) ); //$NON-NLS-1$
            }
            break;
        default:
            break;
    }
}
 
@Override
public void update(ViewerCell cell) {
    super.update(cell);
    final ContractInput element = (ContractInput) cell.getElement();
    final String text = getText(element);
    final StyledString styledString = new StyledString(text, new StyledString.Styler() {

        @Override
        public void applyStyles(TextStyle textStyle) {
            if (element.getType() == ContractInputType.DATE) {
                textStyle.foreground = Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY);
            }
        }
    });
    cell.setText(styledString.getString());
    cell.setStyleRanges(styledString.getStyleRanges());
}
 
源代码3 项目: JDeodorant   文件: CloneDiffTooltip.java
public void update(ViewerCell cell) { 
	Object element = cell.getElement();
	if (element instanceof CloneStructureNode){
		cell.setText("CloneStructureNode");
	}
	if (element instanceof PreconditionViolation){
		PreconditionViolation preconditionViolation = (PreconditionViolation) element;
		StyledString styledString = preconditionViolation.getStyledViolation();
		cell.setText(styledString.getString());
		cell.setStyleRanges(styledString.getStyleRanges());
		cell.setImage(PRECONDITION_VIOLATION_IMAGE);
	}
	if (element instanceof Suggestion){
		Suggestion suggestion = (Suggestion) element;
		cell.setText(suggestion.getSuggestion());
		cell.setImage(SUGGESTION_IMAGE);
	}
}
 
源代码4 项目: neoscada   文件: VariantLabelProvider.java
@Override
public void update ( final ViewerCell cell )
{
    final DecoratedEvent event = (DecoratedEvent)cell.getElement ();

    if ( this.decoration != null )
    {
        switch ( this.decoration )
        {
        case ACTOR:
            this.labelProviderSupport.decorateWithActorType ( event, cell );
            break;
        case MONITOR:
            this.labelProviderSupport.decorateWithMonitorState ( event, cell );
            break;
        }
    }

    if ( this.key != null && !this.key.isEmpty () )
    {
        cell.setText ( this.labelProviderSupport.toLabel ( event, this.key ) );
    }

}
 
源代码5 项目: neoscada   文件: FlagsDetailsPart.java
@Override
public void update ( final ViewerCell cell )
{
    final Object ele = cell.getElement ();
    if ( ele instanceof GroupEntry )
    {
        cell.setText ( String.format ( Messages.FlagsDetailsPart_GroupSumFormat, ( (GroupEntry)ele ).getActiveCount (), ( (GroupEntry)ele ).getCount () ) );
    }
    else if ( ele instanceof AttributeEntry )
    {
        final StyledString str = new StyledString ();

        if ( ( (AttributeEntry)ele ).isActive () )
        {
            str.append ( Messages.FlagsDetailsPart_ActiveMarker, this.activeStyler );
        }
        else
        {
            str.append ( Messages.FlagsDetailsPart_InactiveMarker, this.inactiveStyler );
        }

        cell.setText ( str.getString () );
        cell.setStyleRanges ( str.getStyleRanges () );
    }
}
 
源代码6 项目: bonita-studio   文件: TypeLabelProvider.java
@Override
public void update(ViewerCell cell) {
    Object element = cell.getElement();
    StyledString styledString = getStyledString(element);
    cell.setText(styledString.getString());

    IStatus status = validator.validate(element);
    if (status.getSeverity() == IStatus.ERROR) {
        cell.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR));
        cell.setForeground(errorColor);
    } else {
        cell.setForeground(null);
        cell.setImage(null);
    }
    cell.setStyleRanges(styledString.getStyleRanges());
}
 
源代码7 项目: offspring   文件: GenericLabelProvider.java
@Override
public void update(ViewerCell cell) {
  super.update(cell);

  data[ICellDataProvider.TEXT] = null;
  data[ICellDataProvider.IMAGE] = null;
  data[ICellDataProvider.FONT] = null;
  data[ICellDataProvider.FOREGROUND] = null;

  cellDataProvider.getCellData(cell.getElement(), data);

  if (data[ICellDataProvider.TEXT] != null) {
    cell.setText((String) data[ICellDataProvider.TEXT]);
  }
  if (data[ICellDataProvider.IMAGE] != null) {
    cell.setImage((Image) data[ICellDataProvider.IMAGE]);
  }
  if (data[ICellDataProvider.FONT] != null) {
    cell.setFont((Font) data[ICellDataProvider.FONT]);
  }
  if (data[ICellDataProvider.FOREGROUND] != null) {
    cell.setForeground((Color) data[ICellDataProvider.FOREGROUND]);
  }
}
 
@Override
public void update(final ViewerCell cell) {
    super.update(cell);
    if (cell.getElement() instanceof BusinessObjectData) {
        final BusinessObjectData data = (BusinessObjectData) cell.getElement();
        if (!businessObjectDefinitionExists(data)) {
            final StyledString styledString = createStrikethroughStyle(cell.getText(), data.getClassName());
            cell.setText(styledString.getString());
            cell.setStyleRanges(styledString.getStyleRanges());
        }
    }
}
 
源代码9 项目: olca-app   文件: DQLabelProvider.java
@Override
public void update(ViewerCell cell) {
	super.update(cell);
	if (cell == null)
		return;
	Object obj = cell.getElement();
	int col = cell.getColumnIndex();
	cell.setText(getColumnText(obj, col));
	cell.setImage(getColumnImage(obj, col));
	cell.setForeground(getForeground(obj, col));
	cell.setBackground(getBackground(obj, col));
}
 
源代码10 项目: olca-app   文件: JsonTreeLabelProvider.java
@Override
public void update(ViewerCell cell) {
	Object element = cell.getElement();
	if (!(element instanceof JsonNode))
		return;
	JsonNode node = (JsonNode) element;
	StyledString styledString = getStyledText(node);
	cell.setText(styledString.toString());
	cell.setStyleRanges(styledString.getStyleRanges());
	cell.setImage(nodeLabelProvider.getImage(node, site));
	super.update(cell);
}
 
源代码11 项目: offspring   文件: BuyOrderLabelProvider.java
@Override
public void update(ViewerCell cell) {
  super.update(cell);
  IBuyOrder t = (IBuyOrder) cell.getElement();
  Object[] data = { null, null, null, null };
  getCellData(t, BuyOrderTable.getColumns()[cell.getColumnIndex()], data);
  if (data[TEXT] != null)
    cell.setText((String) data[TEXT]);
  if (data[IMAGE] != null)
    cell.setImage((Image) data[IMAGE]);
  if (data[FONT] != null)
    cell.setFont((Font) data[FONT]);
  if (data[FOREGROUND] != null)
    cell.setForeground((Color) data[FOREGROUND]);
}
 
源代码12 项目: neoscada   文件: SourceTimestampLabelProvider.java
@Override
public void update ( final ViewerCell cell )
{
    final DecoratedEvent event = (DecoratedEvent)cell.getElement ();

    final String value = this.labelProviderSupport.getDf ().format ( event.getEvent ().getSourceTimestamp () );
    cell.setText ( value );
}
 
源代码13 项目: neoscada   文件: EntryTimestampLabelProvider.java
@Override
public void update ( final ViewerCell cell )
{
    final DecoratedEvent event = (DecoratedEvent)cell.getElement ();

    final String value = this.labelProviderSupport.getDf ().format ( event.getEvent ().getEntryTimestamp () );
    cell.setText ( value );
}
 
源代码14 项目: nebula   文件: JFaceViewerIntegrationExample.java
@Override
public void update(ViewerCell cell) {
	Person element = (Person) cell.getElement();
	cell.setText(element.getLastName());
	super.update(cell);
}
 
源代码15 项目: nebula   文件: JFaceViewerIntegrationExample.java
@Override
public void update(ViewerCell cell) {
	Person element = (Person) cell.getElement();
	cell.setText(element.getGender().toString());
	super.update(cell);
}
 
源代码16 项目: offspring   文件: BlockLabelProvider.java
@Override
public void update(ViewerCell cell) {
  super.update(cell);
  Block b = (Block) cell.getElement();
  switch (BlockTable.getColumns()[cell.getColumnIndex()]) {

  case BlockTable.COLUMN_HEIGHT:
    cell.setText(Integer.toString(b.getHeight()));
    break;

  case BlockTable.COLUMN_NUMBER_OF_TRANSACTIONS:
    cell.setText(Integer.toString(b.getTransactions().size()));
    break;

  case BlockTable.COLUMN_TOTAL_AMOUNT:
    cell.setText(Integer.toString(b.getTotalAmount()));
    break;

  case BlockTable.COLUMN_TOTAL_FEE:
    cell.setText(Integer.toString(b.getTotalFee()));
    break;

  case BlockTable.COLUMN_PAYLOAD_LENGTH:
    cell.setText(Formatter.readableFileSize(b.getPayloadLength()));
    break;

  case BlockTable.COLUMN_VERSION:
    cell.setText(Integer.toString(b.getVersion()));
    break;

  case BlockTable.COLUMN_BASETARGET:
    cell.setText(Formatter.formatBaseTarget(b.getBaseTarget()) + " %");
    break;

  case BlockTable.COLUMN_BLOCK:
    cell.setImage(BLOCK);
    cell.setText(b.getStringId());
    break;

  case BlockTable.COLUMN_GENERATOR:
    // cell.setImage(GENERATOR);
    cell.setText(Long.toString(b.getGeneratorId()));
    break;

  case BlockTable.COLUMN_TIMESTAMP:
    cell.setText(formatTimestamp(b.getTimestamp()));
    break;

  default:
    cell.setText("UNKNOWN " + BlockTable.getColumns()[cell.getColumnIndex()]);
  }
}
 
@Override
public void update(ViewerCell cell) {
	Field pi= (Field) cell.getElement();
	cell.setText(doGetValue(pi));
}
 
源代码18 项目: neoscada   文件: ItemCellLabelProvider.java
private void updateListEntry ( final ListEntry listEntry, final ViewerCell cell )
{
    cell.setFont ( listEntry.getFont () );
    cell.setForeground ( listEntry.getForeground () );
    cell.setBackground ( listEntry.getBackground () );

    switch ( cell.getColumnIndex () )
    {
        case 0:
            cell.setImage ( listEntry.getImage () );
            cell.setText ( listEntry.getDataItem ().getItem ().getId () );
            break;
        case 1:
            if ( listEntry.getSubscriptionError () != null )
            {
                cell.setText ( String.format ( "%s (%s)", listEntry.getSubscriptionState (), listEntry.getSubscriptionError ().getMessage () ) ); //$NON-NLS-1$
            }
            else
            {
                cell.setText ( listEntry.getSubscriptionState ().name () );
            }
            break;
        case 2:
            if ( listEntry.getValue () != null )
            {
                cell.setText ( listEntry.getValue ().getType ().name () );
            }
            break;
        case 3:
            if ( listEntry.getValue () != null )
            {
                cell.setText ( listEntry.getValue ().asString ( "<null>" ) ); //$NON-NLS-1$
            }
            break;
        case 4:
            if ( listEntry.getItemValue () != null )
            {
                final Calendar timestamp = listEntry.getItemValue ().getTimestamp ();
                if ( timestamp != null )
                {
                    cell.setText ( formatTimestamp ( timestamp ) );
                }
                else
                {
                    cell.setText ( null );
                }
            }
            break;
        default:
            break;
    }
}
 
@Override
public void update(final ViewerCell cell) {
    cell.setText(getText(cell.getElement()));
    cell.setImage(getImage(cell.getElement()));
}
 
源代码20 项目: ice   文件: ICEMatrixComponentSectionPart.java
/**
 * <p>
 * Update is called whenever data is entered into the cell. Current
 * implementation simply sets the text as what's currently the value on
 * the Entry
 * </p>
 * 
 * @param cell
 *            <p>
 *            The current cell in the TableViewerColumn
 *            </p>
 * 
 */
@Override
public void update(ViewerCell cell) {
	cell.setText(((RowWrapper) cell.getElement()).getRowWrapper()
			.get(tableColumn).toString());
}