Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berryEditorPart.h
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 #ifndef BERRYEDITORPART_H_
18 #define BERRYEDITORPART_H_
19 
21 #include "berryIEditorPart.h"
22 #include "berryIEditorInput.h"
23 #include "berryIEditorSite.h"
24 #include "berryWorkbenchPart.h"
25 
26 namespace berry {
27 
76 class BERRY_UI_QT EditorPart : public WorkbenchPart , public virtual IEditorPart {
77 
78  Q_OBJECT
79  Q_INTERFACES(berry::IEditorPart)
80 
81 public:
83 
84 private:
85 
89  IEditorInput::Pointer editorInput;
90 
91 
92 protected:
93 
97  EditorPart();
98 
119  virtual void SetInput(IEditorInput::Pointer input) ;
120 
134  virtual void SetInputWithNotify(IEditorInput::Pointer input);
135 
136  /* (non-Javadoc)
137  * @see org.blueberry.ui.part.WorkbenchPart#setContentDescription(java.lang.String)
138  */
139  virtual void SetContentDescription(const QString& description) override;
140 
141  /* (non-Javadoc)
142  * @see org.blueberry.ui.part.WorkbenchPart#setPartName(java.lang.String)
143  */
144  virtual void SetPartName(const QString& partName) override;
145 
153  void CheckSite(IWorkbenchPartSite::Pointer site) override;
154 
155 public:
156 
157  /* (non-Javadoc)
158  * Saves the contents of this editor.
159  * <p>
160  * Subclasses must override this method to implement the open-save-close lifecycle
161  * for an editor. For greater details, see <code>IEditorPart</code>
162  * </p>
163  *
164  * @see IEditorPart
165  */
166  virtual void DoSave(/*IProgressMonitor monitor*/) override = 0;
167 
168  /* (non-Javadoc)
169  * Saves the contents of this editor to another object.
170  * <p>
171  * Subclasses must override this method to implement the open-save-close lifecycle
172  * for an editor. For greater details, see <code>IEditorPart</code>
173  * </p>
174  *
175  * @see IEditorPart
176  */
177  virtual void DoSaveAs() override = 0;
178 
179  /* (non-Javadoc)
180  * Method declared on IEditorPart.
181  */
182  IEditorInput::Pointer GetEditorInput() const override;
183 
184  /* (non-Javadoc)
185  * Method declared on IEditorPart.
186  */
187  IEditorSite::Pointer GetEditorSite() const override;
188 
189  /* (non-Javadoc)
190  * Gets the title tool tip text of this part.
191  *
192  * @return the tool tip text
193  */
194  QString GetTitleToolTip() const override;
195 
196  /* (non-Javadoc)
197  * Initializes the editor part with a site and input.
198  * <p>
199  * Subclasses of <code>EditorPart</code> must implement this method. Within
200  * the implementation subclasses should verify that the input type is acceptable
201  * and then save the site and input. Here is sample code:
202  * </p>
203  * <pre>
204  * if (!(input instanceof IFileEditorInput))
205  * throw new PartInitException("Invalid Input: Must be IFileEditorInput");
206  * setSite(site);
207  * setInput(input);
208  * </pre>
209  */
210  virtual void Init(IEditorSite::Pointer site, IEditorInput::Pointer input) override = 0;
211 
212 
213  /* (non-Javadoc)
214  * Returns whether the contents of this editor have changed since the last save
215  * operation.
216  * <p>
217  * Subclasses must override this method to implement the open-save-close lifecycle
218  * for an editor. For greater details, see <code>IEditorPart</code>
219  * </p>
220  *
221  * @see IEditorPart
222  */
223  virtual bool IsDirty() const override = 0;
224 
225  /* (non-Javadoc)
226  * Returns whether the "save as" operation is supported by this editor.
227  * <p>
228  * Subclasses must override this method to implement the open-save-close lifecycle
229  * for an editor. For greater details, see <code>IEditorPart</code>
230  * </p>
231  *
232  * @see IEditorPart
233  */
234  virtual bool IsSaveAsAllowed() const override = 0;
235 
236  /* (non-Javadoc)
237  * Returns whether the contents of this editor should be saved when the editor
238  * is closed.
239  * <p>
240  * This method returns <code>true</code> if and only if the editor is dirty
241  * (<code>isDirty</code>).
242  * </p>
243  */
244  virtual bool IsSaveOnCloseNeeded() const override;
245 
246 };
247 
248 }
249 
250 #endif /*BERRYEDITORPART_H_*/
#define berryObjectMacro(...)
Definition: berryMacros.h:37
#define BERRY_UI_QT