Exemple #1
0
 @Override
 public void update(ViewerCell cell) {
   LogicalTask logicalTask = (LogicalTask) cell.getElement();
   int columnIndex = cell.getColumnIndex();
   if (columnIndex == 0) {
     cell.setImage(severityImages[logicalTask.getSeverityType()]);
     cell.setText(logicalTask.getSummary());
     cell.setFont(logicalTask.getSeverityType() > 1 ? bold : null);
     cell.setForeground(logicalTask.isAllFixed() ? gray : null);
   } else {
     Version version = taskModel.getVersions()[columnIndex - 1];
     VersionTask versionTask = logicalTask.getVersionTask(version);
     if (versionTask != null) {
       cell.setText(versionTask.getStatus());
       cell.setFont(!"enhancement".equalsIgnoreCase(versionTask.getSeverity()) ? bold : null);
       cell.setForeground("FIXED".equalsIgnoreCase(versionTask.getResolution()) ? gray : null);
       cell.setBackground(logicalTask.getVersionTaskCount(version) > 1 ? red : null);
     } else {
       cell.setText("");
       cell.setFont(null);
       cell.setForeground(null);
       cell.setBackground(null);
     }
   }
 }
    /**
     * @see
     *     org.eclipse.jface.viewers.StyledCellLabelProvider#update(org.eclipse.jface.viewers.ViewerCell)
     */
    @Override
    public void update(ViewerCell cell) {
      // Interlace
      if (isInterlaceRow) {
        // Font
        cell.setText("BOLD");
        cell.setFont(SwtFonts.TEXT_BOLD.font());

        // Image
        cell.setImage(SwtImagesSilk.DELETE.image());

        // Color
        cell.setBackground(SwtColors.color(ColorType.RED));

      } else {
        // Font
        cell.setText("Normal");
        cell.setFont(SwtFonts.TEXT.font());

        // Image
        cell.setImage(SwtImagesSilk.ADD.image());

        // Color
        cell.setBackground(SwtColors.color(ColorType.GREEN));
      }
      isInterlaceRow = !isInterlaceRow;
      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);
 }
 @Override
 public void update(ViewerCell cell) {
   Object element = cell.getElement();
   if (element instanceof Cartridge) {
     Cartridge ink = (Cartridge) element;
     int index = cell.getColumnIndex();
     switch (index) {
       case 0: // UUID
         cell.setText(ink.getUuid().toString());
         break;
       case 1: // Maker
         cell.setText(ink.getMaker());
         break;
       case 2: // Model
         cell.setText(ink.getModel());
         break;
       case 3: // Abbreviation
         cell.setText(ink.getAbbreviation());
         break;
       case 4: // Name
         cell.setText(ink.getName());
         break;
       case 5: // Fill Volume
         cell.setText(Double.toString(ink.getFillVolume()));
         break;
       case 6: // Remaining Volume
         cell.setText(Double.toString(ink.getRemainingVolume()));
         break;
       case 7: // Installation Date
         Calendar installation = ink.getInstallDate();
         if (installation != null) {
           cell.setText(PrintPreferences.getDateFormat().format(installation.getTime()));
         }
         break;
       case 8: // Disposal Date
         Calendar disposal = ink.getDisposeDate();
         if (disposal != null) {
           cell.setText(PrintPreferences.getDateFormat().format(disposal.getTime()));
         }
         break;
       case 9: // Price
         cell.setText(ink.getPrice().toString());
         break;
       default:
         break;
     }
   }
 }
 @Override
 public void update(ViewerCell cell) {
   PlatzhalterTreeData data = (PlatzhalterTreeData) cell.getElement();
   if (data != null) {
     cell.setText(data.getName());
   }
 }
    @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();
   cell.setText(getText(element));
   Image image = getImage(element);
   cell.setImage(image);
 }
 @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(final ViewerCell cell) {
   final Object element = cell.getElement();
   String text = null;
   if (element instanceof RemoteR) {
     text = getText((RemoteR) element);
   }
   cell.setText(text);
 }
 public void update(ViewerCell cell) {
   SliceProfileRow element = (SliceProfileRow) cell.getElement();
   int index = cell.getColumnIndex();
   String columnText = getColumnText(element, index);
   cell.setText(columnText);
   cell.setImage(getColumnImage(element, index));
   if (sliceProfileIntersectionIndices.contains(element.getStatementID() - 1)) {
     cell.setBackground(highlightColor);
   } else cell.setBackground(null);
   super.update(cell);
 }
 @Override
 public void update(ViewerCell cell) {
   super.update(cell);
   ISellOrder t = (ISellOrder) cell.getElement();
   Object[] data = {null, null, null, null};
   getCellData(t, SellOrderTable.getColumns()[cell.getColumnIndex()], data);
   if (data[TEXT] != null) cell.setText((String) data[TEXT]);
   if (data[IMAGE] != null) cell.setImage((Image) data[IMAGE]);
   if (data[FONT] != null) cell.setFont((Font) data[FONT]);
   if (data[FOREGROUND] != null) cell.setForeground((Color) data[FOREGROUND]);
 }
Exemple #12
0
    protected void saveCellEditorValue(CellEditor cellEditor, ViewerCell cell) {
      int idx = ((Integer) cellEditor.getValue()).intValue();
      String[] items = ((ComboBoxCellEditor) cellEditor).getItems();

      String selectedVersion = items[idx];
      cell.setText(selectedVersion);

      if (cell.getElement() instanceof JarDiff) {
        ((JarDiff) cell.getElement()).setSelectedVersion(selectedVersion);
        return;
      }
      PackageInfo modelElement = (PackageInfo) cell.getElement();
      modelElement.setSelectedVersion(selectedVersion);
    }
Exemple #13
0
    @Override
    protected void saveCellEditorValue(CellEditor cellEditor, ViewerCell cell) {
      int idx = ((Integer) cellEditor.getValue()).intValue();
      String[] items = ((ComboBoxCellEditor) cellEditor).getItems();

      String selectedVersion = items[idx];
      cell.setText(selectedVersion);

      if (cell.getElement() instanceof Baseline) {
        ((Baseline) cell.getElement()).setSuggestedVersion(Version.parseVersion(selectedVersion));
      } else if (cell.getElement() instanceof Info) {
        ((Info) cell.getElement()).suggestedVersion = Version.parseVersion(selectedVersion);
      }
    }
    @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);
    }
Exemple #15
0
    @Override
    protected void initializeCellEditorValue(CellEditor cellEditor, ViewerCell cell) {

      String selectedVersion = "";
      if (cell.getElement() instanceof Baseline) {
        selectedVersion = ((Baseline) cell.getElement()).getSuggestedVersion().toString();
      } else if (cell.getElement() instanceof Info) {
        selectedVersion = ((Info) cell.getElement()).suggestedVersion.toString();
      }

      String[] items = ((ComboBoxCellEditor) cellEditor).getItems();
      int idx = 0;
      for (int i = 0; i < items.length; i++) {
        if (items[i].equals(selectedVersion)) {
          idx = i;
          break;
        }
      }

      cellEditor.setValue(idx);
      cell.setText(selectedVersion);
    }
    @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);
    }
Exemple #17
0
    protected void initializeCellEditorValue(CellEditor cellEditor, ViewerCell cell) {

      String selectedVersion;
      if (cell.getElement() instanceof JarDiff) {
        selectedVersion = ((JarDiff) cell.getElement()).getSelectedVersion();
      } else {
        PackageInfo pi = (PackageInfo) cell.getElement();
        selectedVersion = pi.getSelectedVersion();
      }

      String[] items = ((ComboBoxCellEditor) cellEditor).getItems();
      int idx = 0;
      for (int i = 0; i < items.length; i++) {
        if (items[i].equals(selectedVersion)) {
          idx = i;
          break;
        }
      }

      cellEditor.setValue(idx);
      cell.setText(selectedVersion);
    }
 @Override
 public void update(ViewerCell cell) {
   Person element = (Person) cell.getElement();
   cell.setText(element.getLastName());
   super.update(cell);
 }
 @Override
 public final void update(ViewerCell cell) {
   Activity activity = (Activity) cell.getElement();
   cell.setText(getText(activity));
 }
 @Override
 public void update(ViewerCell cell) {
   cell.setText(labelProvider.getText(cell.getElement()));
   cell.setImage(labelProvider.getImage(cell.getElement()));
 }
  @Override
  public void update(ViewerCell cell) {
    super.update(cell);

    SourceFilesViewer.TranslationUnitInfo tuInfo = null;
    Object element = cell.getElement();
    if (element instanceof ITranslationUnit) {
      tuInfo = SourceFilesViewer.fetchTranslationUnitInfo((Executable) viewer.getInput(), element);
    }

    int orgColumnIndex = cell.getColumnIndex();

    if (orgColumnIndex == 0) {
      if (element instanceof String) {
        cell.setText((String) element);
        Font italicFont =
            resourceManager.createFont(
                FontDescriptor.createFrom(viewer.getTree().getFont()).setStyle(SWT.ITALIC));
        cell.setFont(italicFont);
      } else {
        cell.setFont(viewer.getTree().getFont());
      }
    } else if (orgColumnIndex == 1) {
      cell.setText(null);
      if (tuInfo != null) {
        if (tuInfo.location != null) {
          cell.setText(tuInfo.location.toOSString());
          if (tuInfo.exists)
            cell.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
          else cell.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY));
        }
      }
      cell.setImage(null);
    } else if (orgColumnIndex == 2) {
      cell.setText(null);
      if (tuInfo != null && tuInfo.originalLocation != null) {
        cell.setText(tuInfo.originalLocation.toOSString());
        if (tuInfo.originalExists)
          cell.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
        else cell.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY));
      }
      cell.setImage(null);
    } else if (orgColumnIndex == 3) {
      cell.setText(null);
      if (tuInfo != null) {
        if (tuInfo.exists) {
          cell.setText(Long.toString(tuInfo.fileLength));
        }
      }
      cell.setImage(null);
    } else if (orgColumnIndex == 4) {
      cell.setText(null);
      if (tuInfo != null) {
        if (tuInfo.exists) {
          String dateTimeString =
              DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT)
                  .format(new Date(tuInfo.lastModified));
          cell.setText(dateTimeString);
        }
      }
      cell.setImage(null);
    } else if (orgColumnIndex == 5) {
      cell.setText(null);
      if (tuInfo != null) {
        if (tuInfo.location != null) {
          String fileExtension = tuInfo.location.getFileExtension();
          if (fileExtension != null) cell.setText(fileExtension.toLowerCase());
        }
      }
      cell.setImage(null);
    }
  }
Exemple #22
0
 @Override
 public void update(ViewerCell cell) {
   cell.setText(((ETItem) cell.getElement()).label);
 }