Esempio n. 1
0
		public void InflAffixSlotShortName()
		{
			CheckDisposed();

			MoInflAffixSlot slot = new MoInflAffixSlot();
			PartOfSpeech pos = (PartOfSpeech)Cache.LangProject.PartsOfSpeechOA.PossibilitiesOS.Append(new PartOfSpeech());
			pos.AffixSlotsOC.Add(slot);
			slot.Optional = false;
			string sName = "TestSlot";
			slot.Name.AnalysisDefaultWritingSystem = sName;
			Assert.AreEqual(sName, slot.ShortName);
			slot.Optional = true;
			Assert.AreEqual("(" + sName + ")", slot.ShortName);
		}
Esempio n. 2
0
		//methods

		public override ObjectLabel Execute()
		{
			IMoInflAffixSlot slot = new MoInflAffixSlot();
			IPartOfSpeech pos = PartOfSpeech.CreateFromDBObject(m_cache, m_posHvo);
			pos.AffixSlotsOC.Add(slot);
			string sNewSlotName = m_mediator.StringTbl.GetString("NewSlotName", "Linguistics/Morphology/TemplateTable");
			slot.Name.AnalysisDefaultWritingSystem = sNewSlotName;
			slot.Optional = m_fOptional;
			return ObjectLabel.CreateObjectLabel(m_cache, slot.Hvo, "");
		}
		/// <summary>
		///
		/// </summary>
		/// <param name="sLabel"></param>
		/// <returns></returns>
		internal ITsString DetermineSlotContextMenuItemLabel(string sLabel)
		{
			CheckDisposed();
			if (m_class == MoInflAffixSlot.kclsidMoInflAffixSlot)
			{
				IMoInflAffixSlot slot = new MoInflAffixSlot(Cache, m_hvo);
				return DoXXXReplace(sLabel, TsSlotName(slot));
			}
			else if (m_class == MoInflAffixTemplate.kclsidMoInflAffixTemplate)
			{
				ITsStrFactory tsf = TsStrFactoryClass.Create();
				ITsString tssStem = tsf.MakeString(m_sStem, Cache.DefaultUserWs);
				return DoXXXReplace(sLabel, tssStem);
			}
			else
			{
				return null;
			}
		}
		private string FindSlotNameOfMsa(int hvoSlot)
		{
#if WantWWStuff // TODO: AndyB(RandyR): Fix this, if it is still needed.
			IMoInflAffixSlot slot = new SIL.FieldWorks.FDO.Ling.MoInflAffixSlot(Cache, hvoSlot);
			List<int> listMsaHvos = new List<int>(slot.AffixesRS.HvoArray);
			int index = listMsaHvos.IndexOf(m_hvo);
			if (index >= 0)
				return slot.Name.AnalysisDefaultWritingSystem;
#endif
			return null;
		}
		/// <summary>
		///
		/// </summary>
		/// <param name="sLabel"></param>
		/// <returns></returns>
		internal ITsString MenuLabelForInflTemplateAddInflAffixMsa(string sLabel)
		{
			CheckDisposed();
			if (m_class == MoInflAffMsa.kclsidMoInflAffMsa)
			{
				return DetermineMsaContextMenuItemLabel(sLabel);
			}
			else if (m_class == MoInflAffixSlot.kclsidMoInflAffixSlot)
			{
				m_hvoSlot = m_hvo;
				IMoInflAffixSlot slot = new MoInflAffixSlot(Cache, m_hvo);
				return DoXXXReplace(sLabel, TsSlotName(slot));
			}
			else
			{
				return null;
			}
		}