コード例 #1
0
 private void handleCopy() {
   String propertyId = descriptor.getId();
   Object value = source.getPropertyValue(propertyId);
   IPropertyTransfer transfer = parent.getTransfer();
   if (transfer != null) {
     transfer.setPropertyValueToClipboard(propertyId, value);
   }
 }
コード例 #2
0
  private void updateLabels() {
    Object value = source.getPropertyValue(descriptor.getId());
    if (nameLayout != null && !nameLayout.isDisposed()) {
      nameLayout.setText(descriptor.getDisplayName());
      nameLayout.setStyle(
          new TextStyle(canvas.getFont(), canvas.getForeground(), null),
          0,
          nameLayout.getText().length());
    }
    ILabelDescriptor labelDescriptor = descriptor.getLabelDescriptor();
    ImageDescriptor image = labelDescriptor == null ? null : labelDescriptor.getImage(value);
    if (valueImage != null) {
      valueImage.dispose();
    }
    valueImage = image == null ? null : image.createImage(false, Display.getCurrent());

    ColorDescriptor color = labelDescriptor == null ? null : labelDescriptor.getForeground(value);
    if (valueColor != null) {
      valueColor.dispose();
    }
    valueColor = color == null ? null : color.createColor(Display.getCurrent());

    FontDescriptor font = labelDescriptor == null ? null : labelDescriptor.getFont(value);
    if (valueFont != null) {
      valueFont.dispose();
    }
    valueFont = font == null ? null : font.createFont(Display.getCurrent());

    if (valueLayout != null && !valueLayout.isDisposed()) {
      String valueText =
          labelDescriptor == null
              ? (value == null
                  ? "" //$NON-NLS-1$
                  : value.toString())
              : labelDescriptor.getText(value);
      if (valueText == null) valueText = ""; // $NON-NLS-1$
      valueLayout.setText(valueText);
      valueLayout.setStyle(
          new TextStyle(
              valueFont == null ? canvas.getFont() : valueFont,
              valueColor == null ? canvas.getForeground() : valueColor,
              null),
          0,
          valueText.length());
    }
    canvas.layout(true);
    canvas.redraw();
  }
コード例 #3
0
 private void updateEditor() {
   if (editor != null) {
     editor.setValue(source.getPropertyValue(descriptor.getId()));
   }
 }