當前位置: 首頁>>代碼示例>>Java>>正文


Java StyledString.append方法代碼示例

本文整理匯總了Java中org.eclipse.jface.viewers.StyledString.append方法的典型用法代碼示例。如果您正苦於以下問題:Java StyledString.append方法的具體用法?Java StyledString.append怎麽用?Java StyledString.append使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jface.viewers.StyledString的用法示例。


在下文中一共展示了StyledString.append方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getStyledText

import org.eclipse.jface.viewers.StyledString; //導入方法依賴的package包/類
@Override
public StyledString getStyledText(Object element) {
	if (element instanceof WorkingSet) {
		final WorkingSet workingSet = (WorkingSet) element;
		final WorkingSetManager manager = workingSet.getWorkingSetManager();

		final String name = workingSet.getName();
		final List<String> allNames = transform(manager.getAllWorkingSets(), ws -> ws.getName());
		if (containsDuplicates(name, allNames)) {
			final String suffix = " [" + workingSet.getId() + "]";
			final StyledString string = new StyledString(name);
			string.append(suffix, COUNTER_STYLER);
			return string;
		}
	}
	return new StyledString(getText(element));
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:18,代碼來源:WorkingSetLabelProvider.java

示例2: getConnectionString

import org.eclipse.jface.viewers.StyledString; //導入方法依賴的package包/類
private StyledString getConnectionString ( final ConnectionHolder holder )
{
    final ConnectionService service = holder.getConnectionService ();

    final ConnectionDescriptor desc = holder.getConnectionInformation ();

    final StyledString str = new StyledString ( makeLabel ( desc.getConnectionInformation () ) );

    if ( service != null )
    {
        str.append ( " [", StyledString.DECORATIONS_STYLER ); //$NON-NLS-1$
        final Connection connection = service.getConnection ();
        if ( connection != null )
        {
            str.append ( String.format ( "%s", holder.getConnectionState () ), StyledString.DECORATIONS_STYLER ); //$NON-NLS-1$
        }
        str.append ( "]", StyledString.DECORATIONS_STYLER ); //$NON-NLS-1$
    }

    if ( desc.getServiceId () != null )
    {
        str.append ( String.format ( " (%s)", desc.getServiceId () ), StyledString.QUALIFIER_STYLER ); //$NON-NLS-1$ 
    }

    return str;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:27,代碼來源:ConnectionLabelProvider.java

示例3: updateLabel

import org.eclipse.jface.viewers.StyledString; //導入方法依賴的package包/類
@Override
public void updateLabel ( final StyledViewerLabel label, final Object element )
{
    if ( element instanceof QueryListWrapper )
    {
        label.setText ( "Test Queries" );
    }
    else if ( element instanceof QueryBean )
    {
        final QueryBean query = (QueryBean)element;
        final StyledString text = new StyledString ();
        text.append ( String.format ( "%.20s:%.40s", query.getFilterType (), query.getFilterData () ) );
        text.append ( " " );
        text.append ( String.format ( "%s", query.getCount () ), StyledString.COUNTER_STYLER );
        text.append ( " " );
        text.append ( String.format ( "[%s]", query.getState () ), StyledString.DECORATIONS_STYLER );
        label.setStyledText ( text );
        label.setTooltipText ( String.format ( "%s%n%s", query.getFilterType (), query.getFilterData () ) );
    }
    else
    {
        super.updateLabel ( label, element );
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:25,代碼來源:LabelProvider.java

示例4: update

import org.eclipse.jface.viewers.StyledString; //導入方法依賴的package包/類
@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 () );
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:26,代碼來源:FlagsDetailsPart.java

示例5: update

import org.eclipse.jface.viewers.StyledString; //導入方法依賴的package包/類
protected void update ( final ViewerCell cell, final ServerEndpoint element )
{
    final StyledString str = new StyledString ();

    final boolean running = element.isRunning ();

    str.append ( element.getLabel () );

    cell.setText ( str.getString () );
    cell.setStyleRanges ( str.getStyleRanges () );

    if ( element.getError () != null )
    {
        cell.setImage ( this.errorImage );
    }
    else
    {
        cell.setImage ( running ? this.runningImage : this.stoppedImage );
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:21,代碼來源:ServerLabelProvider.java

示例6: getStyledText

import org.eclipse.jface.viewers.StyledString; //導入方法依賴的package包/類
@Override
public StyledString getStyledText(Object element) {

	if(!(element instanceof IScannable<?>)) return new StyledString();

	final String       text       = getText(element);
	final StyledString styledText = new StyledString(text!=null?text:"");

	IScannable<?> scannable = (IScannable<?>)element;
	try {

		if (scannable.getUnit() != null) {
			styledText.append("    ");
			styledText.append(scannable.getUnit(), StyledString.DECORATIONS_STYLER);

		} else {

			// Intentionally do nothing!
		}
	} catch (Exception ne) {
		String message = ne.getMessage() == null ? "" : ne.getMessage();
		return styledText.append(message, StyledString.QUALIFIER_STYLER);
	}

	return styledText;
}
 
開發者ID:eclipse,項目名稱:scanning,代碼行數:27,代碼來源:ScannableValueLabelProvider.java

示例7: appendResultsToStyledString

import org.eclipse.jface.viewers.StyledString; //導入方法依賴的package包/類
/**
 * Turn the results into a styled string for display to user, highlighting key values
 * @param results The ValidationResults
 * @return a StyledString to display on the view
 */
private StyledString appendResultsToStyledString(ValidateResults results) {
	StyledString styledString = new StyledString();
	if (results.getResults() != null) {
		if (results.getResults() instanceof String) {
			// Print out all the results from the raw PVStructure string, but style key information
			String resultString = (String)results.getResults();
			styledString.append(resultString);

			// Style the duration
			adjustStyleOfDuration(styledString, resultString);

			// Style the axes to move
			adjustStyleOfAxesToMove(styledString, resultString);

		} else {
			// not a string, just print out the results object
			 styledString.append(results.getResults().toString());
		}
	}

	return styledString;

}
 
開發者ID:eclipse,項目名稱:scanning,代碼行數:29,代碼來源:ValidateResultsView.java

示例8: getStyledDisplayString

import org.eclipse.jface.viewers.StyledString; //導入方法依賴的package包/類
@Override
public StyledString getStyledDisplayString(IDocument document, int offset, BoldStylerProvider boldStylerProvider) {
	// Highlight matched prefix
	StyledString styledDisplayString = new StyledString();
	styledDisplayString.append(getStyledDisplayString());

	String pattern = getPatternToEmphasizeMatch(document, offset);
	if (pattern != null && pattern.length() > 0) {
		String displayString = styledDisplayString.getString();
		int[] bestSequence = completionEntry.getMatcher().bestSubsequence(displayString, pattern);
		int highlightAdjustment = 0;
		for (int index : bestSequence) {
			styledDisplayString.setStyle(index + highlightAdjustment, 1, boldStylerProvider.getBoldStyler());
		}
	}
	return styledDisplayString;
}
 
開發者ID:angelozerr,項目名稱:ec4e,代碼行數:18,代碼來源:EditorConfigCompletionProposal.java

示例9: getStyledText

import org.eclipse.jface.viewers.StyledString; //導入方法依賴的package包/類
@Override
public StyledString getStyledText(Context context, Bookmark bookmark) {
	StyledString styledString = super.getStyledText(context, bookmark);
	BookmarkFolder bookmarkFolder = (BookmarkFolder) bookmark;
	BookmarkId bookmarkId = bookmarkFolder.getId();
	Optional<BookmarkMapping> bookmarkMapping = bookmarkMappings.getMapping(bookmarkId);
	if (!bookmarkMapping.isPresent()) {
		return styledString;
	}
	String sharingUser = bookmarkMapping.get().getProperties().get(BookmarkMapping.PROP_SHARING_USER);
	if (sharingUser == null) {
		return styledString;
	}
	Styler styler = stylerProvider.getStyler(null, Display.getCurrent().getSystemColor(SWT.COLOR_DARK_YELLOW),
			null);
	styledString.append(String.format(" [Shared by %s]", sharingUser), styler);
	return styledString;
}
 
開發者ID:cchabanois,項目名稱:mesfavoris,代碼行數:19,代碼來源:GDriveBookmarkFolderLabelProvider.java

示例10: getStyledText

import org.eclipse.jface.viewers.StyledString; //導入方法依賴的package包/類
@Override
public StyledString getStyledText(Object element) {
	PathPlaceholder pathPlaceholder = (PathPlaceholder) element;
	StyledString sb = new StyledString();
	sb.append(pathPlaceholder.getName());
	sb.append(" (");
	if (isUnmodifiable(pathPlaceholder)) {
		sb.append("non modifiable, ");
	}
	sb.append(
			MessageFormat.format("{0} matches",
					Integer.toString(placeholderStats.getUsageCount(pathPlaceholder.getName()))),
			StyledString.COUNTER_STYLER);
	sb.append(')');
	sb.append(" - ");
	if (pathPlaceholder.getPath() != null) {
		sb.append(pathPlaceholder.getPath().toString());
	}
	return sb;
}
 
開發者ID:cchabanois,項目名稱:mesfavoris,代碼行數:21,代碼來源:PathPlaceholderTableLabelProvider.java

示例11: getStyledText

import org.eclipse.jface.viewers.StyledString; //導入方法依賴的package包/類
@Override
public StyledString getStyledText(Context context, Bookmark bookmark) {
	BookmarkFolder bookmarkFolder = (BookmarkFolder) bookmark;
	StyledString result = super.getStyledText(context, bookmark);
	RemoteBookmarkFolder remoteBookmarkFolder = remoteBookmarksStoreManager
			.getRemoteBookmarkFolder(bookmarkFolder.getId());
	if (remoteBookmarkFolder != null) {
		IRemoteBookmarksStore remoteBookmarksStore = remoteBookmarksStoreManager
				.getRemoteBookmarksStore(remoteBookmarkFolder.getRemoteBookmarkStoreId());
		Optional<Integer> bookmarksCount = getBookmarksCount(remoteBookmarkFolder);
		if (bookmarksCount.isPresent()) {
			result.append(String.format(" (%d)", bookmarksCount.get()), stylerProvider.getStyler(null,
					Display.getCurrent().getSystemColor(SWT.COLOR_DARK_YELLOW), null));
		}
		if (remoteBookmarksStore.getState() == State.connected && isReadOnly(remoteBookmarkFolder)) {
			result.append(" [readonly]", stylerProvider.getStyler(null,
					Display.getCurrent().getSystemColor(SWT.COLOR_DARK_YELLOW), null));
		}
	}

	return result;
}
 
開發者ID:cchabanois,項目名稱:mesfavoris,代碼行數:23,代碼來源:BookmarkFolderLabelProvider.java

示例12: getStyledDisplayString

import org.eclipse.jface.viewers.StyledString; //導入方法依賴的package包/類
@Override
public StyledString getStyledDisplayString(IDocument document, int offset, BoldStylerProvider boldStylerProvider) {
	// Highlight matched prefix
	StyledString styledDisplayString = new StyledString();
	styledDisplayString.append(getStyledDisplayString());

	String pattern = getPatternToEmphasizeMatch(document, offset);
	if (pattern != null && pattern.length() > 0) {
		String displayString = styledDisplayString.getString();
		int[] bestSequence = getMatcher().bestSubsequence(displayString, pattern);
		int highlightAdjustment = 0;
		for (int index : bestSequence) {
			styledDisplayString.setStyle(index + highlightAdjustment, 1, boldStylerProvider.getBoldStyler());
		}
	}
	return styledDisplayString;
}
 
開發者ID:angelozerr,項目名稱:typescript.java,代碼行數:18,代碼來源:TypeScriptCompletionProposalWithExtension7.java

示例13: getDisplayName

import org.eclipse.jface.viewers.StyledString; //導入方法依賴的package包/類
private static StyledString getDisplayName(String methodName, String returnTypeSig) {
  StyledString buf = new StyledString();
  buf.append(methodName);
  buf.append('(');
  buf.append(')');
  if (returnTypeSig != null) {
    buf.append(" : "); // $NON-NLS-1$
    buf.append(Signature.toString(returnTypeSig));
    buf.append(" - ", StyledString.QUALIFIER_STYLER); // $NON-NLS-1$
    buf.append(
        JavaTextMessages.MethodCompletionProposal_method_label, StyledString.QUALIFIER_STYLER);
  } else {
    buf.append(" - ", StyledString.QUALIFIER_STYLER); // $NON-NLS-1$
    buf.append(
        JavaTextMessages.MethodCompletionProposal_constructor_label,
        StyledString.QUALIFIER_STYLER);
  }
  return buf;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:20,代碼來源:MethodDeclarationCompletionProposal.java

示例14: getStyledText

import org.eclipse.jface.viewers.StyledString; //導入方法依賴的package包/類
public StyledString getStyledText(Object element) {
StyledString styledString = new StyledString();
if (element instanceof CollectionNode) {
    styledString.append(((CollectionNode) element).getLabel());
    styledString.append(String.format(" (%s / %s)", ((CollectionNode) element).getResource().getCollectionMediaClipList().size(), ((CollectionNode) element).getResource().getCollectionMediaList().size()), StyledString.COUNTER_STYLER);
} else if (element instanceof AnnotationSetNode) {
    AnnotationSetNode aElement = (AnnotationSetNode) element;
    styledString.append(aElement.getLabel());
    if (aElement.getResource().isLock()) {
	styledString.append(" (Completed)", StyledString.COUNTER_STYLER);
    }
} else if (element instanceof INode) {
    INode node = (INode) element;
    if (node.getLabel() != null) {
	styledString.append(((INode) element).getLabel());
    }
} else {
    styledString.append("Unknown");
}
return styledString;
   }
 
開發者ID:synergynet,項目名稱:synergyview,代碼行數:22,代碼來源:NavigatorLabelProvider.java

示例15: appendParameterSignature

import org.eclipse.jface.viewers.StyledString; //導入方法依賴的package包/類
/**
 * Creates a display string of a parameter list (without the parentheses) for the given parameter
 * types and names.
 *
 * @param buffer the string buffer
 * @param parameterTypes the parameter types
 * @param parameterNames the parameter names
 * @return the display string of the parameter list defined by the passed arguments
 */
private final StyledString appendParameterSignature(
    StyledString buffer, char[][] parameterTypes, char[][] parameterNames) {
  if (parameterTypes != null) {
    for (int i = 0; i < parameterTypes.length; i++) {
      if (i > 0) {
        buffer.append(',');
        buffer.append(' ');
      }
      buffer.append(parameterTypes[i]);
      if (parameterNames != null && parameterNames[i] != null) {
        buffer.append(' ');
        buffer.append(parameterNames[i]);
      }
    }
  }
  return buffer;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:27,代碼來源:CompletionProposalLabelProvider.java


注:本文中的org.eclipse.jface.viewers.StyledString.append方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。