private void transferAddedAttributes(List<Property> classAttributes) {
   for (Property property : classAttributes) {
     if (!property.getName().isEmpty() || !property.getType().getName().isEmpty()) {
       DataType existingType = modelDataTypes.get(property.getType().getName().trim());
       if (existingType != null) {
         property.setType(existingType);
       }
       if (element instanceof DataType) {
         ((DataType) element).getOwnedAttribute().add(property);
       } else {
         ((Class) element).getOwnedAttribute().add(property);
       }
       diagramManager.updateOLEDFromInclusion(property);
     }
   }
 }
  public void transferAttributesData() {
    List<Property> classAttributes = attributesTableModel.getEntries();

    if (cbxVisible.isSelected() == false) {
      if (classAttributes.size() > 0) {
        cbxVisible.setSelected(true);
      }
    }
    if (classElement != null) classElement.setShowAttributes(cbxVisible.isSelected());
    diagramManager.updateOLEDFromInclusion(element);

    transferDataTypes();
    deleteAttributes(classAttributes);
    transferAddedAttributes(classAttributes);

    classElement.reinitAttributesCompartment();
    classElement.invalidate();
  }
  private void transferDataTypes() {
    List<Property> classAttributes = attributesTableModel.getEntries();
    ArrayList<Element> createdList = new ArrayList<Element>();
    for (Property property : classAttributes) {
      // Avoid the creation of duplicated types
      if (modelDataTypes.keySet().contains(property.getType().getName().trim()) == false) {
        UmlProject project = diagramManager.getCurrentProject();
        AddCommand cmd =
            new AddCommand(
                project.getEditingDomain(),
                project.getModel().getPackagedElement(),
                property.getType());
        project.getEditingDomain().getCommandStack().execute(cmd);
        modelDataTypes.put(property.getType().getName(), (DataType) property.getType());
        createdList.add((Element) property.getType());
      }
    }

    for (Element element : createdList) diagramManager.updateOLEDFromInclusion(element);
  }