Skip to content

Commit 2161fc2

Browse files
author
vkarthim
committed
Fix LT-16385:When user adds an analysis WS,
*Removed the DeleteReversalIndex from Edit menu *Handled the issue when default config is missing *Refactored the code on Create Config file. *Handled the issue #2 added in JIRA Change-Id: I499ccbd6de5e1bf4f481da702de7fa721b621510
1 parent 8b88e67 commit 2161fc2

File tree

3 files changed

+29
-12
lines changed

3 files changed

+29
-12
lines changed

DistFiles/Language Explorer/Configuration/Lexicon/areaConfiguration.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@
4040
<command id="CmdChangeToVariant" label="Lexeme Form is a variant" message="ConvertEntryIntoVariant">
4141
<parameters className="LexEntry" restrictToTool="lexiconEdit"/>
4242
</command>
43-
<command id="CmdInsertReversalIndex" label="Reversal Index" message="InsertReversalIndex">
44-
<parameters className="ReversalIndex"/>
45-
</command>
46-
<command id="CmdDeleteReversalIndex" label="Delete Reversal Index" message="DeleteReversalIndex" icon="Delete">
47-
<parameters className="ReversalIndex"/>
48-
</command>
4943
<command id="CmdInsertReversalEntry" label="Reversal Entry" message="InsertItemInVector" icon="reversalEntry">
5044
<parameters className="ReversalIndexEntry"/>
5145
</command>
@@ -195,7 +189,6 @@
195189
</menu>
196190
<menu id="Edit">
197191
<item command="CmdGoToReversalEntry" defaultVisible="false"/>
198-
<item command="CmdDeleteReversalIndex" defaultVisible="false"/>
199192
</menu>
200193
<menu id="View">
201194
<item label="Show _Dictionary Preview" boolProperty="Show_DictionaryPubPreview" defaultVisible="false"/>

Src/xWorks/FwXWindow.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,22 +1408,24 @@ private void CreateReversalIndexConfigurationFile(string originalProjectName, Ch
14081408
"AllReversalIndexes" + configFileExtension);
14091409
var newWsFilePath = Path.Combine(FwDirectoryFinder.ProjectsDirectory, originalProjectName, "ConfigurationSettings",
14101410
"ReversalIndex");
1411+
if (!File.Exists(defaultWsFilePath)) return;
14111412
//Create new Configuration File
14121413
for (int i = 0; i < analysisWsList.Items.Count; i++)
14131414
{
1414-
if (analysisWsList.Items[i].ToString().ToLower().IndexOf("audio", StringComparison.Ordinal) > 0)
1415+
string wsLang = analysisWsList.Items[i].ToString();
1416+
if (wsLang.ToLower().IndexOf("audio", StringComparison.Ordinal) > 0)
14151417
continue;
14161418

1417-
wsList.Add(analysisWsList.Items[i].ToString());
1419+
wsList.Add(wsLang);
14181420
var destFileName = Path.Combine(newWsFilePath, analysisWsList.Items[i] + configFileExtension);
14191421
if (File.Exists(destFileName))
14201422
continue;
14211423
File.Copy(defaultWsFilePath, destFileName, false);
14221424
File.SetAttributes(destFileName, FileAttributes.Normal);
14231425
var xmldoc = XDocument.Load(destFileName);
14241426
var xElement = xmldoc.XPathSelectElement("DictionaryConfiguration").Attribute("name");
1425-
xElement.Value = analysisWsList.Items[i].ToString();
1426-
xmldoc.Save(Path.Combine(newWsFilePath, analysisWsList.SelectedItem + configFileExtension));
1427+
xElement.Value = wsLang;
1428+
xmldoc.Save(Path.Combine(newWsFilePath, wsLang + configFileExtension));
14271429
}
14281430
//Delete old Configuration File
14291431
if (!Directory.Exists(newWsFilePath)) return;
@@ -2282,7 +2284,6 @@ public override void OnPropertyChanged(string name)
22822284
if (this.OwnedForms.Length > 0 && this.OwnedForms[0] is FwFindReplaceDlg)
22832285
this.OwnedForms[0].Close();
22842286
}
2285-
22862287
base.OnPropertyChanged(name);
22872288
}
22882289

Src/xWorks/XhtmlDocView.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,13 +330,36 @@ public void OnPropertyChanged(string name)
330330
m_mediator.PropertyTable.SetProperty("SelectedPublication", validPublication, true);
331331
}
332332
UpdateContent(PublicationDecorator, currentConfig);
333+
SetReversalIndexOnPropertyDlg();
333334
break;
334335
default:
335336
// Not sure what other properties might change, but I'm not doing anything.
336337
break;
337338
}
338339
}
339340

341+
342+
/// <summary>
343+
/// Method which set the current writing system when selected in ConfigureReversalIndexDialog
344+
/// </summary>
345+
private void SetReversalIndexOnPropertyDlg()
346+
{
347+
var currWsPath = m_mediator.PropertyTable.GetStringProperty("DictionaryPublicationLayout", string.Empty);
348+
var currWsName = Path.GetFileNameWithoutExtension(currWsPath);
349+
var currentAnalysisWsList = Cache.LanguageProject.CurrentAnalysisWritingSystems;
350+
foreach (var wsObj in currentAnalysisWsList.Where(wsObj => wsObj.DisplayLabel == currWsName))
351+
{
352+
if (wsObj == null && wsObj.DisplayLabel.ToLower().IndexOf("audio", StringComparison.Ordinal) >= 0) return;
353+
354+
var riRepo = Cache.ServiceLocator.GetInstance<IReversalIndexRepository>();
355+
var mHvoRevIdx = riRepo.FindOrCreateIndexForWs(wsObj.Handle).Hvo;
356+
Guid revGuid = Cache.ServiceLocator.GetInstance<ICmObjectRepository>().GetObject(mHvoRevIdx).Guid;
357+
m_mediator.PropertyTable.SetProperty("ReversalIndexGuid", revGuid.ToString());
358+
m_mediator.PropertyTable.SetPropertyPersistence("ReversalIndexGuid", true);
359+
break;
360+
}
361+
}
362+
340363
public void OnMasterRefresh(object sender)
341364
{
342365
var currentConfig = GetCurrentConfiguration();

0 commit comments

Comments
 (0)