Community
    • Login

    Project Panel API - How to Reload Workspace Programmatically?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 2 Posters 531 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Stier HahnS
      Stier Hahn
      last edited by Stier Hahn

      Hi,
      is there a way to reload workspace file in “Project Panel” programmatically?

      Rationale is to make it easier working with relatively complex environments, when workspace file for “Project Panel” is generated automatically/programmatically.

      I could not find anything relevant searching for “Project Panel” neither could record a macro to automate “reload”.

      -stier08

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Stier Hahn
        last edited by

        @stier-hahn said in Project Panel API - How to Reload Workspace Programmatically?:

        is there a way to reload workspace file in “Project Panel” programmatically?

        Sorry, the plugins API doesn’t define anything that controls the “Project Panel”.

        And unfortunately, the <Item id="3124" name="Reload Workspace"/> ID doesn’t work in a manually created macro, either as a type=2 (which are supposed to be Notepad++ menu commands) or type=3 (which are from the search/replace dialog, only). It’s probably because it is defined outside of the main menuCmdID, so isn’t available except when that dialog/panel is visible.

        So unfortunately, I don’t think it’s possible natively. (Using the PythonScript or other scripting plugin, you might be able to get it to work: use the commands in the PythonScript plugin’s library to make sure the panel is visible, then use generic python win32 API interface to trigger that Workspace menu and trigger the Reload Workspace entry in that menu… but that’s going to be a complicated script to write.)

        If you really wanted that feature, our New Feature FAQ explains how to request a new feature: I would probably ask for “Reload Workspace” to be both macro-recordable and accessible from the plugins API. (Really, I might ask for all of the Project Panel > Workspace actions to be at least plugins-API accessible; the New, Reload, and Save are the only ones that might make sense as macros (since macro actions cannot ask-for-input like Open and Save As would require)… but definitely the Reload would easily work inside a macro.)

        ----

        But, as an aside, I tried to get the Workspace > Reload Workspace to work at all by clicking on the buttons, and in my v8.3.3, it did not.

        What version of Notepad++ are you using?

        Or maybe I’m just using it wrong.

        1. open workspace, and verify it has one or more projects with one or more files. 2. open workspace.xml in external notepad.exe editor.
        2. add new files and/or delete existing files and/or add a whole new <Project ...> section and save in notepad.exe.
        3. Project Panel > Workspace > Reload Workspace shows no change.

        Do you have a version of Notepad++ where that sequence does work? Or is your sequence for Reload Workspace different than mine?

        Because if you have a sequence that works in an older Notepad++, but it doesn’t work in v8.3.3 (or v8.4-RC), then at some point there was a regression that nobody caught, and we should report it as a bug… but before I do that, I’d like to have a repeatable sequence that works in version X but fails in v8.3.3, which I’d then be able to bisect to the exact version that stopped it from working.

        Stier HahnS 1 Reply Last reply Reply Quote 1
        • Stier HahnS
          Stier Hahn @PeterJones
          last edited by Stier Hahn

          @peterjones , thanks for a detailed explanation.
          I’m using “Notepad++ 8.3.3 (Make Apps, not war)” x64 portable version.
          And indeed “Reload” menu item does not work for me. I was kind of ignoring this till now - was going via “open workspace” and copy pasting full path to auto generate workspace spec file.

          I do have PythonScript with custom tailored bells and whistles design for personal needs. Wondering if there is a better solution than win gui automation - which is potentially unstable.

          As advised, I’ve raised a feature request : https://github.com/notepad-plus-plus/notepad-plus-plus/issues/11550

          -stier08

          PeterJonesP 1 Reply Last reply Reply Quote 2
          • PeterJonesP
            PeterJones @Stier Hahn
            last edited by

            @stier-hahn ,

            I confirmed that Reload Workspace is not working in v8.3.3 back to v7.9.0, but it worked properly in v7.8.9. I have created a bug report at https://github.com/notepad-plus-plus/notepad-plus-plus/issues/11551

            1 Reply Last reply Reply Quote 2
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors