本文整理匯總了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));
}
示例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;
}
示例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 );
}
}
示例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 () );
}
}
示例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 );
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}