ViewManager/ViewManager.py

changeset 156
478787b5607e
parent 155
375e3c884874
child 158
6a561f87bc07
--- a/ViewManager/ViewManager.py	Fri Mar 26 15:43:36 2010 +0000
+++ b/ViewManager/ViewManager.py	Fri Mar 26 15:57:07 2010 +0000
@@ -4928,6 +4928,26 @@
     ## Cooperation related methods
     #######################################################################
     
+    def __getCooperationClient(self):
+        """
+        Private method to initialize and get a reference to the cooperation
+        client.
+        
+        @return reference to the cooperation client (CooperationClient)
+        """
+        if self.__cooperationClient is None:
+            self.__cooperationClient = e5App().getObject("Cooperation").getClient()
+            self.__cooperationClient.editorCommand.connect(self.__receive)
+        return self.__cooperationClient
+    
+    def isConnected(self):
+        """
+        Public method to check the connection status of the IDE.
+        
+        @return flag indicating the connection status (boolean)
+        """
+        return self.__getCooperationClient().hasConnections()
+    
     def send(self, fileName, message):
         """
         Public method to send an editor command to remote editors.
@@ -4937,11 +4957,7 @@
         """
         project = e5App().getObject("Project")
         if project.isProjectFile(fileName):
-            if self.__cooperationClient is None:
-                self.__cooperationClient = e5App().getObject("Cooperation").getClient()
-                self.__cooperationClient.editorCommand.connect(
-                    self.__receive)
-            self.__cooperationClient.sendEditorCommand(
+            self.__getCooperationClient().sendEditorCommand(
                 project.getHash(), 
                 project.getRelativeUniversalPath(fileName), 
                 message

eric ide

mercurial