IDEIntf: added AddDependencyToOwners

git-svn-id: trunk@33835 -
This commit is contained in:
mattias 2011-11-28 16:16:14 +00:00
parent 16bfa87121
commit 1fb32e5be1
4 changed files with 13 additions and 5 deletions

View File

@ -833,6 +833,7 @@ var
// returns false to abort
var
Pkg: TIDEPackage;
DepOwner: TObject;
begin
Result:=true;
Pkg:=PackageEditingInterface.FindPackageWithName(NewGroupName);
@ -852,6 +853,11 @@ var
exit(false);
end;
end;
if PackageEditingInterface.IsOwnerDependingOnPkg(CurOwner,NewGroupName,DepOwner)
then begin
// already depending on package name
exit(true);
end;
// ToDo add dependency
end;

View File

@ -218,6 +218,8 @@ type
function IsOwnerDependingOnPkg(AnOwner: TObject; const PkgName: string;
out DependencyOwner: TObject): boolean; virtual; abstract;
function AddDependencyToOwners(OwnerList: TFPList; APackage: TIDEPackage;
OnlyTestIfPossible: boolean = false): TModalResult; virtual; abstract;
function AddUnitDependenciesForComponentClasses(const UnitFilename: string;
ComponentClassnames: TStrings;
Quiet: boolean = false): TModalResult; virtual; abstract;

View File

@ -74,8 +74,6 @@ type
IsPartOfProject: boolean): TModalResult; virtual; abstract;
function FindIncludeFileInProjectDependencies(Project1: TProject;
const Filename: string): string; virtual; abstract;
function AddDependencyToOwners(OwnerList: TFPList; APackage: TLazPackage;
OnlyTestIfPossible: boolean = false): TModalResult; virtual; abstract;
function SearchFile(const AFilename: string;
SearchFlags: TSearchIDEFileFlags;
InObject: TObject): TPkgFile; virtual; abstract;

View File

@ -217,7 +217,7 @@ type
function GetPackageOfCurrentSourceEditor(out APackage: TLazPackage): TPkgFile;
function IsOwnerDependingOnPkg(AnOwner: TObject; const PkgName: string;
out DependencyOwner: TObject): boolean; override;
function AddDependencyToOwners(OwnerList: TFPList; APackage: TLazPackage;
function AddDependencyToOwners(OwnerList: TFPList; APackage: TIDEPackage;
OnlyTestIfPossible: boolean = false): TModalResult; override;
function DoOpenPkgFile(PkgFile: TPkgFile): TModalResult;
function FindVirtualUnitSource(PkgFile: TPkgFile): string;
@ -3221,14 +3221,16 @@ begin
end;
function TPkgManager.AddDependencyToOwners(OwnerList: TFPList;
APackage: TLazPackage; OnlyTestIfPossible: boolean): TModalResult;
APackage: TIDEPackage; OnlyTestIfPossible: boolean): TModalResult;
var
i: Integer;
Item: TObject;
NewDependency: TPkgDependency;
ADependency: TPkgDependency;
r: TModalResult;
Pkg: TLazPackage;
begin
Pkg:=APackage as TLazPackage;
if not OnlyTestIfPossible then begin
Result:=AddDependencyToOwners(OwnerList,APackage,true);
if Result<>mrOk then exit;
@ -3239,7 +3241,7 @@ begin
Item:=TObject(OwnerList[i]);
if Item=APackage then continue;
if Item is TProject then begin
Result:=AddProjectDependency(TProject(Item),APackage,OnlyTestIfPossible);
Result:=AddProjectDependency(TProject(Item),Pkg,OnlyTestIfPossible);
if Result<>mrOk then exit;
end else if Item is TLazPackage then begin
NewDependency:=TPkgDependency.Create;