@Override
 public void update(ViewerCell cell) {
   CeylonHierarchyNode n = (CeylonHierarchyNode) cell.getElement();
   if (n.isMultiple()) {
     cell.setText("multiple supertypes" + getViewInterfacesShortcut());
     cell.setStyleRanges(new StyleRange[0]);
     cell.setImage(MULTIPLE_TYPES_IMAGE);
   } else {
     StyledString styledText = getStyledText(n);
     cell.setText(styledText.toString());
     cell.setStyleRanges(styledText.getStyleRanges());
     cell.setImage(getImageForDeclaration(getDisplayedDeclaration(n), n.isFocus()));
   }
   super.update(cell);
 }
Ejemplo n.º 2
0
    @Override
    public void update(ViewerCell cell) {
      EObject o = (EObject) cell.getElement();

      String label = ""; // $NON-NLS-1$
      Image img = null;
      AbstractComponentEditor elementEditor = getEditor().getEditor(o.eClass());
      if (elementEditor != null) {
        label = elementEditor.getDetailLabel(o);
        label = label == null ? elementEditor.getLabel(o) : label;
        img = elementEditor.getImage(o, composite.getDisplay());
      }

      List<String> parentPath = new ArrayList<String>();
      while (o.eContainer() != null) {
        o = o.eContainer();
        elementEditor = getEditor().getEditor(o.eClass());
        if (elementEditor != null) {
          parentPath.add(0, elementEditor.getLabel(o));
        }
      }

      String parentString = ""; // $NON-NLS-1$
      for (String p : parentPath) {
        parentString += "/" + p; // $NON-NLS-1$
      }

      StyledString s = new StyledString(label);
      s.append(" - " + parentString, StyledString.DECORATIONS_STYLER); // $NON-NLS-1$
      cell.setStyleRanges(s.getStyleRanges());
      cell.setText(s.getString());
      cell.setImage(img);
    }
 @Override
 public void update(ViewerCell cell) {
   Object element = cell.getElement();
   StyledString styledText = getStyledText(element);
   cell.setText(styledText.toString());
   cell.setStyleRanges(styledText.getStyleRanges());
   cell.setImage(getImage(element));
   super.update(cell);
 }
    @Override
    public void update(ViewerCell cell) {
      ExtractedEntry entry = (ExtractedEntry) cell.getElement();
      String text = getText(entry);
      if (text == null) text = ""; // $NON-NLS-1$

      boolean strikeout = !entry.isImported();
      StyledString styledString = new StyledString(text, strikeout ? strikeoutStyler : null);

      cell.setText(styledString.toString());
      cell.setStyleRanges(styledString.getStyleRanges());
      cell.setImage(getImage(entry));

      super.update(cell);
    }
Ejemplo n.º 5
0
    @Override
    public void update(ViewerCell cell) {
      // result on given cell text
      String cellText = (String) cell.getElement();

      StyledString styledLabel = new StyledString();

      String customLabel;
      if (cellText.contains("1")) {
        if (cellText.contains("2")) {
          customLabel = "3";
        } else {
          customLabel = "1";
        }
      } else {
        if (cellText.contains("2")) {
          customLabel = "2";
        } else {
          customLabel = "0";
        }
      }

      if (cellText.contains("1")) {
        styledLabel.append(customLabel + "spre" + modifier, StyledString.COUNTER_STYLER);
        styledLabel.append(" ", null);
      }

      styledLabel.append(customLabel + "nonstyled" + modifier, null);

      if (cellText.contains("2")) {
        styledLabel.append(" ", null);
        styledLabel.append(customLabel + "spost" + modifier, StyledString.COUNTER_STYLER);
      }

      cell.setText(styledLabel.toString());
      cell.setStyleRanges(styledLabel.getStyleRanges());

      super.update(cell);
    }