Commits

Konstantin Kabanov committed 62f90ea

New Command: Checkout Open Files

  • Participants
  • Parent commits 2394206

Comments (0)

Files changed (2)

File Context.sublime-menu

             { "command": "tfs_difference", "caption": "Compare With Latest..." },
             { "command": "tfs_delete", "caption": "Delete" },
             { "command": "tfs_status", "caption": "Status" },
-            { "command": "tfs_annotate", "caption": "Annotate..." }
+            { "command": "tfs_annotate", "caption": "Annotate..." },
+            { "caption": "-" },
+            { "command": "tfs_checkout_open_files", "caption": "Checkout Open Files" }
         ]
     }
 ]

File sublime_tfs.py

     def is_visible(self, dirs):
         return (dirs != None) and (len(dirs) > 0) and all(os.path.isdir(item) for item in dirs)
 
-    def run(self, edit, dirs):
+    def run(self, dirs):
         path = dirs[0] # currently do GLV for first selected directory only
         manager = TfsManager()
         thread = TfsRunnerThread(path, manager.dir_get_latest)
                     if thread.isAlive():
                         sublime.set_timeout(lambda: "Checkout failed. Too long operation")
 
+class TfsCheckoutOpenFilesCommand(sublime_plugin.WindowCommand):
+    """
+    Checout all opened files
+    """
+
+    def run(self):
+        for view in self.window.views():
+            view.run_command('tfs_checkout')
+
 def is_readonly(path):
     try:
         return not os.stat(path)[0] & stat.S_IWRITE