PowerDesigner addin develop

339 views Asked by At

Anyone knows how to develop an add-in for PowerDesigner? I was reading the document of PowerDesigner about how to create an ActiveX Add-in, it says "The ActiveX must implement a specific interface called IPDAddIn to become a PowerDesigner add-in.". But I don't know where the interface IPDAddIn is, and how to implement it ? Here is the online document

1

There are 1 answers

0
pascal On

I have this old example, which could give some ideas, even if not everything it up-to-date.

using PdAddInTypLib;

namespace MineSpace
{
   [ComVisible(true)]
   [Guid("A6FA0D26-77E8-4DD3-B27E-F4050C3D5188")]
   public class Launcher : IPdAddIn {

      // Main() manages the console or GUI interface
      // the PdAddIn interface is managed by an instance of Launcher
      [ComVisible(false)]
      [STAThread]
      public static void Main(String[] args) {
      }

      public Launcher() {
         _app = null;
      }

      // IPdAddIn implementation
      public void Initialize(Object anApplication) {
         try {
            _app = (PdCommon.Application)anApplication;
         }
         catch (Exception e) {
            // process
         }
      }

      public void Uninitialize() {
      }

      public String ProvideMenuItems(String aMenu, Object anObj) {
          return "";
      }

      public int IsCommandSupported(String aMenu, Object anObj, String aCommand) {
         return 0;
      }

      public void DoCommand(String aMenu, Object anObj, String aCommand) {
      }

      private PdCommon.Application _app;
   }
}

with the corresponding part in the class declaration:

[HKEY_CLASSES_ROOT\MyPlugin.Launcher]
@="MyPlugin.Launcher"

[HKEY_CLASSES_ROOT\MyPlugin.Launcher\CLSID]
@="{13749EFC-1ADA-4451-8C47-FF0B545FF172}"

[HKEY_CLASSES_ROOT\CLSID\{13749EFC-1ADA-4451-8C47-FF0B545FF172}]
@="MyPlugin.Launcher"

[HKEY_CLASSES_ROOT\CLSID\{13749EFC-1ADA-4451-8C47-FF0B545FF172}\InprocServer32]
@="C:\windows\System32\mscoree.dll"
"ThreadingModel"="Both"
"Class"="MyPlugin.Launcher"
"Assembly"="MyPlugin, Version=1.0.1402.33688, Culture=neutral, PublicKeyToken=null"
"RuntimeVersion"="v1.0.3705"

[HKEY_CLASSES_ROOT\CLSID\{13749EFC-1ADA-4451-8C47-FF0B545FF172}\ProgId]
@="MyPlugin.Launcher"

[HKEY_CLASSES_ROOT\CLSID\{13749EFC-1ADA-4451-8C47-FF0B545FF172}\Implemented Categories\{62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}]

And the corresponding code to declare the add-in in PowerDesigner. If the File value is present, PowerDesigner could call DllRegisterServer on it, if the component is not yet registered.

[HKEY_LOCAL_MACHINE\SOFTWARE\Sybase\PowerDesigner 10\Addins\MyPlugin Launcher]
"Enable"="No"
"Class"="MyPlugin.Launcher"
"Type"="ActiveX"
"File"="d:\\myplugin\\myplugin.exe"