mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 21:39:12 +02:00
IDE: implement find references of used unit
git-svn-id: trunk@42686 -
This commit is contained in:
parent
ac4996ff62
commit
612b486281
@ -483,7 +483,8 @@ type
|
|||||||
function FindUnitReferences(UnitCode, TargetCode: TCodeBuffer;
|
function FindUnitReferences(UnitCode, TargetCode: TCodeBuffer;
|
||||||
SkipComments: boolean; var ListOfPCodeXYPosition: TFPList): boolean;
|
SkipComments: boolean; var ListOfPCodeXYPosition: TFPList): boolean;
|
||||||
function FindUsedUnitReferences(Code: TCodeBuffer; X, Y: integer;
|
function FindUsedUnitReferences(Code: TCodeBuffer; X, Y: integer;
|
||||||
SkipComments: boolean; var ListOfPCodeXYPosition: TFPList): boolean;
|
SkipComments: boolean; out UsedUnitFilename: string;
|
||||||
|
var ListOfPCodeXYPosition: TFPList): boolean;
|
||||||
function RenameIdentifier(TreeOfPCodeXYPosition: TAVLTree;
|
function RenameIdentifier(TreeOfPCodeXYPosition: TAVLTree;
|
||||||
const OldIdentifier, NewIdentifier: string;
|
const OldIdentifier, NewIdentifier: string;
|
||||||
DeclarationCode: TCodeBuffer = nil; DeclarationCaretXY: PPoint = nil): boolean;
|
DeclarationCode: TCodeBuffer = nil; DeclarationCaretXY: PPoint = nil): boolean;
|
||||||
@ -2552,8 +2553,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TCodeToolManager.FindUsedUnitReferences(Code: TCodeBuffer; X,
|
function TCodeToolManager.FindUsedUnitReferences(Code: TCodeBuffer; X,
|
||||||
Y: integer; SkipComments: boolean; var ListOfPCodeXYPosition: TFPList
|
Y: integer; SkipComments: boolean; out UsedUnitFilename: string;
|
||||||
): boolean;
|
var ListOfPCodeXYPosition: TFPList): boolean;
|
||||||
// finds in unit of Code all references of the unit at the uses clause at X,Y
|
// finds in unit of Code all references of the unit at the uses clause at X,Y
|
||||||
var
|
var
|
||||||
CursorPos: TCodeXYPosition;
|
CursorPos: TCodeXYPosition;
|
||||||
@ -2568,7 +2569,7 @@ begin
|
|||||||
CursorPos.Y:=Y;
|
CursorPos.Y:=Y;
|
||||||
CursorPos.Code:=Code;
|
CursorPos.Code:=Code;
|
||||||
try
|
try
|
||||||
FCurCodeTool.FindUsedUnitReferences(CursorPos,SkipComments,
|
FCurCodeTool.FindUsedUnitReferences(CursorPos,SkipComments,UsedUnitFilename,
|
||||||
ListOfPCodeXYPosition);
|
ListOfPCodeXYPosition);
|
||||||
Result:=true;
|
Result:=true;
|
||||||
except
|
except
|
||||||
|
@ -46,6 +46,7 @@ var
|
|||||||
ListOfPCodeXYPosition: TFPList;
|
ListOfPCodeXYPosition: TFPList;
|
||||||
X: Integer;
|
X: Integer;
|
||||||
Y: Integer;
|
Y: Integer;
|
||||||
|
UsedUnitFilename: string;
|
||||||
begin
|
begin
|
||||||
if (ParamCount>=1) and (Paramcount<3) then begin
|
if (ParamCount>=1) and (Paramcount<3) then begin
|
||||||
writeln('Usage:');
|
writeln('Usage:');
|
||||||
@ -77,9 +78,10 @@ begin
|
|||||||
writeln('Filename: ',Code.Filename);
|
writeln('Filename: ',Code.Filename);
|
||||||
ListOfPCodeXYPosition:=nil;
|
ListOfPCodeXYPosition:=nil;
|
||||||
try
|
try
|
||||||
if CodeToolBoss.FindUsedUnitReferences(Code,X,Y,false,ListOfPCodeXYPosition) then
|
if CodeToolBoss.FindUsedUnitReferences(Code,X,Y,false,UsedUnitFilename,
|
||||||
|
ListOfPCodeXYPosition) then
|
||||||
begin
|
begin
|
||||||
writeln('List:');
|
writeln('List of ',UsedUnitFilename,':');
|
||||||
writeln(ListOfPCodeXYPositionToStr(ListOfPCodeXYPosition));
|
writeln(ListOfPCodeXYPositionToStr(ListOfPCodeXYPosition));
|
||||||
end else begin
|
end else begin
|
||||||
writeln('CodeToolBoss.FindUsedUnitReferences failed: ',CodeToolBoss.ErrorMessage);
|
writeln('CodeToolBoss.FindUsedUnitReferences failed: ',CodeToolBoss.ErrorMessage);
|
||||||
|
@ -828,9 +828,11 @@ type
|
|||||||
function FindUnitReferences(UnitCode: TCodeBuffer;
|
function FindUnitReferences(UnitCode: TCodeBuffer;
|
||||||
SkipComments: boolean; out ListOfPCodeXYPosition: TFPList): boolean; // searches unitname of UnitCode
|
SkipComments: boolean; out ListOfPCodeXYPosition: TFPList): boolean; // searches unitname of UnitCode
|
||||||
procedure FindUsedUnitReferences(const CursorPos: TCodeXYPosition;
|
procedure FindUsedUnitReferences(const CursorPos: TCodeXYPosition;
|
||||||
SkipComments: boolean; out ListOfPCodeXYPosition: TFPList); // searches all references of unit in uses clause
|
SkipComments: boolean; out UsedUnitFilename: string;
|
||||||
|
out ListOfPCodeXYPosition: TFPList); // searches all references of unit in uses clause
|
||||||
procedure FindUsedUnitReferences(TargetTool: TFindDeclarationTool;
|
procedure FindUsedUnitReferences(TargetTool: TFindDeclarationTool;
|
||||||
SkipComments: boolean; out ListOfPCodeXYPosition: TFPList); // searches all references of TargetTool
|
SkipComments: boolean;
|
||||||
|
out ListOfPCodeXYPosition: TFPList); // searches all references of TargetTool
|
||||||
|
|
||||||
function CleanPosIsDeclarationIdentifier(CleanPos: integer;
|
function CleanPosIsDeclarationIdentifier(CleanPos: integer;
|
||||||
Node: TCodeTreeNode): boolean;
|
Node: TCodeTreeNode): boolean;
|
||||||
@ -5124,7 +5126,7 @@ end;
|
|||||||
|
|
||||||
procedure TFindDeclarationTool.FindUsedUnitReferences(
|
procedure TFindDeclarationTool.FindUsedUnitReferences(
|
||||||
const CursorPos: TCodeXYPosition; SkipComments: boolean; out
|
const CursorPos: TCodeXYPosition; SkipComments: boolean; out
|
||||||
ListOfPCodeXYPosition: TFPList);
|
UsedUnitFilename: string; out ListOfPCodeXYPosition: TFPList);
|
||||||
var
|
var
|
||||||
CleanPos: integer;
|
CleanPos: integer;
|
||||||
Node: TCodeTreeNode;
|
Node: TCodeTreeNode;
|
||||||
@ -5134,6 +5136,7 @@ var
|
|||||||
TargetTool: TFindDeclarationTool;
|
TargetTool: TFindDeclarationTool;
|
||||||
begin
|
begin
|
||||||
//debugln(['TFindDeclarationTool.FindUsedUnitReferences ',dbgs(CursorPos)]);
|
//debugln(['TFindDeclarationTool.FindUsedUnitReferences ',dbgs(CursorPos)]);
|
||||||
|
UsedUnitFilename:='';
|
||||||
ListOfPCodeXYPosition:=nil;
|
ListOfPCodeXYPosition:=nil;
|
||||||
BuildTreeAndGetCleanPos(CursorPos,CleanPos);
|
BuildTreeAndGetCleanPos(CursorPos,CleanPos);
|
||||||
Node:=FindDeepestNodeAtPos(CleanPos,true);
|
Node:=FindDeepestNodeAtPos(CleanPos,true);
|
||||||
@ -5145,6 +5148,7 @@ begin
|
|||||||
AnUnitName:=ExtractUsedUnitNameAtCursor(@UnitInFilename);
|
AnUnitName:=ExtractUsedUnitNameAtCursor(@UnitInFilename);
|
||||||
//debugln(['TFindDeclarationTool.FindUsedUnitReferences Used Unit=',AnUnitName,' in "',UnitInFilename,'"']);
|
//debugln(['TFindDeclarationTool.FindUsedUnitReferences Used Unit=',AnUnitName,' in "',UnitInFilename,'"']);
|
||||||
TargetCode:=FindUnitSource(AnUnitName,UnitInFilename,true,Node.StartPos);
|
TargetCode:=FindUnitSource(AnUnitName,UnitInFilename,true,Node.StartPos);
|
||||||
|
UsedUnitFilename:=TargetCode.Filename;
|
||||||
//debugln(['TFindDeclarationTool.FindUsedUnitReferences TargetCode=',TargetCode.Filename]);
|
//debugln(['TFindDeclarationTool.FindUsedUnitReferences TargetCode=',TargetCode.Filename]);
|
||||||
TargetTool:=FOnGetCodeToolForBuffer(Self,TargetCode,false);
|
TargetTool:=FOnGetCodeToolForBuffer(Self,TargetCode,false);
|
||||||
FindUsedUnitReferences(TargetTool,SkipComments,ListOfPCodeXYPosition);
|
FindUsedUnitReferences(TargetTool,SkipComments,ListOfPCodeXYPosition);
|
||||||
|
@ -139,6 +139,7 @@ const
|
|||||||
ecRemoveUnusedUnits = ecFirstLazarus + 121;
|
ecRemoveUnusedUnits = ecFirstLazarus + 121;
|
||||||
ecUseUnit = ecFirstLazarus + 122;
|
ecUseUnit = ecFirstLazarus + 122;
|
||||||
ecFindOverloads = ecFirstLazarus + 123;
|
ecFindOverloads = ecFirstLazarus + 123;
|
||||||
|
ecFindUsedUnitRefs = ecFirstLazarus + 124;
|
||||||
|
|
||||||
// file menu
|
// file menu
|
||||||
ecNew = ecFirstLazarus + 201;
|
ecNew = ecFirstLazarus + 201;
|
||||||
@ -1214,7 +1215,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
const
|
const
|
||||||
IDEEditorCommandStrs: array[0..297] of TIdentMapEntry = (
|
IDEEditorCommandStrs: array[0..298] of TIdentMapEntry = (
|
||||||
// search
|
// search
|
||||||
(Value: ecFind; Name: 'ecFind'),
|
(Value: ecFind; Name: 'ecFind'),
|
||||||
(Value: ecFindAgain; Name: 'ecFindAgain'),
|
(Value: ecFindAgain; Name: 'ecFindAgain'),
|
||||||
@ -1306,6 +1307,7 @@ const
|
|||||||
(Value: ecRemoveUnusedUnits; Name: 'ecRemoveUnusedUnits'),
|
(Value: ecRemoveUnusedUnits; Name: 'ecRemoveUnusedUnits'),
|
||||||
(Value: ecUseUnit; Name: 'ecUseUnit'),
|
(Value: ecUseUnit; Name: 'ecUseUnit'),
|
||||||
(Value: ecFindOverloads; Name: 'ecFindOverloads'),
|
(Value: ecFindOverloads; Name: 'ecFindOverloads'),
|
||||||
|
(Value: ecFindUsedUnitRefs; Name: 'ecFindUsedUnitRefs'),
|
||||||
|
|
||||||
// file menu
|
// file menu
|
||||||
(Value: ecNew; Name: 'ecNew'),
|
(Value: ecNew; Name: 'ecNew'),
|
||||||
|
@ -557,6 +557,7 @@ begin
|
|||||||
ecShowCodeContext : Result:= srkmecShowCodeContext;
|
ecShowCodeContext : Result:= srkmecShowCodeContext;
|
||||||
ecExtractProc : Result:= srkmecExtractProc;
|
ecExtractProc : Result:= srkmecExtractProc;
|
||||||
ecFindIdentifierRefs : Result:= srkmecFindIdentifierRefs;
|
ecFindIdentifierRefs : Result:= srkmecFindIdentifierRefs;
|
||||||
|
ecFindUsedUnitRefs : Result:= lisMenuFindReferencesOfUsedUnit;
|
||||||
ecRenameIdentifier : Result:= srkmecRenameIdentifier;
|
ecRenameIdentifier : Result:= srkmecRenameIdentifier;
|
||||||
ecInvertAssignment : Result:= srkmecInvertAssignment;
|
ecInvertAssignment : Result:= srkmecInvertAssignment;
|
||||||
ecSyntaxCheck : Result:= srkmecSyntaxCheck;
|
ecSyntaxCheck : Result:= srkmecSyntaxCheck;
|
||||||
@ -1046,6 +1047,7 @@ begin
|
|||||||
ecShowCodeContext: SetSingle(VK_SPACE,[ssCtrl,ssShift]);
|
ecShowCodeContext: SetSingle(VK_SPACE,[ssCtrl,ssShift]);
|
||||||
ecExtractProc: SetSingle(VK_UNKNOWN,[]);
|
ecExtractProc: SetSingle(VK_UNKNOWN,[]);
|
||||||
ecFindIdentifierRefs: SetSingle(VK_I,[ssCtrl,ssShift]);
|
ecFindIdentifierRefs: SetSingle(VK_I,[ssCtrl,ssShift]);
|
||||||
|
ecFindUsedUnitRefs: SetSingle(VK_UNKNOWN,[]);
|
||||||
ecRenameIdentifier: SetSingle(VK_F2,[], VK_E,[ssShift,ssCtrl]);
|
ecRenameIdentifier: SetSingle(VK_F2,[], VK_E,[ssShift,ssCtrl]);
|
||||||
ecInvertAssignment: SetSingle(VK_UNKNOWN,[]);
|
ecInvertAssignment: SetSingle(VK_UNKNOWN,[]);
|
||||||
ecSyntaxCheck: SetSingle(VK_UNKNOWN,[]);
|
ecSyntaxCheck: SetSingle(VK_UNKNOWN,[]);
|
||||||
@ -1486,6 +1488,7 @@ begin
|
|||||||
ecShowCodeContext: SetSingle(VK_SPACE,[ssShift,ssCtrl]);
|
ecShowCodeContext: SetSingle(VK_SPACE,[ssShift,ssCtrl]);
|
||||||
ecExtractProc: SetSingle(VK_UNKNOWN,[]);
|
ecExtractProc: SetSingle(VK_UNKNOWN,[]);
|
||||||
ecFindIdentifierRefs: SetSingle(VK_UNKNOWN,[]);
|
ecFindIdentifierRefs: SetSingle(VK_UNKNOWN,[]);
|
||||||
|
ecFindUsedUnitRefs: SetSingle(VK_UNKNOWN,[]);
|
||||||
ecRenameIdentifier: SetSingle(VK_E,[ssShift,ssCtrl]);
|
ecRenameIdentifier: SetSingle(VK_E,[ssShift,ssCtrl]);
|
||||||
ecInvertAssignment: SetSingle(VK_UNKNOWN,[]);
|
ecInvertAssignment: SetSingle(VK_UNKNOWN,[]);
|
||||||
ecSyntaxCheck: SetSingle(VK_UNKNOWN,[]);
|
ecSyntaxCheck: SetSingle(VK_UNKNOWN,[]);
|
||||||
@ -2106,6 +2109,7 @@ begin
|
|||||||
ecShowCodeContext: SetSingle(VK_SPACE,[ssCtrl,ssShift]);
|
ecShowCodeContext: SetSingle(VK_SPACE,[ssCtrl,ssShift]);
|
||||||
ecExtractProc: SetSingle(VK_UNKNOWN,[]);
|
ecExtractProc: SetSingle(VK_UNKNOWN,[]);
|
||||||
ecFindIdentifierRefs: SetSingle(VK_UNKNOWN,[]);
|
ecFindIdentifierRefs: SetSingle(VK_UNKNOWN,[]);
|
||||||
|
ecFindUsedUnitRefs: SetSingle(VK_UNKNOWN,[]);
|
||||||
ecRenameIdentifier: SetSingle(VK_E,[ssMeta,ssShift]);
|
ecRenameIdentifier: SetSingle(VK_E,[ssMeta,ssShift]);
|
||||||
ecInvertAssignment: SetSingle(VK_UNKNOWN,[]);
|
ecInvertAssignment: SetSingle(VK_UNKNOWN,[]);
|
||||||
ecSyntaxCheck: SetSingle(VK_UNKNOWN,[]);
|
ecSyntaxCheck: SetSingle(VK_UNKNOWN,[]);
|
||||||
@ -2689,6 +2693,7 @@ begin
|
|||||||
AddDefault(C, 'Identifier completion', dlgEdIdComlet, ecIdentCompletion);
|
AddDefault(C, 'Identifier completion', dlgEdIdComlet, ecIdentCompletion);
|
||||||
AddDefault(C, 'Rename identifier', srkmecRenameIdentifier, ecRenameIdentifier);
|
AddDefault(C, 'Rename identifier', srkmecRenameIdentifier, ecRenameIdentifier);
|
||||||
AddDefault(C, 'Find identifier references', srkmecFindIdentifierRefs, ecFindIdentifierRefs);
|
AddDefault(C, 'Find identifier references', srkmecFindIdentifierRefs, ecFindIdentifierRefs);
|
||||||
|
AddDefault(C, 'Find references of used unit', lisMenuFindReferencesOfUsedUnit, ecFindUsedUnitRefs);
|
||||||
AddDefault(C, 'Show code context', srkmecShowCodeContext, ecShowCodeContext);
|
AddDefault(C, 'Show code context', srkmecShowCodeContext, ecShowCodeContext);
|
||||||
AddDefault(C, 'Extract proc', srkmecExtractProc, ecExtractProc);
|
AddDefault(C, 'Extract proc', srkmecExtractProc, ecExtractProc);
|
||||||
AddDefault(C, 'Invert assignment', srkmecInvertAssignment, ecInvertAssignment);
|
AddDefault(C, 'Invert assignment', srkmecInvertAssignment, ecInvertAssignment);
|
||||||
|
@ -2887,6 +2887,7 @@ resourcestring
|
|||||||
lisMenuExtractProc = 'Extract Procedure ...';
|
lisMenuExtractProc = 'Extract Procedure ...';
|
||||||
srkmecFindIdentifierRefs = 'Find Identifier References';
|
srkmecFindIdentifierRefs = 'Find Identifier References';
|
||||||
lisMenuFindIdentifierRefs = 'Find Identifier References ...';
|
lisMenuFindIdentifierRefs = 'Find Identifier References ...';
|
||||||
|
lisMenuFindReferencesOfUsedUnit = 'Find References Of Used Unit';
|
||||||
srkmecRenameIdentifier = 'Rename Identifier';
|
srkmecRenameIdentifier = 'Rename Identifier';
|
||||||
lisMenuRenameIdentifier = 'Rename Identifier ...';
|
lisMenuRenameIdentifier = 'Rename Identifier ...';
|
||||||
srkmecInvertAssignment = 'Invert Assignment';
|
srkmecInvertAssignment = 'Invert Assignment';
|
||||||
|
75
ide/main.pp
75
ide/main.pp
@ -932,6 +932,7 @@ type
|
|||||||
procedure DoFindDeclarationAtCursor;
|
procedure DoFindDeclarationAtCursor;
|
||||||
procedure DoFindDeclarationAtCaret(const LogCaretXY: TPoint);
|
procedure DoFindDeclarationAtCaret(const LogCaretXY: TPoint);
|
||||||
function DoFindRenameIdentifier(Rename: boolean): TModalResult;
|
function DoFindRenameIdentifier(Rename: boolean): TModalResult;
|
||||||
|
function DoFindUsedUnitReferences: boolean;
|
||||||
function DoReplaceUnitUse(OldFilename, OldUnitName,
|
function DoReplaceUnitUse(OldFilename, OldUnitName,
|
||||||
NewFilename, NewUnitName: string;
|
NewFilename, NewUnitName: string;
|
||||||
IgnoreErrors, Quiet, Confirm: boolean): TModalResult;
|
IgnoreErrors, Quiet, Confirm: boolean): TModalResult;
|
||||||
@ -3344,6 +3345,9 @@ begin
|
|||||||
ecFindIdentifierRefs:
|
ecFindIdentifierRefs:
|
||||||
DoFindRenameIdentifier(false);
|
DoFindRenameIdentifier(false);
|
||||||
|
|
||||||
|
ecFindUsedUnitRefs:
|
||||||
|
DoFindUsedUnitReferences;
|
||||||
|
|
||||||
ecRenameIdentifier:
|
ecRenameIdentifier:
|
||||||
DoFindRenameIdentifier(true);
|
DoFindRenameIdentifier(true);
|
||||||
|
|
||||||
@ -10968,6 +10972,77 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TMainIDE.DoFindUsedUnitReferences: boolean;
|
||||||
|
var
|
||||||
|
SrcEdit: TSourceEditor;
|
||||||
|
AnUnitInfo: TUnitInfo;
|
||||||
|
LogCaretXY: Classes.TPoint;
|
||||||
|
ListOfPCodeXYPosition: TFPList;
|
||||||
|
UsedUnitFilename: string;
|
||||||
|
SearchPageIndex: TTabSheet;
|
||||||
|
OldSearchPageIndex: TTabSheet;
|
||||||
|
i: Integer;
|
||||||
|
CodePos: PCodeXYPosition;
|
||||||
|
CurLine: String;
|
||||||
|
TrimmedLine: String;
|
||||||
|
TrimCnt: Integer;
|
||||||
|
Identifier: String;
|
||||||
|
begin
|
||||||
|
Result:=false;
|
||||||
|
if not BeginCodeTool(SrcEdit,AnUnitInfo,[]) then exit;
|
||||||
|
|
||||||
|
ListOfPCodeXYPosition:=nil;
|
||||||
|
try
|
||||||
|
LogCaretXY:=SrcEdit.EditorComponent.LogicalCaretXY;
|
||||||
|
if not CodeToolBoss.FindUsedUnitReferences(AnUnitInfo.Source,
|
||||||
|
LogCaretXY.X,LogCaretXY.Y,true,UsedUnitFilename,ListOfPCodeXYPosition) then
|
||||||
|
begin
|
||||||
|
DoJumpToCodeToolBossError;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
LazarusIDE.DoShowSearchResultsView(false);
|
||||||
|
// create a search result page
|
||||||
|
//debugln(['ShowIdentifierReferences ',DbgSName(SearchResultsView)]);
|
||||||
|
SearchPageIndex:=SearchResultsView.AddSearch(
|
||||||
|
'Ref: '+ExtractFileName(UsedUnitFilename),
|
||||||
|
UsedUnitFilename,
|
||||||
|
'',
|
||||||
|
ExtractFilePath(UsedUnitFilename),
|
||||||
|
'*.pas;*.pp;*.p',
|
||||||
|
[fifWholeWord,fifSearchDirectories]);
|
||||||
|
if SearchPageIndex = nil then exit;
|
||||||
|
|
||||||
|
// list results
|
||||||
|
SearchResultsView.BeginUpdate(SearchPageIndex.PageIndex);
|
||||||
|
for i:=0 to ListOfPCodeXYPosition.Count-1 do begin
|
||||||
|
CodePos:=PCodeXYPosition(ListOfPCodeXYPosition[i]);
|
||||||
|
CurLine:=TrimRight(CodePos^.Code.GetLine(CodePos^.Y-1));
|
||||||
|
if CodePos^.X<=length(CurLine) then
|
||||||
|
Identifier:=GetIdentifier(@CurLine[CodePos^.X])
|
||||||
|
else
|
||||||
|
Identifier:='';
|
||||||
|
TrimmedLine:=Trim(CurLine);
|
||||||
|
TrimCnt:=length(CurLine)-length(TrimmedLine);
|
||||||
|
//debugln('DoFindUsedUnitReferences x=',dbgs(CodePos^.x),' y=',dbgs(CodePos^.y),' ',CurLine);
|
||||||
|
SearchResultsView.AddMatch(SearchPageIndex.PageIndex,
|
||||||
|
CodePos^.Code.Filename,
|
||||||
|
Point(CodePos^.X,CodePos^.Y),
|
||||||
|
Point(CodePos^.X+length(Identifier),CodePos^.Y),
|
||||||
|
TrimmedLine,
|
||||||
|
CodePos^.X-TrimCnt, length(Identifier));
|
||||||
|
end;
|
||||||
|
|
||||||
|
OldSearchPageIndex:=SearchPageIndex;
|
||||||
|
SearchPageIndex:=nil;
|
||||||
|
SearchResultsView.EndUpdate(OldSearchPageIndex.PageIndex);
|
||||||
|
IDEWindowCreators.ShowForm(SearchResultsView,true);
|
||||||
|
|
||||||
|
finally
|
||||||
|
FreeListOfPCodeXYPosition(ListOfPCodeXYPosition);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TMainIDE.DoShowAbstractMethods: TModalResult;
|
function TMainIDE.DoShowAbstractMethods: TModalResult;
|
||||||
begin
|
begin
|
||||||
Result:=ShowAbstractMethodsDialog;
|
Result:=ShowAbstractMethodsDialog;
|
||||||
|
@ -621,7 +621,6 @@ type
|
|||||||
procedure CompleteCodeMenuItemClick(Sender: TObject);
|
procedure CompleteCodeMenuItemClick(Sender: TObject);
|
||||||
procedure ExtractProcMenuItemClick(Sender: TObject);
|
procedure ExtractProcMenuItemClick(Sender: TObject);
|
||||||
procedure InvertAssignmentMenuItemClick(Sender: TObject);
|
procedure InvertAssignmentMenuItemClick(Sender: TObject);
|
||||||
procedure FindIdentifierReferencesMenuItemClick(Sender: TObject);
|
|
||||||
procedure RenameIdentifierMenuItemClick(Sender: TObject);
|
procedure RenameIdentifierMenuItemClick(Sender: TObject);
|
||||||
procedure ShowAbstractMethodsMenuItemClick(Sender: TObject);
|
procedure ShowAbstractMethodsMenuItemClick(Sender: TObject);
|
||||||
procedure ShowEmptyMethodsMenuItemClick(Sender: TObject);
|
procedure ShowEmptyMethodsMenuItemClick(Sender: TObject);
|
||||||
@ -1257,6 +1256,7 @@ var
|
|||||||
SrcEditMenuFindPrevWordOccurrence: TIDEMenuCommand;
|
SrcEditMenuFindPrevWordOccurrence: TIDEMenuCommand;
|
||||||
SrcEditMenuFindinFiles: TIDEMenuCommand;
|
SrcEditMenuFindinFiles: TIDEMenuCommand;
|
||||||
SrcEditMenuFindIdentifierReferences: TIDEMenuCommand;
|
SrcEditMenuFindIdentifierReferences: TIDEMenuCommand;
|
||||||
|
SrcEditMenuFindUsedUnitReferences: TIDEMenuCommand;
|
||||||
// open file
|
// open file
|
||||||
SrcEditMenuOpenFileAtCursor: TIDEMenuCommand;
|
SrcEditMenuOpenFileAtCursor: TIDEMenuCommand;
|
||||||
SrcEditMenuClosePage: TIDEMenuCommand;
|
SrcEditMenuClosePage: TIDEMenuCommand;
|
||||||
@ -1504,7 +1504,11 @@ begin
|
|||||||
(AParent, 'Find in files', srkmecFindInFiles, nil,
|
(AParent, 'Find in files', srkmecFindInFiles, nil,
|
||||||
@ExecuteIdeMenuClick, nil, 'menu_search_files');
|
@ExecuteIdeMenuClick, nil, 'menu_search_files');
|
||||||
SrcEditMenuFindIdentifierReferences := RegisterIDEMenuCommand
|
SrcEditMenuFindIdentifierReferences := RegisterIDEMenuCommand
|
||||||
(AParent, 'FindIdentifierReferences',lisMenuFindIdentifierRefs, nil, @ExecuteIdeMenuClick);
|
(AParent, 'FindIdentifierReferences',lisMenuFindIdentifierRefs, nil,
|
||||||
|
@ExecuteIdeMenuClick);
|
||||||
|
SrcEditMenuFindUsedUnitReferences := RegisterIDEMenuCommand
|
||||||
|
(AParent, 'FindUsedUnitReferences', lisMenuFindReferencesOfUsedUnit,
|
||||||
|
nil, @ExecuteIdeMenuClick);
|
||||||
{%endregion}
|
{%endregion}
|
||||||
{%endregion}
|
{%endregion}
|
||||||
|
|
||||||
@ -6278,6 +6282,7 @@ begin
|
|||||||
CurWordAtCursor:=ASrcEdit.GetWordAtCurrentCaret;
|
CurWordAtCursor:=ASrcEdit.GetWordAtCurrentCaret;
|
||||||
AtIdentifier:=IsValidIdent(CurWordAtCursor);
|
AtIdentifier:=IsValidIdent(CurWordAtCursor);
|
||||||
SrcEditMenuFindIdentifierReferences.Enabled:=AtIdentifier;
|
SrcEditMenuFindIdentifierReferences.Enabled:=AtIdentifier;
|
||||||
|
SrcEditMenuFindUsedUnitReferences.Enabled:=AtIdentifier;
|
||||||
SrcEditMenuRenameIdentifier.Enabled:=AtIdentifier and (not ASrcEdit.ReadOnly);
|
SrcEditMenuRenameIdentifier.Enabled:=AtIdentifier and (not ASrcEdit.ReadOnly);
|
||||||
SrcEditMenuShowAbstractMethods.Enabled:=not ASrcEdit.ReadOnly;
|
SrcEditMenuShowAbstractMethods.Enabled:=not ASrcEdit.ReadOnly;
|
||||||
SrcEditMenuShowEmptyMethods.Enabled:=not ASrcEdit.ReadOnly;
|
SrcEditMenuShowEmptyMethods.Enabled:=not ASrcEdit.ReadOnly;
|
||||||
@ -7501,11 +7506,6 @@ begin
|
|||||||
ASrcEdit.InvertAssignment;
|
ASrcEdit.InvertAssignment;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceNotebook.FindIdentifierReferencesMenuItemClick(Sender: TObject);
|
|
||||||
begin
|
|
||||||
MainIDEInterface.DoCommand(ecFindIdentifierRefs);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSourceNotebook.RenameIdentifierMenuItemClick(Sender: TObject);
|
procedure TSourceNotebook.RenameIdentifierMenuItemClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
MainIDEInterface.DoCommand(ecRenameIdentifier);
|
MainIDEInterface.DoCommand(ecRenameIdentifier);
|
||||||
@ -9817,6 +9817,8 @@ begin
|
|||||||
SrcEditMenuFindNextWordOccurrence.Command := GetCommand(ecFindNextWordOccurrence);
|
SrcEditMenuFindNextWordOccurrence.Command := GetCommand(ecFindNextWordOccurrence);
|
||||||
SrcEditMenuFindPrevWordOccurrence.Command := GetCommand(ecFindPrevWordOccurrence);
|
SrcEditMenuFindPrevWordOccurrence.Command := GetCommand(ecFindPrevWordOccurrence);
|
||||||
SrcEditMenuFindInFiles.Command := GetCommand(ecFindInFiles);
|
SrcEditMenuFindInFiles.Command := GetCommand(ecFindInFiles);
|
||||||
|
SrcEditMenuFindIdentifierReferences.Command:=GetCommand(ecFindIdentifierRefs);
|
||||||
|
SrcEditMenuFindUsedUnitReferences.Command:=GetCommand(ecFindUsedUnitRefs);
|
||||||
{%endregion}
|
{%endregion}
|
||||||
{%endregion}
|
{%endregion}
|
||||||
|
|
||||||
@ -9879,7 +9881,6 @@ begin
|
|||||||
|
|
||||||
{%region *** Refactoring Section ***}
|
{%region *** Refactoring Section ***}
|
||||||
SrcEditMenuRenameIdentifier.Command:=GetCommand(ecRenameIdentifier);
|
SrcEditMenuRenameIdentifier.Command:=GetCommand(ecRenameIdentifier);
|
||||||
SrcEditMenuFindIdentifierReferences.Command:=GetCommand(ecFindIdentifierRefs);
|
|
||||||
SrcEditMenuExtractProc.Command:=GetCommand(ecExtractProc);
|
SrcEditMenuExtractProc.Command:=GetCommand(ecExtractProc);
|
||||||
SrcEditMenuInvertAssignment.Command:=GetCommand(ecInvertAssignment);
|
SrcEditMenuInvertAssignment.Command:=GetCommand(ecInvertAssignment);
|
||||||
SrcEditMenuShowAbstractMethods.Command:=GetCommand(ecShowAbstractMethods);
|
SrcEditMenuShowAbstractMethods.Command:=GetCommand(ecShowAbstractMethods);
|
||||||
|
Loading…
Reference in New Issue
Block a user