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