Converter: ChgEncodingDlg, compile regular expression right after setting it to catch exceptions. Issue #26497

git-svn-id: trunk@46030 -
This commit is contained in:
juha 2014-08-10 23:28:23 +00:00
parent 9dd4d9b9c7
commit 6f59df453d
3 changed files with 20 additions and 3 deletions

View File

@ -98,6 +98,21 @@ object ChgEncodingDialog: TChgEncodingDialog
TabOrder = 3
Text = 'FileFilterCombobox'
end
object RegExprErrorLabel: TLabel
AnchorSideLeft.Control = RegExprCheckBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = RegExprCheckBox
AnchorSideTop.Side = asrCenter
Left = 167
Height = 15
Top = 116
Width = 114
BorderSpacing.Left = 27
Caption = 'RegExprErrorLabel'
Font.Color = clFuchsia
ParentColor = False
ParentFont = False
end
end
object BtnPanel: TPanel
Left = 0

View File

@ -48,6 +48,7 @@ type
HelpButton: TBitBtn;
BtnPanel: TPanel;
CloseButton: TBitBtn;
RegExprErrorLabel: TLabel;
NewEncodingComboBox: TComboBox;
FileFilterCombobox: TComboBox;
NewEncodingLabel: TLabel;
@ -275,14 +276,15 @@ begin
ok:=false;
try
IncludeFilterRegExpr.Expression:=Expr;
IncludeFilterRegExpr.Compile;
ok:=true;
except
on E: Exception do begin
DebugLn('Invalid Include File Expression ',Expr,' ',E.Message);
MessageDlg('Error in regular expression',
E.Message,mtError,[mbCancel],0);
RegExprErrorLabel.Caption:=E.Message;
end;
end;
RegExprErrorLabel.Visible := not ok;
if not ok then exit;
NewEncoding:=NormalizeEncoding(NewEncodingComboBox.Text);

View File

@ -26,7 +26,7 @@
***************************************************************************
Author: Mattias Gaertner
Abstract:
The TDiffDlg is a dialog for showing differences between two files.