+void HYDROGUI_Operation::setCursor()
+{
+ if ( myPreviewManager )
+ {
+ QVector<SUIT_ViewWindow*> winList = myPreviewManager->getViews();
+ for ( QVector<SUIT_ViewWindow*>::iterator it = winList.begin(); it != winList.end(); ++it )
+ {
+ OCCViewer_ViewWindow* occWin = ::qobject_cast<OCCViewer_ViewWindow*>( *it );
+ if ( occWin )
+ {
+ OCCViewer_ViewPort3d* vp = occWin->getViewPort();
+ if ( vp )
+ {
+ // Save old cursor
+ myCursor = vp->cursor();
+ // Set specific cursor chosen in preferences
+ QCursor aCursor = module()->getPrefEditCursor();
+ vp->setDefaultCursor( aCursor.shape() );
+ vp->setCursor( *vp->getDefaultCursor() );
+ }
+ }
+ }
+ }
+}
+
+void HYDROGUI_Operation::restoreCursor()
+{
+ if ( myPreviewManager )
+ {
+ QVector<SUIT_ViewWindow*> winList = myPreviewManager->getViews();
+ for ( QVector<SUIT_ViewWindow*>::iterator it = winList.begin(); it != winList.end(); ++it )
+ {
+ OCCViewer_ViewWindow* occWin = ::qobject_cast<OCCViewer_ViewWindow*>( *it );
+ if ( occWin )
+ {
+ OCCViewer_ViewPort3d* vp = occWin->getViewPort();
+ if ( vp )
+ {
+ // Restore old cursor
+ vp->setDefaultCursor( myCursor.shape() );
+ vp->setCursor( myCursor );
+ }
+ }
+ }
+ }
+}
+
+void HYDROGUI_Operation::setIsApplyAndClose( const bool theFlag )
+{
+ myIsApplyAndClose = theFlag;
+}
+
+bool HYDROGUI_Operation::isApplyAndClose() const
+{
+ return myIsApplyAndClose;
+}
+
+void HYDROGUI_Operation::apply()
+{
+ QApplication::setOverrideCursor( Qt::WaitCursor );
+
+ startDocOperation();
+
+ int anUpdateFlags = 0;
+ QString anErrorMsg;
+
+ bool aResult = false;
+ QStringList aBrowseObjectsEntries;
+
+ try
+ {
+ aResult = processApply( anUpdateFlags, anErrorMsg, aBrowseObjectsEntries );
+ }
+ catch ( Standard_Failure )
+ {
+ Handle(Standard_Failure) aFailure = Standard_Failure::Caught();
+ anErrorMsg = aFailure->GetMessageString();
+ aResult = false;
+ }
+ catch ( ... )
+ {
+ aResult = false;
+ }
+
+ QApplication::restoreOverrideCursor();
+
+ if ( aResult )
+ {
+ module()->update( anUpdateFlags );
+ commitDocOperation();
+ commit();
+ browseObjects( aBrowseObjectsEntries, myIsApplyAndClose );
+
+ if ( !myIsApplyAndClose && inputPanel() )
+ start();
+ }
+ else if( !anErrorMsg.isEmpty() )
+ {
+ // Abort document opeartion only if requested
+ if ( isToAbortOnApply() )
+ abortDocOperation();
+
+ printErrorMessage( anErrorMsg );
+
+ // If the operation has no input panel - do abort
+ if ( !inputPanel() ) {
+ abort();
+ }
+ }
+}
+