private void AbortEdits(bool bUseNonVersionedDelete, IEditor pEd, IWorkspace pWS)
        {
            Utilities FabricUTILS = new Utilities();

            if (bUseNonVersionedDelete)
            {
                FabricUTILS.AbortEditing(pWS);
            }
            else
            {
                if (pEd != null)
                {
                    if (pEd.EditState == esriEditState.esriStateEditing)
                    {
                        pEd.AbortOperation();
                    }
                }
            }
        }
        protected override void OnClick()
        {
            IApplication pApp;
              ICadastralFabric m_pCadaFab;
              IQueryFilter m_pQF;

              #region Get Fabric

              pApp = (IApplication)ArcMap.Application;
              if (pApp == null)
            //if the app is null then could be running from ArcCatalog
            pApp = (IApplication)ArcCatalog.Application;

              if (pApp == null)
              {
            MessageBox.Show("Could not access the application.", "No Application found");
            return;
              }

              IGxApplication pGXApp = (IGxApplication)pApp;
              stdole.IUnknown pUnk = null;
              try
              {
            pUnk = (stdole.IUnknown)pGXApp.SelectedObject.InternalObjectName.Open();
              }
              catch (COMException ex)
              {
            if (ex.ErrorCode == (int)fdoError.FDO_E_DATASET_TYPE_NOT_SUPPORTED_IN_RELEASE ||
            ex.ErrorCode == -2147220944)
              MessageBox.Show("The dataset is not supported in this release.", "Could not open the dataset");
            else
              MessageBox.Show(ex.ErrorCode.ToString(), "Could not open the dataset");
            return;
              }

              if (pUnk is ICadastralFabric)
            m_pCadaFab = (ICadastralFabric)pUnk;
              else
              {
            MessageBox.Show("Please select a parcel fabric and try again.", "Not a parcel fabric");
            return;
              }
              #endregion

              IFeatureClass pFabricPointClass = (IFeatureClass)m_pCadaFab.get_CadastralTable(esriCadastralFabricTable.esriCFTPoints);
              IDataset pDS = (IDataset)pFabricPointClass;
              IWorkspace pWS = pDS.Workspace;

              bool bIsFileBasedGDB = true;
              bool bIsUnVersioned = true;
              Utilities FabricUTILS = new Utilities();
              FabricUTILS.GetFabricPlatform(pWS, m_pCadaFab, out bIsFileBasedGDB,
            out bIsUnVersioned);

              if (!FabricUTILS.StartEditing(pWS, bIsUnVersioned))
            return;
              m_pQF = new QueryFilterClass();
              m_pQF.WhereClause = "";
              int iChangePointCount = 0;
              try
              {
            //next need to use an in clause to update the points, ...
            ICadastralFabricSchemaEdit2 pSchemaEd = (ICadastralFabricSchemaEdit2)m_pCadaFab;
            pSchemaEd.ReleaseReadOnlyFields((ITable)pFabricPointClass, esriCadastralFabricTable.esriCFTPoints);

            IGeoDataset pGeoDS = (IGeoDataset)pFabricPointClass;
            ISpatialReferenceTolerance pSRTol = (ISpatialReferenceTolerance)pGeoDS.SpatialReference;
            double dTolerance = pSRTol.XYTolerance;

            if (!UpdatePointXYFromGeometry((ITable)pFabricPointClass, m_pQF, (bIsUnVersioned || bIsFileBasedGDB), dTolerance, out iChangePointCount))
            {
              FabricUTILS.AbortEditing(pWS);
              return;
            }

            FabricUTILS.StopEditing(pWS);
            pSchemaEd.ResetReadOnlyFields(esriCadastralFabricTable.esriCFTPoints);

            MessageBox.Show("Updated " + iChangePointCount.ToString() + " points that had coordinates different" + Environment.NewLine +"from their geometry by more than " +
              dTolerance.ToString("0.00000000").TrimEnd('0'),"Coordinate Inverse", MessageBoxButtons.OK, MessageBoxIcon.Information);
              }
              catch (Exception ex)
              {
            MessageBox.Show(ex.Message);
            FabricUTILS.AbortEditing(pWS);
              }
              finally
              {
              }
        }
        protected override void OnClick()
        {
            IApplication     pApp;
            ICadastralFabric m_pCadaFab;
            IQueryFilter     m_pQF;

            #region Get Fabric

            pApp = (IApplication)ArcMap.Application;
            if (pApp == null)
            {
                //if the app is null then could be running from ArcCatalog
                pApp = (IApplication)ArcCatalog.Application;
            }

            if (pApp == null)
            {
                MessageBox.Show("Could not access the application.", "No Application found");
                return;
            }

            IGxApplication  pGXApp = (IGxApplication)pApp;
            stdole.IUnknown pUnk   = null;
            try
            {
                pUnk = (stdole.IUnknown)pGXApp.SelectedObject.InternalObjectName.Open();
            }
            catch (COMException ex)
            {
                if (ex.ErrorCode == (int)fdoError.FDO_E_DATASET_TYPE_NOT_SUPPORTED_IN_RELEASE ||
                    ex.ErrorCode == -2147220944)
                {
                    MessageBox.Show("The dataset is not supported in this release.", "Could not open the dataset");
                }
                else
                {
                    MessageBox.Show(ex.ErrorCode.ToString(), "Could not open the dataset");
                }
                return;
            }

            if (pUnk is ICadastralFabric)
            {
                m_pCadaFab = (ICadastralFabric)pUnk;
            }
            else
            {
                MessageBox.Show("Please select a parcel fabric and try again.", "Not a parcel fabric");
                return;
            }
            #endregion

            IFeatureClass pFabricPointClass = (IFeatureClass)m_pCadaFab.get_CadastralTable(esriCadastralFabricTable.esriCFTPoints);
            IDataset      pDS = (IDataset)pFabricPointClass;
            IWorkspace    pWS = pDS.Workspace;

            bool      bIsFileBasedGDB = true;
            bool      bIsUnVersioned  = true;
            Utilities FabricUTILS     = new Utilities();
            FabricUTILS.GetFabricPlatform(pWS, m_pCadaFab, out bIsFileBasedGDB,
                                          out bIsUnVersioned);


            if (!FabricUTILS.StartEditing(pWS, bIsUnVersioned))
            {
                return;
            }
            m_pQF             = new QueryFilterClass();
            m_pQF.WhereClause = "";
            int iChangePointCount = 0;
            try
            {
                //next need to use an in clause to update the points, ...
                ICadastralFabricSchemaEdit2 pSchemaEd = (ICadastralFabricSchemaEdit2)m_pCadaFab;
                pSchemaEd.ReleaseReadOnlyFields((ITable)pFabricPointClass, esriCadastralFabricTable.esriCFTPoints);

                IGeoDataset pGeoDS = (IGeoDataset)pFabricPointClass;
                ISpatialReferenceTolerance pSRTol = (ISpatialReferenceTolerance)pGeoDS.SpatialReference;
                double dTolerance = pSRTol.XYTolerance;

                if (!UpdatePointXYFromGeometry((ITable)pFabricPointClass, m_pQF, (bIsUnVersioned || bIsFileBasedGDB), dTolerance, out iChangePointCount))
                {
                    FabricUTILS.AbortEditing(pWS);
                    return;
                }

                FabricUTILS.StopEditing(pWS);
                pSchemaEd.ResetReadOnlyFields(esriCadastralFabricTable.esriCFTPoints);

                MessageBox.Show("Updated " + iChangePointCount.ToString() + " points that had coordinates different" + Environment.NewLine + "from their geometry by more than " +
                                dTolerance.ToString("0.00000000").TrimEnd('0'), "Coordinate Inverse", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                FabricUTILS.AbortEditing(pWS);
            }
            finally
            {
            }
        }