diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Open Document in Running Browser(s).tmCommand b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Open Document in Running Browser(s).tmCommand new file mode 100644 index 000000000..a85993ae3 --- /dev/null +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Open Document in Running Browser(s).tmCommand @@ -0,0 +1,65 @@ + + + + + beforeRunningCommand + nop + command + #!/usr/bin/env ruby -wKU +# +# Open Document in Running Browser(s) +# v3 - November 22, 2007 +# +# Now supports multiple running versions of a single browser along +# with a range of new/old browsers. Bring back support for Firefox. +# +# Options: Set TM_PROJECT_SITEURL in your TM Project Window Info Button +# in the following form: "http://example.com/" + +require "#{ENV['TM_SUPPORT_PATH']}/lib/escape.rb" + +if ENV['TM_PROJECT_SITEURL'] + url = "#{ENV['TM_PROJECT_SITEURL']}" + ENV['TM_FILEPATH'].sub(/^#{Regexp.escape(ENV['TM_PROJECT_DIRECTORY'])}\//, '') +else + url = "file://#{ENV['TM_PROJECT_DIRECTORY']}/index.html" +end + +proclist = `ps -x -o command` +active = [] +os = `defaults read /System/Library/CoreServices/SystemVersion ProductVersion` + +browsers = %w[ Safari OmniWeb Camino Shiira firefox-bin Xyle\ scope Opera Internet\ Explorer flock-bin iCab Sunrise seamonkey-bin navigator-bin ].join('|') + +# Build paths to each active browser +# +# Notes: +# - 'WebKit' look ahead is to rule it out so we can use the working +# rule below. +# - 'LaunchCFMApp' portion is so iCab works. +active = proclist.scan(%r{^(?:/.*LaunchCFMApp )?(/.*\.app)(?=/Contents/MacOS/(?:#{browsers})\b(?!\s-WebKit))}) + +# Special check for WebKit as it appears as Safari +# Note: Only supports one running instance of WebKit, picked at random. +if proclist =~ %r{/Contents/MacOS/Safari.*-WebKit(DeveloperExtras|ScriptDebuggerEnabled)} + active << "WebKit" +end + +# TODO: Change when Leopard Only +# On Leopard use the -g option to open in background. +if os =~ /^10\.(5|6)/ + active.each {|p| `open -g -a #{e_sh(p)} #{e_sh(url)}` } +else + active.each {|p| `open -a #{e_sh(p)} #{e_sh(url)}` } +end + input + none + name + Open Document in Running Browser(s) + output + discard + scope + source.js.objj + uuid + 36FD3695-1051-401E-8536-89FB9CEEEAB4 + + diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Refresh Running Browser(s).tmCommand b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Refresh Running Browser(s).tmCommand new file mode 100644 index 000000000..9b85e3197 --- /dev/null +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Refresh Running Browser(s).tmCommand @@ -0,0 +1,51 @@ + + + + + beforeRunningCommand + nop + command + ### Refresh All Active Browsers - OmniWeb, Safari, Firefox & IE +### v1.0. 2005-03-29 +### + +# Check if Internet Explorer is running, if so refresh +ps -xc|grep -sq "Internet Explorer" && osascript -e 'tell app "Internet Explorer"' -e 'activate' -e 'OpenURL "JavaScript:window.location.reload();" toWindow -1' -e 'end tell' + +# Check if OmniWeb is running, if so refresh +ps -xc|grep -sq OmniWeb && osascript -e 'tell app "OmniWeb"' -e 'activate' -e 'reload first browser' -e 'end tell' + +# Check if Firefox is running, if so refresh +ps -xc|grep -sqi firefox && osascript <<'APPLESCRIPT' + tell app "Firefox" to activate + tell app "System Events" + if UI elements enabled then + keystroke "r" using command down + -- Fails if System Preferences > Universal access > "Enable access for assistive devices" is not on + else + tell app "Firefox" to Get URL "JavaScript:window.location.reload();" inside window 1 + -- Fails if Firefox is set to open URLs from external apps in new tabs. + end if + end tell +APPLESCRIPT + +# Check if Safari is running, if so refresh +ps -xc|grep -sq Safari && osascript -e 'tell app "Safari"' -e 'activate' -e 'do JavaScript "window.location.reload();" in first document' -e 'end tell' + +# Check if Camino is running, if so refresh +ps -xc|grep -sq Camino && osascript -e 'tell app "Camino"' -e 'activate' -e 'tell app "System Events" to keystroke "r" using {command down}' -e 'end tell' + + input + none + keyEquivalent + @r + name + Refresh Running Browser(s) + output + discard + scope + source.js.objj + uuid + 033BC36A-97DA-4F48-9ACB-B58C80D1A689 + + diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Syntaxes/Objective-J.tmLanguage b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Syntaxes/Objective-J.tmLanguage index a1ced269f..b750cb206 100644 --- a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Syntaxes/Objective-J.tmLanguage +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Syntaxes/Objective-J.tmLanguage @@ -21,7 +21,7 @@ begin - ((@)(interface|protocol))(?!.+;)\s+([A-Za-z][A-Za-z0-9]*)\s*((:)(?:\s*)([A-Za-z][A-Za-z0-9]*))?(\s|\n)? + ((@)(interface|protocol))(?!.+;)\s+([_A-Za-z][_A-Za-z0-9]*)\s*((:)(?:\s*)([_A-Za-z][_A-Za-z0-9]*))?(\s|\n)? captures 1 @@ -84,7 +84,7 @@ begin - ((@)(implementation))\s+([A-Za-z][A-Za-z0-9]*)\s*(?::\s*([A-Za-z][A-Za-z0-9]*))? + ((@)(implementation))\s+([_A-Za-z][_A-Za-z0-9]*)\s*(?::\s*([_A-Za-z][_A-Za-z0-9]*))? captures 1 diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/info.plist b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/info.plist index f5f1b9036..b7c519f74 100644 --- a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/info.plist +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/info.plist @@ -8,14 +8,31 @@ Tom Robinson description <a href="http://cappuccino.org/">Cappuccino</a> is an open source framework that makes it easy to build desktop-caliber applications that run in a web browser. + mainMenu + + items + + 96C39647-4346-4750-9F96-58070F24EDE6 + AA41BEF8-5F81-4A5A-85DE-2E81A112778B + 85B0746B-AE1C-47B3-8B9A-2B9A95F4C71E + ------------------------------------ + 36FD3695-1051-401E-8536-89FB9CEEEAB4 + 033BC36A-97DA-4F48-9ACB-B58C80D1A689 + + submenus + + name JavaScript Objective-J ordering 58D4B98A-2110-423E-9C80-CC9E202816E7 + 85A46AFC-5552-4CE5-BDA0-ED34F0398399 96C39647-4346-4750-9F96-58070F24EDE6 AA41BEF8-5F81-4A5A-85DE-2E81A112778B 85B0746B-AE1C-47B3-8B9A-2B9A95F4C71E + 36FD3695-1051-401E-8536-89FB9CEEEAB4 + 033BC36A-97DA-4F48-9ACB-B58C80D1A689 uuid 1FB3D538-84E1-4002-AA46-5705529A27E1