Ejemplo n.º 1
0
  /** @see LabelProvider#getImage(Object) */
  @Override
  public Image getImage(Object element) {
    if (element instanceof IStructuredSelection) {
      element = ((IStructuredSelection) element).getFirstElement();
    }

    element = TransformationTreeUtil.extractObject(element);

    if (element instanceof Entity) {
      element = ((Entity) element).getDefinition();
    }

    if (element instanceof EntityDefinition || element instanceof Definition<?>) {
      return definitionLabels.getImage(element);
    }

    if (element instanceof Cell) {
      Cell cell = (Cell) element;
      AbstractFunction<?> function = FunctionUtil.getFunction(cell.getTransformationIdentifier());
      if (function != null) {
        element = function;
      }
    }

    if (element instanceof Function) {
      return functionLabels.getImage(element);
    }

    return super.getImage(element);
  }
Ejemplo n.º 2
0
  /** @see LabelProvider#getText(Object) */
  @Override
  public String getText(Object element) {
    if (element instanceof IStructuredSelection) {
      element = ((IStructuredSelection) element).getFirstElement();
    }

    element = TransformationTreeUtil.extractObject(element);

    if (element instanceof Entity) {
      element = ((Entity) element).getDefinition();
    }

    if ((element instanceof EntityDefinition
            && ((EntityDefinition) element).getDefinition() instanceof TypeDefinition)
        || element instanceof TypeDefinition) {
      if (element instanceof EntityDefinition) {
        element = ((EntityDefinition) element).getDefinition();
      }

      // return the local name of the type instead of the display name
      // XXX as it may be masked by an XML element name
      return ((TypeDefinition) element).getName().getLocalPart();
    }

    if (element instanceof EntityDefinition || element instanceof Definition<?>) {
      return definitionLabels.getText(element);
    }

    if (element instanceof Function) {
      return functionLabels.getText(element);
    }

    if (element instanceof Cell) {
      return CellUtil.getCellDescription((Cell) element);
    }

    return super.getText(element);
  }