myModule( theModule ),
myPanel( 0 ),
myIsPrintErrorMessage( true ),
+ myIsTransactionOpened( false ),
myPreviewManager( 0 ),
myPreviewZLayer( -1 )
{
void HYDROGUI_Operation::startDocOperation()
{
- // Open transaction in the model document
+ // Open transaction in the model document only if it not
+ // already opened by other operation (intended for nested operations)
if ( !doc()->IsOperation() )
+ {
doc()->StartOperation();
+ myIsTransactionOpened = true;
+ }
}
void HYDROGUI_Operation::abortDocOperation()
{
- // Abort transaction in the model document
- if ( doc()->IsOperation() )
+ // Abort transaction in the model document only if it was
+ // opened by this operation (intended for nested operations)
+ if ( myIsTransactionOpened && doc()->IsOperation() )
+ {
doc()->AbortOperation();
+ myIsTransactionOpened = false;
+ }
}
void HYDROGUI_Operation::commitDocOperation()
{
- // Commit transaction in the model document
- if ( doc()->IsOperation() )
+ // Commit transaction in the model document only if it was
+ // opened by this operation (intended for nested operations)
+ if ( myIsTransactionOpened && doc()->IsOperation() )
+ {
doc()->CommitOperation( HYDROGUI_Tool::ToExtString( getName() ) );
+ myIsTransactionOpened = false;
+ }
}
Handle_HYDROData_Document HYDROGUI_Operation::doc() const