Salome HOME
Issue #1834: Fix length of lines
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_ImportFeature.cpp
index 4060c3e0495948dfdeb3be2f51009fa93c1963e6..70bab6e93944316af75e56853536b65dbce28718 100644 (file)
@@ -52,8 +52,11 @@ ExchangePlugin_ImportFeature::~ExchangePlugin_ImportFeature()
  */
 void ExchangePlugin_ImportFeature::initAttributes()
 {
-  data()->addAttribute(ExchangePlugin_ImportFeature::FILE_PATH_ID(), ModelAPI_AttributeString::typeId());
-  AttributePtr aFeaturesAttribute = data()->addAttribute(ExchangePlugin_ImportFeature::FEATURES_ID(), ModelAPI_AttributeRefList::typeId());
+  data()->addAttribute(ExchangePlugin_ImportFeature::FILE_PATH_ID(), 
+                       ModelAPI_AttributeString::typeId());
+  AttributePtr aFeaturesAttribute = 
+    data()->addAttribute(ExchangePlugin_ImportFeature::FEATURES_ID(), 
+                         ModelAPI_AttributeRefList::typeId());
   aFeaturesAttribute->setIsArgument(false);
 
   ModelAPI_Session::get()->validators()->registerNotObligatory(
@@ -187,6 +190,9 @@ void ExchangePlugin_ImportFeature::importXAO(const std::string& theFileName)
       aSelectionList->value(anElementIndex)->setId(aReferenceID);
     }
   }
+  // Top avoid problems in Object Browser update: issue #1647.
+  ModelAPI_EventCreator::get()->sendReordered(
+    std::dynamic_pointer_cast<ModelAPI_Feature>(aRefListOfGroups->owner()));
 
   } catch (XAO::XAO_Exception& e) {
     std::string anError = e.what();
@@ -213,19 +219,12 @@ void ExchangePlugin_ImportFeature::removeFeature(
   if (!data()->isValid())
     return;
   AttributeRefListPtr aList = reflist(FEATURES_ID());
-  // if the object is last, remove it from the list (needed to skip empty transaction on edit of sketch feature)
-  if (aList->object(aList->size(true) - 1, true) == theFeature) {
-    aList->remove(theFeature);
-  } else {
-    // to keep the persistent sub-elements indexing, do not remove elements from list,
-    // but substitute by nulls
-    aList->substitute(theFeature, ObjectPtr());
-  }
+  aList->remove(theFeature);
 }
 
 int ExchangePlugin_ImportFeature::numberOfSubs(bool forTree) const
 {
-  return data()->reflist(FEATURES_ID())->size(false);
+  return data()->reflist(FEATURES_ID())->size(true);
 }
 
 std::shared_ptr<ModelAPI_Feature> ExchangePlugin_ImportFeature::subFeature(