Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.StyledString


  // }
  @Test public void should_return_label_for_stream() {
    Stream stream = xtext.findFirst(Stream.class);
    Object label = labels.labelFor(stream);
    assertThat(label, instanceOf(StyledString.class));
    StyledString labelText = (StyledString) label;
    assertThat(labelText.getString(), equalTo("PersonStream (Person, Type)"));
  }
View Full Code Here


  // }
  @Test public void should_return_label_for_stream_with_unresolved_client_message() {
    Stream stream = xtext.findFirst(Stream.class);
    Object label = labels.labelFor(stream);
    assertThat(label, instanceOf(StyledString.class));
    StyledString labelText = (StyledString) label;
    assertThat(labelText.getString(), equalTo("PersonStream (<unresolved>, Type)"));
  }
View Full Code Here

  // }
  @Test public void should_return_label_for_stream_with_unresolved_server_message() {
    Stream stream = xtext.findFirst(Stream.class);
    Object label = labels.labelFor(stream);
    assertThat(label, instanceOf(StyledString.class));
    StyledString labelText = (StyledString) label;
    assertThat(labelText.getString(), equalTo("PersonStream (Person, <unresolved>)"));
  }
View Full Code Here

    return (ProtobufScopeProvider) super.getScopeProvider();
  }

  @Override public ICompletionProposal createCompletionProposal(String proposal, String displayString, Image image,
      ContentAssistContext contentAssistContext) {
    StyledString styled = null;
    if (displayString != null) {
      styled = new StyledString(displayString);
    }
    int priority = getPriorityHelper().getDefaultPriority();
    String prefix = contentAssistContext.getPrefix();
    return createCompletionProposal(proposal, styled, image, priority, prefix, contentAssistContext);
  }
View Full Code Here

  private Object labelFor(Import anImport) {
    return imports.uriAsEnteredByUser(anImport);
  }

  private Object labelFor(Literal literal) {
    StyledString text = new StyledString(nameResolver.nameOf(literal));
    String index = String.format(" [%d]", literal.getIndex());
    text.append(index, DECORATIONS_STYLER);
    return text;
  }
View Full Code Here

    return text;
  }


  private Object labelFor(MessageField field) {
    StyledString text = new StyledString(nameResolver.nameOf(field));
    String typeName = messageFields.typeNameOf(field);
    if (typeName == null) {
      typeName = unresolved;
    }
    String indexAndType = String.format(" [%d] : %s", field.getIndex(), typeName);
    text.append(indexAndType, DECORATIONS_STYLER);
    return text;
  }
View Full Code Here

    text.append(indexAndType, DECORATIONS_STYLER);
    return text;
  }

  private Object labelFor(Rpc rpc) {
    StyledString text = new StyledString(nameResolver.nameOf(rpc));
    String types = String.format(" : %s > %s", nameOf(rpc.getArgType()), nameOf(rpc.getReturnType()));
    text.append(types, DECORATIONS_STYLER);
    return text;
  }
View Full Code Here

    text.append(types, DECORATIONS_STYLER);
    return text;
  }

  private Object labelFor(Stream stream) {
    StyledString text = new StyledString(nameResolver.nameOf(stream));
    String types = String.format(" (%s, %s)", nameOf(stream.getClientMessage()), nameOf(stream.getServerMessage()));
    text.append(types, DECORATIONS_STYLER);
    return text;
  }
View Full Code Here

    return null;
  }
 
  @Override
  public StyledString getStyledText(Object element) {
    StyledString ss = super.getStyledText(element);
    if(element instanceof function){
      String text = ss.getString();
      if(isDefaultXVRFunc(text)){
        XVRStyler sty = new XVRStyler();
        ss.setStyle(0, text.length(), sty);
      }
    }
    return ss;
  }
View Full Code Here

    public void update(ViewerCell cell) {
        Object element = cell.getElement();
        if (element != null && element instanceof ITreeElement) {
            ITreeElement treeElement = (ITreeElement) element;

            StyledString styledString = treeElement.getStyledText();
            if (styledString != null) {
                cell.setText(styledString.toString());
                cell.setStyleRanges(styledString.getStyleRanges());
            } else {
                cell.setText(null);
            }

            cell.setImage(treeElement.getImage());
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.