00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #include "mitkDataStorageEditorInput.h" 00019 00020 #include <berryPlatform.h> 00021 #include <mitkIDataStorageService.h> 00022 00023 namespace mitk 00024 { 00025 00026 DataStorageEditorInput::DataStorageEditorInput() 00027 { 00028 } 00029 00030 DataStorageEditorInput::DataStorageEditorInput(IDataStorageReference::Pointer ref) 00031 { 00032 m_DataStorageRef = ref; 00033 } 00034 00035 bool DataStorageEditorInput::Exists() const 00036 { 00037 return true; 00038 } 00039 00040 std::string DataStorageEditorInput::GetName() const 00041 { 00042 return "DataStorage Scene"; 00043 } 00044 00045 std::string DataStorageEditorInput::GetToolTipText() const 00046 { 00047 return ""; 00048 } 00049 00050 bool DataStorageEditorInput::operator==(const berry::Object* o) const 00051 { 00052 if (const DataStorageEditorInput* input = dynamic_cast<const DataStorageEditorInput*>(o)) 00053 return this->GetName() == input->GetName(); 00054 00055 return false; 00056 } 00057 00058 IDataStorageReference::Pointer 00059 DataStorageEditorInput::GetDataStorageReference() 00060 { 00061 if (m_DataStorageRef.IsNull()) 00062 { 00063 berry::ServiceRegistry& serviceRegistry = berry::Platform::GetServiceRegistry(); 00064 IDataStorageService::Pointer dataService = serviceRegistry.GetServiceById<IDataStorageService>(IDataStorageService::ID); 00065 if (!dataService) return IDataStorageReference::Pointer(0); 00066 m_DataStorageRef = dataService->GetDefaultDataStorage(); 00067 } 00068 00069 return m_DataStorageRef; 00070 } 00071 00072 }