Hi,

On 10/23/2012 04:11 PM, Miklos Espak wrote:

Create a plugin, without any view.

Create a class that register listeners to the datastorage events.

Instantiate it from the plugin activator. That's the key point.

Add the "eager" option to the manifest file to make sure it is loaded before other plugins. I don't remember the syntax.


That is all correct. You could also do without the "eager" property. You would have to make sure that every plug-in who wants to access the special data node properties has a dependency on your new plug-in (maybe transitively). On startup, your plug-in would then add the properties to existing nodes and listen to any data storage changes.

You can have preference page as usual.

It's a bit tricky to get a reference to the data storage from the plugin activator. I have an example, I can give it to you next week.

Hmm, shouldn't be that tricky. Out of my head:

void start(ctkPluginContext* context)
{
  mitk::IDataStorageService* dss = NULL;
ctkServiceReference sr = context->getServiceReference<mitk::IDataStorageService>();
  if (sr)
  {
    dss = context->getService<mitk::IDataStorageService>(sr);
  }

  if (dss)
  {
    doSomethingWithDataStorage(dss->GetDataStorage ...);
  }
}

- Sascha

Miklos

On 23 Oct 2012 04:36, "Müller, Michael" <[email protected] <mailto:[email protected]>> wrote:

    Hi Matt,

    the DataNodeAdded event is essentially an event coming from the
    DataStorage and then proxified through QmitkAbstractView. I.e.
    directly listen to the DataStorage (code is given in
    QmitkAbstractView) will make you independent of your view
    visibility state.
    However, a view that should never show up on the screen is rather
    the wrong way. You can e.g. contribute preference pages and access
    the DataStorage service without creating a view class.

    Hope that helps
    Michael

    -----Ursprüngliche Nachricht-----
    Von: Clarkson, Matt [mailto:[email protected]
    <mailto:[email protected]>]
    Gesendet: Dienstag, 23. Oktober 2012 09:06
    An: mitk-users
    Betreff: [mitk-users] Application level response to NodeAdded events

    Hi there,

    within a view, derived from QmitkAbstractView it is easy to
    respond to DataStorage NodeAdded events.
    But what is the best way to provide application level
    functionality, independent of whether a view is visible on screen.

    It seems like I want a subclass derived from QmitkAbstractView,
    but I never want to see it on screen. It should just run in the
    background. I also need a corresponding preference page to control
    some preferences.
    Should I add this to my application plugin as this is derived from
    berry::AbstractUICTKPlugin, or is there another way?

    My requirements are:
      1. Whenever any image node is added, set some default properties.
      2. These default properties have a few preferences to select the
    correct calculation of these properties.
      3. It is independent of any Qt View.

    Thanks

    Matt



    
------------------------------------------------------------------------------
    Everyone hates slow websites. So do we.
    Make your web apps faster with AppDynamics Download AppDynamics
    Lite for free today:
    http://p.sf.net/sfu/appdyn_sfd2d_oct
    _______________________________________________
    mitk-users mailing list
    [email protected]
    <mailto:[email protected]>
    https://lists.sourceforge.net/lists/listinfo/mitk-users

    
------------------------------------------------------------------------------
    Everyone hates slow websites. So do we.
    Make your web apps faster with AppDynamics
    Download AppDynamics Lite for free today:
    http://p.sf.net/sfu/appdyn_sfd2d_oct
    _______________________________________________
    mitk-users mailing list
    [email protected]
    <mailto:[email protected]>
    https://lists.sourceforge.net/lists/listinfo/mitk-users


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to