Search in sources :

Example 56 with StyledString

use of org.eclipse.jface.viewers.StyledString in project che by eclipse.

the class GetterSetterCompletionProposal method getDisplayName.

private static StyledString getDisplayName(IField field, boolean isGetter) throws JavaModelException {
    StyledString buf = new StyledString();
    String fieldTypeName = Signature.toString(field.getTypeSignature());
    String fieldNameLabel = BasicElementLabels.getJavaElementName(field.getElementName());
    if (isGetter) {
        buf.append(BasicElementLabels.getJavaElementName(//$NON-NLS-1$
        GetterSetterUtil.getGetterName(field, null) + "() : " + fieldTypeName));
        //$NON-NLS-1$
        buf.append(" - ", StyledString.QUALIFIER_STYLER);
        buf.append(Messages.format(JavaTextMessages.GetterSetterCompletionProposal_getter_label, fieldNameLabel), StyledString.QUALIFIER_STYLER);
    } else {
        buf.append(BasicElementLabels.getJavaElementName(//$NON-NLS-1$
        GetterSetterUtil.getSetterName(field, null) + '(' + fieldTypeName + ") : void"));
        //$NON-NLS-1$
        buf.append(" - ", StyledString.QUALIFIER_STYLER);
        buf.append(Messages.format(JavaTextMessages.GetterSetterCompletionProposal_setter_label, fieldNameLabel), StyledString.QUALIFIER_STYLER);
    }
    return buf;
}
Also used : StyledString(org.eclipse.jface.viewers.StyledString) StyledString(org.eclipse.jface.viewers.StyledString)

Example 57 with StyledString

use of org.eclipse.jface.viewers.StyledString in project che by eclipse.

the class Strings method markLTR.

/**
	 * Adds special marks so that that the given styled string is readable in a BiDi environment.
	 * 
	 * @param styledString the styled string
	 * @return the processed styled string
	 * @since 3.4
	 */
public static StyledString markLTR(StyledString styledString) {
    if (!USE_TEXT_PROCESSOR)
        return styledString;
    String inputString = styledString.getString();
    String string = TextProcessor.process(inputString);
    if (string != inputString)
        insertMarks(styledString, inputString, string);
    return styledString;
}
Also used : StyledString(org.eclipse.jface.viewers.StyledString)

Example 58 with StyledString

use of org.eclipse.jface.viewers.StyledString in project translationstudio8 by heartsome.

the class WorkbenchLabelProvider method getStyledText.

/**
	 * The default implementation of this returns the styled text label for the given element.
	 * @param element
	 *            the element to evaluate the styled string for
	 * @return the styled string.
	 * @since 3.7
	 */
public StyledString getStyledText(Object element) {
    IWorkbenchAdapter3 adapter = getAdapter3(element);
    if (adapter == null) {
        // here.
        return new StyledString(getText(element));
    }
    StyledString styledString = adapter.getStyledText(element);
    // Now, re-use any existing decorateText implementation, to decorate
    // this styledString.
    String decorated = decorateText(styledString.getString(), element);
    Styler styler = getDecorationStyle(element);
    return StyledCellLabelProvider.styleDecoratedString(decorated, styler, styledString);
}
Also used : StyledString(org.eclipse.jface.viewers.StyledString) StyledString(org.eclipse.jface.viewers.StyledString) Styler(org.eclipse.jface.viewers.StyledString.Styler) IWorkbenchAdapter3(org.eclipse.ui.model.IWorkbenchAdapter3)

Example 59 with StyledString

use of org.eclipse.jface.viewers.StyledString in project ow by vtst.

the class LessLabelProvider method text.

StyledString text(ImportStatement obj) {
    StyledString ss = new StyledString("@import ", atKeywordStyler);
    ss.append(obj.getUri(), italicStyler);
    return ss;
}
Also used : StyledString(org.eclipse.jface.viewers.StyledString)

Example 60 with StyledString

use of org.eclipse.jface.viewers.StyledString in project ow by vtst.

the class LessLabelProvider method text.

StyledString text(MediaStatement obj) {
    StyledString ss = new StyledString("@media", atKeywordStyler);
    EList<MediaQuery> medias = obj.getMedia_queries().getMedia_query();
    boolean first = true;
    for (MediaQuery mediaQuery : medias) {
        if (first)
            first = false;
        else
            ss.append(",");
        if (mediaQuery.getKeyword() != null) {
            ss.append(" ");
            ss.append(mediaQuery.getKeyword());
        }
        ss.append(" ");
        ss.append(mediaQuery.getMedia_type());
    }
    return ss;
}
Also used : MediaQuery(net.vtst.ow.eclipse.less.less.MediaQuery) StyledString(org.eclipse.jface.viewers.StyledString)

Aggregations

StyledString (org.eclipse.jface.viewers.StyledString)95 Image (org.eclipse.swt.graphics.Image)17 JavaCompletionProposal (org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposal)8 LazyJavaCompletionProposal (org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal)8 ViewerCell (org.eclipse.jface.viewers.ViewerCell)5 GridData (org.eclipse.swt.layout.GridData)5 Table (org.eclipse.swt.widgets.Table)5 Entry (java.util.Map.Entry)4 StyledCellLabelProvider (org.eclipse.jface.viewers.StyledCellLabelProvider)4 Styler (org.eclipse.jface.viewers.StyledString.Styler)4 Capability (org.osgi.resource.Capability)4 EObject (org.eclipse.emf.ecore.EObject)3 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 Composite (org.eclipse.swt.widgets.Composite)3 Label (org.eclipse.swt.widgets.Label)3 Version (org.osgi.framework.Version)3 Resource (org.osgi.resource.Resource)3 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)2 IStatus (org.eclipse.core.runtime.IStatus)2