gpt4 book ai didi

delphi - 使用 Delphi Open Tools API 将我自己的项目添加到 Delphi IDE Insight (F6)

转载 作者:行者123 更新时间:2023-12-03 14:52:29 25 4
gpt4 key购买 nike

我想使用 INTAIDEINsightService 或者 AddItemAddActionList 向 Delphi 中的 IDE 洞察功能添加条目。

根据 Delphi OTA wiki,INTAIDEINsightService 允许您注册自己的操作。我能找到的唯一引用是here ,其中提到了 API 的名称,并且它确实存在。 Delphi 的帮助里没有任何相关内容。 Delphi XE 中的 ToolsAPI.pas 单元在此接口(interface)中显示了两个可让您注册操作的方法:

function AddActionList(  Actions: TCustomActionList; ... ): Integer;
procedure RemoveActionList(const Index: Integer);

注释说“项目将显示为[Description |] Category | TCustomAction.Caption。未指定类别的包含操作将不会显示。”。

我无法找到任何其他使用操作的文档或示例。一个简单的“hello world”示例,其中一个操作或只是一个项目,使用描述或类别“helloworld”注册,然后可搜索并在您按 F6 时显示,这将是完美的,但操作是首选。

看起来这样的向导必须实现 INTAIDEInsightItem 才能在 IDE 洞察中呈现自身,但我不确定这对于 hello-world 示例是否是“必需的” 。我不太确定您是否必须使用操作,或者常规的“项目”添加是否足够。

(我的最终目标是创建一个新的 gExperts 风格的专家,“通过使用 IDE 洞察按名称搜索来打开我的库路径中的任何单元”,但我将从将单元名称添加到 ide 洞察一项开始一次。)

最佳答案

以下显示“命令”下的“Hello”类别:

IDE Insight screenshot

unit Unit1;

interface

uses
SysUtils, Classes, ActnList, ImgList, Controls;

type
TDataModule1 = class(TDataModule)
ActionList1: TActionList;
ImageList1: TImageList;
ActionHello: TAction;
procedure ActionHelloExecute(Sender: TObject);
private
public
end;

var
DataModule1: TDataModule1;

implementation

{$R *.dfm}

uses
ToolsAPI, Dialogs;

procedure TDataModule1.ActionHelloExecute(Sender: TObject);
begin
ShowMessage('Hello, world!');
end;

var
Index: Integer = -1;

initialization
DataModule1 := TDataModule1.Create(nil);
Index := (BorlandIDEServices as INTAIDEInsightService).AddActionList(DataModule1.ActionList1);

finalization
if Index <> -1 then
(BorlandIDEServices as INTAIDEInsightService).RemoveActionList(Index);
FreeAndNil(DataModule1);

end.

dfm 只是一个带有操作列表、图像列表和操作的数据模块:

object DataModule1: TDataModule1
OldCreateOrder = False
Left = 218
Top = 134
Height = 215
Width = 306
object ActionList1: TActionList
Images = ImageList1
Left = 24
Top = 16
object ActionHello: TAction
Category = 'Hello'
Caption = 'Hello, World!'
ImageIndex = 0
OnExecute = ActionHelloExecute
end
end
object ImageList1: TImageList
Left = 88
Top = 16
Bitmap = {
494C010101000C000C0010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000001000000001002000000000000010
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000800080008000800086868600000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000008000800080008000FFFFFF00FFFFFF00C0C0C000868686000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000008000
800080008000FFFFFF00FFFFFF000000000000000000C0C0C000C0C0C0008686
8600000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000868686008000800080008000FFFF
FF00FFFFFF000000000000000000800080008000800000000000C0C0C000C0C0
C000868686000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008686860080008000FFFFFF000000
000000000000800080008000800080008000800080008000800000000000C0C0
C000C0C0C0008686860000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008686860000000000000000008000
800080008000800080000080800000FFFF008000800080008000800080000000
0000C0C0C000C0C0C00086868600000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008686860080008000800080008000
8000800080008000800080008000008080008000800080008000800080008000
800000000000C0C0C00000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000080008000FFFFFF008000
80008000800080008000800080008000800000FFFF0000FFFF00800080008000
8000800080000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000080008000FFFF
FF0080008000800080008000800080008000800080000080800000FFFF0000FF
FF00800080008000800000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000008000
8000FFFFFF00800080008000800080008000008080008000800000FFFF0000FF
FF00800080008000800080008000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000080008000FFFFFF00800080008000800000FFFF0000FFFF0000FFFF008000
8000800080008000800000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000080008000FFFFFF00800080008000800080008000800080008000
8000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000080008000FFFFFF008000800080008000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000800080008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000424D3E000000000000003E000000
2800000040000000100000000100010000000000800000000000000000000000
000000000000000000000000FFFFFF00FFFF000000000000FE3F000000000000
F81F000000000000E00F00000000000080070000000000000003000000000000
0001000000000000000000000000000000010000000000008001000000000000
C001000000000000E000000000000000F000000000000000F803000000000000
FC0F000000000000FE3F00000000000000000000000000000000000000000000
000000000000}
end
end

在这里,我将 AddActionList 方法的可选参数 DescriptionCategory 保留为默认的空字符串,最终为“Commands” ' 以及操作列表中的 Category 值,但您可以指定自己的值来覆盖这些默认值。

关于delphi - 使用 Delphi Open Tools API 将我自己的项目添加到 Delphi IDE Insight (F6),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10147850/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com