mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 10:59:11 +02:00
IDE: unit dependencies: quickfix for circular units: show path
git-svn-id: trunk@45185 -
This commit is contained in:
parent
1fcab0ef9f
commit
53ca8fe17d
@ -308,6 +308,7 @@ type
|
|||||||
|
|
||||||
TQuickFixCircularUnitReference = class(TMsgQuickFix)
|
TQuickFixCircularUnitReference = class(TMsgQuickFix)
|
||||||
public
|
public
|
||||||
|
function IsApplicable(Msg: TMessageLine; out Unitname1, Unitname2: string): boolean;
|
||||||
procedure CreateMenuItems(Fixes: TMsgQuickFixes); override;
|
procedure CreateMenuItems(Fixes: TMsgQuickFixes); override;
|
||||||
procedure QuickFix(Fixes: TMsgQuickFixes; Msg: TMessageLine); override;
|
procedure QuickFix(Fixes: TMsgQuickFixes; Msg: TMessageLine); override;
|
||||||
end;
|
end;
|
||||||
@ -427,19 +428,22 @@ end;
|
|||||||
{$IFDEF EnableNewExtTools}
|
{$IFDEF EnableNewExtTools}
|
||||||
{ TQuickFixCircularUnitReference }
|
{ TQuickFixCircularUnitReference }
|
||||||
|
|
||||||
|
function TQuickFixCircularUnitReference.IsApplicable(Msg: TMessageLine; out
|
||||||
|
Unitname1, Unitname2: string): boolean;
|
||||||
|
begin
|
||||||
|
Result:=IDEFPCParser.MsgLineIsId(Msg,10020,Unitname1,Unitname2);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TQuickFixCircularUnitReference.CreateMenuItems(
|
procedure TQuickFixCircularUnitReference.CreateMenuItems(
|
||||||
Fixes: TMsgQuickFixes);
|
Fixes: TMsgQuickFixes);
|
||||||
var
|
var
|
||||||
Msg: TMessageLine;
|
Msg: TMessageLine;
|
||||||
Code: TCodeBuffer;
|
Unitname1: string;
|
||||||
|
Unitname2: string;
|
||||||
begin
|
begin
|
||||||
if Fixes.LineCount<>1 then exit;
|
if Fixes.LineCount<>1 then exit;
|
||||||
Msg:=Fixes.Lines[0];
|
Msg:=Fixes.Lines[0];
|
||||||
if not Msg.HasSourcePosition then exit;
|
if not IsApplicable(Msg,Unitname1,Unitname2) then exit;
|
||||||
if Msg.SubTool<>SubToolFPC then exit;
|
|
||||||
if Msg.MsgID<>10020 then exit;
|
|
||||||
Code:=CodeToolBoss.LoadFile(Msg.GetFullFilename,true,false);
|
|
||||||
if Code=nil then exit;
|
|
||||||
Fixes.AddMenuItem(Self,Msg,'Show unit dependencies');
|
Fixes.AddMenuItem(Self,Msg,'Show unit dependencies');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -450,10 +454,7 @@ var
|
|||||||
UnitName2: String;
|
UnitName2: String;
|
||||||
Path: TStringList;
|
Path: TStringList;
|
||||||
begin
|
begin
|
||||||
if not IDEFPCParser.GetFPCMsgValues(Msg,UnitName1,UnitName2) then begin
|
if not IsApplicable(Msg,UnitName1,UnitName2) then exit;
|
||||||
debugln(['TQuickFixCircularUnitReference.QuickFix invalid message ',Msg.Msg]);
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
ShowUnitDependencies(true,true);
|
ShowUnitDependencies(true,true);
|
||||||
Path:=TStringList.Create;
|
Path:=TStringList.Create;
|
||||||
try
|
try
|
||||||
|
Loading…
Reference in New Issue
Block a user