Find References Overview (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Refactoring Applications Index

Sometimes, you may not want to change code, but want to find references to a particular identifier. The refactoring engine provides Find References, Find Local References, and Find Declaration Symbol commands.

Both Find References and Find Local References commands provide you with a hierarchical list in a separate Find References window, showing you all occurrences of a selected reference. If you choose the Find References command, you are presented with a treeview of all references to your selection in the entire project. If you want to see local references only, meaning those in the active code file, you can select the Find Local References command from the Search menu. If you want to find the original declaration within the active Delphi code file, you can use the Find Declaration Symbol command. The Find Declaration Symbol command is only valid in Delphi.

Sample Refactoring

The following sample illustrates how the Find References refactoring will proceed:

1 TFoo = class
2   loc_a: Integer;            // Find references on loc_a finds only
3   procedure Foo1;            // this line (Line 2) and the usage
4 end;                         // in TFoo.Foo1 (Line 15)

5 var
6  loc_a: string;            // Find references on loc_a here
                             // finds only this line (Line 6) and
                             // the usage in procedure Foo (Line11)
7 implementation

8 {$R *.nfm}

9 procedure Foo;
10 begin
11  loc_a := 'test';
12 end;

13 procedure TFoo.Foo1;
14 begin
15   loc_a:=1;
16 end;

See Also