plugger.py
changeset 443 34c9788bd933
parent 440 f122eb4248b6
child 447 af3399aca7b7
--- a/plugger.py	Mon Nov 30 10:13:36 2009 +0100
+++ b/plugger.py	Tue Dec 01 10:59:17 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()
@@ -988,6 +992,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.