plugger.py
changeset 447 af3399aca7b7
parent 446 1edde533db19
parent 443 34c9788bd933
child 450 18583d13f0fa
--- a/plugger.py	Tue Dec 01 13:41:29 2009 +0100
+++ b/plugger.py	Tue Dec 01 13:45:49 2009 +0100
@@ -174,7 +174,11 @@
         self.ChangesToSave = True
         # Filter IEC_Channel and Name, that have specific behavior
         if path == "BaseParams.IEC_Channel":
-            return self.FindNewIEC_Channel(value), True
+            old_leading = ".".join(map(str, self.GetCurrentLocation()))
+            new_value = self.FindNewIEC_Channel(value)
+            new_leading = ".".join(map(str, self.PlugParent.GetCurrentLocation() + (new_value,)))
+            self.GetPlugRoot().UpdateProjectVariableLocation(old_leading, new_leading)
+            return new_value, True
         elif path == "BaseParams.Name":
             res = self.FindNewName(value)
             self.PlugRequestSave()
@@ -986,6 +990,14 @@
             self.AppFrame.RefreshLibraryTree()
             self.AppFrame.RefreshEditor()
     
+    # Update a PLCOpenEditor Pou variable location
+    def UpdateProjectVariableLocation(self, old_leading, new_leading):
+        self.Project.updateElementAddress(old_leading, new_leading)
+        self.BufferProject()
+        if self.AppFrame is not None:
+            self.AppFrame._Refresh(TITLE, INSTANCESTREE, FILEMENU, EDITMENU)
+            self.AppFrame.RefreshEditor()
+    
     def GetVariableLocationTree(self):
         '''
         This function is meant to be overridden by plugins.