@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);
 }
示例#3
0
 private void updateInput() {
   if (this.infoText == null || !this.inputChanged) {
     return;
   }
   if (this.labelProvider == null) {
     this.labelProvider =
         new RLabelProvider(
             RLabelProvider.LONG | RLabelProvider.HEADER | RLabelProvider.NAMESPACE);
   }
   if (this.input != null) {
     final Image image = this.labelProvider.getImage(this.input.getElement());
     this.titleImage.setImage(
         (image != null)
             ? image
             : SharedUIResources.getImages().get(SharedUIResources.PLACEHOLDER_IMAGE_ID));
     final StyledString styleString =
         this.labelProvider.getStyledText(
             this.input.getElement(), this.input.getElementName(), this.input.getElementAttr());
     if (this.input.isElementOfActiveBinding()) {
       styleString.append(" (active binding)", StyledString.QUALIFIER_STYLER);
     }
     this.titleText.setText(styleString.getString());
     this.titleText.setStyleRanges(styleString.getStyleRanges());
     if (this.input.hasDetail()) {
       this.infoText.setText(
           this.input.getDetailTitle()
               + '\n'
               + ((this.input.getDetailInfo() != null)
                   ? this.input.getDetailInfo()
                   : "")); //$NON-NLS-1$
       final StyleRange title =
           new StyleRange(0, this.input.getDetailTitle().length(), null, null);
       title.underline = true;
       this.infoText.setStyleRange(title);
     } else {
       this.infoText.setText(""); // $NON-NLS-1$
     }
   } else {
     this.titleImage.setImage(
         SharedUIResources.getImages().get(SharedUIResources.PLACEHOLDER_IMAGE_ID));
     this.titleText.setText(""); // $NON-NLS-1$
     this.infoText.setText(""); // $NON-NLS-1$
   }
   if ((this.mode & MODE_FOCUS) != 0) {
     getToolBarManager().update(true);
   } else {
     setStatusText(
         (this.input.getControl() != null && this.input.getControl().isFocusControl())
             ? InformationDispatchHandler.getTooltipAffordanceString()
             : ""); //$NON-NLS-1$
   }
   this.inputChanged = false;
 }
    @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);
    }
 @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);
 }
 private void updateInput() {
   if (fInfoText == null || !fInputChanged) {
     return;
   }
   if (fLabelProvider == null) {
     fLabelProvider =
         new RLabelProvider(
             RLabelProvider.LONG | RLabelProvider.HEADER | RLabelProvider.NAMESPACE);
   }
   if (fInput != null) {
     final Image image = fLabelProvider.getImage(fInput.element);
     fTitleImage.setImage(
         (image != null)
             ? image
             : SharedUIResources.getImages().get(SharedUIResources.PLACEHOLDER_IMAGE_ID));
     final StyledString styleString =
         fLabelProvider.getStyledText(
             fInput.element, fInput.element.getElementName(), fInput.elementAttr);
     fTitleText.setText(styleString.getString());
     fTitleText.setStyleRanges(styleString.getStyleRanges());
     if (fInput.detailTitle != null) {
       fInfoText.setText(
           fInput.detailTitle
               + '\n'
               + ((fInput.detailInfo != null) ? fInput.detailInfo : "")); // $NON-NLS-1$
       final StyleRange title = new StyleRange(0, fInput.detailTitle.length(), null, null);
       title.underline = true;
       fInfoText.setStyleRange(title);
     } else {
       fInfoText.setText(""); // $NON-NLS-1$
     }
   } else {
     fTitleImage.setImage(
         SharedUIResources.getImages().get(SharedUIResources.PLACEHOLDER_IMAGE_ID));
     fTitleText.setText(""); // $NON-NLS-1$
     fInfoText.setText(""); // $NON-NLS-1$
   }
   if (fMode == MODE_SIMPLE) {
     setStatusText(
         (fInput.control != null && fInput.control.isFocusControl())
             ? InformationDispatchHandler.getTooltipAffordanceString()
             : ""); //$NON-NLS-1$
   }
   fInputChanged = false;
 }
    @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);
    }