}
}
+ startDocOperation();
for( Standard_Integer anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ )
{
Handle(HYDROData_Object) anObject = aSeq.Value( anIndex );
if( !anObject.IsNull() )
anObject->Remove();
}
+ commitDocOperation();
module()->update( UF_Model | UF_Viewer );
commit();
{
}
+void HYDROGUI_Operation::startDocOperation()
+{
+ // Open transaction in the model document
+ doc()->StartOperation();
+}
+
+void HYDROGUI_Operation::abortDocOperation()
+{
+ // Abort transaction in the model document
+ doc()->AbortOperation();
+}
+
+void HYDROGUI_Operation::commitDocOperation()
+{
+ // Commit transaction in the model document
+ doc()->CommitOperation( HYDROGUI_Tool::ToExtString( getName() ) );
+}
+
Handle_HYDROData_Document HYDROGUI_Operation::doc() const
{
return HYDROData_Document::Document( myModule->getStudyId() );
{
QApplication::setOverrideCursor( Qt::WaitCursor );
- // Open transaction in the model document
- doc()->StartOperation();
+ startDocOperation();
int anUpdateFlags = 0;
QString anErrorMsg;
if ( aResult )
{
module()->update( anUpdateFlags );
-
- // Commit transaction in the model document
- doc()->CommitOperation( HYDROGUI_Tool::ToExtString( getName() ) );
+ commitDocOperation();
commit();
}
else
{
- // Abort transaction in the model document
- doc()->AbortOperation();
-
+ abortDocOperation();
QString aMsg = tr( "INPUT_VALID_DATA" );
if( !anErrorMsg.isEmpty() )
aMsg.prepend( anErrorMsg + "\n" );
virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg );
virtual void processCancel();
+ void startDocOperation();
+ void commitDocOperation();
+ void abortDocOperation();
+
Handle_HYDROData_Document doc() const;
protected slots:
{
HYDROGUI_Operation::startOperation();
+ startDocOperation();
+
bool aResult = false;
if( myIsLoad )
aResult = loadVisualState();
aResult = saveVisualState();
if( aResult )
+ {
+ commitDocOperation();
commit();
+ }
else
+ {
+ abortDocOperation();
abort(); // do not commit the document command
+ }
}
bool HYDROGUI_VisualStateOp::saveVisualState()