How do I integrate a .NET assembly plug-in into the BDS IDE?

Abstract: How do I integrate a .NET assembly plug-in into the BDS IDE?


  • Product Name: Borland Developer Studio 2006
  • Product Component: N/A
  • Platform/OS Version: Windows

Description:

This article shows how to integrate a .NET assembly into the IDE.

Resolution:

To integrate a .NET assembly into the IDE, start up the Registry Editor, and create a string value with the full path name to the location of the assembly at HKEY_CURRENT_USER\Software\Borland\BDS\4.0\Known IDE Assemblies. Set the data of the value to non-empty string in order for the IDE to load the assembly. The IDE will then load and run the assembly every time it starts up.

To have the assembly only loaded and run once, set the data to RunOnce. When the IDE encounters a string value with the data being RunOnce, the assembly pointed to by the string will be loaded and run once. The IDE will then remove the registry entry, and on subsequent runs of the IDE, the IDE won't load and run the assembly, since the registry entry is no longer there.

To run the assembly, ensure that the assembly has at least one class containing a static class method named IDERegister. The method will be called when the IDE starts up. If an assembly has multiple classes each containing a static class method named IDERegister, then each class' IDERegister method would be executed.

OpenToolsplugin.PNG

The following shows an example C# class file and a Delphi.NET unit for the above .NET plugin.


using System;
using System.Windows.Forms;

namespace OpenToolsPlugin
{

public class Class
{

public Class()
{
}

public static void IDERegister()
{
MessageBox.Show("I'm loaded");
}


}
}


unit Class2; // Include this unit in a Delphi.NET package

interface

type
TClass2 = class
private
{ Private Declarations }
public
constructor Create;
class procedure IDERegister; static;
end;

implementation
uses Dialogs;

constructor TClass2.Create;
begin
inherited Create;
end;

class procedure TClass2.IDERegister;
begin
ShowMessage('TClass2 loaded');
end;

end.