mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 23:18:01 +02:00
IDE: warn when deleting main unit of package
git-svn-id: trunk@27855 -
This commit is contained in:
parent
0f581e002a
commit
b35808d50f
@ -4912,6 +4912,8 @@ resourcestring
|
||||
lisMoveOnePositionDown = 'Move "%s" one position down';
|
||||
lisShowDifferencesBetweenModes = 'Show differences between modes ...';
|
||||
lisChangeBuildMode = 'Change build mode';
|
||||
lisWarningThisIsTheMainUnitTheNewMainUnitWillBePas = '%sWarning: This is '
|
||||
+'the main unit. The new main unit will be %s.pas.';
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -878,6 +878,8 @@ var
|
||||
NodeIndex: Integer;
|
||||
CurFile: TPkgFile;
|
||||
CurDependency: TPkgDependency;
|
||||
s: String;
|
||||
mt: TMsgDlgType;
|
||||
begin
|
||||
ANode:=FilesTreeView.Selected;
|
||||
if (ANode=nil) or LazPackage.ReadOnly then begin
|
||||
@ -890,10 +892,17 @@ begin
|
||||
CurFile:=LazPackage.Files[NodeIndex];
|
||||
if CurFile<>nil then begin
|
||||
// confirm deletion
|
||||
s:='';
|
||||
mt:=mtConfirmation;
|
||||
if CurFile.FileType=pftMainUnit then begin
|
||||
s:=Format(lisWarningThisIsTheMainUnitTheNewMainUnitWillBePas, [#13#13,
|
||||
lowercase(LazPackage.Name)]);
|
||||
mt:=mtWarning;
|
||||
end;
|
||||
if MessageDlg(lisPckEditRemoveFile2,
|
||||
Format(lisPckEditRemoveFileFromPackage, ['"', CurFile.Filename, '"',
|
||||
#13, '"', LazPackage.IDAsString, '"']),
|
||||
mtConfirmation,[mbYes,mbNo],0)=mrNo
|
||||
#13, '"', LazPackage.IDAsString, '"'])+s,
|
||||
mt,[mbYes,mbNo],0)=mrNo
|
||||
then
|
||||
exit;
|
||||
LazPackage.RemoveFile(CurFile);
|
||||
|
Loading…
Reference in New Issue
Block a user