Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

refresh active file support

  • Loading branch information...
commit 78cf272d56116d47a4452e54ba754715776a8b89 1 parent ee3e2b5
Joe Ferraro authored
View
10 Context.sublime-menu
@@ -0,0 +1,10 @@
+[
+ { "caption": "-" },
+ {
+ "caption": "MavensMate",
+ "children":
+ [
+ { "caption": "Refresh File From Server", "command": "refresh_active_file" }
+ ]
+ }
+]
View
5 Main.sublime-menu
@@ -65,6 +65,11 @@
"command": "compile_active_file"
},
{
+ "id": "refresh_active",
+ "caption": "Refresh File From Server",
+ "command": "refresh_active_file"
+ },
+ {
"id": "delete_active",
"caption": "Delete Active File",
"command": "mavens_mate"
View
7 commands/refresh_from_server.rb
@@ -0,0 +1,7 @@
+#!/usr/bin/env ruby -W0
+require File.dirname(File.dirname(__FILE__)) + "/constants.rb"
+include Constants
+ENV["TM_FILEPATH"] = ARGV[0]
+require LIB_ROOT + "/mavensmate.rb"
+MavensMate::Util.set_project_directory(File.dirname(ENV["TM_FILEPATH"]))
+MavensMate.refresh_selected_file
View
17 mavensmate.py
@@ -226,7 +226,19 @@ def run(self):
thread.start()
handle_threads(threads, self.status_panel, handle_result, 0)
-#deploys the currently open tabs
+#deploys the currently active file
+class RefreshActiveFile(sublime_plugin.WindowCommand):
+ def run(self):
+ self.status_panel = show_mm_panel(self)
+ active_file = get_active_file()
+ write_to_panel(self.status_panel, 'Refreshing From Server => ' + active_file + '\n')
+ threads = []
+ thread = MetadataAPICall("refresh_from_server", "'"+active_file+"'")
+ threads.append(thread)
+ thread.start()
+ handle_threads(threads, self.status_panel, handle_result, 0)
+
+#TODO: deploys the currently open tabs
class CompileTabsCommand(sublime_plugin.WindowCommand):
def run(self):
#self.status_panel = show_mm_panel(self)
@@ -383,6 +395,9 @@ def handle_result(panel, result):
sublime.active_window().open_file(res['location'])
if res['success'] == True and hide_panel == True:
hide_mm_panel(panel)
+ elif 'success' in result:
+ if result['success'] == True and hide_panel == True:
+ hide_mm_panel(panel)
def parse_new_metadata_input(input):
input = input.replace(" ", "")
View
16 support/lib/mavensmate.rb
@@ -257,17 +257,15 @@ def self.save(active_file=false)
#refreshes the selected file from the server // TODO:selected *files*
def self.refresh_selected_file
- validate [:internet, :mm_project, :file_selected]
-
begin
- TextMate.call_with_progress( :title => 'MavensMate', :message => 'Refreshing '+File.basename(ENV['TM_FILEPATH']+' from the server') ) do
- client = MavensMate::Client.new
- result_zip = client.retrieve({ :path => ENV['TM_FILEPATH'] })
- MavensMate::FileFactory.replace_file(ENV['TM_FILEPATH'], result_zip)
- TextMate.rescan_project
- end
+ client = MavensMate::Client.new
+ result_zip = client.retrieve({ :path => ENV['TM_FILEPATH'] })
+ MavensMate::FileFactory.replace_file(ENV['TM_FILEPATH'], result_zip)
+ res = { :success => true, :message => "Refreshed successfully" }
+ puts res.to_json
rescue Exception => e
- alert e.message + "\n" + e.backtrace.join("\n")
+ res = { :success => false, :message => e.message }
+ puts res.to_json
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.