Browse Source

clarify UI messages for highlighting import

pull/28/head
Siegfried Pammer 13 years ago
parent
commit
052d80d953
  1. 5
      data/resources/StringResources.resx
  2. 14
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml.cs

5
data/resources/StringResources.resx

@ -1556,8 +1556,11 @@ Examples: "120", "MainClass", "Main.cs, 120".</value> @@ -1556,8 +1556,11 @@ Examples: "120", "MainClass", "Main.cs, 120".</value>
<data name="Dialog.HighlightingEditor.Import" xml:space="preserve">
<value>Import highlighting colors</value>
</data>
<data name="Dialog.HighlightingEditor.NotSupportedMessage" xml:space="preserve">
<value>Settings version not supported!</value>
</data>
<data name="Dialog.HighlightingEditor.OverwriteCustomizationsMessage" xml:space="preserve">
<value>There are already one or more existing customizations. Do you want to replace them with the imported values? Colors that are not yet customized will be imported anyway.</value>
<value>This will reset all existing customizations and then import the selected file. Do you want to continue?</value>
</data>
<data name="Dialog.HighlightingEditor.Properties.Value" xml:space="preserve">
<value>Value</value>

14
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/HighlightingOptions.xaml.cs

@ -589,10 +589,12 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options @@ -589,10 +589,12 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
{
XElement[] items;
if (!CheckVersionAndFindCategory(document, out items) || items == null) {
Core.MessageService.ShowError("Settings version not supported!");
Core.MessageService.ShowError("${res:Dialog.HighlightingEditor.NotSupportedMessage}");
return;
}
bool? replaceCustomizations = null;
if (!MessageService.AskQuestion("${res:Dialog.HighlightingEditor.OverwriteCustomizationsMessage}"))
return;
ResetAllButtonClick(null, null);
XElement plainTextItem = items.FirstOrDefault(element => element.Attribute("Name") != null && element.Attribute("Name").Value == "Plain Text");
Color defaultForeground = Colors.Black;
Color defaultBackground = Colors.White;
@ -607,14 +609,6 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options @@ -607,14 +609,6 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
foreach (var sdKey in mapping[key]) {
IHighlightingItem color;
if (FindSDColor(sdKey, out color)) {
if (color.IsCustomized) {
if (!replaceCustomizations.HasValue) {
replaceCustomizations =
MessageService.AskQuestion("${res:Dialog.HighlightingEditor.OverwriteCustomizationsMessage}");
}
if (replaceCustomizations == false)
continue;
}
color.Bold = entry.Item3;
color.Foreground = entry.Item1 ?? defaultForeground;
color.Background = entry.Item2 ?? defaultBackground;

Loading…
Cancel
Save