Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.StyledString


        return roster.getEntry(jid.getBase());
    }

    @Override
    public StyledString getStyledText() {
        StyledString styledString = new StyledString();
        final String subscription_pending = Messages.RosterEntryElement_subscription_pending;
        final String connected_using = Messages.RosterEntryElement_connected_using;

        /*
         * Name
         */
        RosterEntry rosterEntry = this.getRosterEntry();
        styledString.append((rosterEntry == null) ? this.jid.toString()
            : RosterUtils.getDisplayableName(rosterEntry));

        /*
         * Append presence information if available. Otherwise append presence.
         */
        final Presence presence = roster.getPresence(this.jid.getBase());
        if (rosterEntry != null
            && rosterEntry.getStatus() == RosterPacket.ItemStatus.SUBSCRIPTION_PENDING) {
            styledString.append(" (" + subscription_pending + ")", //$NON-NLS-1$ //$NON-NLS-2$
                StyledString.COUNTER_STYLER);
        } else if (presence != null && presence.getType() != Type.available
            && presence.getType() != Type.unavailable) {
            styledString.append(" (" + presence.getType() + ")", //$NON-NLS-1$ //$NON-NLS-2$
                StyledString.COUNTER_STYLER);
        }

        /*
         * Append DataTransfer state information if debug mode is enabled.
         */
        if (presence != null && presence.isAvailable()) {
            final NetTransferMode transferMode = dataTransferManager
                .getTransferMode(jid);

            if (transferMode != NetTransferMode.NONE) {
                styledString.append(
                    " " + MessageFormat.format(connected_using, transferMode), //$NON-NLS-1$
                    StyledString.QUALIFIER_STYLER);
            }
        }
        return styledString;
View Full Code Here


        this.rosterGroup = rosterGroup;
    }

    @Override
    public StyledString getStyledText() {
        return new StyledString(this.rosterGroup.getName());
    }
View Full Code Here

        this.roster = roster;
    }

    @Override
    public StyledString getStyledText() {
        StyledString styledString = new StyledString();
        styledString.append(Messages.RosterHeaderElement_buddies, boldStyler);
        return styledString;
    }
View Full Code Here

        return this.user;
    }

    @Override
    public StyledString getStyledText() {
        StyledString styledString = new StyledString();
        final String read_only = Messages.UserElement_read_only;
        final String following = Messages.UserElement_following;
        final String joining = Messages.UserElement_joining;

        /*
         * Name
         */
        styledString.append(user.getHumanReadableName());

        /*
         * Right level
         */
        if (user.hasReadOnlyAccess()) {
            styledString.append(" (" + read_only + ")", //$NON-NLS-1$ //$NON-NLS-2$
                StyledString.COUNTER_STYLER);
        }

        /*
         * Other
         */
        if (user.equals(editorManager.getFollowedUser())) {
            styledString.append(" (" + following + ")", //$NON-NLS-1$ //$NON-NLS-2$
                StyledString.QUALIFIER_STYLER);
        }

        if (!user.isInvitationComplete()) {
            styledString.append(" (" + joining + ")", //$NON-NLS-1$ //$NON-NLS-2$
                StyledString.COUNTER_STYLER);
        }

        return styledString;
    }
View Full Code Here

        this.rosterSessionInput = rosterSessionInput;
    }

    @Override
    public StyledString getStyledText() {
        StyledString styledString = new StyledString();
        if (rosterSessionInput == null
            || rosterSessionInput.getSarosSession() == null) {
            styledString.append(
                Messages.SessionHeaderElement_no_session_running, boldStyler);
        } else {
            styledString.append(Messages.SessionHeaderElement_session,
                boldStyler);
        }
        return styledString;
    }
View Full Code Here

   * 1: <a></a> (2 matches)</p>
   *
   * @see org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider#getStyledText(java.lang.Object)
   */
  public StyledString getStyledText(Object obj) {
    StyledString styledText = new StyledString();
    BasicSearchMatchElement element = null;
    if (obj instanceof Match) {
      Match match = (Match) obj;

      if(match.getElement() instanceof BasicSearchMatchElement) {
        element = (BasicSearchMatchElement) match.getElement();
      }
    } else if(obj instanceof BasicSearchMatchElement) {
      element = (BasicSearchMatchElement)obj;
    }
   
    //get the match count if possible
    int matchCount = 0;
    Match[] matches = new Match[0];
    if(fPage != null) {
      matches = fPage.getInput().getMatches(obj);
      matchCount = matches.length;
    }
   
    //if everything was of the right type create our formated message,
    //else use the toString of the given object for the message
    if(element != null) {
      String message = element.getLine().trim(); //$NON-NLS-1$
      int trimedAmount = element.getLine().indexOf(message);
      String lineNum = element.getLineNum() + 1 + ": "; //$NON-NLS-1$
     
      styledText.append(lineNum, StyledString.QUALIFIER_STYLER);
      styledText.append(message);
     
      //get the match count if possible
      for(int i = 0; i < matchCount; ++i) {
        int offset = matches[i].getOffset() - element.geLineOffset() + lineNum.length() - trimedAmount;
        styledText.setStyle(offset, matches[i].getLength(), HIGHLIGHT_WRITE_STYLE);
      }
     
    } else {
      styledText.append(obj.toString());
    }
   
    //append the match count if its worth appending
    if (matchCount > 1) {
      String matchesMsg = " " + MessageFormat.format(
        SSEUIMessages.TextSearchLabelProvider_matchCountFormat,
        new Object[] { new Integer(matchCount) });
      styledText.append(matchesMsg, StyledString.COUNTER_STYLER);
    }
 
    return styledText;
  }
View Full Code Here

      ICompletionProposal current= fFilteredProposals[index];

      String displayString;
      StyleRange[] styleRanges= null;
      if (fIsColoredLabelsSupportEnabled && current instanceof ICompletionProposalExtension6) {
        StyledString styledString= ((ICompletionProposalExtension6)current).getStyledDisplayString();
        displayString= styledString.getString();
        styleRanges= styledString.getStyleRanges();
      } else
        displayString= current.getDisplayString();

      item.setText(displayString);
      if (fIsColoredLabelsSupportEnabled)
View Full Code Here

  }

  @Override
  public StyledString getStyledText(Object element) {
    if (element == null) {
      return new StyledString();
    }

    if (!(element instanceof FitResource)) {
      return new StyledString(element.toString());
    }

    String text = getBasicText((FitResource) element);

    StyledString string = new StyledString(text);
    int index = text.indexOf(CONCAT_STRING);

    if (index != -1) {
      string.setStyle(index, text.length() - index,
          StyledString.QUALIFIER_STYLER);
    }
    return string;
  }
View Full Code Here

    }

    public StyledString getStyledDisplayString() {
      String defaultString = "no Default Proposals";
      if (replacementObject.toString().contains(defaultString)) {
        return new StyledString(defaultString);
      }
      return labelProvider.getStyledText(replacementObject);
    }
View Full Code Here

    return imgManager.getImage(icon);
  }

  public StyledString getStyledText(Object element) {
    if (!(element instanceof ATGSegment)) {
      return new StyledString(getText(element));
    }
    ATGSegment seg = (ATGSegment) element;
    StyledString sstr = new StyledString(seg.getName());
    sstr.append(seg.getAttributes(), StyledString.DECORATIONS_STYLER);
    return sstr;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.viewers.StyledString

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.