org.eclipse.jface.viewers.StyledString#length ( )源码实例Demo

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

@Override
public StyledString getStyledText(Object element) {
	if (element instanceof IImportDeclaration)
		element= ((IImportDeclaration)element).getParent().getParent();

	StyledString text= super.getStyledText(element);
	if (text.length() > 0) {
		StyledString countLabel= getColoredLabelWithCounts(element, text);
		if (fCurrentOrder == SHOW_ELEMENT_CONTAINER) {
			countLabel.append(getPostQualification(element), StyledString.QUALIFIER_STYLER);
		}
		return countLabel;
	}
	return getStyledParticipantText(element);
}
 
源代码2 项目: neoscada   文件: BlockControlImage.java
protected StyledString getStyledString ( final String note, final String user, final Calendar timestamp )
{
    final StyledString string = new StyledString ();

    if ( timestamp != null )
    {
        string.append ( Messages.BlockControllerImage_String_Timestamp, this.boldStyler );
        string.append ( timestamp.getTime ().toString () + "\n\n" );
    }

    if ( user != null )
    {
        string.append ( Messages.BlockControllerImage_String_BlockedBy, this.boldStyler );
        if ( user.equals ( "" ) )
        {
            string.append ( Messages.BlockControllerImage_String_Unknown );
        }
        else
        {
            string.append ( user );
        }
    }

    if ( note != null )
    {
        // show tooltip
        if ( string.length () > 0 )
        {
            string.append ( "\n" ); //$NON-NLS-1$
        }
        string.append ( Messages.BlockControllerImage_String_Reason, this.boldStyler );
        if ( note.equals ( "" ) )
        {
            string.append ( Messages.BlockControllerImage_String_None );
        }
        else
        {
            string.append ( note );
        }
    }
    return string;
}
 
private StyledString internalGetStyledText(Object element) {
	StyledString text= super.getStyledText(element);
	if (text != null && text.length() > 0)
		return text;
	return getStyledParticipantText(element);
}