// TODO : In some cases, we may have a filter based on both a UML Metaclass and a Stereotype
  // In such a specific case, a specific implementation is probably needed
  //
  // This case may especially occur in the case of dynamic creation of stereotype associations.
  @Override
  public Object getAdaptedValue(Object containerElement) {
    Object semanticElement = super.getAdaptedValue(containerElement);

    if (semanticElement instanceof Element) {
      Element element = (Element) semanticElement;
      // Looks for a compatible Stereotype application
      for (Object metaclassWanted : getWantedMetaclasses()) {

        if (metaclassWanted instanceof Stereotype) {
          EObject stereotypeApplication = null;

          stereotypeApplication = element.getStereotypeApplication((Stereotype) metaclassWanted);
          if (stereotypeApplication == null) {
            List<Stereotype> subStereotypes =
                element.getAppliedSubstereotypes((Stereotype) metaclassWanted);
            for (Stereotype subSteretoype : subStereotypes) {
              stereotypeApplication = element.getStereotypeApplication(subSteretoype);
              if (stereotypeApplication != null) {
                break;
              }
            }
          }

          if (stereotypeApplication != null) {
            return stereotypeApplication;
          }
        }
      }
    }

    // If no stereotype application is found, return the UML Element
    return semanticElement;
  }
  /**
   * @see
   *     org.eclipse.nebula.widgets.nattable.edit.gui.AbstractDialogCellEditor#createDialogInstance()
   * @return
   */
  @Override
  public Object createDialogInstance() {
    int columnIndex = this.layerCell.getColumnIndex();
    int rowIndex = this.layerCell.getRowIndex();
    Object row = this.manager.getRowElement(rowIndex);
    Object column = this.manager.getColumnElement(columnIndex);
    row = AxisUtils.getRepresentedElement(row);
    column = AxisUtils.getRepresentedElement(column);
    Element editedElement = null;
    Object feature = null;
    if (row instanceof EObject && column == this.axisElement) {
      editedElement = (Element) row;
      feature = column;
    } else {
      editedElement = (Element) column;
      feature = row;
    }

    EStructuralFeature realFeature = null;
    EObject realEditedObject = null;
    Stereotype stereotype = null;
    List<Stereotype> stereotypesWithEditedFeatureAppliedOnElement = null;
    if (feature instanceof EStructuralFeature) {
      realFeature = (EStructuralFeature) feature;
      realEditedObject = editedElement;
    } else {
      final String id = AxisUtils.getPropertyId(this.axisElement);
      stereotypesWithEditedFeatureAppliedOnElement =
          UMLTableUtils.getAppliedSteretoypesWithThisProperty(editedElement, id);
      stereotype = stereotypesWithEditedFeatureAppliedOnElement.get(0);
      realEditedObject =
          editedElement.getStereotypeApplication(
              stereotypesWithEditedFeatureAppliedOnElement.get(0));
      Property prop = UMLTableUtils.getRealStereotypeProperty(editedElement, id);
      realFeature = realEditedObject.eClass().getEStructuralFeature(prop.getName());
    }
    if (stereotypesWithEditedFeatureAppliedOnElement != null
        && stereotypesWithEditedFeatureAppliedOnElement.size() > 1) {
      // FIXME : not yet managed
    } else {
      this.dialog =
          createDialog(
              realEditedObject,
              realFeature,
              stereotype,
              editedElement.eResource().getResourceSet());
    }
    return this.dialog;
  }