コード例 #1
0
		public SemDomSearchEngine(FdoCache cache)
		{
			if (cache == null)
				throw new ApplicationException("Can't search domains without a cache.");

			m_semdomRepo = cache.ServiceLocator.GetInstance<ICmSemanticDomainRepository>();
		}
コード例 #2
0
        private void SetRelatedDomainsLinks()
        {
            ICmSemanticDomainRepository repo = m_cache.ServiceLocator.GetInstance <ICmSemanticDomainRepository>();

            foreach (Guid guidKey in m_mapRelatedDomains.Keys)
            {
                try
                {
                    ICmSemanticDomain dom = repo.GetObject(guidKey);
                    foreach (Guid guidLink in m_mapRelatedDomains[guidKey])
                    {
                        try
                        {
                            ICmSemanticDomain domLink = repo.GetObject(guidLink);
                            dom.RelatedDomainsRC.Add(domLink);
                        }
                        catch { }
                    }
                    if (m_progress != null)
                    {
                        m_progress.Step(1);
                    }
                }
                catch { }
            }
        }
コード例 #3
0
        public SemDomSearchEngine(FdoCache cache)
        {
            if (cache == null)
            {
                throw new ApplicationException("Can't search domains without a cache.");
            }

            m_semdomRepo = cache.ServiceLocator.GetInstance <ICmSemanticDomainRepository>();
        }
コード例 #4
0
		/// <summary>
		/// Create an (uninitialized) cache of Semantic Domains by word string and writing system
		/// integer to provide quick searching for multiple keys (bulk edit of the
		/// LexSense.SemanticDomains collection; Suggest button).
		/// </summary>
		/// <param name="cache">FdoCache</param>
		public SemDomSearchCache(FdoCache cache)
		{
			CacheIsInitialized = false;
			m_cache = cache;
			m_semDomRepo = m_cache.ServiceLocator.GetInstance<ICmSemanticDomainRepository>();
			m_semDomCache = new Dictionary<Tuple<string, int>, HashSet<ICmSemanticDomain>>();
			m_appropriateCulture = GetAppropriateCultureInfo();
			// Starting after whitespace or the beginning of a line, finds runs of either letters or
			// singlequote or hyphen followed by either whitespace or the end of a line.
			// The first look-ahead, (?=\w), means that single quote and hyphen are only included
			// if there is an adjacent following letter, that is, if they occur word-medially.
			m_wordParsingRegex = new Regex(@"(?<=(^|\s))(\w|['-](?=\w))*(?=(\s|,|$))");
		}
コード例 #5
0
        /// <summary>
        /// Load the test data into the Semantic Domains list.
        /// </summary>
        protected override void CreateTestData()
        {
            base.CreateTestData();

            Cache.ActionHandlerAccessor.EndUndoTask();             // I'll make my own Undo tasks, since ImportList has its own.
            var servLoc = Cache.ServiceLocator;

            m_semdomRepo   = servLoc.GetInstance <ICmSemanticDomainRepository>();
            m_entryFactory = servLoc.GetInstance <ILexEntryFactory>();
            m_senseFactory = servLoc.GetInstance <ILexSenseFactory>();

            LoadSemDomTestData(XMLTESTDATA);
        }
コード例 #6
0
 /// <summary>
 /// Create an (uninitialized) cache of Semantic Domains by word string and writing system
 /// integer to provide quick searching for multiple keys (bulk edit of the
 /// LexSense.SemanticDomains collection; Suggest button).
 /// </summary>
 /// <param name="cache">FdoCache</param>
 public SemDomSearchCache(FdoCache cache)
 {
     CacheIsInitialized   = false;
     m_cache              = cache;
     m_semDomRepo         = m_cache.ServiceLocator.GetInstance <ICmSemanticDomainRepository>();
     m_semDomCache        = new Dictionary <Tuple <string, int>, HashSet <ICmSemanticDomain> >();
     m_appropriateCulture = GetAppropriateCultureInfo();
     // Starting after whitespace or the beginning of a line, finds runs of either letters or
     // singlequote or hyphen followed by either whitespace or the end of a line.
     // The first look-ahead, (?=\w), means that single quote and hyphen are only included
     // if there is an adjacent following letter, that is, if they occur word-medially.
     m_wordParsingRegex = new Regex(@"(?<=(^|\s))(\w|['-](?=\w))*(?=(\s|,|$))");
 }
コード例 #7
0
 public void Initialize(IEnumerable <ObjectLabel> labels, IEnumerable <ICmObject> selectedItems)
 {
     m_semdomRepo = Cache.ServiceLocator.GetInstance <ICmSemanticDomainRepository>();
     m_stylesheet = FontHeightAdjuster.StyleSheetFromMediator(Mediator);
     m_selectedItems.UnionWith(selectedItems);
     UpdateDomainTreeAndListLabels(labels);
     searchTextBox.WritingSystemFactory = Cache.LanguageWritingSystemFactoryAccessor;
     searchTextBox.AdjustForStyleSheet(m_stylesheet);
     m_SearchTimer = new SearchTimer(this, 500, SearchSemanticDomains, new List <Control> {
         domainTree, domainList
     });
     searchTextBox.TextChanged += m_SearchTimer.OnSearchTextChanged;
 }
コード例 #8
0
		public void Initialize(IEnumerable<ObjectLabel> labels, IEnumerable<ICmObject> selectedItems)
		{
			m_semdomRepo = Cache.ServiceLocator.GetInstance<ICmSemanticDomainRepository>();
			m_stylesheet = FontHeightAdjuster.StyleSheetFromMediator(Mediator);
			selectedDomainsList.Font = FontHeightAdjuster.GetFontForNormalStyle(
				Cache.DefaultAnalWs, m_stylesheet, Cache);
			m_selectedItems.UnionWith(selectedItems);
			UpdateDomainTreeAndListLabels(labels);
			searchTextBox.WritingSystemFactory = Cache.LanguageWritingSystemFactoryAccessor;
			searchTextBox.AdjustForStyleSheet(m_stylesheet);
			m_SearchTimer = new SearchTimer(this, 500, SearchSemanticDomains, new List<Control> {domainTree, domainList});
			searchTextBox.TextChanged += OnSearchTextChanged;
		}
コード例 #9
0
        internal override void Init(Mediator mediator, XmlNode node)
        {
            base.Init(mediator, node);

            m_semDomRepo = m_cache.ServiceLocator.GetInstance<ICmSemanticDomainRepository>();
            m_stylesheet = FontHeightAdjuster.StyleSheetFromMediator(m_mediator);
            var treeBarControl = GetTreeBarControl(mediator);
            SetupAndShowHeaderPanel(node, treeBarControl);
            m_searchTimer = new SearchTimer(treeBarControl, 500, HandleChangeInSearchText,
                new List<Control> { treeBarControl.TreeView, treeBarControl.ListView });
            m_textSearch.TextChanged += m_searchTimer.OnSearchTextChanged;
            m_treeView = treeBarControl.TreeView;
            m_listView = treeBarControl.ListView;
            m_listView.HeaderStyle = ColumnHeaderStyle.None; // We don't want a secondary "Records" title bar
        }
コード例 #10
0
        internal override void Init(Mediator mediator, XmlNode node)
        {
            base.Init(mediator, node);

            m_semDomRepo = m_cache.ServiceLocator.GetInstance <ICmSemanticDomainRepository>();
            var treeBarControl = GetTreeBarControl(mediator);

            SetupAndShowHeaderPanel(mediator, node, treeBarControl);
            m_searchTimer = new SearchTimer(treeBarControl, 500, HandleChangeInSearchText,
                                            new List <Control> {
                treeBarControl.TreeView, treeBarControl.ListView
            });
            m_textSearch.TextChanged += m_searchTimer.OnSearchTextChanged;
            m_treeView             = treeBarControl.TreeView;
            m_listView             = treeBarControl.ListView;
            m_listView.HeaderStyle = ColumnHeaderStyle.None;             // We don't want a secondary "Records" title bar
        }
コード例 #11
0
ファイル: BulkEditBar.cs プロジェクト: sillsdev/FieldWorks
		public SemanticDomainChooserBEditControl(FdoCache cache, Mediator mediator, BulkEditBar bar, XmlNode colSpec) :
			base(cache, mediator, colSpec)
		{
			m_suggestButton = new Button();
			m_suggestButton.Text = XMLViewsStrings.ksSuggestButtonText;
			m_suggestButton.Image = ResourceHelper.SuggestLightbulb;
			m_suggestButton.ImageAlign = ContentAlignment.MiddleRight;
			m_toolTip = new ToolTip();
			m_toolTip.SetToolTip(m_suggestButton, XMLViewsStrings.ksSuggestButtonToolTip);
			m_doingSuggest = false;
			m_semDomRepo = cache.ServiceLocator.GetInstance<ICmSemanticDomainRepository>();
			m_bar = bar;
			m_searchCache = new SemDomSearchCache(cache);
		}
コード例 #12
0
		public void CreateMockCache()
		{
			m_cache = FdoCache.CreateCacheWithNewBlankLangProj(
				new TestProjectId(FDOBackendProviderType.kMemoryOnly, null), "en", "es", "en", new DummyFdoUI(),
				FwDirectoryFinder.FdoDirectories, new FdoSettings());

			var xl = new XmlList();
			using (var reader = new StringReader(XmlListTests.s_ksPartsOfSpeechXml))
			{
				xl.ImportList(m_cache.LangProject, "PartsOfSpeech", reader, null);
				reader.Close();
			}
			using (var reader = new StringReader(XmlListTests.s_ksSemanticDomainsXml))
			{
				xl.ImportList(m_cache.LangProject, "SemanticDomainList", reader, null);
				reader.Close();
			}

			m_repoPOS = m_cache.ServiceLocator.GetInstance<IPartOfSpeechRepository>();
			m_repoSemDom = m_cache.ServiceLocator.GetInstance<ICmSemanticDomainRepository>();

			m_wsEn = m_cache.WritingSystemFactory.GetWsFromStr("en");
			m_wsEs = m_cache.WritingSystemFactory.GetWsFromStr("es");
			m_wsFr = m_cache.WritingSystemFactory.GetWsFromStr("fr");
			m_wsDe = m_cache.WritingSystemFactory.GetWsFromStr("de");
		}
コード例 #13
0
		protected override void CreateTestData()
		{
			base.CreateTestData();

			Cache.ActionHandlerAccessor.EndUndoTask(); // I'll make my own Undo tasks, since ImportList has its own.
			var servLoc = Cache.ServiceLocator;
			m_semdomRepo = servLoc.GetInstance<ICmSemanticDomainRepository>();
			m_entryFactory = servLoc.GetInstance<ILexEntryFactory>();
			m_senseFactory = servLoc.GetInstance<ILexSenseFactory>();

			LoadSemDomTestData(XMLTESTDATA);
		}