コード例 #1
0
        /// <summary>
        /// Have the main FLEx window jump to the appropriate item
        /// </summary>
        /// <param name="hvo">item whose parent will indcate where to jump to</param>
        public void JumpToToolBasedOnHvo(int hvo)
        {
            if (hvo == 0)
            {
                return;
            }
            string    sTool         = null;
            int       parentClassId = 0;
            ICmObject cmo           = m_cache.ServiceLocator.GetObject(hvo);

            switch (cmo.ClassID)
            {
            case MoFormTags.kClassId:                                           // fall through
            case MoAffixAllomorphTags.kClassId:                                 // fall through
            case MoStemAllomorphTags.kClassId:                                  // fall through
            case MoInflAffMsaTags.kClassId:                                     // fall through
            case MoDerivAffMsaTags.kClassId:                                    // fall through
            case MoUnclassifiedAffixMsaTags.kClassId:                           // fall through
            case MoStemMsaTags.kClassId:                                        // fall through
            case MoMorphSynAnalysisTags.kClassId:                               // fall through
            case MoAffixProcessTags.kClassId:
                sTool         = "lexiconEdit";
                parentClassId = LexEntryTags.kClassId;
                break;

            case MoInflAffixSlotTags.kClassId:                          // fall through
            case MoInflAffixTemplateTags.kClassId:                      // fall through
            case PartOfSpeechTags.kClassId:
                sTool         = "posEdit";
                parentClassId = PartOfSpeechTags.kClassId;
                break;

            // still need to test compound rule ones
            case MoCoordinateCompoundTags.kClassId:                     // fall through
            case MoEndoCompoundTags.kClassId:                           // fall through
            case MoExoCompoundTags.kClassId:
                sTool         = "compoundRuleAdvancedEdit";
                parentClassId = cmo.ClassID;
                break;

            case PhRegularRuleTags.kClassId:                                    // fall through
            case PhMetathesisRuleTags.kClassId:
                sTool         = "PhonologicalRuleEdit";
                parentClassId = cmo.ClassID;
                break;
            }
            if (parentClassId <= 0)
            {
                return;                 // do nothing
            }
            cmo = CmObjectUi.GetSelfOrParentOfClass(cmo, parentClassId);
            if (cmo == null)
            {
                return;                 // do nothing
            }
            m_mediator.PostMessage("FollowLink", new FwLinkArgs(sTool, cmo.Guid));
        }