Plugin installation without restart

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Plugin installation without restart

Jiri Vlasak
Dear JOSM devs,

I would like to ask about the difference between installing and upgrading JOSM
plugin. In my case, the installation does not the restart of JOSM [1]. However,
when the plugin is upgraded, the new functionality does not work until restart.

The plugin adds JMenu with multiple options.

Thanks,
jiri

[1]: https://josm.openstreetmap.de/wiki/DevelopersGuide/PluginInstallationWithoutRestart

Reply | Threaded
Open this post in threaded view
|

AW: Plugin installation without restart

Gerd Petermann
Hi Jiri,

my understanding is that your plugin either requires a restart (set plugin.canloadatruntime to false in build.xml)
or it should work so that it reacts on a event to rebuild everything (maybe costly)

Gerd

________________________________________
Von: Jiri Vlasak <[hidden email]>
Gesendet: Dienstag, 19. Februar 2019 07:47
An: [hidden email]
Betreff: Plugin installation without restart

Dear JOSM devs,

I would like to ask about the difference between installing and upgrading JOSM
plugin. In my case, the installation does not the restart of JOSM [1]. However,
when the plugin is upgraded, the new functionality does not work until restart.

The plugin adds JMenu with multiple options.

Thanks,
jiri

[1]: https://josm.openstreetmap.de/wiki/DevelopersGuide/PluginInstallationWithoutRestart


Reply | Threaded
Open this post in threaded view
|

Re: Plugin installation without restart

Jiri Vlasak
Hi Gerd,

thanks for your time. I am pretty sure I miss something trivial.

On Sat, Feb 23, 2019 at 08:10:12AM +0000, Gerd Petermann wrote:
> Hi Jiri,
>
> my understanding is that your plugin either requires a restart (set plugin.canloadatruntime to false in build.xml)

The `canLoadAtRuntime = true` should be set properly [1].

> or it should work so that it reacts on a event to rebuild everything (maybe costly)

I am confused a little bit with "reacts on a event" part. The plugin constructor add entries to menu:

    public class MapathonerPlugin extends Plugin
    {
        /**
         * Constructs a new {@code MapathonerPlugin}.
         */
        public MapathonerPlugin(PluginInformation info)
        {
            super(info);
            MainMenu mm = MainApplication.getMenu();
            JMenu hm = mm.addMenu("Mapathoner",
                    tr("Mapathoner"),
                    KeyEvent.VK_M,
                    mm.getDefaultMenuPos(),
                    ht("/Plugin/Mapathoner"));
   
            hm.setMnemonic(KeyEvent.VK_M);
   
            mm.add(hm, new BatchCircleBuildingAction());
            mm.add(hm, new BatchOrthogonalBuildingAction());
            mm.add(hm, new BatchLBuildingAction());
            hm.addSeparator();
            mm.add(hm, new PickResidentialAreaAction());
        }
    }

Which should be ok ("Adding a menu entry to the main menu in the plugin
Constructor" [3]). Also, shortcuts are bound to actions.

Thanks for any pointer,
jiri

[1]: https://gitlab.com/qeef/mapathoner/blob/master/build.gradle
[2]: https://gitlab.com/qeef/mapathoner/blob/master/src/main/java/org/openstreetmap/josm/plugins/mapathoner/MapathonerPlugin.java
[3]: https://josm.openstreetmap.de/wiki/DevelopersGuide/PluginInstallationWithoutRestart

> Gerd
>
> ________________________________________
> Von: Jiri Vlasak <[hidden email]>
> Gesendet: Dienstag, 19. Februar 2019 07:47
> An: [hidden email]
> Betreff: Plugin installation without restart
>
> Dear JOSM devs,
>
> I would like to ask about the difference between installing and upgrading JOSM
> plugin. In my case, the installation does not the restart of JOSM [1]. However,
> when the plugin is upgraded, the new functionality does not work until restart.
>
> The plugin adds JMenu with multiple options.
>
> Thanks,
> jiri
>
> [1]: https://josm.openstreetmap.de/wiki/DevelopersGuide/PluginInstallationWithoutRestart
>

Reply | Threaded
Open this post in threaded view
|

Re: Plugin installation without restart

Michael Zangl-3
Hi,

A plugin update always requires a restart - you cannot get around this.

The technical reason is that JOSM cannot unload the old plugin classes. This is why an activation of a plugin is possible without restart, but deactivating it is not.

Am 27. Februar 2019 13:33:49 MEZ schrieb Jiri Vlasak <[hidden email]>:

>Hi Gerd,
>
>thanks for your time. I am pretty sure I miss something trivial.
>
>On Sat, Feb 23, 2019 at 08:10:12AM +0000, Gerd Petermann wrote:
>> Hi Jiri,
>>
>> my understanding is that your plugin either requires a restart (set
>plugin.canloadatruntime to false in build.xml)
>
>The `canLoadAtRuntime = true` should be set properly [1].
>
>> or it should work so that it reacts on a event to rebuild everything
>(maybe costly)
>
>I am confused a little bit with "reacts on a event" part. The plugin
>constructor add entries to menu:
>
>    public class MapathonerPlugin extends Plugin
>    {
>        /**
>         * Constructs a new {@code MapathonerPlugin}.
>         */
>        public MapathonerPlugin(PluginInformation info)
>        {
>            super(info);
>            MainMenu mm = MainApplication.getMenu();
>            JMenu hm = mm.addMenu("Mapathoner",
>                    tr("Mapathoner"),
>                    KeyEvent.VK_M,
>                    mm.getDefaultMenuPos(),
>                    ht("/Plugin/Mapathoner"));
>    
>            hm.setMnemonic(KeyEvent.VK_M);
>    
>            mm.add(hm, new BatchCircleBuildingAction());
>            mm.add(hm, new BatchOrthogonalBuildingAction());
>            mm.add(hm, new BatchLBuildingAction());
>            hm.addSeparator();
>            mm.add(hm, new PickResidentialAreaAction());
>        }
>    }
>
>Which should be ok ("Adding a menu entry to the main menu in the plugin
>Constructor" [3]). Also, shortcuts are bound to actions.
>
>Thanks for any pointer,
>jiri
>
>[1]: https://gitlab.com/qeef/mapathoner/blob/master/build.gradle
>[2]:
>https://gitlab.com/qeef/mapathoner/blob/master/src/main/java/org/openstreetmap/josm/plugins/mapathoner/MapathonerPlugin.java
>[3]:
>https://josm.openstreetmap.de/wiki/DevelopersGuide/PluginInstallationWithoutRestart
>
>> Gerd
>>
>> ________________________________________
>> Von: Jiri Vlasak <[hidden email]>
>> Gesendet: Dienstag, 19. Februar 2019 07:47
>> An: [hidden email]
>> Betreff: Plugin installation without restart
>>
>> Dear JOSM devs,
>>
>> I would like to ask about the difference between installing and
>upgrading JOSM
>> plugin. In my case, the installation does not the restart of JOSM
>[1]. However,
>> when the plugin is upgraded, the new functionality does not work
>until restart.
>>
>> The plugin adds JMenu with multiple options.
>>
>> Thanks,
>> jiri
>>
>> [1]:
>https://josm.openstreetmap.de/wiki/DevelopersGuide/PluginInstallationWithoutRestart
>>
Reply | Threaded
Open this post in threaded view
|

Re: Plugin installation without restart

Jiri Vlasak
Hi,

thanks. It make sense now. I think I was confused because the JOSM didn't ask
for restart after update once. But maybe I just overlooked it.

Thanks again,
jiri

On Wed, Feb 27, 2019 at 06:56:47PM +0100, Michael Zangl wrote:

> Hi,
>
> A plugin update always requires a restart - you cannot get around this.
>
> The technical reason is that JOSM cannot unload the old plugin classes. This is why an activation of a plugin is possible without restart, but deactivating it is not.
>
> Am 27. Februar 2019 13:33:49 MEZ schrieb Jiri Vlasak <[hidden email]>:
> >Hi Gerd,
> >
> >thanks for your time. I am pretty sure I miss something trivial.
> >
> >On Sat, Feb 23, 2019 at 08:10:12AM +0000, Gerd Petermann wrote:
> >> Hi Jiri,
> >>
> >> my understanding is that your plugin either requires a restart (set
> >plugin.canloadatruntime to false in build.xml)
> >
> >The `canLoadAtRuntime = true` should be set properly [1].
> >
> >> or it should work so that it reacts on a event to rebuild everything
> >(maybe costly)
> >
> >I am confused a little bit with "reacts on a event" part. The plugin
> >constructor add entries to menu:
> >
> >    public class MapathonerPlugin extends Plugin
> >    {
> >        /**
> >         * Constructs a new {@code MapathonerPlugin}.
> >         */
> >        public MapathonerPlugin(PluginInformation info)
> >        {
> >            super(info);
> >            MainMenu mm = MainApplication.getMenu();
> >            JMenu hm = mm.addMenu("Mapathoner",
> >                    tr("Mapathoner"),
> >                    KeyEvent.VK_M,
> >                    mm.getDefaultMenuPos(),
> >                    ht("/Plugin/Mapathoner"));
> >    
> >            hm.setMnemonic(KeyEvent.VK_M);
> >    
> >            mm.add(hm, new BatchCircleBuildingAction());
> >            mm.add(hm, new BatchOrthogonalBuildingAction());
> >            mm.add(hm, new BatchLBuildingAction());
> >            hm.addSeparator();
> >            mm.add(hm, new PickResidentialAreaAction());
> >        }
> >    }
> >
> >Which should be ok ("Adding a menu entry to the main menu in the plugin
> >Constructor" [3]). Also, shortcuts are bound to actions.
> >
> >Thanks for any pointer,
> >jiri
> >
> >[1]: https://gitlab.com/qeef/mapathoner/blob/master/build.gradle
> >[2]:
> >https://gitlab.com/qeef/mapathoner/blob/master/src/main/java/org/openstreetmap/josm/plugins/mapathoner/MapathonerPlugin.java
> >[3]:
> >https://josm.openstreetmap.de/wiki/DevelopersGuide/PluginInstallationWithoutRestart
> >
> >> Gerd
> >>
> >> ________________________________________
> >> Von: Jiri Vlasak <[hidden email]>
> >> Gesendet: Dienstag, 19. Februar 2019 07:47
> >> An: [hidden email]
> >> Betreff: Plugin installation without restart
> >>
> >> Dear JOSM devs,
> >>
> >> I would like to ask about the difference between installing and
> >upgrading JOSM
> >> plugin. In my case, the installation does not the restart of JOSM
> >[1]. However,
> >> when the plugin is upgraded, the new functionality does not work
> >until restart.
> >>
> >> The plugin adds JMenu with multiple options.
> >>
> >> Thanks,
> >> jiri
> >>
> >> [1]:
> >https://josm.openstreetmap.de/wiki/DevelopersGuide/PluginInstallationWithoutRestart
> >>