OSGi question

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

OSGi question

Felix Natter
Administrator
hi,

I would like to execute code like this (to make clicking on an "openmaps
node" open the map window):

                                final NodeModel model = nodeView.getModel();
                                OpenMapsExtension openMapsExtension = (OpenMapsExtension) model.getExtension(OpenMapsExtension.class);
                                if (openMapsExtension != null) {
                                        OpenMapsDialog map = new OpenMapsDialog();
                                        map.showZoomToLocation(openMapsExtension.getLocation(), openMapsExtension.getZoom());
                                }

in freeplane/src/org/freeplane/view/swing/ui/DefaultNodeMouseMotionListener.java.

The problem is that org.freeplane.plugin.openmaps.OpenMapsExtension and
org.freeplane.plugin.openmaps.mapelements.OpenMapsDialog are in the
openmaps plugin, and exporting them + importing into /freeplane probably
creates a circular dependency (at least it does for me, maybe I did
something wrong ;-)

--> without OSGi knowledge I guess that I would have to transfer the two
classes in question to another bundle "openmaps-core", and make
freeplane and freeplane_plugin_openmaps depend on it?
But hopefully there is a better solution, maybe by selectively importing
from freeplane to freeplane_plugin_openmaps and vice versa or by using
interfaces?

Thanks and Best Regards,
--
Felix Natter
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OSGi question

Volker Börchers
Administrator
Hi Felix,

Listeners are a solution to such problems by decoupling the registration from the execution: The actual implementation is only needed on registration while the Listener interface is enough to execute it. So couldn't you register another listener in the open maps plugin?

Regards, Volker

On 10. Juli 2014 21:37:23 MESZ, "Felix Natter [via Freeplane Developer]" <[hidden email]> wrote:
hi,

I would like to execute code like this (to make clicking on an "openmaps
node" open the map window):

                                final NodeModel model = nodeView.getModel();
                                OpenMapsExtension openMapsExtension = (OpenMapsExtension) model.getExtension(OpenMapsExtension.class);
                                if (openMapsExtension != null) {
                                        OpenMapsDialog map = new OpenMapsDialog();
                                        map.showZoomToLocation(openMapsExtension.getLocation(), openMapsExtension.getZoom());
                                }

in freeplane/src/org/freeplane/view/swing/ui/DefaultNodeMouseMotionListener.java.

The problem is that org.freeplane.plugin.openmaps.OpenMapsExtension and
org.freeplane.plugin.openmaps.mapelements.OpenMapsDialog are in the
openmaps plugin, and exporting them + importing into /freeplane probably
creates a circular dependency (at least it does for me, maybe I did
something wrong ;-)

--> without OSGi knowledge I guess that I would have to transfer the two
classes in question to another bundle "openmaps-core", and make
freeplane and freeplane_plugin_openmaps depend on it?
But hopefully there is a better solution, maybe by selectively importing
from freeplane to freeplane_plugin_openmaps and vice versa or by using
interfaces?

Thanks and Best Regards,
--
Felix Natter



If you reply to this email, your message will be added to the discussion below:
http://freeplane-developer.996965.n3.nabble.com/OSGi-question-tp466.html
To start a new topic under Freeplane Developer, email [hidden email]
To unsubscribe from Freeplane Developer, click here.
NAML

Viele Grüße,
Volker
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OSGi question

Felix Natter
Administrator
"Volker Börchers [via Freeplane Developer]"
<[hidden email]> writes:

> Hi Felix,

hi Volker,

> Listeners are a solution to such problems by decoupling the registration from the execution: The
> actual implementation is only needed on registration while the Listener interface is enough to
> execute it. So couldn't you register another listener in the open maps plugin?

Yes, that's the right solution, thanks.

There is already 'ViewOpenMapsAction':
freeplane_plugin_openmaps/src/org/freeplane/plugin/openmaps/actions/ViewOpenMapsAction.java
But I will add (and register) a subclass of this
("ViewOpenMapsActionWithGivenNode") because ViewOpenMapsAction grabs the
selected node (and I want to apply the action to the node that the user
clicked on).

Thanks and Best Regards,
--
Felix Natter
Loading...