[GME-commit] GMESRC/GME/GMEActiveBrowser AggregateContextMenu.cpp,1.16,1.17

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Tue Sep 14 10:13:25 CDT 2004


Update of /var/lib/gme/GMESRC/GME/GMEActiveBrowser
In directory braindrain:/tmp/cvs-serv1223

Modified Files:
	AggregateContextMenu.cpp 
Log Message:
no message

CVS User: bogyom

Index: AggregateContextMenu.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/GMEActiveBrowser/AggregateContextMenu.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** AggregateContextMenu.cpp	2 Jun 2004 22:15:47 -0000	1.16
--- AggregateContextMenu.cpp	14 Sep 2004 14:13:22 -0000	1.17
***************
*** 290,320 ****
  void CAggregateContextMenu::OnEditDelete()
  {
  
! 	HTREEITEM hSelItem=m_pParent->m_TreeAggregate.GetFirstSelectedItem();
! 	LPUNKNOWN pUnknown;
! 
! 	// Starting transaction
! 	CGMEActiveBrowserApp* pApp=(CGMEActiveBrowserApp*)AfxGetApp();
! 	CMgaContext* pMgaContext=&pApp->m_CurrentProject.m_MgaContext;
! 	pMgaContext->BeginTransaction(FALSE);
! 
! 	while(hSelItem)
! 	{
! 		/////////////////////////////////////////////////////////////////////////
! 		// The MGA layer does not send consistent messages with its actual state
! 		// So we collapse the item to be deleted, to avoid the inconsistency
! 		// caused by the order of deleting the child items and the parents in MGA
! 		m_pParent->m_TreeAggregate.DeleteAllChildren(hSelItem);
! 		if(m_pParent->m_TreeAggregate.m_MgaMap.LookupObjectUnknown(hSelItem,pUnknown))
! 		{
! 			CComQIPtr<IMgaObject> ccpMgaObject(pUnknown);
! 			// Deleting object
! 			COMTHROW(ccpMgaObject->DestroyObject());
! 		}
! 		hSelItem=m_pParent->m_TreeAggregate.GetNextSelectedItem(hSelItem);
! 	}
! 	// Ending transaction
! 	pMgaContext->CommitTransaction();
  
  }
  
--- 290,326 ----
  void CAggregateContextMenu::OnEditDelete()
  {
+     CMgaContext * pMgaContext = NULL;
+     try
+     {
+ 	    HTREEITEM hSelItem=m_pParent->m_TreeAggregate.GetFirstSelectedItem();
+ 	    LPUNKNOWN pUnknown;
  
! 	    // Starting transaction
! 	    CGMEActiveBrowserApp* pApp=(CGMEActiveBrowserApp*)AfxGetApp();
! 	    pMgaContext = &pApp->m_CurrentProject.m_MgaContext;
! 	    pMgaContext->BeginTransaction(FALSE);
  
+ 	    while(hSelItem)
+ 	    {
+ 		    /////////////////////////////////////////////////////////////////////////
+ 		    // The MGA layer does not send consistent messages with its actual state
+ 		    // So we collapse the item to be deleted, to avoid the inconsistency
+ 		    // caused by the order of deleting the child items and the parents in MGA
+ 		    m_pParent->m_TreeAggregate.DeleteAllChildren(hSelItem);
+ 		    if(m_pParent->m_TreeAggregate.m_MgaMap.LookupObjectUnknown(hSelItem,pUnknown))
+ 		    {
+ 			    CComQIPtr<IMgaObject> ccpMgaObject(pUnknown);
+ 			    // Deleting object
+ 			    COMTHROW(ccpMgaObject->DestroyObject());
+ 		    }
+ 		    hSelItem=m_pParent->m_TreeAggregate.GetNextSelectedItem(hSelItem);
+ 	    }
+ 	    // Ending transaction
+ 	    pMgaContext->CommitTransaction();
+     }
+     catch(hresult_exception &e)
+     {
+         pMgaContext->AbortTransaction();
+     }
  }
  



More information about the GME-commit mailing list