-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
EditorLocalMenuImpl.pas
65 lines (57 loc) · 1.71 KB
/
EditorLocalMenuImpl.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
unit EditorLocalMenuImpl;
// References:
// "How do I add an item to te delphi editor menu?" [sic]
// http://groups-beta.google.com/group/borland.public.delphi.opentoolsapi/browse_frm/thread/da06b091817127d6/777569bdba83b09f#777569bdba83b09f
interface
procedure Register;
implementation
uses
SysUtils, Classes, Forms, ActnList, StdActns, ToolsAPI;
function GetIDEBaseEditorActionList: TCustomActionList;
var
MS: IOTAMessageServices;
procedure FindActionList(const Prefix: string; AComponent: TComponent);
var
I: Integer;
LComponent: TComponent;
begin
for I := 0 to AComponent.ComponentCount-1 do
begin
LComponent := AComponent.Components[I];
MS.AddTitleMessage(Format('%sComponent: %s', [Prefix, LComponent.Name]));
FindActionList(Prefix + ' ', LComponent);
end;
end;
var
LForm: TForm;
EditorModule: TDataModule;
EditorComponent: TComponent;
I: Integer;
begin
MS := BorlandIDEServices as IOTAMessageServices;
Result := nil;
EditorModule := nil;
for I := 0 to Screen.FormCount - 1 do
begin
LForm := Screen.Forms[I];
MS.AddTitleMessage(Format('Form: "%s"', [LForm.Name]));
FindActionList(' ', LForm);
end;
for I := 0 to Screen.DataModuleCount - 1 do
begin
MS.AddTitleMessage(Format('Data Module: "%s"', [Screen.DataModules[I].Name]));
FindActionList(' ', Screen.DataModules[I]);
end;
end;
procedure Register;
const
sMenuRegionName = 'chuacw_ProductivityExperts_DefineRegion';
var
EditorActions: TCustomActionList;
MS: IOTAMessageServices;
begin
MS := BorlandIDEServices as IOTAMessageServices;
MS.AddTitleMessage('Calling GetIDEBaseEditorActionList');
EditorActions := GetIDEBaseEditorActionList;
end;
end.