Re: Plugin installation without restart

2019-02-27 Thread 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 :
> >Hi Gerd,
> >
> >thanks for your time. I am pretty sure I miss something trivial.
> >
> >On Sat, Feb 23, 2019 at 08:10:12AM +, 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 
> >> Gesendet: Dienstag, 19. Februar 2019 07:47
> >> An: josm-dev@openstreetmap.org
> >> 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
> >> 



Re: Plugin installation without restart

2019-02-27 Thread Michael Zangl
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 :
>Hi Gerd,
>
>thanks for your time. I am pretty sure I miss something trivial.
>
>On Sat, Feb 23, 2019 at 08:10:12AM +, 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 
>> Gesendet: Dienstag, 19. Februar 2019 07:47
>> An: josm-dev@openstreetmap.org
>> 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
>> 


Re: Plugin installation without restart

2019-02-27 Thread 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 +, 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 
> Gesendet: Dienstag, 19. Februar 2019 07:47
> An: josm-dev@openstreetmap.org
> 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
>