IDE: disable "Add Active Unit to Package" menu item for virtual files

git-svn-id: trunk@30383 -
This commit is contained in:
juha 2011-04-19 09:13:24 +00:00
parent 6fdeb037a4
commit 3f96385d5a
2 changed files with 6 additions and 3 deletions

View File

@ -3972,7 +3972,11 @@ begin
if Assigned(ASrcEdit) then if Assigned(ASrcEdit) then
PkgFile:=PackageGraph.FindFileInAllPackages(AnUnitInfo.Filename,true, PkgFile:=PackageGraph.FindFileInAllPackages(AnUnitInfo.Filename,true,
not AnUnitInfo.IsPartOfProject); not AnUnitInfo.IsPartOfProject);
MainIDEBar.itmPkgOpenPackageOfCurUnit.Enabled:=Assigned(PkgFile); with MainIDEBar do begin
itmPkgOpenPackageOfCurUnit.Enabled:=Assigned(PkgFile);
itmPkgAddCurUnitToPkg.Enabled:=
(not AnUnitInfo.IsVirtual) and FileExistsUTF8(AnUnitInfo.Filename);
end;
end; end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}

View File

@ -3319,8 +3319,7 @@ begin
// check if filename is absolute // check if filename is absolute
if ActiveUnitInfo.IsVirtual or (not FileExistsUTF8(Filename)) then begin if ActiveUnitInfo.IsVirtual or (not FileExistsUTF8(Filename)) then begin
Result:=IDEMessageDialog(lisPkgMangFileNotSaved, Result:=IDEMessageDialog(lisPkgMangFileNotSaved,
lisPkgMangPleaseSaveTheFileBeforeAddingItToAPackage, lisPkgMangPleaseSaveTheFileBeforeAddingItToAPackage, mtWarning,[mbCancel]);
mtWarning,[mbCancel]);
exit; exit;
end; end;