1 #include "XGUI_Module.h"
2 #include "XGUI_Constants.h"
3 #include "XGUI_Command.h"
4 #include "XGUI_MainMenu.h"
5 #include "XGUI_MainWindow.h"
6 #include "XGUI_MenuGroupPanel.h"
7 #include "XGUI_Tools.h"
8 #include "XGUI_Workbench.h"
9 #include "XGUI_Workshop.h"
10 #include "XGUI_Viewer.h"
11 #include "ModuleBase_WidgetFactory.h"
12 #include "XGUI_SelectionMgr.h"
13 #include "XGUI_ObjectsBrowser.h"
14 #include "XGUI_Displayer.h"
15 #include "XGUI_OperationMgr.h"
16 #include "XGUI_SalomeConnector.h"
17 #include "XGUI_ActionsMgr.h"
18 #include "XGUI_ErrorDialog.h"
20 #include <ModelAPI_PluginManager.h>
21 #include <ModelAPI_Feature.h>
22 #include <ModelAPI_Data.h>
23 #include <ModelAPI_AttributeDocRef.h>
25 #include <Events_Loop.h>
26 #include <Events_Error.h>
27 #include <ModuleBase_PropPanelOperation.h>
28 #include <ModuleBase_Operation.h>
29 #include <Config_FeatureMessage.h>
30 #include <Config_PointerMessage.h>
32 #include <QApplication>
33 #include <QFileDialog>
34 #include <QMessageBox>
35 #include <QMdiSubWindow>
36 #include <QPushButton>
37 #include <QDockWidget>
50 XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
52 myCurrentFile(QString()),
53 myPartSetModule(NULL),
54 mySalomeConnector(theConnector),
55 myPropertyPanelDock(0),
59 myMainWindow = mySalomeConnector? 0 : new XGUI_MainWindow();
61 // In SALOME viewer is accessible only when module is initialized
62 // and in SALOME mode myDisplayer object has to be created later
63 // So, displayer will be created on demand.
65 mySelector = new XGUI_SelectionMgr(this);
66 myOperationMgr = new XGUI_OperationMgr(this);
67 myActionsMgr = new XGUI_ActionsMgr(this);
68 myErrorDlg = new XGUI_ErrorDialog(myMainWindow);
70 connect(myOperationMgr, SIGNAL(operationStarted()), this, SLOT(onOperationStarted()));
71 connect(myOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)),
72 this, SLOT(onOperationStopped(ModuleBase_Operation*)));
73 connect(this, SIGNAL(errorOccurred(const QString&)), myErrorDlg, SLOT(addError(const QString&)));
76 //******************************************************
77 XGUI_Workshop::~XGUI_Workshop(void)
81 //******************************************************
82 void XGUI_Workshop::startApplication()
85 //Initialize event listening
86 Events_Loop* aLoop = Events_Loop::loop();
87 aLoop->registerListener(this, Events_Error::errorID()); //!< Listening application errors.
88 //TODO(sbh): Implement static method to extract event id [SEID]
89 Events_ID aFeatureId = aLoop->eventByName("FeatureEvent");
90 aLoop->registerListener(this, aFeatureId);
91 Events_ID aPartSetId = aLoop->eventByName("PartSetModuleEvent");
92 aLoop->registerListener(this, aPartSetId);
96 updateCommandStatus();
99 // Testing of document creation
100 //boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
101 //boost::shared_ptr<ModelAPI_Feature> aPoint1 = aMgr->rootDocument()->addFeature("Point");
102 //boost::shared_ptr<ModelAPI_Feature> aPart = aMgr->rootDocument()->addFeature("Part");
104 //aMgr->setCurrentDocument(aPart->data()->docRef("PartDocument")->value());
105 //boost::shared_ptr<ModelAPI_Feature> aPoint2 = aMgr->rootDocument()->addFeature("Point");
106 //aPoint2 = aMgr->rootDocument()->addFeature("Point");
108 //aPart = aMgr->rootDocument()->addFeature("Part");
112 //******************************************************
113 void XGUI_Workshop::initMenu()
115 if (isSalomeMode()) {
116 // Create only Undo, Redo commands
117 salomeConnector()->addEditCommand("UNDO_CMD",
118 tr("Undo"), tr("Undo last command"),
119 QIcon(":pictures/undo.png"),
120 false, this, SLOT(onUndo()),
122 salomeConnector()->addEditCommand("REDO_CMD",
123 tr("Redo"), tr("Redo last command"),
124 QIcon(":pictures/redo.png"),
125 false, this, SLOT(onRedo()),
127 salomeConnector()->addEditMenuSeparator();
130 XGUI_Workbench* aPage = myMainWindow->menuObject()->generalPage();
132 // File commands group
133 XGUI_MenuGroupPanel* aGroup = aPage->addGroup("Default");
135 XGUI_Command* aCommand;
137 aCommand = aGroup->addFeature("SAVE_CMD", tr("Save..."), tr("Save the document"),
138 QIcon(":pictures/save.png"), QKeySequence::Save);
139 aCommand->connectTo(this, SLOT(onSave()));
140 //aCommand->disable();
142 aCommand = aGroup->addFeature("UNDO_CMD", tr("Undo"), tr("Undo last command"),
143 QIcon(":pictures/undo.png"), QKeySequence::Undo);
144 aCommand->connectTo(this, SLOT(onUndo()));
146 aCommand = aGroup->addFeature("REDO_CMD", tr("Redo"), tr("Redo last command"),
147 QIcon(":pictures/redo.png"), QKeySequence::Redo);
148 aCommand->connectTo(this, SLOT(onRedo()));
150 aCommand = aGroup->addFeature("REBUILD_CMD", tr("Rebuild"), tr("Rebuild data objects"),
151 QIcon(":pictures/rebuild.png"));
153 aCommand = aGroup->addFeature("SAVEAS_CMD", tr("Save as..."), tr("Save the document into a file"),
154 QIcon(":pictures/save.png"));
155 aCommand->connectTo(this, SLOT(onSaveAs()));
156 //aCommand->disable();
158 aCommand = aGroup->addFeature("OPEN_CMD", tr("Open..."), tr("Open a new document"),
159 QIcon(":pictures/open.png"), QKeySequence::Open);
160 aCommand->connectTo(this, SLOT(onOpen()));
162 //aCommand = aGroup->addFeature("NEW_CMD", tr("New"), tr("Create a new document"),
163 // QIcon(":pictures/new.png"), QKeySequence::New);
164 //aCommand->connectTo(this, SLOT(onNew()));
166 aCommand = aGroup->addFeature("EXIT_CMD", tr("Exit"), tr("Exit application"),
167 QIcon(":pictures/close.png"), QKeySequence::Close);
168 aCommand->connectTo(this, SLOT(onExit()));
172 //******************************************************
173 XGUI_Workbench* XGUI_Workshop::addWorkbench(const QString& theName)
175 XGUI_MainMenu* aMenuBar = myMainWindow->menuObject();
176 return aMenuBar->addWorkbench(theName);
179 //******************************************************
180 void XGUI_Workshop::processEvent(const Events_Message* theMessage)
182 static Events_ID aFeatureId = Events_Loop::loop()->eventByName("FeatureEvent");
183 if (theMessage->eventID() == aFeatureId) {
184 const Config_FeatureMessage* aFeatureMsg = dynamic_cast<const Config_FeatureMessage*>(theMessage);
185 addFeature(aFeatureMsg);
188 const Config_PointerMessage* aPartSetMsg = dynamic_cast<const Config_PointerMessage*>(theMessage);
190 ModuleBase_PropPanelOperation* anOperation =
191 (ModuleBase_PropPanelOperation*)(aPartSetMsg->pointer());
193 if (myOperationMgr->startOperation(anOperation)) {
194 if (anOperation->xmlRepresentation().isEmpty()) {
195 anOperation->commit();
196 updateCommandStatus();
201 const Events_Error* anAppError = dynamic_cast<const Events_Error*>(theMessage);
203 emit errorOccurred(QString::fromLatin1(anAppError->description()));
206 myErrorDlg->activateWindow();
210 qDebug() << "XGUI_Workshop::ProcessEvent: "
211 << "Catch message, but it can not be processed.";
216 //******************************************************
217 void XGUI_Workshop::onOperationStarted()
219 ModuleBase_PropPanelOperation* aOperation =
220 (ModuleBase_PropPanelOperation*)(myOperationMgr->currentOperation());
222 if(!aOperation->xmlRepresentation().isEmpty()) { //!< No need for property panel
223 connectWithOperation(aOperation);
224 QWidget* aPropWidget = myPropertyPanelDock->findChild<QWidget*>(XGUI::PROP_PANEL_WDG);
225 qDeleteAll(aPropWidget->children());
229 ModuleBase_WidgetFactory aFactory = ModuleBase_WidgetFactory(aOperation);
230 aFactory.createWidget(aPropWidget);
231 setPropertyPannelTitle(aOperation->description());
235 //******************************************************
236 void XGUI_Workshop::onOperationStopped(ModuleBase_Operation* theOperation)
238 ModuleBase_PropPanelOperation* aOperation =
239 (ModuleBase_PropPanelOperation*)(myOperationMgr->currentOperation());
241 if(aOperation->xmlRepresentation().isEmpty()) { //!< No need for property panel
242 updateCommandStatus();
245 updateCommandStatus();
248 myActionsMgr->restoreCommandState();
256 void XGUI_Workshop::addFeature(const Config_FeatureMessage* theMessage)
260 qDebug() << "XGUI_Workshop::addFeature: NULL message.";
264 //Find or create Workbench
265 QString aWchName = QString::fromStdString(theMessage->workbenchId());
266 if (isSalomeMode()) {
267 salomeConnector()->addFeature(aWchName,
268 QString::fromStdString(theMessage->id()),
269 QString::fromStdString(theMessage->text()),
270 QString::fromStdString(theMessage->tooltip()),
271 QIcon(theMessage->icon().c_str()),
273 SLOT(onFeatureTriggered()), QKeySequence());
275 XGUI_MainMenu* aMenuBar = myMainWindow->menuObject();
276 XGUI_Workbench* aPage = aMenuBar->findWorkbench(aWchName);
278 aPage = addWorkbench(aWchName);
280 //Find or create Group
281 QString aGroupName = QString::fromStdString(theMessage->groupId());
282 XGUI_MenuGroupPanel* aGroup = aPage->findGroup(aGroupName);
284 aGroup = aPage->addGroup(aGroupName);
286 bool isUsePropPanel = theMessage->isUseInput();
288 XGUI_Command* aCommand = aGroup->addFeature(QString::fromStdString(theMessage->id()),
289 QString::fromStdString(theMessage->text()),
290 QString::fromStdString(theMessage->tooltip()),
291 QIcon(theMessage->icon().c_str()),
292 QKeySequence(), isUsePropPanel);
293 myActionsMgr->addCommand(aCommand);
294 myPartSetModule->featureCreated(aCommand);
299 * Makes a signal/slot connections between Property Panel
300 * and given operation. The given operation becomes a
301 * current operation and previous operation if exists
303 void XGUI_Workshop::connectWithOperation(ModuleBase_Operation* theOperation)
305 QPushButton* aOkBtn = myPropertyPanelDock->findChild<QPushButton*>(XGUI::PROP_PANEL_OK);
306 connect(aOkBtn, SIGNAL(clicked()), theOperation, SLOT(commit()));
307 QPushButton* aCancelBtn = myPropertyPanelDock->findChild<QPushButton*>(XGUI::PROP_PANEL_CANCEL);
308 connect(aCancelBtn, SIGNAL(clicked()), theOperation, SLOT(abort()));
310 QAction* aCommand = 0;
311 if (isSalomeMode()) {
312 aCommand = salomeConnector()->command(theOperation->operationId());
314 XGUI_MainMenu* aMenu = myMainWindow->menuObject();
315 aCommand = aMenu->feature(theOperation->operationId());
317 //Abort operation on uncheck the command
318 connect(aCommand, SIGNAL(triggered(bool)), theOperation, SLOT(setRunning(bool)));
322 * Saves document with given name.
324 void XGUI_Workshop::saveDocument(QString theName)
326 QApplication::restoreOverrideCursor();
327 boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
328 boost::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
329 aDoc->save(theName.toLatin1().constData());
330 QApplication::restoreOverrideCursor();
333 //******************************************************
334 void XGUI_Workshop::onExit()
336 boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
337 boost::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
338 if(aDoc->isModified()) {
339 int anAnswer = QMessageBox::question(
340 myMainWindow, tr("Save current file"),
341 tr("The document is modified, save before exit?"),
342 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Cancel);
343 if(anAnswer == QMessageBox::Save) {
345 } else if (anAnswer == QMessageBox::Cancel) {
352 //******************************************************
353 void XGUI_Workshop::onNew()
355 QApplication::setOverrideCursor(Qt::WaitCursor);
356 if (objectBrowser() == 0) {
358 mySelector->connectObjectBrowser(objectBrowser());
361 if (!isSalomeMode()) {
362 myMainWindow->showPythonConsole();
363 QMdiSubWindow* aWnd = myMainWindow->viewer()->createView();
364 aWnd->showMaximized();
365 updateCommandStatus();
367 QApplication::restoreOverrideCursor();
370 //******************************************************
371 void XGUI_Workshop::onOpen()
373 //save current file before close if modified
374 boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
375 boost::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
376 if(aDoc->isModified()) {
377 //TODO(sbh): re-launch the app?
378 int anAnswer = QMessageBox::question(
379 myMainWindow, tr("Save current file"),
380 tr("The document is modified, save before opening another?"),
381 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Cancel);
382 if(anAnswer == QMessageBox::Save) {
384 } else if (anAnswer == QMessageBox::Cancel) {
391 //show file dialog, check if readable and open
392 myCurrentFile = QFileDialog::getOpenFileName(mainWindow());
393 if(myCurrentFile.isEmpty())
395 QFileInfo aFileInfo(myCurrentFile);
396 if(!aFileInfo.exists() || !aFileInfo.isReadable()) {
397 QMessageBox::critical(myMainWindow, tr("Warning"), tr("Unable to open the file."));
401 QApplication::setOverrideCursor(Qt::WaitCursor);
402 aDoc->load(myCurrentFile.toLatin1().constData());
403 QApplication::restoreOverrideCursor();
404 updateCommandStatus();
407 //******************************************************
408 void XGUI_Workshop::onSave()
410 if(myCurrentFile.isEmpty()) {
414 saveDocument(myCurrentFile);
415 updateCommandStatus();
418 //******************************************************
419 void XGUI_Workshop::onSaveAs()
421 QString aTemp = myCurrentFile;
422 myCurrentFile = QFileDialog::getSaveFileName(mainWindow());
423 if(myCurrentFile.isEmpty()) {
424 myCurrentFile = aTemp;
427 QFileInfo aFileInfo(myCurrentFile);
428 if(aFileInfo.exists() && !aFileInfo.isWritable()) {
429 QMessageBox::critical(myMainWindow, tr("Warning"), tr("Unable to save the file."));
435 //******************************************************
436 void XGUI_Workshop::onUndo()
438 objectBrowser()->setCurrentIndex(QModelIndex());
439 boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
440 boost::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
442 updateCommandStatus();
445 //******************************************************
446 void XGUI_Workshop::onRedo()
448 objectBrowser()->setCurrentIndex(QModelIndex());
449 boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
450 boost::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
452 updateCommandStatus();
455 //******************************************************
456 XGUI_Module* XGUI_Workshop::loadModule(const QString& theModule)
458 QString libName = library(theModule);
459 if (libName.isEmpty()) {
461 qPrintable( tr( "Information about module \"%1\" doesn't exist." ).arg( theModule ) ));
466 CREATE_FUNC crtInst = 0;
470 HINSTANCE modLib = ::LoadLibrary((LPTSTR) qPrintable(libName));
474 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
475 0, ::GetLastError(), 0, (LPTSTR) & lpMsgBuf, 0, 0);
476 QString aMsg((char*) &lpMsgBuf);
477 err = QString("Failed to load %1. %2").arg(libName).arg(aMsg);
478 ::LocalFree(lpMsgBuf);
480 crtInst = (CREATE_FUNC) ::GetProcAddress(modLib, CREATE_MODULE);
484 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM
485 | FORMAT_MESSAGE_IGNORE_INSERTS,
486 0, ::GetLastError(), 0, (LPTSTR) & lpMsgBuf, 0, 0);
487 QString aMsg((char*) &lpMsgBuf);
488 err = QString("Failed to find %1 function. %2").arg( CREATE_MODULE).arg(aMsg);
489 ::LocalFree(lpMsgBuf);
493 void* modLib = dlopen( libName.toLatin1(), RTLD_LAZY );
495 err = QString( "Can not load library %1. %2" ).arg( libName ).arg( dlerror() );
498 crtInst = (CREATE_FUNC)dlsym( modLib, CREATE_MODULE );
500 err = QString( "Failed to find function %1. %2" ).arg( CREATE_MODULE ).arg( dlerror() );
504 XGUI_Module* aModule = crtInst ? crtInst(this) : 0;
506 if (!err.isEmpty()) {
507 if (mainWindow() && mainWindow()->isVisible())
508 QMessageBox::warning(mainWindow(), tr("Error"), err);
510 qWarning( qPrintable( err ));
515 //******************************************************
516 bool XGUI_Workshop::activateModule()
518 myPartSetModule = loadModule("PartSet");
519 if (!myPartSetModule)
521 myPartSetModule->createFeatures();
525 //******************************************************
526 void XGUI_Workshop::updateCommandStatus()
528 if (isSalomeMode()) // TODO: update commands in SALOME
530 XGUI_MainMenu* aMenuBar = myMainWindow->menuObject();
532 QList<XGUI_Command*> aCommands = aMenuBar->features();
533 QList<XGUI_Command*>::const_iterator aIt;
535 boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
536 if (aMgr->hasRootDocument()) {
537 XGUI_Command* aUndoCmd;
538 XGUI_Command* aRedoCmd;
539 for (aIt = aCommands.constBegin(); aIt != aCommands.constEnd(); ++aIt) {
540 if ((*aIt)->id() == "UNDO_CMD")
542 else if ((*aIt)->id() == "REDO_CMD")
544 else // Enable all commands
547 boost::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
548 aUndoCmd->setEnabled(aDoc->canUndo());
549 aRedoCmd->setEnabled(aDoc->canRedo());
551 for (aIt = aCommands.constBegin(); aIt != aCommands.constEnd(); ++aIt) {
552 if ((*aIt)->id() == "NEW_CMD")
554 else if ((*aIt)->id() == "EXIT_CMD")
562 //******************************************************
563 QDockWidget* XGUI_Workshop::createObjectBrowser(QWidget* theParent)
565 QDockWidget* aObjDock = new QDockWidget(theParent);
566 aObjDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
567 aObjDock->setWindowTitle(tr("Object browser"));
568 myObjectBrowser = new XGUI_ObjectsBrowser(aObjDock);
569 aObjDock->setWidget(myObjectBrowser);
573 //******************************************************
574 QDockWidget* XGUI_Workshop::createPropertyPanel(QWidget* theParent)
576 QDockWidget* aPropPanel = new QDockWidget(theParent);
577 aPropPanel->setWindowTitle(tr("Property Panel"));
578 QAction* aViewAct = aPropPanel->toggleViewAction();
579 aPropPanel->setObjectName(XGUI::PROP_PANEL);
581 QWidget* aContent = new QWidget(aPropPanel);
582 QVBoxLayout* aMainLay = new QVBoxLayout(aContent);
583 aMainLay->setContentsMargins(3, 3, 3, 3);
584 aPropPanel->setWidget(aContent);
586 QFrame* aFrm = new QFrame(aContent);
587 aFrm->setFrameStyle(QFrame::Sunken);
588 aFrm->setFrameShape(QFrame::Panel);
589 QHBoxLayout* aBtnLay = new QHBoxLayout(aFrm);
590 aBtnLay->setContentsMargins(0, 0, 0, 0);
591 aMainLay->addWidget(aFrm);
593 QPushButton* aBtn = new QPushButton(QIcon(":pictures/button_help.png"), "", aFrm);
595 aBtnLay->addWidget(aBtn);
596 aBtnLay->addStretch(1);
597 aBtn = new QPushButton(QIcon(":pictures/button_ok.png"), "", aFrm);
598 aBtn->setObjectName(XGUI::PROP_PANEL_OK);
600 aBtnLay->addWidget(aBtn);
601 aBtn = new QPushButton(QIcon(":pictures/button_cancel.png"), "", aFrm);
602 aBtn->setObjectName(XGUI::PROP_PANEL_CANCEL);
604 aBtnLay->addWidget(aBtn);
606 QWidget* aCustomWidget = new QWidget(aContent);
607 aCustomWidget->setObjectName(XGUI::PROP_PANEL_WDG);
608 aMainLay->addWidget(aCustomWidget);
609 aMainLay->addStretch(1);
614 //******************************************************
615 void XGUI_Workshop::setPropertyPannelTitle(const QString& theTitle)
617 myPropertyPanelDock->setWindowTitle(theTitle);
620 //******************************************************
622 * Creates dock widgets, places them in corresponding area
623 * and tabifies if necessary.
625 void XGUI_Workshop::createDockWidgets()
627 QMainWindow* aDesktop = isSalomeMode()? salomeConnector()->desktop() :
629 QDockWidget* aObjDock = createObjectBrowser(aDesktop);
630 aDesktop->addDockWidget(Qt::LeftDockWidgetArea, aObjDock);
631 myPropertyPanelDock = createPropertyPanel(aDesktop);
632 aDesktop->addDockWidget(Qt::LeftDockWidgetArea, myPropertyPanelDock);
633 hidePropertyPanel(); //<! Invisible by default
635 aDesktop->tabifyDockWidget(aObjDock, myPropertyPanelDock);
638 //******************************************************
639 void XGUI_Workshop::showPropertyPanel()
641 QAction* aViewAct = myPropertyPanelDock->toggleViewAction();
642 //<! Restore ability to close panel from the window's menu
643 aViewAct->setEnabled(true);
644 myPropertyPanelDock->show();
645 myPropertyPanelDock->raise();
648 //******************************************************
649 void XGUI_Workshop::hidePropertyPanel()
651 QAction* aViewAct = myPropertyPanelDock->toggleViewAction();
652 //<! Do not allow to show empty property panel
653 aViewAct->setEnabled(false);
654 myPropertyPanelDock->hide();
657 //******************************************************
658 void XGUI_Workshop::showObjectBrowser()
660 myObjectBrowser->parentWidget()->show();
663 //******************************************************
664 void XGUI_Workshop::hideObjectBrowser()
666 myObjectBrowser->parentWidget()->hide();
669 //******************************************************
670 void XGUI_Workshop::onFeatureTriggered()
672 QAction* aCmd = dynamic_cast<QAction*>(sender());
674 QString aId = salomeConnector()->commandId(aCmd);
676 myPartSetModule->launchOperation(aId);
680 //******************************************************
681 XGUI_Displayer* XGUI_Workshop::displayer() const
683 // In SALOME viewer is accessible only when module is initialized
684 // and in SALOME mode myDisplayer object has to be created later (on demand)
686 XGUI_Workshop* that = (XGUI_Workshop*)this;
687 that->myDisplayer = isSalomeMode() ?
688 new XGUI_Displayer(salomeConnector()->AISContext()):
689 new XGUI_Displayer(myMainWindow->viewer()->AISContext());