You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
998 B
32 lines
998 B
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) |
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) |
|
|
|
using System; |
|
using ICSharpCode.Core; |
|
using ICSharpCode.SharpDevelop.Gui; |
|
|
|
namespace ICSharpCode.AvalonEdit.AddIn.Commands |
|
{ |
|
/// <summary> |
|
/// Choose encoding, then save file. |
|
/// </summary> |
|
public class SaveFileWithEncoding : AbstractMenuCommand |
|
{ |
|
public override void Run() |
|
{ |
|
IViewContent vc = WorkbenchSingleton.Workbench.ActiveViewContent; |
|
if (vc == null) |
|
return; |
|
var codeEditor = vc.GetService<CodeEditor>(); |
|
if (codeEditor != null) { |
|
ChooseEncodingDialog dlg = new ChooseEncodingDialog(); |
|
dlg.Owner = WorkbenchSingleton.MainWindow; |
|
dlg.Encoding = codeEditor.PrimaryTextEditor.Encoding; |
|
if (dlg.ShowDialog() == true) { |
|
codeEditor.PrimaryTextEditor.Encoding = dlg.Encoding; |
|
SharpDevelop.Commands.SaveFile.Save(vc.PrimaryFile); |
|
} |
|
} |
|
} |
|
} |
|
}
|
|
|