]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Correction for additional debug information
authornds <nds@opencascade.com>
Fri, 9 Dec 2016 04:48:49 +0000 (07:48 +0300)
committernds <nds@opencascade.com>
Fri, 9 Dec 2016 04:48:49 +0000 (07:48 +0300)
src/Model/Model_Application.cpp
src/XGUI/CMakeLists.txt
src/XGUI/XGUI_ContextMenuMgr.cpp
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_Displayer.h
src/XGUI/XGUI_SelectionMgr.cpp
src/XGUI/XGUI_ViewerProxy.cpp
src/XGUI/XGUI_Workshop.cpp

index ac84508a241bf10e3f4f52c3ae65ac8efbbed2d6..875e1537fb6ab1c98ae51fb527b518952bf9dd5e 100644 (file)
@@ -9,12 +9,6 @@
 
 #include <ModelAPI_Events.h>
 
-#ifdef DFBROWSER
-#include <DFBrowserAPI_Communicator.hxx>
-
-static bool FirstCall = true;
-#endif
-
 IMPLEMENT_STANDARD_HANDLE(Model_Application, TDocStd_Application)
 IMPLEMENT_STANDARD_RTTIEXT(Model_Application, TDocStd_Application)
 
@@ -23,14 +17,6 @@ static Handle_Model_Application TheApplication = new Model_Application;
 //=======================================================================
 Handle(Model_Application) Model_Application::getApplication()
 {
-#ifdef DFBROWSER
-  if (FirstCall) {
-    DFBrowserAPI_Communicator* aCommunicator =
-                   DFBrowserAPI_Communicator::loadPluginLibrary("DFBrowser.dll");
-    aCommunicator->setApplication(TheApplication);
-    FirstCall = false;
-  }
-#endif
   return TheApplication;
 }
 
index ca942c29ca06c9a5da44e23f577ace33b24fd797..c140d618cc70d847e0187b08114df319cdfef152 100644 (file)
@@ -140,6 +140,13 @@ IF(NOT ${HAVE_SALOME})
     SET(PROJECT_INCLUDES ${PROJECT_INCLUDES} ${APPELEMENTS_INCLUDE_DIR})
 ENDIF(NOT ${HAVE_SALOME})
 
+IF(EXISTS ${DFBROWSER_ROOT_DIR})
+    SET(PROJECT_LIBRARIES ${PROJECT_LIBRARIES} ${DFBrowserAPI})
+    SET(PROJECT_INCLUDES ${PROJECT_INCLUDES} ${DFBROWSER_INCLUDE_DIR})
+
+    ADD_DEFINITIONS(-DDFBROWSER)
+ENDIF()
+
 INCLUDE_DIRECTORIES(${PROJECT_INCLUDES})
 
 LINK_DIRECTORIES($ENV{PYTHON_LIB_DIR})
index 5ec4d3f083bcd5985f350c142a5247a17828c917..72025823a4a3775c3900f16c43b90741f0c0fe64 100644 (file)
@@ -45,7 +45,6 @@
 #include <QMainWindow>
 #include <QModelIndex>
 
-
 XGUI_ContextMenuMgr::XGUI_ContextMenuMgr(XGUI_Workshop* theParent)
     : QObject(theParent),
       myWorkshop(theParent),
@@ -152,6 +151,15 @@ void XGUI_ContextMenuMgr::createActions()
                                            tr("Select parent feature"), aDesktop);
   addAction("SHOW_FEATURE_CMD", aAction);
 
+#ifdef VINSPECTOR
+  aAction = ModuleBase_Tools::createAction(QIcon(), tr("Debug Visualization"), aDesktop);
+  addAction("VINSPECTOR_VIEW", aAction);
+#endif
+#ifdef DFBROWSER
+  aAction = ModuleBase_Tools::createAction(QIcon(), tr("DFBrowser"), aDesktop);
+  addAction("DFBROWSER_VIEW", aAction);
+#endif
+
   buildObjBrowserMenu();
   buildViewerMenu();
 }
@@ -329,6 +337,16 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu()
   if (myWorkshop->canChangeDeflection())
     action("DEFLECTION_CMD")->setEnabled(true);
 
+  #ifdef _DEBUG
+    #ifdef VINSPECTOR
+      action("VINSPECTOR_VIEW")->setEnabled(true);
+    #endif
+    #ifdef DFBROWSER
+      action("DFBROWSER_VIEW")->setEnabled(true);
+    #endif
+  #endif
+
+
   ModuleBase_IModule* aModule = myWorkshop->module();
   if (aModule)
     aModule->updateObjectBrowserMenu(myActions);
@@ -558,6 +576,16 @@ void XGUI_ContextMenuMgr::addObjBrowserMenu(QMenu* theMenu) const
       aActions.append(action("CLEAN_HISTORY_CMD"));
       aActions.append(action("DELETE_CMD"));
   }
+#ifdef _DEBUG
+  if (aSelected == 0) {
+    #ifdef VINSPECTOR
+    aActions.append(action("VINSPECTOR_VIEW"));
+    #endif
+    #ifdef DFBROWSER
+    aActions.append(action("DFBROWSER_VIEW"));
+    #endif
+  }
+#endif
   theMenu->addActions(aActions);
   addFeatures(theMenu);
 
index b90a936c6ae15cabd03baef4936d7774a0c3a148..0d718aae1ea5af1aca283ca5aebc5effbe0cf64e 100644 (file)
 #include <TColStd_MapOfTransient.hxx>
 #include <TColStd_MapIteratorOfMapOfTransient.hxx>
 
+#ifdef VINSPECTOR
+#include <VInspectorAPI_CallBack.h>
+#endif
+
 #include <Events_Loop.h>
 #include <ModelAPI_Events.h>
 
@@ -117,6 +121,9 @@ XGUI_Displayer::XGUI_Displayer(XGUI_Workshop* theWorkshop)
   : myWorkshop(theWorkshop), myNeedUpdate(false),
   myIsTrihedronActive(true), myViewerBlockedRecursiveCount(0)
 {
+  #ifdef VINSPECTOR
+  myContextCallBack = 0;
+  #endif
   myCustomPrs = std::shared_ptr<GeomAPI_ICustomPrs>(new XGUI_CustomPrs(theWorkshop));
 }
 
@@ -248,6 +255,9 @@ bool XGUI_Displayer::display(ObjectPtr theObject, AISObjectPtr theAIS,
       anAISIO->Attributes()->SetFaceBoundaryDraw( Standard_True );
     anAISIO->SetDisplayMode(aDispMode);
     aContext->Display(anAISIO, aDispMode, 0, false, true, AIS_DS_Displayed);
+    #ifdef VINSPECTOR
+    if (myContextCallBack) myContextCallBack->Display(anAISIO);
+    #endif
     aDisplayed = true;
 
     emit objectDisplayed(theObject, theAIS);
@@ -275,6 +285,9 @@ bool XGUI_Displayer::erase(ObjectPtr theObject, const bool theUpdateViewer)
     if (!anAIS.IsNull()) {
       emit beforeObjectErase(theObject, anObject);
       aContext->Remove(anAIS, false/*update viewer*/);
+      #ifdef VINSPECTOR
+      if (myContextCallBack) myContextCallBack->Remove(anAIS);
+      #endif
       ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::erase -- Remove");
       aErased = true;
     }
@@ -363,6 +376,9 @@ bool XGUI_Displayer::redisplay(ObjectPtr theObject, bool theUpdateViewer)
         aContext->Deactivate(aAISIO, 0);
 #endif
 
+      #ifdef VINSPECTOR
+      if (myContextCallBack) myContextCallBack->Redisplay(aAISIO);
+      #endif
       ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::redisplay -- Redisplay");
 
       if (aNeedToRestoreSelection)
@@ -409,6 +425,9 @@ void XGUI_Displayer::deactivate(ObjectPtr theObject, const bool theUpdateViewer)
     deactivateAIS(anAIS);
     // the selection from the previous activation modes should be cleared manually (#26172)
     aContext->LocalContext()->ClearOutdatedSelection(anAIS, true);
+    #ifdef VINSPECTOR
+    if (myContextCallBack) myContextCallBack->ClearOutdatedSelection(anAIS);
+    #endif
     ModuleBase_Tools::selectionInfo(aContext,
       "XGUI_Displayer::deactivate -- ClearOutdatedSelection");
     if (theUpdateViewer)
@@ -608,6 +627,10 @@ bool XGUI_Displayer::isActive(ObjectPtr theObject) const
 
   TColStd_ListOfInteger aModes;
   aContext->ActivatedModes(anAIS, aModes);
+  #ifdef VINSPECTOR
+  if (myContextCallBack) myContextCallBack->ActivatedModes(anAIS, aModes);
+  #endif
+
   return aModes.Extent() > 0;
 }
 
@@ -621,6 +644,9 @@ void XGUI_Displayer::setSelected(const  QList<ModuleBase_ViewerPrsPtr>& theValue
   if (aContext->HasOpenedContext()) {
     aContext->UnhilightSelected(false);
     aContext->ClearSelected(false);
+    #ifdef VINSPECTOR
+    if (myContextCallBack) myContextCallBack->ClearSelected();
+    #endif
     NCollection_DataMap<TopoDS_Shape, NCollection_Map<Handle(AIS_InteractiveObject)>>
       aShapesToBeSelected;
 
@@ -633,6 +659,9 @@ void XGUI_Displayer::setSelected(const  QList<ModuleBase_ViewerPrsPtr>& theValue
         // problem 2: IO is not specified, so the first found owner is selected, as a result
         // it might belong to another result
         aContext->AddOrRemoveSelected(aShape, false);
+        #ifdef VINSPECTOR
+        if (myContextCallBack) myContextCallBack->AddOrRemoveSelected(aShape);
+        #endif
 #else
         NCollection_Map<Handle(AIS_InteractiveObject)> aPresentations;
         if (aShapesToBeSelected.IsBound(aShape))
@@ -655,6 +684,9 @@ void XGUI_Displayer::setSelected(const  QList<ModuleBase_ViewerPrsPtr>& theValue
             //aContext->SetSelected(anAIS, false);
             // The selection in the context was cleared, so the method sets the objects are selected
             aContext->AddOrRemoveSelected(anAIS, false);
+            #ifdef VINSPECTOR
+            if (myContextCallBack) myContextCallBack->AddOrRemoveSelected(anAIS);
+            #endif
           }
         }
       }
@@ -687,6 +719,9 @@ void XGUI_Displayer::clearSelected(const bool theUpdateViewer)
   if (!aContext.IsNull()) {
     aContext->UnhilightCurrents(false);
     aContext->ClearSelected(theUpdateViewer);
+    #ifdef VINSPECTOR
+    if (myContextCallBack) myContextCallBack->ClearSelected();
+    #endif
   }
 }
 
@@ -702,6 +737,9 @@ bool XGUI_Displayer::eraseAll(const bool theUpdateViewer)
       if (!anIO.IsNull()) {
         emit beforeObjectErase(aObj, aAISObj);
         aContext->Remove(anIO, false/*update viewer*/);
+        #ifdef VINSPECTOR
+        if (myContextCallBack) myContextCallBack->Remove(anIO);
+        #endif
         aErased = true;
       }
     }
@@ -719,10 +757,16 @@ bool XGUI_Displayer::eraseAll(const bool theUpdateViewer)
 
 void deactivateObject(Handle(AIS_InteractiveContext) theContext,
                       Handle(AIS_InteractiveObject) theObject,
+#ifdef VINSPECTOR
+                      VInspectorAPI_CallBack* theCallBack,
+#endif
                       const bool theClear = true)
 {
   if (!theObject.IsNull()) {
     theContext->Deactivate(theObject);
+    #ifdef VINSPECTOR
+    if (theCallBack) theCallBack->Deactivate(theObject);
+    #endif
     ModuleBase_Tools::selectionInfo(theContext, "XGUI_Displayer::deactivateObject -- Deactivate");
     //if (theClear) {
       //theObject->ClearSelected();
@@ -737,19 +781,19 @@ void XGUI_Displayer::deactivateTrihedron(const bool theUpdateViewer) const
   Handle(AIS_InteractiveContext) aContext = AISContext();
   if (!aTrihedron.IsNull() && aContext->IsDisplayed(aTrihedron)) {
     Handle(AIS_Trihedron) aTrie = Handle(AIS_Trihedron)::DownCast(aTrihedron);
-    deactivateObject(aContext, aTrie);
+    deactivateObject(aContext, aTrie, myContextCallBack);
 
     /// #1136 hidden axis are selected in sketch
     /// workaround for Cascade: there is a crash in AIS_LocalContext::ClearOutdatedSelection
     /// for Position AIS object in SelectionModes.
-    deactivateObject(aContext, aTrie->XAxis());
-    deactivateObject(aContext, aTrie->YAxis());
-    deactivateObject(aContext, aTrie->Axis());
-    deactivateObject(aContext, aTrie->Position());
+    deactivateObject(aContext, aTrie->XAxis(), myContextCallBack);
+    deactivateObject(aContext, aTrie->YAxis(), myContextCallBack);
+    deactivateObject(aContext, aTrie->Axis(), myContextCallBack);
+    deactivateObject(aContext, aTrie->Position(), myContextCallBack);
 
-    deactivateObject(aContext, aTrie->XYPlane());
-    deactivateObject(aContext, aTrie->XZPlane());
-    deactivateObject(aContext, aTrie->YZPlane());
+    deactivateObject(aContext, aTrie->XYPlane(), myContextCallBack);
+    deactivateObject(aContext, aTrie->XZPlane(), myContextCallBack);
+    deactivateObject(aContext, aTrie->YZPlane(), myContextCallBack);
 
     if (theUpdateViewer)
       updateViewer();
@@ -929,6 +973,9 @@ void XGUI_Displayer::activateAIS(const Handle(AIS_InteractiveObject)& theIO,
       aContext->Activate(theIO, theMode, false);
     } else
       aContext->Activate(theIO, theMode, false);
+    #ifdef VINSPECTOR
+    if (myContextCallBack) myContextCallBack->Activate(theIO, theMode);
+    #endif
 
     // the fix from VPA for more suitable selection of sketcher lines
     if (theIO->Width() > 1) {
@@ -962,10 +1009,18 @@ void XGUI_Displayer::deactivateAIS(const Handle(AIS_InteractiveObject)& theIO,
 {
   Handle(AIS_InteractiveContext) aContext = AISContext();
   if (!aContext.IsNull()) {
-    if (theMode == -1)
+    if (theMode == -1) {
       aContext->Deactivate(theIO);
-    else
+      #ifdef VINSPECTOR
+      if (myContextCallBack) myContextCallBack->Deactivate(theIO);
+      #endif
+    }
+    else {
       aContext->Deactivate(theIO, theMode);
+      #ifdef VINSPECTOR
+      if (myContextCallBack) myContextCallBack->Deactivate(theIO, theMode);
+      #endif
+    }
     ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::deactivateAIS -- Deactivate");
 
 #ifdef DEBUG_DEACTIVATE_AIS
@@ -1008,9 +1063,18 @@ bool XGUI_Displayer::displayAIS(AISObjectPtr theAIS, const bool toActivateInSele
   Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
   if (!aContext.IsNull() && !anAISIO.IsNull()) {
     aContext->Display(anAISIO, 0/*wireframe*/, 0, false/*update viewer*/, true, AIS_DS_Displayed);
+    #ifdef VINSPECTOR
+    if (myContextCallBack) myContextCallBack->Display(anAISIO);
+    #endif
     aDisplayed = true;
     aContext->Deactivate(anAISIO);
+    #ifdef VINSPECTOR
+    if (myContextCallBack) myContextCallBack->Deactivate(anAISIO);
+    #endif
     aContext->Load(anAISIO);
+    #ifdef VINSPECTOR
+    if (myContextCallBack) myContextCallBack->Load(anAISIO);
+    #endif
     if (toActivateInSelectionModes) {
       if (aContext->HasOpenedContext()) {
         if (myActiveSelectionModes.size() == 0)
@@ -1036,6 +1100,9 @@ bool XGUI_Displayer::eraseAIS(AISObjectPtr theAIS, const bool theUpdateViewer)
     Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
     if (!anAISIO.IsNull() && aContext->IsDisplayed(anAISIO)) {
       aContext->Remove(anAISIO, false/*update viewer*/);
+      #ifdef VINSPECTOR
+      if (myContextCallBack) myContextCallBack->Remove(anAISIO);
+      #endif
       ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::eraseAIS -- Remove");
       aErased = true;
     }
@@ -1215,6 +1282,9 @@ bool XGUI_Displayer::activate(const Handle(AIS_InteractiveObject)& theIO,
   // The result is the selection of the first IO is lost.
   TColStd_ListOfInteger aTColModes;
   aContext->ActivatedModes(theIO, aTColModes);
+  #ifdef VINSPECTOR
+  if (myContextCallBack) myContextCallBack->ActivatedModes(theIO, aTColModes);
+  #endif
   TColStd_ListIteratorOfListOfInteger itr( aTColModes );
   QIntList aModesActivatedForIO;
   bool isDeactivated = false;
@@ -1232,7 +1302,13 @@ bool XGUI_Displayer::activate(const Handle(AIS_InteractiveObject)& theIO,
   if (isDeactivated) {
     // the selection from the previous activation modes should be cleared manually (#26172)
     theIO->ClearSelected();
+    #ifdef VINSPECTOR
+    if (myContextCallBack) myContextCallBack->ClearSelected(theIO);
+    #endif
     aContext->LocalContext()->ClearOutdatedSelection(theIO, true);
+    #ifdef VINSPECTOR
+    if (myContextCallBack) myContextCallBack->ClearOutdatedSelection(theIO);
+    #endif
     ModuleBase_Tools::selectionInfo(aContext,
             "XGUI_Displayer::activate -- ClearSelected/ClearOutdatedSelection");
     // For performance issues
@@ -1244,6 +1320,9 @@ bool XGUI_Displayer::activate(const Handle(AIS_InteractiveObject)& theIO,
   // loading the interactive object allowing the decomposition
   if (aTColModes.IsEmpty()) {
     aContext->Load(theIO, -1, true);
+    #ifdef VINSPECTOR
+    if (myContextCallBack) myContextCallBack->Load(theIO);
+    #endif
   }
 
   // trihedron AIS check should be after the AIS loading.
@@ -1397,6 +1476,9 @@ void XGUI_Displayer::displayTrihedron(bool theToDisplay) const
                         Standard_True /* update viewer*/,
                         Standard_False /* allow decomposition */,
                         AIS_DS_Displayed /* xdisplay status */);
+    #ifdef VINSPECTOR
+    if (myContextCallBack) myContextCallBack->Display(aTrihedron);
+    #endif
 
     if (!isTrihedronActive())
       deactivateTrihedron(false);
@@ -1408,6 +1490,9 @@ void XGUI_Displayer::displayTrihedron(bool theToDisplay) const
     // the selection from the previous activation modes should be cleared manually (#26172)
 
     aContext->Erase(aTrihedron);
+    #ifdef VINSPECTOR
+    if (myContextCallBack) myContextCallBack->Remove(aTrihedron);
+    #endif
   }
 
   updateViewer();
@@ -1423,8 +1508,20 @@ QIntList XGUI_Displayer::activeSelectionModes() const
   return aModes;
 }
 
+#ifdef VINSPECTOR
+void XGUI_Displayer::setCallBack(VInspectorAPI_CallBack* theCallBack)
+{
+  myContextCallBack = theCallBack;
+}
+
+VInspectorAPI_CallBack* XGUI_Displayer::getCallBack() const
+{
+  return myContextCallBack;
+}
+#endif
+
 void XGUI_Displayer::AddOrRemoveSelectedShapes(Handle(AIS_InteractiveContext) theContext,
- const NCollection_DataMap<TopoDS_Shape,
                          const NCollection_DataMap<TopoDS_Shape,
                            NCollection_Map<Handle(AIS_InteractiveObject)>>& theShapesToBeSelected)
 {
   Handle(AIS_LocalContext) aLContext = theContext->LocalContext();
index ea3af4c2ca7fd7f938c7eda1b86188c55d07f7ff..8ff49c78bbcda81b8769fce5b1b1238b2c983f13 100644 (file)
@@ -33,6 +33,10 @@ class ModuleBase_ViewerPrs;
 class ModelAPI_Feature;
 class XGUI_Workshop;
 
+#ifdef VINSPECTOR
+class VInspectorAPI_CallBack;
+#endif
+
 /**\class XGUI_Displayer
  * \ingroup GUI
  * \brief Displayer. Provides mechanizm of display/erase of objects in the viewer
@@ -254,7 +258,13 @@ class XGUI_EXPORT XGUI_Displayer: public QObject
   /// Selection modes will be returned according to TopAbs_ShapeEnum
   QIntList activeSelectionModes() const;
 
+#ifdef VINSPECTOR
+  /// Sets callback to debug display
+  /// \param theCallBack a callback instance
+  void setCallBack(VInspectorAPI_CallBack* theCallBack);
 
+  VInspectorAPI_CallBack* getCallBack() const;
+#endif
   /// Converts shape type (TopAbs_ShapeEnum) to selection mode
   /// \param theShapeType a shape type from TopAbs_ShapeEnum
   static int getSelectionMode(int theShapeType);
@@ -350,7 +360,9 @@ private:
  protected:
    /// Reference to workshop
   XGUI_Workshop* myWorkshop;
-
+#ifdef VINSPECTOR
+  VInspectorAPI_CallBack* myContextCallBack; ///< callback to debug display
+#endif
   /// A container for selection filters
   Handle(SelectMgr_AndFilter) myAndFilter;
 
index b4a2bbc5ffb7ba4a89c91ebe730698154dd02757..894198d3dc5e0a8ddd4ea0e7baa5d238c35af70b 100755 (executable)
 
 #include <SelectMgr_ListIteratorOfListOfFilter.hxx>
 
+#ifdef VINSPECTOR
+#include <VInspectorAPI_CallBack.h>
+#endif
+
 XGUI_SelectionMgr::XGUI_SelectionMgr(XGUI_Workshop* theParent)
     : QObject(theParent),
       myWorkshop(theParent)
@@ -63,6 +67,10 @@ void XGUI_SelectionMgr::setSelectedOwners(const SelectMgr_IndexedMapOfOwner& the
         continue;
 
       aContext->AddOrRemoveSelected(anOwner, isUpdateViewer);
+      #ifdef VINSPECTOR
+      if (myWorkshop->displayer()->getCallBack())
+        myWorkshop->displayer()->getCallBack()->AddOrRemoveSelected(anOwner);
+      #endif
     }
   }
   ModuleBase_Tools::selectionInfo(aContext,
index 770494651b3b8cfe85670dbf89110a01f1f51316..1b9e3fb0e9976b63d6a78ba8e2a137bbbf4ee73e 100644 (file)
   #include <AppElements_Viewer.h>
 #endif
 
-#ifdef VINSPECTOR
-#include <VInspectorAPI_PluginMgr.h>
-#include <VInspectorAPI_Communicator.h>
-
-static bool FirstCall = true;
-
-#endif
-
 #include <ModuleBase_IViewWindow.h>
 
 #include <QEvent>
@@ -49,15 +41,6 @@ Handle(AIS_InteractiveContext) XGUI_ViewerProxy::AISContext() const
 #else
   aContext = myWorkshop->mainWindow()->viewer()->AISContext();
 #endif
-
-#ifdef VINSPECTOR
-  if (FirstCall) {
-    VInspectorAPI_PluginMgr::activateVInspector("VInspector.dll", aContext);
-    FirstCall = false;
-  }
-#endif
-
-
   return aContext;
 }
 
index 47bfd5355f22f2cca530b10794ec6a0a95e1111e..d80fcaf25a929030e72bbddbbc4f21c88df6a5db 100755 (executable)
 
 #include <iterator>
 
+#ifdef VINSPECTOR
+#include <VInspectorAPI_PluginMgr.h>
+#include <VInspectorAPI_Communicator.h>
+static bool VInspector_FirstCall = true;
+#endif
+
+#ifdef DFBROWSER
+#include <CDF_Session.hxx>
+#include <DFBrowserAPI_Communicator.hxx>
+static bool DFBrowser_FirstCall = true;
+#endif
+
 #ifdef _DEBUG
 #include <QDebug>
 #include <iostream>
@@ -1337,6 +1349,33 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked)
   } else if (theId == "SHOW_FEATURE_CMD") {
     highlightFeature(aObjects);
   }
+#ifdef VINSPECTOR
+  else if (theId == "VINSPECTOR_VIEW") {
+    if (VInspector_FirstCall) {
+      VInspectorAPI_Communicator* aCommunicator = VInspectorAPI_PluginMgr::activateVInspector(
+                                        "VInspector.dll", viewer()->AISContext());
+      displayer()->setCallBack(aCommunicator->getCallBack());
+      #ifndef HAVE_SALOME
+      AppElements_Viewer* aViewer = mainWindow()->viewer();
+      if (aViewer)
+        aViewer->setCallBack(aCommunicator->getCallBack());
+      #endif
+      VInspector_FirstCall = false;
+    }
+  }
+#endif
+#ifdef DFBROWSER
+  else if (theId == "DFBROWSER_VIEW") {
+    if (DFBrowser_FirstCall) {
+      Handle(CDF_Application) anApplication = CDF_Session::CurrentSession()->CurrentApplication();
+
+      DFBrowserAPI_Communicator* aCommunicator =
+                     DFBrowserAPI_Communicator::loadPluginLibrary("DFBrowser.dll");
+      aCommunicator->setApplication(anApplication);
+      DFBrowser_FirstCall = false;
+    }
+  }
+#endif
 }
 
 //**************************************************************