Salome HOME
Fix for the issue #2417 : human name for a generic error
[modules/shaper.git] / src / XGUI / XGUI_WorkshopListener.cpp
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #include "XGUI_WorkshopListener.h"
22
23 #ifndef HAVE_SALOME
24 #include <AppElements_MainWindow.h>
25 #endif
26
27 #include <Config_FeatureMessage.h>
28 #include <Config_PointerMessage.h>
29 #include <Config_Keywords.h>
30
31 #include <Events_InfoMessage.h>
32 #include <Events_Loop.h>
33 #include <Events_LongOp.h>
34
35 #include <ModelAPI_Object.h>
36 #include <ModelAPI_Events.h>
37 #include <ModelAPI_Session.h>
38 #include <ModelAPI_Result.h>
39 #include <ModelAPI_Feature.h>
40 #include <ModelAPI_Data.h>
41 #include <ModelAPI_ResultCompSolid.h>
42 #include <ModelAPI_Tools.h>
43
44 #include <ModuleBase_Events.h>
45 #include <ModuleBase_IModule.h>
46 #include <ModuleBase_IViewer.h>
47 #include <ModuleBase_IWorkshop.h>
48 #include <ModuleBase_Operation.h>
49 #include <ModuleBase_OperationDescription.h>
50 #include <ModuleBase_OperationFeature.h>
51 #include <ModuleBase_Tools.h>
52 #include <ModuleBase_WidgetSelector.h>
53
54 #include "XGUI_ActionsMgr.h"
55 #include "XGUI_Displayer.h"
56 #include "XGUI_ErrorMgr.h"
57 #include "XGUI_FacesPanel.h"
58 #include "XGUI_OperationMgr.h"
59 #include "XGUI_ModuleConnector.h"
60 #include "XGUI_PropertyPanel.h"
61
62 #include "XGUI_QtEvents.h"
63 #include "XGUI_SalomeConnector.h"
64 #include "XGUI_SelectionMgr.h"
65 #include "XGUI_Workshop.h"
66
67 #include <QAction>
68 #include <QApplication>
69 #include <QMainWindow>
70 #include <QThread>
71
72 #ifdef _DEBUG
73 #include <QDebug>
74 #include <iostream>
75 #endif
76
77 //#define DEBUG_FEATURE_CREATED
78 //#define DEBUG_FEATURE_REDISPLAY
79 //#define DEBUG_FEATURE_UPDATED
80 //#define DEBUG_RESULT_COMPSOLID
81
82 #ifdef DEBUG_FEATURE_REDISPLAY
83 const std::string DebugFeatureKind = "";//"Extrusion";
84 #endif
85
86 XGUI_WorkshopListener::XGUI_WorkshopListener(ModuleBase_IWorkshop* theWorkshop)
87   : myWorkshop(theWorkshop),
88     myUpdatePrefs(false)
89 {
90   XGUI_OperationMgr* anOperationMgr = workshop()->operationMgr();
91 }
92
93 //******************************************************
94 XGUI_WorkshopListener::~XGUI_WorkshopListener(void)
95 {
96 }
97
98 //******************************************************
99 void XGUI_WorkshopListener::initializeEventListening()
100 {
101   //Initialize event listening
102   Events_Loop* aLoop = Events_Loop::loop();
103   aLoop->registerListener(this, Events_InfoMessage::errorID());  //!< Listening application errors.
104   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
105   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED));
106   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
107   aLoop->registerListener(this, Events_LongOp::eventID());
108   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_PLUGIN_LOADED));
109
110   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED));
111   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED));
112   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION));
113   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION));
114
115   aLoop->registerListener(this, Events_Loop::eventByName("FinishOperation"));
116   aLoop->registerListener(this, Events_Loop::eventByName("AbortOperation"));
117 }
118
119 //******************************************************
120 void XGUI_WorkshopListener::processEvent(const std::shared_ptr<Events_Message>& theMessage)
121 {
122   if (QApplication::instance() &&
123       QApplication::instance()->thread() != QThread::currentThread()) {
124     #ifdef _DEBUG
125     std::cout << "XGUI_Workshop::processEvent: " << "Working in another thread." << std::endl;
126     #endif
127     SessionPtr aMgr = ModelAPI_Session::get();
128     PostponeMessageQtEvent* aPostponeEvent = new PostponeMessageQtEvent(theMessage);
129     QApplication::postEvent(this, aPostponeEvent);
130     return;
131   }
132
133   // Process creation of Part
134   if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)) {
135     std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
136         std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
137     onFeatureCreatedMsg(aUpdMsg);
138     if (myUpdatePrefs) {
139       XGUI_SalomeConnector* aSalomeConnector = workshop()->salomeConnector();
140       if (aSalomeConnector)
141         aSalomeConnector->createPreferences();
142       myUpdatePrefs = false;
143     }
144   }
145   else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_PLUGIN_LOADED)) {
146     myUpdatePrefs = true;
147   }
148   // Redisplay feature
149   else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)) {
150     std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
151         std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
152     onFeatureRedisplayMsg(aUpdMsg);
153   } else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION)) {
154     std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
155         std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
156     onFeatureEmptyPresentationMsg(aUpdMsg);
157   } else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION)) {
158     ModuleBase_ModelWidget* aWidget = workshop()->propertyPanel()->activeWidget();
159     if (aWidget) {
160       ModuleBase_WidgetSelector* aWidgetSelector =
161         dynamic_cast<ModuleBase_WidgetSelector*>(aWidget);
162       if (aWidgetSelector)
163         workshop()->selector()->setSelected(aWidgetSelector->getAttributeSelection());
164     }
165   } else if (theMessage->eventID() == Events_Loop::eventByName("FinishOperation")/* ||
166              theMessage->eventID() == Events_Loop::eventByName("AbortOperation")*/)
167     workshop()->facesPanel()->reset(false); // do not flush redisplay, it is flushed after event
168
169   //Update property panel on corresponding message. If there is no current operation (no
170   //property panel), or received message has different feature to the current - do nothing.
171   else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)) {
172     std::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
173         std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
174     onFeatureUpdatedMsg(anUpdateMsg);
175   } else if (theMessage->eventID() == Events_LongOp::eventID()) {
176     if (Events_LongOp::isPerformed()) {
177       QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
178     } else {
179       QApplication::restoreOverrideCursor();
180     }
181   } else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED)) {
182     // the viewer's update context will not happens until viewer updated is emitted
183       workshop()->displayer()->enableUpdateViewer(false);
184   } else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED)) {
185     // the viewer's update context is unblocked, the viewer's update works
186     XGUI_Displayer* aDisplayer = workshop()->displayer();
187     aDisplayer->enableUpdateViewer(true);
188   } else {
189     //Show error dialog if error message received.
190     std::shared_ptr<Events_InfoMessage> anIngfoMsg =
191       std::dynamic_pointer_cast<Events_InfoMessage>(theMessage);
192     if (anIngfoMsg) {
193       emit errorOccurred(anIngfoMsg);
194     }
195     return;
196   }
197 #ifndef HAVE_SALOME
198     SessionPtr aMgr = ModelAPI_Session::get();
199     AppElements_MainWindow* aMainWindow = workshop()->mainWindow();
200     if (aMgr->isModified() != aMainWindow->isModifiedState())
201       aMainWindow->setModifiedState(aMgr->isModified());
202 #endif
203 }
204
205 //******************************************************
206 void XGUI_WorkshopListener::onFeatureUpdatedMsg(
207                                      const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
208 {
209 #ifdef DEBUG_FEATURE_UPDATED
210   std::set<ObjectPtr> anObjects = theMsg->objects();
211   std::set<ObjectPtr>::const_iterator aIt;
212   QStringList anInfo;
213   for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) {
214     anInfo.append(ModuleBase_Tools::objectInfo((*aIt)));
215   }
216   QString anInfoStr = anInfo.join(";\t");
217   qDebug(QString("onFeatureUpdatedMsg: %1, %2")
218     .arg(anObjects.size()).arg(anInfoStr).toStdString().c_str());
219 #endif
220   std::set<ObjectPtr> aFeatures = theMsg->objects();
221   XGUI_OperationMgr* anOperationMgr = workshop()->operationMgr();
222   if (anOperationMgr->hasOperation()) {
223     ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
224                                                       (anOperationMgr->currentOperation());
225     if (aFOperation) {
226       FeaturePtr aCurrentFeature = aFOperation->feature();
227       std::set<ObjectPtr>::const_iterator aIt;
228       for (aIt = aFeatures.begin(); aIt != aFeatures.end(); ++aIt) {
229         ObjectPtr aNewFeature = (*aIt);
230         if (aNewFeature == aCurrentFeature) {
231           workshop()->propertyPanel()->updateContentWidget(aCurrentFeature);
232           break;
233         }
234       }
235     }
236   }
237   //anOperationMgr->onValidateOperation();
238
239   //if (myObjectBrowser)
240   //  myObjectBrowser->processEvent(theMsg);
241 }
242
243 //******************************************************
244 void XGUI_WorkshopListener::
245   onFeatureRedisplayMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
246 {
247   std::set<ObjectPtr> anObjects = theMsg->objects();
248   std::set<ObjectPtr>::const_iterator aIt;
249
250 #ifdef DEBUG_FEATURE_REDISPLAY
251   QStringList anInfo;
252   for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) {
253     anInfo.append(ModuleBase_Tools::objectInfo((*aIt)));
254   }
255   QString anInfoStr = anInfo.join(";\t");
256   qDebug(QString("onFeatureRedisplayMsg: %1, %2")
257     .arg(anObjects.size()).arg(anInfoStr).toStdString().c_str());
258 #endif
259
260   XGUI_Workshop* aWorkshop = workshop();
261   XGUI_Displayer* aDisplayer = aWorkshop->displayer();
262   bool aRedisplayed = false;
263   //std::list<ObjectPtr> aHiddenObjects;
264   for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) {
265     ObjectPtr aObj = (*aIt);
266
267     // Hide the object if it is invalid or concealed one
268     bool aHide = !aObj->data() || !aObj->data()->isValid() ||
269       aObj->isDisabled() || (!aObj->isDisplayed());
270     if (!aHide) { // check that this is not hidden result
271       ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
272       aHide = aRes && aRes->isConcealed();
273
274       // Hide the presentation with an empty shape. But isDisplayed state of the object should not
275       // be changed to the object becomes visible when the shape becomes not empty
276       if (!aHide && aRes.get())
277         aHide = !aRes->shape().get() || aRes->shape()->isNull();
278     }
279
280 #ifdef DEBUG_RESULT_COMPSOLID
281     ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
282     if (aRes.get()) {
283       ResultCompSolidPtr aCompSolidRes = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aRes);
284       if (aCompSolidRes.get()) {
285           qDebug(QString("COMPSOLID, numberOfSubs = %1")
286             .arg(aCompSolidRes->numberOfSubs()).toStdString().c_str());
287       }
288       if (ModelAPI_Tools::compSolidOwner(aRes))
289         qDebug("COMPSOLID sub-object");
290     }
291 #endif
292     #ifdef DEBUG_FEATURE_REDISPLAY
293       QString anObjInfo = ModuleBase_Tools::objectInfo((aObj));
294       FeaturePtr aFeature = ModelAPI_Feature::feature(aObj);
295       if (aFeature.get()) {
296         std::string aKind = aFeature->getKind();
297         if (aKind == DebugFeatureKind || DebugFeatureKind.empty()) {
298           qDebug(QString("visible=%1, hide=%2 : display= %2").arg(aDisplayer->isVisible(aObj))
299                                             .arg(aHide).arg(anObjInfo).toStdString().c_str());
300         }
301       }
302     #endif
303     if (aHide) {
304       //we should provide objects which are hidden in the viewer, e.g. sketch always should
305       // visualizes all sub-features, if some features are to be hidden, sould be proposed may
306       // be to removed #1223
307       // aHiddenObjects.push_back(aObj);
308       aRedisplayed = aDisplayer->erase(aObj, false) || aRedisplayed;
309       #ifdef DEBUG_FEATURE_REDISPLAY
310         // Redisplay the visible object or the object of the current operation
311         bool isVisibleObject = aDisplayer->isVisible(aObj);
312
313         QString anObjInfo = ModuleBase_Tools::objectInfo((aObj));
314       #endif
315     }
316     else {
317       // Redisplay the visible object or the object of the current operation
318       bool isVisibleObject = aDisplayer->isVisible(aObj);
319       #ifdef DEBUG_FEATURE_REDISPLAY
320         QString anObjInfo = ModuleBase_Tools::objectInfo((aObj));
321       #endif
322
323       if (isVisibleObject)  { // redisplay visible object
324         //displayObject(aObj);  // In order to update presentation
325         // in order to avoid the check whether the object can be redisplayed, the exact method
326         // of redisplay is called. This modification is made in order to have the line is updated
327         // by creation of a horizontal constraint on the line by preselection
328         if (ModelAPI_Tools::hasSubResults(std::dynamic_pointer_cast<ModelAPI_Result>(aObj))) {
329           aRedisplayed = aDisplayer->erase(aObj, false) || aRedisplayed;
330         }
331         else {
332           aRedisplayed = aDisplayer->redisplay(aObj, false) || aRedisplayed;
333           // Deactivate object of current operation from selection
334           aWorkshop->deactivateActiveObject(aObj, false);
335         }
336       } else { // display object if the current operation has it
337         if (displayObject(aObj)) {
338           aRedisplayed = true;
339           // Deactivate object of current operation from selection
340           aWorkshop->deactivateActiveObject(aObj, false);
341         }
342       }
343     }
344   }
345   // this processing should be moved in another place in order to do not cause problems in
346   // flush messages chain
347   //if (aHiddenObjects.size() > 0)
348   //  myWorkshop->module()->processHiddenObject(aHiddenObjects);
349
350   bool isCustomized = customizeCurrentObject(anObjects, aRedisplayed);
351   if (aRedisplayed || isCustomized) {
352     Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION));
353
354     aDisplayer->updateViewer();
355   }
356 }
357
358 //******************************************************
359 void XGUI_WorkshopListener::
360   onFeatureCreatedMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
361 {
362   std::set<ObjectPtr> anObjects = theMsg->objects();
363   std::set<ObjectPtr>::const_iterator aIt;
364 #ifdef DEBUG_FEATURE_CREATED
365   QStringList anInfo;
366   for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) {
367     anInfo.append(ModuleBase_Tools::objectInfo((*aIt)));
368   }
369   QString anInfoStr = anInfo.join(";\t");
370   qDebug(QString("onFeatureCreatedMsg: %1, %2")
371     .arg(anObjects.size()).arg(anInfoStr).toStdString().c_str());
372 #endif
373
374   //bool aHasPart = false;
375   bool aDisplayed = false;
376   for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) {
377     ObjectPtr anObject = *aIt;
378
379 #ifdef DEBUG_RESULT_COMPSOLID
380     ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
381     if (aRes.get()) {
382       ResultCompSolidPtr aCompSolidRes = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aRes);
383       if (aCompSolidRes.get()) {
384           qDebug(QString("COMPSOLID, numberOfSubs = %1")
385             .arg(aCompSolidRes->numberOfSubs()).toStdString().c_str());
386       }
387       if (ModelAPI_Tools::compSolidOwner(aRes))
388         qDebug("COMPSOLID sub-object");
389     }
390 #endif
391     // the validity of the data should be checked here in order to avoid display of the objects,
392     // which were created, then deleted, but flush for the creation event happens after that
393     // we should not display disabled objects
394     bool aHide = !anObject->data()->isValid() ||
395                  anObject->isDisabled() ||
396                  !anObject->isDisplayed();
397     if (!aHide) { // check that this is not hidden result
398       ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
399       bool isConcealed = aRes && aRes->isConcealed();
400       aHide = aRes && aRes->isConcealed();
401       // Hide the presentation with an empty shape. But isDisplayed state of the object should not
402       // be changed to the object becomes visible when the shape becomes not empty
403       if (!aHide && aRes.get())
404         aHide = !aRes->shape().get() || aRes->shape()->isNull();
405     }
406     if (!aHide) {
407       // setDisplayed has to be called in order to synchronize internal state of the object
408       // with list of displayed objects
409       if (myWorkshop->module()->canDisplayObject(anObject)) {
410         anObject->setDisplayed(true);
411         aDisplayed = displayObject(anObject);
412       } else
413         anObject->setDisplayed(false);
414     }
415   }
416
417   bool isCustomized = customizeCurrentObject(anObjects, aDisplayed);
418
419   //if (myObjectBrowser)
420   //  myObjectBrowser->processEvent(theMsg);
421   if (aDisplayed) {
422     Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION));
423     workshop()->displayer()->updateViewer();
424   }
425   //if (aHasPart) { // TODO: Avoid activate last part on loading of document
426   //  activateLastPart();
427   //}
428 }
429
430 //******************************************************
431 void XGUI_WorkshopListener::onFeatureEmptyPresentationMsg(
432                                       const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
433 {
434   std::set<ObjectPtr> anObjects = theMsg->objects();
435   std::set<ObjectPtr>::const_iterator aIt;
436 #ifdef DEBUG_FEATURE_CREATED
437   QStringList anInfo;
438   for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) {
439     anInfo.append(ModuleBase_Tools::objectInfo((*aIt)));
440   }
441   QString anInfoStr = anInfo.join(";\t");
442   qDebug(QString("onFeatureEmptyPresentationMsg: %1, %2")
443     .arg(anObjects.size()).arg(anInfoStr).toStdString().c_str());
444 #endif
445
446   XGUI_Workshop* aWorkshop = workshop();
447   XGUI_Displayer* aDisplayer = aWorkshop->displayer();
448
449   bool aRedisplayed = false;
450   for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) {
451     ObjectPtr anObject = *aIt;
452     aRedisplayed = aDisplayer->erase(anObject, false) || aRedisplayed;
453   }
454
455   if (aRedisplayed)
456     aDisplayer->updateViewer();
457 }
458
459 bool XGUI_WorkshopListener::event(QEvent * theEvent)
460 {
461   PostponeMessageQtEvent* aPostponedEv = dynamic_cast<PostponeMessageQtEvent*>(theEvent);
462   if (aPostponedEv) {
463     std::shared_ptr<Events_Message> aEventPtr = aPostponedEv->postponedMessage();
464     processEvent(aEventPtr);
465     return true;
466   }
467   return false;
468 }
469
470 //**************************************************************
471 bool XGUI_WorkshopListener::displayObject(ObjectPtr theObj)
472 {
473 #ifdef DEBUG_RESULT_COMPSOLID
474   ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(theObj);
475   if (aRes.get() && (ModelAPI_Tools::hasSubResults(aRes) || ModelAPI_Tools::compSolidOwner(aRes))) {
476     ResultCompSolidPtr aCompSolidRes = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aRes);
477     if (aCompSolidRes.get()) {
478       qDebug("COMPSOLID: displayObject");
479     }
480   }
481 #endif
482
483   bool aDisplayed = false;
484   XGUI_Workshop* aWorkshop = workshop();
485   // do not display the object if it has sub objects. They should be displayed separately.
486   if (!aWorkshop->module()->canDisplayObject(theObj) ||
487       ModelAPI_Tools::hasSubResults(std::dynamic_pointer_cast<ModelAPI_Result>(theObj)))
488     return aDisplayed;
489
490   XGUI_Displayer* aDisplayer = aWorkshop->displayer();
491   int aNb = aDisplayer->objectsCount();
492   return aDisplayer->display(theObj, false);
493 }
494
495 bool XGUI_WorkshopListener::customizeCurrentObject(const std::set<ObjectPtr>& theObjects,
496                                                    bool theForceRedisplay)
497 {
498   XGUI_OperationMgr* anOperationMgr = workshop()->operationMgr();
499   FeaturePtr aCurrentFeature;
500   if (anOperationMgr->hasOperation()) {
501     ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
502                                                       (anOperationMgr->currentOperation());
503     if (aFOperation) {
504       aCurrentFeature = aFOperation->feature();
505     }
506   }
507
508   bool aCustomized = false;
509   if (aCurrentFeature.get()) {
510     // the customize presentation should be redisplayed if force redislayed is true or
511     // if a list of message objects contains the operation feature for case when
512     // the feature is hidden, but arguments of the feature are modified
513     // e.g. extrusion is hidden(h=0) but sketch is chosen
514     if (theForceRedisplay || theObjects.find(aCurrentFeature) != theObjects.end()) {
515       aCustomized = myWorkshop->module()->customizeObject(aCurrentFeature,
516                                  ModuleBase_IModule::CustomizeArguments, false) || aCustomized;
517       aCustomized = myWorkshop->module()->customizeObject(aCurrentFeature,
518                                    ModuleBase_IModule::CustomizeResults, false) || aCustomized;
519       aCustomized = myWorkshop->module()->customizeObject(aCurrentFeature,
520                         ModuleBase_IModule::CustomizeHighlightedObjects, false) || aCustomized;
521     }
522   }
523   return aCustomized;
524 }
525
526 XGUI_Workshop* XGUI_WorkshopListener::workshop() const
527 {
528   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
529   return aConnector->workshop();
530 }