Community
    • Login

    [New plugin] PlantUML Viewer

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    pluginplantumlnet
    40 Posts 10 Posters 18.4k 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.
    • Fruchtzwerg94F
      Fruchtzwerg94
      last edited by

      Hi Notepad++ community,

      I am happy to announce my first plugin for Notepad++. PlantUML Viewer integrates the generation and export of PlantUML diagrams to Notepad++.
      You can find the source and all information at GitHub: Fruchtzwerg94/PlantUmlViewer.

      Feel free to give me your feedback.

      Cheers,
      Philipp

      rdipardoR 1 Reply Last reply Reply Quote 7
      • rdipardoR
        rdipardo @Fruchtzwerg94
        last edited by

        There seems to be a problem with the release build. It throws an ArugmentException every time the refresh button is clicked. I tried a few Notepad++ versions [1], all with the same result.

        I cloned the source code and built a debug assembly, and it worked perfectly without any modification at all:

        PlantUML-Debug-x64.png

        When I chose the Release build configuration, the compiled assembly consistently reproduced the exception:

        PlantUML-Release-x64.png

        I didn’t look closely at the VC# project file, but I think the Release configuration is leaving out a dependency or optimizing away a critical code path.


        [1]: Notepad++ 8.3.3 (32-, 64-bit); 8.4.1 (64-bit); OpenJDK Runtime Environment Temurin-17.0.3+7 (build 17.0.3+7)

        Fruchtzwerg94F 1 Reply Last reply Reply Quote 4
        • Fruchtzwerg94F
          Fruchtzwerg94 @rdipardo
          last edited by

          @rdipardo
          Good catch, thank you for the hints. I had some time to deeper investigate it. It looks like the initialization order of some fields was incorrect. I’ve fixed it and created a new release.
          You may want to have a look at it?

          Cheers,
          Philipp

          rdipardoR 1 Reply Last reply Reply Quote 3
          • rdipardoR
            rdipardo @Fruchtzwerg94
            last edited by

            No problems with the latest release (1.0.2.3).
            Bravo!

            Fruchtzwerg94F Lycan ThropeL 2 Replies Last reply Reply Quote 4
            • Fruchtzwerg94F
              Fruchtzwerg94 @rdipardo
              last edited by

              @rdipardo Great to hear. Thanks again for checking and mentioning the issue with all the details.

              1 Reply Last reply Reply Quote 0
              • Lycan ThropeL
                Lycan Thrope @rdipardo
                last edited by

                @rdipardo ,
                Glad it’s working for you. :)
                I’m getting this error while trying to use a file. I tried using different file extensions, but according to the PlantUML site, all it has to be is a .txt file and the jar will do the conversion, but apparently asking it to ‘Show Preview’, which brings up the checkerboard graphics box, it shows nothing. When I hit ‘Refresh’ this is the error box that comes up.

                ![alt text](PlantUMLError.PNG image url)
                Debug info:


                Notepad++ v8.3.3 (64-bit)
                Build time : Mar 13 2022 - 17:20:02
                Path : C:\Program Files\Notepad++\notepad++.exe
                Command Line :
                Admin mode : OFF
                Local Conf mode : OFF
                Cloud Config : OFF
                OS Name : Windows 10 Home (64-bit)
                OS Version : 2009
                OS Build : 19044.1706
                Current ANSI codepage : 1252
                Plugins : CSVLint.dll mimeTools.dll NppConverter.dll NppExport.dll NppXmlTreeviewPlugin.dll PlantUmlViewer.dll XMLTools.dll


                Lycan ThropeL 1 Reply Last reply Reply Quote 0
                • Lycan ThropeL
                  Lycan Thrope @Lycan Thrope
                  last edited by Lycan Thrope

                  @lycan-thrope
                  I think I see the problem, the Java environment is not automatically set. I’ll have to try that first. Nope, pointed it to my Java.exe directory and same error. My Java, of course, is a 32 bit, while my NPP is a 64 bit, not sure if that’s the problem here or not.

                  Lycan ThropeL 1 Reply Last reply Reply Quote 0
                  • Lycan ThropeL
                    Lycan Thrope @Lycan Thrope
                    last edited by

                    @lycan-thrope Correction, this is the error box I get now.
                    PlantUMLErrorAfterJavaPathSet.PNG
                    I even installed the PlantUML UDL’s.

                    Lycan ThropeL 1 Reply Last reply Reply Quote 0
                    • Lycan ThropeL
                      Lycan Thrope @Lycan Thrope
                      last edited by

                      @lycan-thrope
                      LOL I suck. :) Found the problem, apparently the path I copied didn’t include the ‘java.exe’ in it, so I added that and a few seconds later, the diagram showed up. :) Nice job.

                      Fruchtzwerg94F 1 Reply Last reply Reply Quote 0
                      • Fruchtzwerg94F
                        Fruchtzwerg94 @Lycan Thrope
                        last edited by

                        Hi all,

                        this issue is related to the Java installation, which is not found. You can set the path to Java.exe manually in the plugin settings (Plugins–>PlantUML Viewer --> Settings):
                        05e7173a-39e0-4b67-bee4-310d1c888a01-image.png
                        Looks like I really have to improve the error message here in future.

                        Hope it now works for you?

                        BR,
                        Philipp

                        1 Reply Last reply Reply Quote 3
                        • Fruchtzwerg94F
                          Fruchtzwerg94
                          last edited by

                          Thanks for all the positive feedback. I am really surprised how positive the community picked up the plugin. Due to that, I’ve created a major update which improves usability and design a lot.
                          The new version supports now the dark mode
                          3630b04c-76dd-42a7-8148-f14dfcfbb89b-grafik.png
                          an improved menu
                          09c33cce-62d6-46a6-a021-40041ecd2511-grafik.png
                          a shortcut and the option to cancel ongoing generation.

                          Let me know if you have some feedback.

                          Michael VincentM 1 Reply Last reply Reply Quote 3
                          • Michael VincentM
                            Michael Vincent @Fruchtzwerg94
                            last edited by

                            @fruchtzwerg94 said in [New plugin] PlantUML Viewer:

                            a shortcut

                            My suggestion would be to remove the Shift+U shortcut and let the use define what they want with Notepad++ shortcut mapper. The Shift+U shortcut makes it impossible for me to type capital letter U in the document.

                            Otherwise - tremendous work!

                            Cheers.

                            Fruchtzwerg94F 1 Reply Last reply Reply Quote 3
                            • Fruchtzwerg94F
                              Fruchtzwerg94 @Michael Vincent
                              last edited by

                              @michael-vincent said in [New plugin] PlantUML Viewer:

                              Notepad++ shortcut mapper

                              Hi @michael-vincent,
                              thanks for your proposal. From my understanding setting a shortcut in the plugin can be overridden with the shortcut manager. So you should be free to redefine it like you need it. Is that not the right assumption?

                              Michael VincentM PeterJonesP 2 Replies Last reply Reply Quote 0
                              • Michael VincentM
                                Michael Vincent @Fruchtzwerg94
                                last edited by

                                @fruchtzwerg94 said in [New plugin] PlantUML Viewer:

                                From my understanding setting a shortcut in the plugin can be overridden with the shortcut manager. So you should be free to redefine it

                                That is correct. But upon initial install, the user isn’t aware that a shortcut has been set and during normal typing they won’t be able to type the capital letter U - which they may not initially assume has been captured by a plugin. From your write-up above, I was aware this might happen, tested it and when it did, I removed the shortcut manually from Shortcut Mapper.

                                I’ve learned it’s better to let the user define their shortcuts for plugins rather than provide them default ones (though some of my plugins still do provide “default” shortcuts).

                                Cheers.

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

                                  @fruchtzwerg94 said in [New plugin] PlantUML Viewer:

                                  thanks for your proposal. From my understanding setting a shortcut in the plugin can be overridden with the shortcut manager. So you should be free to redefine it like you need it. Is that not the right assumption?

                                  Plugins, like the applications they are affecting, should be implemented under the principle of least surprise: do not change the user expected experience without making it abundantly clear.

                                  And there are some changes that should never be made without approval from the user. One such change is you should never override the default behavior of normally typed characters, like a lowercase or uppercase letter. Your plugin having the Shift+U defaulting to your plugin command will break the user experience.

                                  Moreover, if they don’t happen to type Uppercase U for a few days after installing your plugin, they might think that their keyboard is broken and waste time debugging it or even waste money buying a new keyboard. Or, if they don’t blame it on the keyboard, they might blame it on Notepad++ itself, rather than realizing that it’s your plugin that won’t allow them to type Uppercase U in their HTML file or their C++ source code, which they wouldn’t expect to be affected by your plugin at all.

                                  To sum up

                                  1. Plugins should NEVER define shortcuts that are just a letter or shift+letter

                                  2. Plugin authors should consider not setting any default shortcut for their actions

                                    • let the user decide to add a shortcut, rather than foisting one upon them.
                                    • For all you know, the user already has another feature mapped to that shortcut, and they don’t want a hard-to-find conflict that changes the meaning of their favorite shortcut unexpectedly
                                  3. All shortcuts defined by plugin authors should contain an Alt, a Ctrl, or both.

                                    • … But don’t ignore #2
                                  Fruchtzwerg94F 1 Reply Last reply Reply Quote 4
                                  • Fruchtzwerg94F
                                    Fruchtzwerg94 @PeterJones
                                    last edited by

                                    @peterjones Your points are really good, I am definitively going to change this behaviour. To your point:
                                    “let the user decide to add a shortcut, rather than foisting one upon them.”
                                    How would you concretely implement this to Notepad++ ? Hust remove the default shortcut from code and let the user do it completely by its own in the Shortcut Manager of Notepad++. Or also an option in the plugin itself?

                                    Thanks for your input!

                                    Alan KilbornA PeterJonesP 3 Replies Last reply Reply Quote 4
                                    • Alan KilbornA
                                      Alan Kilborn @Fruchtzwerg94
                                      last edited by

                                      @fruchtzwerg94 said in [New plugin] PlantUML Viewer:

                                      Just remove the default shortcut from code and let the user do it completely by its own in the Shortcut Manager of Notepad++.

                                      Yes.

                                      Or also an option in the plugin itself?

                                      This is also fine.

                                      @peterjones said in [New plugin] PlantUML Viewer:

                                      Plugin authors should consider not setting any default shortcut for their actions

                                      100% agree that plugins should never automatically assign shortcuts, unfortunately so many of them do. :-(

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

                                        @fruchtzwerg94 said in [New plugin] PlantUML Viewer:

                                        remove the default shortcut from code and let the user do it completely by its own in the Shortcut Manager of Notepad++. Or also an option in the plugin itself?

                                        Any command in your plugin’s main menu will be visible by Shortcut Mapper, so you don’t need to do anything special. If you wanted, you could also add the ability to turn on a shortcut in your plugin, but since that interface already exists in Shortcut Mapper, that seems a lot of extra work for you.

                                        1 Reply Last reply Reply Quote 3
                                        • Alan KilbornA
                                          Alan Kilborn @Fruchtzwerg94
                                          last edited by

                                          @fruchtzwerg94 said in [New plugin] PlantUML Viewer:

                                          Or also an option in the plugin itself?

                                          When OP said this, I was thinking of like some sort of first-running “Add this plugin’s keyboard shortcuts to N++?” question, at which point, if the user said yes, the plugin would do it behind the scenes. It could even list out the ones that it would create. (Although, if there are conflicts, what to do…?) Thus it wouldn’t be for the plugin author to recreate a mini-shortcut-mapper in their plugin.

                                          Perhaps the only advantage in any of this would be for users that have zero idea the Shortcut Mapper even exists.

                                          I stand by that the best advice is to not do anything custom with shortcuts in a plugin, and put those things that benefit from having a keyboard shortcut in the plugin’s main menu (per Peter).

                                          Fruchtzwerg94F 1 Reply Last reply Reply Quote 2
                                          • Fruchtzwerg94F
                                            Fruchtzwerg94 @Alan Kilborn
                                            last edited by

                                            @alan-kilborn @PeterJones

                                            Thanks for these points. These points are great input, sorry for the confusion here. I’ve created a patch and released it already. Therefore I’ve removed the shortcut completely, which is indeed the most straight forward solution.
                                            So version 1.1.1.5 should be fine regarding this.
                                            Let me know if you see more things which could be improved!

                                            Cheers

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