Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berryViewPart.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 
17 #include "berryViewPart.h"
18 
19 #include <Poco/Exception.h>
20 
21 namespace berry
22 {
23 
25 {
26 
27 }
28 
30 {
31  /*
32  * Initializes this view with the given view site. A memento is passed to
33  * the view which contains a snapshot of the views state from a previous
34  * session. Where possible, the view should try to recreate that state
35  * within the part controls.
36  * <p>
37  * This implementation will ignore the memento and initialize the view in
38  * a fresh state. Subclasses may override the implementation to perform any
39  * state restoration as needed.
40  */
41  this->SetSite(site);
42 }
43 
44 void ViewPart::SaveState(IMemento::Pointer /*memento*/)
45 {
46  // do nothing
47 }
48 
50 {
52  if (site.Cast<IViewSite>().IsNull())
53  throw Poco::AssertionViolationException("The site for a view must be an IViewSite"); //$NON-NLS-1$
54 }
55 
57 {
58  return this->GetSite().Cast<IViewSite>();
59 }
60 
61 } // namespace berry
62 
void SetSite(IWorkbenchPartSite::Pointer site)
virtual void SaveState(IMemento::Pointer memento)=0
berry::SmartPointer< Self > Pointer
Definition: berryObject.h:88
virtual void CheckSite(IWorkbenchPartSite::Pointer site)
void CheckSite(IWorkbenchPartSite::Pointer site) override
virtual void Init(IViewSite::Pointer site, IMemento::Pointer memento=IMemento::Pointer(nullptr))=0
SmartPointer< Other > Cast() const
IViewSite::Pointer GetViewSite() override
IWorkbenchPartSite::Pointer GetSite() const override