Medical Imaging Interaction Toolkit  2018.4.99-4c24e3cb
Medical Imaging Interaction Toolkit
berryPropertyTester.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #include "berryPropertyTester.h"
14 
15 #include "berryPlatform.h"
16 #include "berryIContributor.h"
17 
18 #include <ctkPlugin.h>
19 
20 namespace berry
21 {
22 
23 void PropertyTester::InternalInitialize(PropertyTesterDescriptor::Pointer descriptor)
24 {
25  fProperties = descriptor->GetProperties();
26  fNamespace= descriptor->GetNamespace();
27  fConfigElement= descriptor->GetExtensionElement();
28 }
29 
30 PropertyTesterDescriptor::Pointer PropertyTester::InternalCreateDescriptor()
31 {
32  PropertyTesterDescriptor::Pointer tester(new PropertyTesterDescriptor(fConfigElement, fNamespace, fProperties));
33  return tester;
34 }
35 
36 bool PropertyTester::Handles(const QString &namespaze,
37  const QString &property)
38 {
39  return fNamespace == namespaze && fProperties.contains("," + property + ",");
40 }
41 
43 {
44  return true;
45 }
46 
48 {
49  QSharedPointer<ctkPlugin> plugin = Platform::GetPlugin(fConfigElement->GetContributor()->GetName());
50  return plugin->getState() == ctkPlugin::ACTIVE;
51 }
52 
54 {
55  return this;
56 }
57 
58 
59 } // namespace berry
bool IsDeclaringPluginActive() override
PropertyTesterDescriptor::Pointer InternalCreateDescriptor()
bool Handles(const QString &namespaze, const QString &property) override
IPropertyTester * Instantiate() override
static QSharedPointer< ctkPlugin > GetPlugin(const QString &symbolicName)
void InternalInitialize(PropertyTesterDescriptor::Pointer descriptor)
bool IsInstantiated() override