Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berryContributorFactory.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 BlueBerry Platform
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
18 
19 #include "internal/berryRegistryContributor.h"
20 #include "internal/berryCTKPluginUtils.h"
21 
22 #include <ctkPlugin.h>
23 
24 namespace berry {
25 
27 {
28  QString id = QString::number(contributor->getPluginId());
29  QString name = contributor->getSymbolicName();
30  QString hostId;
31  QString hostName;
32 
33 // // determine host properties, if any
34 // if (OSGIUtils.getDefault().isFragment(contributor)) {
35 // Bundle[] hosts = OSGIUtils.getDefault().getHosts(contributor);
36 // if (hosts != null) {
37 // Bundle hostBundle = hosts[0];
38 // hostId = Long.toString(hostBundle.getBundleId());
39 // hostName = hostBundle.getSymbolicName();
40 // }
41 // }
42 
43  IContributor::Pointer result(new RegistryContributor(id, name, hostId, hostName));
44  return result;
45 }
46 
48 {
49  if (contributor.IsNull())
51 
52  if (RegistryContributor::Pointer regContributor = contributor.Cast<RegistryContributor>())
53  {
54  QString symbolicName = regContributor->GetActualName();
55  return CTKPluginUtils::GetDefault()->GetPlugin(symbolicName);
56  }
58 }
59 
60 }
itk::SmartPointer< Self > Pointer
static SmartPointer< IContributor > CreateContributor(const QSharedPointer< ctkPlugin > &contributor)
static QSharedPointer< ctkPlugin > Resolve(const SmartPointer< IContributor > &contributor)
SmartPointer< Other > Cast() const