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