Tuned the remote editor commands to only send, if the IDE is connected.

Fri, 26 Mar 2010 15:57:07 +0000

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 26 Mar 2010 15:57:07 +0000
changeset 156
478787b5607e
parent 155
375e3c884874
child 157
c8d5916b9934

Tuned the remote editor commands to only send, if the IDE is connected.

Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
Documentation/Source/eric5.ViewManager.ViewManager.html file | annotate | diff | comparison | revisions
QScintilla/Editor.py file | annotate | diff | comparison | revisions
ViewManager/ViewManager.py file | annotate | diff | comparison | revisions
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Help/source.qhp	Fri Mar 26 15:43:36 2010 +0000
+++ b/Documentation/Help/source.qhp	Fri Mar 26 15:57:07 2010 +0000
@@ -3292,6 +3292,7 @@
       <keyword name="ViewManager.__enableSpellingActions" id="ViewManager.__enableSpellingActions" ref="eric5.ViewManager.ViewManager.html#ViewManager.__enableSpellingActions" />
       <keyword name="ViewManager.__exportMenuTriggered" id="ViewManager.__exportMenuTriggered" ref="eric5.ViewManager.ViewManager.html#ViewManager.__exportMenuTriggered" />
       <keyword name="ViewManager.__findFileName" id="ViewManager.__findFileName" ref="eric5.ViewManager.ViewManager.html#ViewManager.__findFileName" />
+      <keyword name="ViewManager.__getCooperationClient" id="ViewManager.__getCooperationClient" ref="eric5.ViewManager.ViewManager.html#ViewManager.__getCooperationClient" />
       <keyword name="ViewManager.__goto" id="ViewManager.__goto" ref="eric5.ViewManager.ViewManager.html#ViewManager.__goto" />
       <keyword name="ViewManager.__gotoBrace" id="ViewManager.__gotoBrace" ref="eric5.ViewManager.ViewManager.html#ViewManager.__gotoBrace" />
       <keyword name="ViewManager.__gotoSyntaxError" id="ViewManager.__gotoSyntaxError" ref="eric5.ViewManager.ViewManager.html#ViewManager.__gotoSyntaxError" />
@@ -3412,6 +3413,7 @@
       <keyword name="ViewManager.initSpellingToolbar" id="ViewManager.initSpellingToolbar" ref="eric5.ViewManager.ViewManager.html#ViewManager.initSpellingToolbar" />
       <keyword name="ViewManager.initViewMenu" id="ViewManager.initViewMenu" ref="eric5.ViewManager.ViewManager.html#ViewManager.initViewMenu" />
       <keyword name="ViewManager.initViewToolbar" id="ViewManager.initViewToolbar" ref="eric5.ViewManager.ViewManager.html#ViewManager.initViewToolbar" />
+      <keyword name="ViewManager.isConnected" id="ViewManager.isConnected" ref="eric5.ViewManager.ViewManager.html#ViewManager.isConnected" />
       <keyword name="ViewManager.newEditor" id="ViewManager.newEditor" ref="eric5.ViewManager.ViewManager.html#ViewManager.newEditor" />
       <keyword name="ViewManager.newEditorView" id="ViewManager.newEditorView" ref="eric5.ViewManager.ViewManager.html#ViewManager.newEditorView" />
       <keyword name="ViewManager.newProject" id="ViewManager.newProject" ref="eric5.ViewManager.ViewManager.html#ViewManager.newProject" />
--- a/Documentation/Source/eric5.ViewManager.ViewManager.html	Fri Mar 26 15:43:36 2010 +0000
+++ b/Documentation/Source/eric5.ViewManager.ViewManager.html	Fri Mar 26 15:57:07 2010 +0000
@@ -302,6 +302,9 @@
 <td><a href="#ViewManager.__findFileName">__findFileName</a></td>
 <td>Private method to handle the search for file action.</td>
 </tr><tr>
+<td><a href="#ViewManager.__getCooperationClient">__getCooperationClient</a></td>
+<td>Private method to initialize and get a reference to the cooperation client.</td>
+</tr><tr>
 <td><a href="#ViewManager.__goto">__goto</a></td>
 <td>Private method to handle the goto action.</td>
 </tr><tr>
@@ -662,6 +665,9 @@
 <td><a href="#ViewManager.initViewToolbar">initViewToolbar</a></td>
 <td>Public method to create the View toolbar</td>
 </tr><tr>
+<td><a href="#ViewManager.isConnected">isConnected</a></td>
+<td>Public method to check the connection status of the IDE.</td>
+</tr><tr>
 <td><a href="#ViewManager.newEditor">newEditor</a></td>
 <td>Public slot to generate a new empty editor.</td>
 </tr><tr>
@@ -1070,7 +1076,18 @@
 <b>__findFileName</b>(<i></i>)
 <p>
         Private method to handle the search for file action.
-</p><a NAME="ViewManager.__goto" ID="ViewManager.__goto"></a>
+</p><a NAME="ViewManager.__getCooperationClient" ID="ViewManager.__getCooperationClient"></a>
+<h4>ViewManager.__getCooperationClient</h4>
+<b>__getCooperationClient</b>(<i></i>)
+<p>
+        Private method to initialize and get a reference to the cooperation
+        client.
+</p><dl>
+<dt>Returns:</dt>
+<dd>
+reference to the cooperation client (CooperationClient)
+</dd>
+</dl><a NAME="ViewManager.__goto" ID="ViewManager.__goto"></a>
 <h4>ViewManager.__goto</h4>
 <b>__goto</b>(<i></i>)
 <p>
@@ -2151,6 +2168,16 @@
 <dd>
 the generated toolbar
 </dd>
+</dl><a NAME="ViewManager.isConnected" ID="ViewManager.isConnected"></a>
+<h4>ViewManager.isConnected</h4>
+<b>isConnected</b>(<i></i>)
+<p>
+        Public method to check the connection status of the IDE.
+</p><dl>
+<dt>Returns:</dt>
+<dd>
+flag indicating the connection status (boolean)
+</dd>
 </dl><a NAME="ViewManager.newEditor" ID="ViewManager.newEditor"></a>
 <h4>ViewManager.newEditor</h4>
 <b>newEditor</b>(<i></i>)
--- a/QScintilla/Editor.py	Fri Mar 26 15:43:36 2010 +0000
+++ b/QScintilla/Editor.py	Fri Mar 26 15:57:07 2010 +0000
@@ -5510,10 +5510,11 @@
         """
         Private slot to handle a change of the selection.
         """
-        sel = self.getSelection()
-        if sel != self.__lastSelection:
-            self.send(Editor.SelectionToken, args = sel)
-            self.__lastSelection = sel
+        if self.vm.isConnected():
+            sel = self.getSelection()
+            if sel != self.__lastSelection:
+                self.send(Editor.SelectionToken, args = sel)
+                self.__lastSelection = sel
     
     def __processSelectionCommand(self, argsString):
         """
--- 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