public void GetFWDataSubDirectory_LeadingSlash() { Assert.That(DirectoryFinder.GetFWDataSubDirectory("/Translation Editor/Configuration"), Is.SamePath(Path.Combine(DirectoryFinder.FWDataDirectory, "Translation Editor/Configuration"))); }
public void GetFWDataSubDirectory_InvalidDir() { Assert.That(DirectoryFinder.GetFWDataSubDirectory("NotExisting"), Is.SamePath("NotExisting")); }
/// <summary> /// Initialize an Concorder dlg. /// </summary> /// <param name="xwindow">The main window for this modeless dlg.</param> /// <param name="configurationNode">The XML node to control the ConcorderControl.</param> internal void SetDlgInfo(XWindow xwindow, XmlNode configurationNode) { CheckDisposed(); if (xwindow == null) { throw new ArgumentNullException("Main window is missing."); } if (m_myOwnPrivateMediator != null) { throw new InvalidOperationException("It is not legal to call this method more than once."); } m_xwindow = xwindow; m_cache = m_xwindow.Mediator.PropertyTable.GetValue("cache") as FdoCache; m_myOwnPrivateMediator = new Mediator(); // The extension XML files should be stored in the data area, not in the code area. // This reduces the need for users to have administrative privileges. string dir = DirectoryFinder.GetFWDataSubDirectory(@"Language Explorer\Configuration\Extensions\Concorder"); m_myOwnPrivateMediator.StringTbl = new StringTable(dir); m_myOwnPrivateMediator.PropertyTable.SetProperty("cache", m_cache, false); m_myOwnPrivateMediator.PropertyTable.SetPropertyPersistence("cache", false); m_myOwnPrivateMediator.PropertyTable.SetPropertyDispose("cache", false); m_myOwnPrivateMediator.SpecificToOneMainWindow = true; //FwStyleSheet styleSheet = m_xwindow.Mediator.PropertyTable.GetValue("FwStyleSheet") as FwStyleSheet; //m_myOwnPrivateMediator.PropertyTable.SetProperty("FwStyleSheet", styleSheet); //m_myOwnPrivateMediator.PropertyTable.SetPropertyPersistence("FwStyleSheet", false); //m_myOwnPrivateMediator.PropertyTable.SetPropertyPersistence("FwStyleSheet", false); List <ConcorderControl.FindComboFillerBase> fcfList = new List <ConcorderControl.FindComboFillerBase>(); ConcorderControl.FindComboFillerBase fcf = null; // Find: main POS: // UsedBy: MSAs, senses, entries, analyses (x2), wordforms, compound rules fcf = new ConcorderControl.FindPossibilityComboFiller(m_cache.LangProject.PartsOfSpeechOA); fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcGrammaticalCategory']")); fcfList.Add(fcf); // Find: sense // UsedBy: Analyses, Sentences fcf = new ConcorderControl.FindComboFiller(); fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcSense']")); fcfList.Add(fcf); /* * // Find: allomorph (main and alternates) * // UsedBy: Analyses, Sentences, Ad hoc rules * fcf = new ConcorderControl.FindComboFiller(); * fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcAllomorph']")); * fcfList.Add(fcf); * * // Find: entry * // UsedBy: Analyses, Sentences * fcf = new ConcorderControl.FindComboFiller(); * fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcEntry']")); * fcfList.Add(fcf); * * // Find: Wordform * // UsedBy: Sentences * fcf = new ConcorderControl.FindComboFiller(); * fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcWordform']")); * fcfList.Add(fcf); * * //// Find: MSA * //// UsedBy: Senses, Analyses, Sentences * //fcf = new ConcorderControl.FindComboFiller(); * //fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcGrammaticalFunction']")); * //fcfList.Add(fcf); * * //// Find: Analysis * //// UsedBy: Sentences * //fcf = new ConcorderControl.FindComboFiller(); * //fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcAnalysis']")); * //fcfList.Add(fcf); * * //// Find: Environment * //// UsedBy: Allomorphs * //fcf = new ConcorderControl.FindComboFiller(); * //fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcEnvironment']")); * //fcfList.Add(fcf); * * //// Find: Word-level gloss * //// UsedBy: Sentences * //fcf = new ConcorderControl.FindComboFiller(); * //fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcWordLevelGloss']")); * //fcfList.Add(fcf); * * // Find: Phonemes * // UsedBy: * * // Find: Natural Classes * // UsedBy: * * // Find: Features * // UsedBy: * * // Find: Exception Features * // UsedBy: * * // // Find: eng rev POS * // // UsedBy: rev entries * // ubfList = new List<ConcorderControl.UsedByFiller>(); * // fcfConfigNode = configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcXX']"); * // fcf = new ConcorderControl.FindComboFiller("Grammatical Category: English Reversal", ubfList); * // fcfList.Add(fcf); * // ubfList.Add(new ConcorderControl.UsedByFiller("Reversal Entries" )); * * // // Find: spn rev POS * // // UsedBy: rev entries * // ubfList = new List<ConcorderControl.UsedByFiller>(); * // fcfConfigNode = configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcXX']"); * // fcf = new ConcorderControl.FindComboFiller("Grammatical Category: Spanish Reversal", ubfList); * // fcfList.Add(fcf); * // ubfList.Add(new ConcorderControl.UsedByFiller("Reversal Entries" )); * * //// Find: Academic Domain * //// UsedBy: Senses * //ubfList = new List<ConcorderControl.UsedByFiller>(); * //fcf = new ConcorderControl.FindPossibilityComboFiller( * // configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcAcademicDomain']"), * // ubfList, * // m_cache.LangProject.LexDbOA.DomainTypesOA); * //fcfList.Add(fcf); * //ubfList.Add(new ConcorderControl.UsedByFiller( * // configurationNode.SelectSingleNode("targetcontrols/control[@id='Senses']"))); * * //// Find: Anthropology Category * //// UsedBy: Senses * //ubfList = new List<ConcorderControl.UsedByFiller>(); * //fcf = new ConcorderControl.FindPossibilityComboFiller( * // configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcAnthropologyCategory']"), * // ubfList, * // m_cache.LangProject.AnthroListOA); * //fcfList.Add(fcf); * //ubfList.Add(new ConcorderControl.UsedByFiller( * // configurationNode.SelectSingleNode("targetcontrols/control[@id='Senses']"))); * * // Find: Confidence Level * // UsedBy: * * // Find: Education Level * // UsedBy: * * //// Find: Entry Type * //// UsedBy: Entries * //ubfList = new List<ConcorderControl.UsedByFiller>(); * //fcf = new ConcorderControl.FindPossibilityComboFiller( * // configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcEntryType']"), * // ubfList, * // m_cache.LangProject.LexDbOA.EntryTypesOA); * //fcfList.Add(fcf); * //ubfList.Add(new ConcorderControl.UsedByFiller( * // configurationNode.SelectSingleNode("targetcontrols/control[@id='Entries']"))); * * // Find: Feature Type * // UsedBy: * * // Find: Lexical Reference Type * // UsedBy: * * // Find: Location * // UsedBy: * * // Find: Minor Entry Condition * // UsedBy: Entries * //ubfList = new List<ConcorderControl.UsedByFiller>(); * //// TODO: Where is its pos list? * //fcf = new ConcorderControl.FindComboFiller( * // configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcMinorEntryCondition']"), * // ubfList); * //fcfList.Add(fcf); * //ubfList.Add(new ConcorderControl.UsedByFiller("Entries" )); * * //// Find: Morpheme Type * //// UsedBy: Allomorphs * //ubfList = new List<ConcorderControl.UsedByFiller>(); * //fcf = new ConcorderControl.FindPossibilityComboFiller( * // configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcMorphemeType']"), * // ubfList, * // m_cache.LangProject.LexDbOA.MorphTypesOA); * //fcfList.Add(fcf); * //ubfList.Add(new ConcorderControl.UsedByFiller( * // configurationNode.SelectSingleNode("targetcontrols/control[@id='Allomorphs']"))); * * // Find: People * // UsedBy: * * // Find: Positions * // UsedBy: * * // Find: Restrictions * // UsedBy: * * //// Find: Semantic Domain * //// UsedBy: Senses * //ubfList = new List<ConcorderControl.UsedByFiller>(); * //fcf = new ConcorderControl.FindPossibilityComboFiller( * // configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcSemanticDomain']"), * // ubfList, * // m_cache.LangProject.SemanticDomainListOA); * //fcfList.Add(fcf); * //ubfList.Add(new ConcorderControl.UsedByFiller( * // configurationNode.SelectSingleNode("targetcontrols/control[@id='Senses']"))); * * // Find: Sense Status * // UsedBy: Senses * //ubfList = new List<ConcorderControl.UsedByFiller>(); * //// TODO: Where is the pos list? * //fcf = new ConcorderControl.FindComboFiller( * // configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcSenseStatus']"), * // ubfList); * //fcfList.Add(fcf); * //ubfList.Add(new ConcorderControl.UsedByFiller("Senses" )); * * //// Find: Sense Type * //// UsedBy: Senses * //ubfList = new List<ConcorderControl.UsedByFiller>(); * //fcf = new ConcorderControl.FindPossibilityComboFiller( * // configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcSenseType']"), * // ubfList, * // m_cache.LangProject.LexDbOA.SenseTypesOA); * //fcfList.Add(fcf); * //ubfList.Add(new ConcorderControl.UsedByFiller( * // configurationNode.SelectSingleNode("targetcontrols/control[@id='Senses']"))); * * // Find: Status * // UsedBy: Senses * //ubfList = new List<ConcorderControl.UsedByFiller>(); * //// TODO: Where is the pos list? * //fcf = new ConcorderControl.FindComboFiller( * // configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcStatus']"), * // ubfList); * //fcfList.Add(fcf); * //ubfList.Add(new ConcorderControl.UsedByFiller("Senses" )); * * // Find: Translation Type * // UsedBy: * * //// Find: Usages * //// UsedBy: Senses * //ubfList = new List<ConcorderControl.UsedByFiller>(); * //fcf = new ConcorderControl.FindPossibilityComboFiller( * // configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcUsages']"), * // ubfList, * // m_cache.LangProject.LexDbOA.UsageTypesOA); * //fcfList.Add(fcf); * //ubfList.Add(new ConcorderControl.UsedByFiller( * // configurationNode.SelectSingleNode("targetcontrols/control[@id='Senses']"))); */ m_concorderControl.SetupDlg(m_myOwnPrivateMediator, fcfList, fcfList[0]); }