问题
There is a button "Upload All Outgoing Changes" in Synchronize panel of eclipse. Any way to "click" it without mouse? There is no such action in prefs->general->keys
回答1:
I created an Auto Hot Key file just for this. http://www.autohotkey.com/ I hope you like it!
; Eclipse Synchronize Override Upload
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: Taylor York <taylor@tyec.co>
;
; Script Function:
; Upload Files to the Synchronize Window in Eclipse
;
;#NoTrayIcon
#SingleInstance force
DetectHiddenWindows, on
; the title starts with
SetTitleMatchMode 2
SyncAndUpload() ; Function
{
; Get to the Synchronize Tab
Send {ALT down} ; Hold Alt+Shift+Q down
Send {SHIFT down} ; Eclipse seemed to dislike pressing every key at once
Send {Q down}
Send {Q up}
Send {SHIFT up}
Send {ALT up}
Sleep, 250 ; wait 250 milliseconds
Send y
; Click Override and Upload
Send {Space} ; When you go to the Synchronize tab, you have to select something. Space selects to top item
Send {AppsKey} ; "Right Click" / Context menu the item that is selected
Send {o 2} ; Press o twice (Override and Upload is the second O)
}
; Make sure we are in Eclipse, so we dont hijack other apps!
#IfWinActive, ahk_class SWT_Window0
{
#IfWinActive, PHP ; Title starts with PHP (this is used so it only works in PHP mode.
{
^T::
{
KeyWait Control ; Wait to run until all keys are let go
KeyWait T
SyncAndUpload()
return
}
^S::
{
KeyWait Control ; Wait to run until all keys are let go
KeyWait S
Send ^S
Sleep 250
SyncAndUpload()
}
return
}
return
}
;endofscript
回答2:
It does not exist and I think I know why: committing or updating should be a very conscious decision. So clicking the button promotes that kind of decision.
In general you can use Ctrl-Shift-L to see quick cheat sheet of shortcuts for currently opened views.
来源:https://stackoverflow.com/questions/3119239/eclipse-synchronize-hotkeys