Search code examples
pluginsplsqlplsqldeveloper

How to wirte a pl/sql developer plugin to insert into the special text to the cursor position of current window?


I'm study how to develop plsql-developer plugin by the plugindoc.pdf and I'm using C++.

Now,I want to insert into the special text to the cursor position of current window,

The function IDE_SetText will Covered the old text in the editor of current window.

IDE_GetCursorX and IDE_GetCursorY get the position of the cursor in the current editor.

What's next?


Solution

  • The PL/SQL Developer editor window implements the standard WinAPI editing control. Use WinAPI messages to interact with the window.

    void SetSelection(char *s)
    {
      int H;
    
      H = IDE_GetEditorHandle();
      if (H > 0)
      {
        SendMessage((HWND)H, EM_REPLACESEL, true, (int)s);
      }
    }