Java Code Examples for org.eclipse.jface.viewers.StyledString#length()

The following examples show how to use org.eclipse.jface.viewers.StyledString#length() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SortingLabelProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@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);
}
 
Example 2
Source File: BlockControlImage.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
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;
}
 
Example 3
Source File: PostfixLabelProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private StyledString internalGetStyledText(Object element) {
	StyledString text= super.getStyledText(element);
	if (text != null && text.length() > 0)
		return text;
	return getStyledParticipantText(element);
}