Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
Medical Imaging Interaction Toolkit
berryWorkbenchAdvisor.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 BERRYWORKBENCHADVISOR_H_
14 #define BERRYWORKBENCHADVISOR_H_
15 
17 
18 #include "berryIMemento.h"
19 #include <berryIAdaptable.h>
20 
23 
24 namespace berry {
25 
93 
97  private: IWorkbenchConfigurer::Pointer workbenchConfigurer;
98 
99  /*
100  * The workbench error handler.
101  */
102  //private: AbstractStatusHandler workbenchErrorHandler;
103 
104  //private: bool introOpened;
105 
109  protected: WorkbenchAdvisor();
110  virtual ~WorkbenchAdvisor();
111 
121  public: void InternalBasicInitialize(IWorkbenchConfigurer::Pointer configurer);
122 
137  public: virtual void Initialize(IWorkbenchConfigurer::Pointer configurer);
138 
146  protected: IWorkbenchConfigurer::Pointer GetWorkbenchConfigurer();
147 
148  /*
149  * Returns the workbench error handler for the advisor.
150  *
151  * @return the workbench error handler
152  * @since 3.3
153  */
154 // public: AbstractStatusHandler getWorkbenchErrorHandler() {
155 // if (workbenchErrorHandler == null) {
156 // workbenchErrorHandler = new WorkbenchErrorHandler();
157 // }
158 // return workbenchErrorHandler;
159 // }
160 
171  public: virtual void PreStartup();
172 
183  public: virtual void PostStartup();
184 
203  public: virtual bool PreShutdown();
204 
214  public: virtual void PostShutdown();
215 
216  /*
217  * Performs arbitrary actions when the event loop crashes (the code that
218  * handles a UI event throws an exception that is not caught).
219  * <p>
220  * This method is called when the code handling a UI event throws an
221  * exception. In a perfectly functioning application, this method would
222  * never be called. In practice, it comes into play when there are bugs in
223  * the code that trigger unchecked runtime exceptions. It is also activated
224  * when the system runs short of memory, etc. Fatal errors (ThreadDeath) are
225  * not passed on to this method, as there is nothing that could be done.
226  * </p>
227  * <p>
228  * Clients must not call this method directly (although super calls are
229  * okay). The default implementation logs the problem so that it does not go
230  * unnoticed. Subclasses may override or extend this method. It is generally
231  * a bad idea to override with an empty method, and you should be especially
232  * careful when handling Errors.
233  * </p>
234  *
235  * @param exception
236  * the uncaught exception that was thrown inside the UI event
237  * loop
238  */
239 // public: void eventLoopException(Throwable exception) {
240 // // Protection from client doing super(null) call
241 // if (exception == null) {
242 // return;
243 // }
244 //
245 // try {
246 // StatusManager.getManager().handle(
247 // new Status(IStatus.ERR, WorkbenchPlugin.PI_WORKBENCH,
248 // "Unhandled event loop exception", exception)); //$NON-NLS-1$
249 //
250 // if (WorkbenchPlugin.DEBUG) {
251 // exception.printStackTrace();
252 // }
253 // } catch (Throwable e) {
254 // // One of the log listeners probably failed. Core should have logged
255 // // the
256 // // exception since its the first listener.
257 // System.err.println("Error while logging event loop exception:"); //$NON-NLS-1$
258 // exception.printStackTrace();
259 // System.err.println("Logging exception:"); //$NON-NLS-1$
260 // e.printStackTrace();
261 // }
262 // }
263 
264  /*
265  * Performs arbitrary work or yields when there are no events to be
266  * processed.
267  * <p>
268  * This method is called when there are currently no more events on the
269  * queue to be processed at the moment.
270  * </p>
271  * <p>
272  * Clients must not call this method directly (although super calls are
273  * okay). The default implementation yields until new events enter the
274  * queue. Subclasses may override or extend this method. It is generally a
275  * bad idea to override with an empty method. It is okay to call
276  * <code>IWorkbench.close()</code> from this method.
277  * </p>
278  *
279  * @param display
280  * the main display of the workbench UI
281  */
282 // public: void eventLoopIdle(Display display) {
283 // // default: yield cpu until new events enter the queue
284 // display.sleep();
285 // }
286 
296  public: virtual WorkbenchWindowAdvisor* CreateWorkbenchWindowAdvisor(
297  IWorkbenchWindowConfigurer::Pointer configurer) = 0;
298 
299 
313  public: virtual IAdaptable* GetDefaultPageInput();
314 
331  public: virtual QString GetInitialWindowPerspectiveId() = 0;
332 
343  public: virtual QString GetMainPreferencePageId();
344 
356  public: virtual bool OpenWindows();
357 
370  public: virtual bool SaveState(IMemento::Pointer memento);
371 
384  public: virtual bool RestoreState(IMemento::Pointer memento);
385 
386  /*
387  * Return the contribution comparator for the particular type of
388  * contribution. The default implementation of this class returns a
389  * comparator that sorts the items by label.
390  *
391  * The contributionType may be one of the constants in
392  * {@link IContributionService} or it can be a value defined by the user.
393  *
394  * @param contributionType
395  * the contribution type
396  * @return the comparator, must not return <code>null</code>
397  * @see IContributionService#GetComparatorFor(const QString&)
398  */
399 // public: ContributionComparator getComparatorFor(String contributionType) {
400 // return new ContributionComparator();
401 // }
402 };
403 
404 }
405 
406 #endif /*BERRYWORKBENCHADVISOR_H_*/
org_blueberry_ui_qt_Export.h
berryWorkbenchWindowAdvisor.h
berryIMemento.h
berry::SmartPointer
Implements transparent reference counting.
Definition: berryICommandCategoryListener.h:21
berry::WorkbenchWindowAdvisor
Definition: berryWorkbenchWindowAdvisor.h:67
berry::WorkbenchAdvisor
Definition: berryWorkbenchAdvisor.h:92
BERRY_UI_QT
#define BERRY_UI_QT
Definition: org_blueberry_ui_qt_Export.h:26
berry::IAdaptable
Definition: berryIAdaptable.h:50
berry::Object::Pointer
berry::SmartPointer< Self > Pointer
Definition: berryObject.h:82
berryIAdaptable.h
berry
Definition: QmitkPropertyItemModel.h:24
berryIWorkbenchConfigurer.h