Salome HOME
6be0e46bee9ba1851f811788d5ee4a6bbe5ee372
[modules/shaper.git] / src / XGUI / XGUI_ContextMenuMgr.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 #include "XGUI_ContextMenuMgr.h"
4 #include "XGUI_Workshop.h"
5 #include "XGUI_ObjectsBrowser.h"
6 #include "XGUI_SelectionMgr.h"
7 #include "XGUI_Displayer.h"
8 #include "XGUI_ViewerProxy.h"
9 #include "XGUI_Selection.h"
10 #include "XGUI_SalomeConnector.h"
11 #include "XGUI_DataModel.h"
12 #include "XGUI_OperationMgr.h"
13 #include "XGUI_Tools.h"
14
15 #ifndef HAVE_SALOME
16 #include <AppElements_MainWindow.h>
17 #endif
18
19 //#include "PartSetPlugin_Part.h"
20
21 #include <ModelAPI_Data.h>
22 #include <ModelAPI_AttributeDocRef.h>
23 #include <ModelAPI_Object.h>
24 #include <ModelAPI_Session.h>
25 #include <ModelAPI_ResultGroup.h>
26 #include <ModelAPI_ResultParameter.h>
27 #include <ModelAPI_ResultConstruction.h>
28 #include <ModelAPI_ResultBody.h>
29 #include <ModelAPI_Tools.h>
30
31 #include <ModuleBase_IModule.h>
32 #include <ModuleBase_Tools.h>
33 #include <ModuleBase_OperationAction.h>
34 #include <ModuleBase_ViewerPrs.h>
35
36 #include <QAction>
37 #include <QActionGroup>
38 #include <QContextMenuEvent>
39 #include <QMenu>
40 #include <QMdiArea>
41 #include <QMainWindow>
42
43
44 XGUI_ContextMenuMgr::XGUI_ContextMenuMgr(XGUI_Workshop* theParent)
45     : QObject(theParent),
46       myWorkshop(theParent),
47       mySeparator(0)
48 {
49 }
50
51 XGUI_ContextMenuMgr::~XGUI_ContextMenuMgr()
52 {
53 }
54
55 void XGUI_ContextMenuMgr::createActions()
56 {
57 #ifdef HAVE_SALOME
58   QMainWindow* aDesktop = myWorkshop->salomeConnector()->desktop();
59 #else
60   QMainWindow* aDesktop = myWorkshop->mainWindow();
61 #endif
62
63   QAction* aAction = new QAction(QIcon(":pictures/delete.png"), tr("Delete"), this);
64   aDesktop->addAction(aAction);
65
66   addAction("DELETE_CMD", aAction);
67   aAction->setShortcutContext(Qt::ApplicationShortcut);
68
69   aAction = new QAction(QIcon(":pictures/rename_edit.png"), tr("Rename"), this);
70   addAction("RENAME_CMD", aAction);
71   connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onRename()));
72
73   aAction = new QAction(QIcon(":pictures/move.png"), XGUI_Workshop::MOVE_TO_END_COMMAND, this);
74   addAction("MOVE_CMD", aAction);
75
76   aAction = new QAction(QIcon(":pictures/clean_history.png"), tr("Clean history"), this);
77   addAction("CLEAN_HISTORY_CMD", aAction);
78
79   aAction = new QAction(QIcon(":pictures/color.png"), tr("Color..."), this);
80   addAction("COLOR_CMD", aAction);
81
82   aAction = new QAction(QIcon(":pictures/eye_pencil.png"), tr("Show"), this);
83   addAction("SHOW_CMD", aAction);
84
85   aAction = new QAction(QIcon(":pictures/eye_pencil.png"), tr("Show only"), this);
86   addAction("SHOW_ONLY_CMD", aAction);
87
88   aAction = new QAction(QIcon(":pictures/eye_pencil_closed.png"), tr("Hide"), this);
89   addAction("HIDE_CMD", aAction);
90
91   aAction = new QAction(QIcon(":pictures/eye_pencil_closed.png"), tr("Hide all"), this);
92   addAction("HIDEALL_CMD", aAction);
93
94   aAction = new QAction(QIcon(":pictures/shading.png"), tr("Shading"), this);
95   addAction("SHADING_CMD", aAction);
96
97   aAction = new QAction(QIcon(":pictures/wireframe.png"), tr("Wireframe"), this);
98   addAction("WIREFRAME_CMD", aAction);
99
100   mySeparator = new QAction(this);
101   mySeparator->setSeparator(true);
102
103   mySelectActions = new QActionGroup(this);
104   mySelectActions->setExclusive(true);
105
106   aAction = new QAction(QIcon(":pictures/vertex.png"), tr("Vertices"), this);
107   aAction->setCheckable(true);
108   addAction("SELECT_VERTEX_CMD", aAction);
109   mySelectActions->addAction(aAction);
110
111   aAction = new QAction(QIcon(":pictures/edge.png"), tr("Edges"), this);
112   aAction->setCheckable(true);
113   addAction("SELECT_EDGE_CMD", aAction);
114   mySelectActions->addAction(aAction);
115
116   aAction = new QAction(QIcon(":pictures/face.png"), tr("Faces"), this);
117   aAction->setCheckable(true);
118   addAction("SELECT_FACE_CMD", aAction);
119   mySelectActions->addAction(aAction);
120
121   aAction = new QAction(QIcon(":pictures/result.png"), tr("Result"), this);
122   aAction->setCheckable(true);
123   addAction("SELECT_RESULT_CMD", aAction);
124   mySelectActions->addAction(aAction);
125
126   aAction->setChecked(true);
127
128   aAction = new QAction(QIcon(":pictures/find_result.png"), tr("Select results"), this);
129   addAction("SHOW_RESULTS_CMD", aAction);
130
131   buildObjBrowserMenu();
132   buildViewerMenu();
133 }
134
135 void XGUI_ContextMenuMgr::addAction(const QString& theId, QAction* theAction)
136 {
137   if (myActions.contains(theId))
138     qCritical("A command with Id = '%s' already defined!", qPrintable(theId));
139   theAction->setData(theId);
140   connect(theAction, SIGNAL(triggered(bool)), this, SLOT(onAction(bool)));
141   myActions[theId] = theAction;
142 }
143
144 QAction* XGUI_ContextMenuMgr::action(const QString& theId) const
145 {
146   if (myActions.contains(theId))
147     return myActions[theId];
148   return 0;
149 }
150
151 QAction* XGUI_ContextMenuMgr::actionByName(const QString& theName) const
152 {
153   foreach(QAction* eachAction, myActions) {
154     if (eachAction->text() == theName) {
155       return eachAction;
156     }
157   }
158   return NULL;
159 }
160
161 QStringList XGUI_ContextMenuMgr::actionIds() const
162 {
163   return myActions.keys();
164 }
165
166 void XGUI_ContextMenuMgr::onAction(bool isChecked)
167 {
168   QAction* aAction = static_cast<QAction*>(sender());
169   emit actionTriggered(aAction->data().toString(), isChecked);
170 }
171
172 void XGUI_ContextMenuMgr::updateCommandsStatus()
173 {
174 }
175
176 void XGUI_ContextMenuMgr::onContextMenuRequest(QContextMenuEvent* theEvent)
177 {
178   QMenu* aMenu = new QMenu();
179   if (sender() == myWorkshop->objectBrowser()) {
180     updateObjectBrowserMenu();
181     addObjBrowserMenu(aMenu);
182   } else if (sender() == myWorkshop->viewer()) {
183     updateViewerMenu();
184     addViewerMenu(aMenu);
185   }
186
187   if (aMenu && (aMenu->actions().size() > 0)) {
188     // it is possible that some objects should do something before and after the popup menu exec
189     // e.g. a sketch manager changes an internal flag on this signals in order to do not hide
190     // a created entity
191     emit beforeContextMenu();
192     aMenu->exec(theEvent->globalPos());
193     emit afterContextMenu();
194     delete aMenu;
195   }
196 }
197
198 void XGUI_ContextMenuMgr::updateObjectBrowserMenu() 
199 {
200   foreach(QAction* aAction, myActions)
201     aAction->setEnabled(false);
202
203   XGUI_SelectionMgr* aSelMgr = myWorkshop->selector();
204   QObjectPtrList aObjects = aSelMgr->selection()->selectedObjects();
205   int aSelected = aObjects.size();
206   if (aSelected > 0) {
207     SessionPtr aMgr = ModelAPI_Session::get();
208     XGUI_Displayer* aDisplayer = myWorkshop->displayer();
209     bool hasResult = false;
210     bool hasFeature = false;
211     bool hasParameter = false;
212     bool hasCompositeOwner = false;
213     ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter,
214                                    hasCompositeOwner);
215     //Process Feature
216     if (aSelected == 1) {
217       ObjectPtr aObject = aObjects.first();
218       if (aObject) {
219         if (hasResult && myWorkshop->canBeShaded(aObject)) {
220           XGUI_Displayer::DisplayMode aMode = aDisplayer->displayMode(aObject);
221           if (aMode != XGUI_Displayer::NoMode) {
222             action("WIREFRAME_CMD")->setEnabled(aMode == XGUI_Displayer::Shading);
223             action("SHADING_CMD")->setEnabled(aMode == XGUI_Displayer::Wireframe);
224           } else {
225             action("WIREFRAME_CMD")->setEnabled(true);
226             action("SHADING_CMD")->setEnabled(true);
227           }
228         }
229         if (!hasFeature) {
230           bool aHasSubResults = ModelAPI_Tools::hasSubResults(
231                                             std::dynamic_pointer_cast<ModelAPI_Result>(aObject));
232           if (aHasSubResults) {
233             action("HIDE_CMD")->setEnabled(true);
234             action("SHOW_CMD")->setEnabled(true);
235           }
236           else {
237             if (aObject->isDisplayed()) {
238               action("HIDE_CMD")->setEnabled(true);
239             } else if (hasResult && (!hasParameter)) {
240               action("SHOW_CMD")->setEnabled(true);
241             }
242           }
243           if (!(hasParameter || hasFeature))
244             action("SHOW_ONLY_CMD")->setEnabled(true);
245         }
246         else if (hasFeature && myWorkshop->canMoveFeature())
247           action("MOVE_CMD")->setEnabled(true);
248
249         if( aMgr->activeDocument() == aObject->document() )
250         {
251           action("RENAME_CMD")->setEnabled(true);
252           action("DELETE_CMD")->setEnabled(!hasCompositeOwner);
253           action("CLEAN_HISTORY_CMD")->setEnabled(!hasCompositeOwner &&
254                                                   (hasFeature || hasParameter));
255         }
256       }
257     } else {
258       // parameter is commented because the actions are not in the list of result parameter actions
259       if (hasResult /*&& (!hasParameter)*/) {
260         action("SHOW_CMD")->setEnabled(true);
261         action("HIDE_CMD")->setEnabled(true);
262         action("SHOW_ONLY_CMD")->setEnabled(true);
263         action("SHADING_CMD")->setEnabled(true);
264         action("WIREFRAME_CMD")->setEnabled(true);
265       }
266     }
267     bool allActive = true;
268     foreach( ObjectPtr aObject, aObjects )
269       if( aMgr->activeDocument() != aObject->document() )  {
270         allActive = false;
271         break;
272       }
273     if (!hasCompositeOwner && allActive ) {
274       if (hasFeature || hasParameter)
275         action("DELETE_CMD")->setEnabled(true);
276     }
277     if (!hasCompositeOwner && allActive && (hasFeature|| hasParameter))
278       action("CLEAN_HISTORY_CMD")->setEnabled(true);
279
280     action("SHOW_RESULTS_CMD")->setEnabled(hasFeature);
281   }
282
283   // Show/Hide command has to be disabled for objects from non active document
284   bool aDeactivate = false;
285   foreach (ObjectPtr aObj, aObjects) {
286     if (!aObj->document()->isActive()) {
287       if ((aObj->document() != ModelAPI_Session::get()->moduleDocument()) ||
288            aObj->groupName() == ModelAPI_ResultPart::group()) {
289         aDeactivate = true;
290         break;
291       }
292     }
293   }
294   if (aDeactivate) {
295     // If at leas a one objec can not be edited then Show/Hide has to be disabled
296     action("SHOW_CMD")->setEnabled(false);
297     action("HIDE_CMD")->setEnabled(false);
298     action("SHOW_ONLY_CMD")->setEnabled(false);
299   }
300
301   if (myWorkshop->canChangeColor())
302     action("COLOR_CMD")->setEnabled(true);
303
304   ModuleBase_IModule* aModule = myWorkshop->module();
305   if (aModule)
306     aModule->updateObjectBrowserMenu(myActions);
307 }
308
309 void XGUI_ContextMenuMgr::updateViewerMenu()
310 {
311   foreach(QAction* aAction, myActions)
312     aAction->setEnabled(false);
313
314   XGUI_SelectionMgr* aSelMgr = myWorkshop->selector();
315   XGUI_Displayer* aDisplayer = myWorkshop->displayer();
316   QList<ModuleBase_ViewerPrsPtr> aPrsList = aSelMgr->selection()->getSelected(ModuleBase_ISelection::Viewer);
317   if (aPrsList.size() > 0) {
318     bool isVisible = false;
319     bool isShading = false;
320     bool canBeShaded = false;
321     ObjectPtr aObject;
322     foreach(ModuleBase_ViewerPrsPtr aPrs, aPrsList) {
323       aObject = aPrs->object();
324       ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aObject);
325       if (aRes && aRes->isDisplayed()) {
326         isVisible = true;
327         canBeShaded = myWorkshop->displayer()->canBeShaded(aObject);
328         isShading = (myWorkshop->displayer()->displayMode(aObject) == XGUI_Displayer::Shading);      
329         break;
330       }
331     }
332     if (isVisible) {
333       if (canBeShaded) {
334         XGUI_Displayer::DisplayMode aMode = aDisplayer->displayMode(aObject);
335         if (aMode != XGUI_Displayer::NoMode) {
336           action("WIREFRAME_CMD")->setEnabled(aMode == XGUI_Displayer::Shading);
337           action("SHADING_CMD")->setEnabled(aMode == XGUI_Displayer::Wireframe);
338         } else {
339           action("WIREFRAME_CMD")->setEnabled(true);
340           action("SHADING_CMD")->setEnabled(true);
341         }
342       }
343       action("SHOW_ONLY_CMD")->setEnabled(true);
344       action("HIDE_CMD")->setEnabled(true);
345     } else
346       action("SHOW_CMD")->setEnabled(true);
347   }
348   if (myWorkshop->displayer()->objectsCount() > 0)
349     action("HIDEALL_CMD")->setEnabled(true);
350
351   // Update selection menu
352   QIntList aModes = aDisplayer->activeSelectionModes();
353   if (aModes.count() <= 1) {
354     action("SELECT_VERTEX_CMD")->setEnabled(true);
355     action("SELECT_EDGE_CMD")->setEnabled(true);
356     action("SELECT_FACE_CMD")->setEnabled(true);
357     action("SELECT_RESULT_CMD")->setEnabled(true);
358     if (aModes.count() == 1) {
359       switch (aModes.first()) {
360       case TopAbs_VERTEX: 
361         action("SELECT_VERTEX_CMD")->setChecked(true);
362         break;
363       case TopAbs_EDGE: 
364         action("SELECT_EDGE_CMD")->setChecked(true);
365         break;
366       case TopAbs_FACE:
367         action("SELECT_FACE_CMD")->setChecked(true);
368         break;
369       default:
370         action("SELECT_RESULT_CMD")->setChecked(true);
371       }
372     } else 
373       action("SELECT_RESULT_CMD")->setChecked(true);
374   }
375
376   ModuleBase_IModule* aModule = myWorkshop->module();
377   if (aModule)
378     aModule->updateViewerMenu(myActions);
379
380   if (myWorkshop->canChangeColor())
381     action("COLOR_CMD")->setEnabled(true);
382
383   action("DELETE_CMD")->setEnabled(true);
384 }
385
386 void XGUI_ContextMenuMgr::connectObjectBrowser()
387 {
388   connect(myWorkshop->objectBrowser(), SIGNAL(contextMenuRequested(QContextMenuEvent*)), this,
389           SLOT(onContextMenuRequest(QContextMenuEvent*)));
390 }
391
392 void XGUI_ContextMenuMgr::connectViewer()
393 {
394   connect(myWorkshop->viewer(), SIGNAL(contextMenuRequested(QContextMenuEvent*)), this,
395           SLOT(onContextMenuRequest(QContextMenuEvent*)));
396 }
397
398
399 void XGUI_ContextMenuMgr::buildObjBrowserMenu()
400 {
401   QAction* aSeparator = new QAction(this);
402   aSeparator->setSeparator(true);
403
404   QActionsList aList;
405
406   // Result construction menu
407   aList.append(action("SHOW_CMD"));
408   aList.append(action("HIDE_CMD"));
409   aList.append(action("SHOW_ONLY_CMD"));
410   aList.append(mySeparator);
411   aList.append(action("RENAME_CMD"));
412   aList.append(action("COLOR_CMD"));
413   myObjBrowserMenus[ModelAPI_ResultConstruction::group()] = aList;
414
415   //-------------------------------------
416   // Result body menu
417   aList.clear();
418   aList.append(action("WIREFRAME_CMD"));
419   aList.append(action("SHADING_CMD"));
420   aList.append(mySeparator);
421   aList.append(action("SHOW_CMD"));
422   aList.append(action("HIDE_CMD"));
423   aList.append(action("SHOW_ONLY_CMD"));
424   aList.append(mySeparator);
425   aList.append(action("RENAME_CMD"));
426   aList.append(action("COLOR_CMD"));
427   myObjBrowserMenus[ModelAPI_ResultBody::group()] = aList;
428   // Group menu
429   myObjBrowserMenus[ModelAPI_ResultGroup::group()] = aList;
430   // Result part menu
431   myObjBrowserMenus[ModelAPI_ResultPart::group()] = aList;
432   //-------------------------------------
433   // Feature menu
434   aList.clear();
435   aList.append(action("SHOW_RESULTS_CMD"));
436   aList.append(mySeparator);
437   aList.append(action("RENAME_CMD"));
438   aList.append(action("MOVE_CMD"));
439   aList.append(mySeparator);
440   aList.append(action("CLEAN_HISTORY_CMD"));
441   aList.append(action("DELETE_CMD"));
442   myObjBrowserMenus[ModelAPI_Feature::group()] = aList;
443
444   aList.clear();
445   aList.append(action("RENAME_CMD"));
446   aList.append(mySeparator);
447   aList.append(action("CLEAN_HISTORY_CMD"));
448   aList.append(action("DELETE_CMD"));
449   myObjBrowserMenus[ModelAPI_ResultParameter::group()] = aList;
450   //-------------------------------------
451 }
452
453 void XGUI_ContextMenuMgr::buildViewerMenu()
454 {
455   QActionsList aList;
456   // Result construction menu
457   aList.append(action("HIDE_CMD"));
458   aList.append(action("SHOW_ONLY_CMD"));
459   aList.append(mySeparator);
460   aList.append(action("COLOR_CMD"));
461   myViewerMenu[ModelAPI_ResultConstruction::group()] = aList;
462   // Result part menu
463   myViewerMenu[ModelAPI_ResultPart::group()] = aList;
464   //-------------------------------------
465   // Result body menu
466   aList.clear();
467   aList.append(action("WIREFRAME_CMD"));
468   aList.append(action("SHADING_CMD"));
469   aList.append(mySeparator);
470   aList.append(action("HIDE_CMD"));
471   aList.append(action("SHOW_ONLY_CMD"));
472   aList.append(mySeparator);
473   aList.append(action("COLOR_CMD"));
474   myViewerMenu[ModelAPI_ResultBody::group()] = aList;
475   // Group menu
476   myViewerMenu[ModelAPI_ResultGroup::group()] = aList;
477   //-------------------------------------
478 }
479
480
481 void XGUI_ContextMenuMgr::addObjBrowserMenu(QMenu* theMenu) const
482 {
483   ModuleBase_IModule* aModule = myWorkshop->module();
484   if (aModule) {
485     theMenu->addSeparator();
486     aModule->addObjectBrowserMenu(theMenu);
487   }
488
489   XGUI_SelectionMgr* aSelMgr = myWorkshop->selector();
490   QObjectPtrList aObjects = aSelMgr->selection()->selectedObjects();
491   int aSelected = aObjects.size();
492   QActionsList aActions;
493   if (aSelected == 1) {
494     ObjectPtr aObject = aObjects.first();
495     std::string aName = aObject->groupName();
496     if (myObjBrowserMenus.contains(aName))
497       aActions = myObjBrowserMenus[aName];
498   } else if (aSelected > 1) {
499       aActions.append(action("WIREFRAME_CMD"));
500       aActions.append(action("SHADING_CMD"));
501       aActions.append(mySeparator);
502       aActions.append(action("SHOW_CMD"));
503       aActions.append(action("HIDE_CMD"));
504       aActions.append(action("SHOW_ONLY_CMD"));
505       aActions.append(mySeparator);
506       //aActions.append(action("MOVE_CMD"));
507       aActions.append(action("COLOR_CMD"));
508       aActions.append(action("CLEAN_HISTORY_CMD"));
509       aActions.append(action("DELETE_CMD"));
510   }
511   theMenu->addActions(aActions);
512
513   theMenu->addSeparator();
514   theMenu->addActions(myWorkshop->objectBrowser()->actions());
515 }
516
517 void XGUI_ContextMenuMgr::addViewerMenu(QMenu* theMenu) const
518 {
519   ModuleBase_IModule* aModule = myWorkshop->module();
520   if (aModule) {
521     if (aModule->addViewerMenu(theMenu, myActions))
522       theMenu->addSeparator();
523   }
524   XGUI_SelectionMgr* aSelMgr = myWorkshop->selector();
525   QList<ModuleBase_ViewerPrsPtr> aPrsList = aSelMgr->selection()->getSelected(ModuleBase_ISelection::Viewer);
526   int aSelected = aPrsList.size();
527   QActionsList aActions;
528
529   // Create selection menu
530   XGUI_OperationMgr* aOpMgr = myWorkshop->operationMgr();
531   QIntList aModes;
532   myWorkshop->module()->activeSelectionModes(aModes);
533   if ((!aOpMgr->hasOperation()) && aModes.isEmpty()) {
534     QMenu* aSelMenu = new QMenu(tr("Selection mode"), theMenu);
535     aSelMenu->addAction(action("SELECT_VERTEX_CMD"));
536     aSelMenu->addAction(action("SELECT_EDGE_CMD"));
537     aSelMenu->addAction(action("SELECT_FACE_CMD"));
538     aSelMenu->addAction(action("SELECT_RESULT_CMD"));
539     theMenu->addMenu(aSelMenu);
540     theMenu->addSeparator();
541   }
542   if (aSelected == 1) {
543     ObjectPtr aObject = aPrsList.first()->object();
544     if (aObject.get() != NULL) {
545       std::string aName = aObject->groupName();
546       if (myViewerMenu.contains(aName))
547         aActions = myViewerMenu[aName];
548     }
549     aActions.append(action("COLOR_CMD"));
550   } else if (aSelected > 1) {
551     aActions.append(action("HIDE_CMD"));
552     aActions.append(action("COLOR_CMD"));
553   }
554   // hide all is shown always even if selection in the viewer is empty
555   aActions.append(action("HIDEALL_CMD"));
556   theMenu->addActions(aActions);
557
558 #ifndef HAVE_SALOME
559   theMenu->addSeparator();
560   QMdiArea* aMDI = myWorkshop->mainWindow()->mdiArea();
561   if (aMDI->actions().size() > 0) {
562     QMenu* aSubMenu = theMenu->addMenu(tr("Windows"));
563     aSubMenu->addActions(aMDI->actions());
564   }
565 #endif
566 }
567
568 QStringList XGUI_ContextMenuMgr::actionObjectGroups(const QString& theName)
569 {
570   QStringList aGroups;
571
572   QMap<std::string, QActionsList>::const_iterator anIt = myObjBrowserMenus.begin(),
573                                                   aLast = myObjBrowserMenus.end();
574   for (; anIt != aLast; anIt++) {
575     QString aGroupName(anIt.key().c_str());
576     if (aGroups.contains(aGroupName))
577       continue;
578     QActionsList anActions = anIt.value();
579     QActionsList::const_iterator anAIt = anActions.begin(), anALast = anActions.end();
580     bool aFound = false;
581     for (; anAIt != anALast && !aFound; anAIt++)
582       aFound = (*anAIt)->data().toString() == theName;
583     if (aFound)
584       aGroups.append(aGroupName);
585   }
586   return aGroups;
587 }
588
589 void XGUI_ContextMenuMgr::onRename()
590 {
591   QObjectPtrList anObjects = myWorkshop->selector()->selection()->selectedObjects();
592   if (!myWorkshop->abortAllOperations())
593     return; 
594   // restore selection in case if dialog box was shown
595   myWorkshop->objectBrowser()->setObjectsSelected(anObjects);
596   myWorkshop->objectBrowser()->onEditItem();
597 }