diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/.gitignore b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/.gitignore new file mode 100644 index 000000000..90ec22bee --- /dev/null +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/.gitignore @@ -0,0 +1 @@ +.svn diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/CPLog() for Current Method.tmCommand b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/CPLog() for Current Method.tmCommand new file mode 100644 index 000000000..ec6f3d84f --- /dev/null +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/CPLog() for Current Method.tmCommand @@ -0,0 +1,70 @@ + + + + + beforeRunningCommand + nop + command + #!/usr/bin/env ruby + +proto_re = / + ^\s* # Start of the line and optional space + [+-]\s* # a plus or minus for method specifier + \([^)]+\) # the return type in brackets + ((?:\n|[^{])*) + (?m:.*?) + \{ + /x + +previous_lines = STDIN.readlines[1..ENV['TM_LINE_NUMBER'].to_i - 1] +invocation_line = previous_lines[-1] + +proto = previous_lines.join.scan(proto_re)[-1] + +exit if proto.nil? or proto.empty? + +last_proto_sel_with_types = proto[0].strip.sub(/^\s+/, '').sub(%r{\s*//.*$}, '').gsub(/\n\s*/, ' ') + +params = [] +params = last_proto_sel_with_types.scan(/(.+?):\((.+?)\)(\w+)/) + +def format_specifier_for_type(type) + %w[int bool BOOL long].each { |t| return('%d') if type.include? t } + return '%c' if type == 'char' + return '%C' if type == 'unichar' + return '%s' if type == 'char*' + '%@' +end + +def transformer_for(type, name) + return "CPStringFromRect(#{name})" if type == 'CPRect' + return "CPStringFromPoint(#{name})" if type == 'CPPoint' + return "CPStringFromSize(#{name})" if type == 'CPSize' + return "CPStringFromSelector(#{name})" if type == 'SEL' + name +end + +print 'CPLog("[%@ ' +if params.empty? + print last_proto_sel_with_types +else + print params.map { |param, type, name| param + ':' + format_specifier_for_type(type) }.join +end +print ']", [self class]' +print ', ' + params.map { |param, type, name| transformer_for(type, name) }.join(', ') unless params.empty? +print ");" + + input + document + name + CPLog() for Current Method + output + insertAsSnippet + scope + source.js.objj meta.scope.implementation + tabTrigger + logm + uuid + F220FEE6-6522-4281-8091-CF8C66AED44F + + diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Help.tmCommand b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Help.tmCommand new file mode 100644 index 000000000..43f1a9784 --- /dev/null +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Help.tmCommand @@ -0,0 +1,29 @@ + + + + + beforeRunningCommand + nop + command + +. "$TM_SUPPORT_PATH/lib/webpreview.sh" + +html_header "Objective-J Bundle Help" "Objective-J" + +"$TM_SUPPORT_PATH/lib/markdown_to_help.rb" "$TM_BUNDLE_SUPPORT/help/help.markdown" + +html_footer + input + none + keyEquivalent + + name + Help + output + showAsHTML + scope + source.js.objj + uuid + AF27A8B3-C87F-410A-915B-D83271FDDC00 + + diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Insert Matching Start Bracket.tmCommand b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Insert Matching Start Bracket.tmCommand new file mode 100644 index 000000000..2fa24f653 --- /dev/null +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Insert Matching Start Bracket.tmCommand @@ -0,0 +1,320 @@ + + + + + beforeRunningCommand + nop + bundleUUID + 4679484F-6227-11D9-BFB1-000D93589AF6 + command + #!/usr/bin/env ruby +require "#{ENV['TM_SUPPORT_PATH']}/lib/escape" +require ENV['TM_SUPPORT_PATH'] + "/lib/exit_codes" + +class Lexer + include Enumerable + def initialize + @label = nil + @pattern = nil + @handler = nil + @input = nil + + reset + + yield self if block_given? + end + + def input(&reader) + if @input.is_a? self.class + @input.input(&reader) + else + class << reader + alias_method :next, :call + end + + @input = reader + end + end + + def add_token(label, pattern, &handler) + unless @label.nil? + @input = clone + end + + @label = label + @pattern = /(#{pattern})/ + @handler = handler || lambda { |label, match| [label, match] } + + reset + end + + def next(peek = false) + while @tokens.empty? and not @finished + new_input = @input.next + if new_input.nil? or new_input.is_a? String + @buffer += new_input unless new_input.nil? + new_tokens = @buffer.split(@pattern) + while new_tokens.size > 2 or (new_input.nil? and not new_tokens.empty?) + @tokens << new_tokens.shift + @tokens << @handler[@label, new_tokens.shift] unless new_tokens.empty? + end + @buffer = new_tokens.join + @finished = true if new_input.nil? + else + separator, new_token = @buffer.split(@pattern) + new_token = @handler[@label, new_token] unless new_token.nil? + @tokens.push( *[ separator, + new_token, + new_input ].select { |t| not t.nil? and t != "" } ) + reset(:buffer) + end + end + peek ? @tokens.first : @tokens.shift + end + + def peek + self.next(true) + end + + def each + while token = self.next + yield token + end + end + + private + + def reset(*attrs) + @buffer = String.new if attrs.empty? or attrs.include? :buffer + @tokens = Array.new if attrs.empty? or attrs.include? :tokens + @finished = false if attrs.empty? or attrs.include? :finished + end +end + + +class ObjcParser + + attr_reader :list + def initialize(args) + @list = args + end + + def get_position + return nil,nil if @list.empty? + has_message = true + + a = @list.pop + endings = [:close,:post_op,:at_string,:at_selector,:identifier] +openings = [:open,:return,:control] + if a.tt == :identifier && !@list.empty? && endings.include?(@list[-1].tt) + insert_point = find_object_start + else + @list << a + has_message = false unless methodList + insert_point = find_object_start + end +return insert_point, has_message + end + + def methodList + old = Array.new(@list) + + a = selector_loop(@list) + if !a.nil? && a.tt == :selector + if file_contains_selector? a.text + return true + else + internal = Array.new(@list) + b = a.text + until internal.empty? + tmp = selector_loop(internal) + return true if tmp.nil? + b = tmp.text + b + if file_contains_selector? b + @list = internal + return true + end + end + end + else + end +@list = old +return false + end + + def file_contains_selector?(methodName) + fileNames = ["#{ENV['TM_BUNDLE_SUPPORT']}/cocoa.txt.gz"] + userMethods = "#{ENV['TM_PROJECT_DIRECTORY']}/.methods.TM_Completions.txt.gz" + + fileNames += [userMethods] if File.exists? userMethods + candidates = [] + fileNames.each do |fileName| + zGrepped = %x{zgrep ^#{e_sh methodName }[[:space:]] #{e_sh fileName }} + candidates += zGrepped.split("\n") + end + + return !candidates.empty? + end + + def selector_loop(l) + until l.empty? + obj = l.pop + case obj.tt + when :selector + return obj + when :close + return nil if match_bracket(obj.text,l).nil? + when :open + return nil + end + end + return nil + end + + def match_bracket(type,l) + partner = {"]"=>"[",")"=>"(","}"=>"{"}[type] + up = 1 + until l.empty? + obj = l.pop + case obj.text + when type + up +=1 + when partner + up -=1 + end + return obj.beg if up == 0 + end + end + + def find_object_start + openings = [:operator,:selector,:open,:return,:control] + until @list.empty? || openings.include?(@list[-1].tt) + obj = @list.pop + case obj.tt + when :close + tmp = match_bracket(obj.text, @list) + b = tmp unless tmp.nil? + when :star + b, ate = eat_star(b,obj.beg) + return b unless ate + when :nil + b = nil + else + b = obj.beg + end + end + return b + end + + def eat_star(prev, curr) + openings = [:operator,:selector,:open,:return,:control,:star] + if @list.empty? || openings.include?(@list[-1].tt) + return curr, true + else + return prev, false + end + end +end + +if __FILE__ == $PROGRAM_NAME + require "stringio" + line = ENV['TM_CURRENT_LINE'] + caret_placement =ENV['TM_LINE_INDEX'].to_i - 1 + + up = 0 + pat = /"(?:\\.|[^"\\])*"|\[|\]/ + line.scan(pat).each do |item| + case item + when "[" + up+=1 + when "]" + up -=1 + end + end + if caret_placement ==-1 + print "]$0" + e_sn(line[caret_placement+1..-1]) + TextMate.exit_insert_snippet + end + + if up != 0 + print e_sn(line[0..caret_placement])+"]$0"+e_sn(line[caret_placement+1..-1]) + TextMate.exit_insert_snippet + end + + to_parse = StringIO.new(line[0..caret_placement]) + lexer = Lexer.new do |l| + l.add_token(:return, /\breturn\b/) + l.add_token(:nil, /\bnil\b/) + l.add_token(:control, /\b(?:if|while|for|do)(?:\s*)\(/)# /\bif|while|for|do(?:\s*)\(/) + l.add_token(:at_string, /"(?:\\.|[^"\\])*"/) + l.add_token(:selector, /\b[A-Za-z_0-9]+:/) + l.add_token(:identifier, /\b[A-Za-z_0-9]+\b/) + l.add_token(:bind, /(?:->)|\./) + l.add_token(:post_op, /\+\+|\-\-/) + l.add_token(:at, /@/) + l.add_token(:star, /\*/) + l.add_token(:close, /\)|\]|\}/) + l.add_token(:open, /\(|\[|\{/) + l.add_token(:operator, /[&-+\/=%!:\,\?;<>\|\~\^]/) + + l.add_token(:terminator, /;\n*|\n+/) + l.add_token(:whitespace, /\s+/) + l.add_token(:unknown, /./) + + l.input { to_parse.gets } + #l.input {STDIN.read} + end + + offset = 0 + tokenList = [] + A = Struct.new(:tt, :text, :beg) + + lexer.each do |token| + tokenList << A.new(*(token<<offset)) unless [:whitespace,:terminator].include? token[0] + offset +=token[1].length + end + if tokenList.empty? + print e_sn(line[0..caret_placement])+"]$0"+e_sn(line[caret_placement+1..-1]) + TextMate.exit_insert_snippet + end + + par = ObjcParser.new(tokenList) + b, has_message = par.get_position + + if !line[caret_placement+1].nil? && line[caret_placement+1].chr == "]" + if b.nil? || par.list.empty? || par.list[-1].text == "[" + print e_sn(line[0..caret_placement])+"]$0"+e_sn(line[caret_placement+2..-1]) + TextMate.exit_insert_snippet + end + end + + if b.nil? + print e_sn(line[0..caret_placement])+"]$0"+e_sn(line[caret_placement+1..-1]) + elsif !has_message && (b < caret_placement ) + print e_sn(line[0..b-1]) unless b == 0 + ins = (/\s/ =~ line[caret_placement].chr ? "$0]" : " $0]") + print "[" +e_sn(line[b..caret_placement]) + ins +e_sn(line[caret_placement+1..-1]) + elsif b < caret_placement + print e_sn(line[0..b-1]) unless b == 0 + print "[" +e_sn(line[b..caret_placement]) +"]$0"+e_sn(line[caret_placement+1..-1]) + else + print e_sn(line[0..caret_placement])+"]$0"+e_sn(line[caret_placement+1..-1]) + end +end + + fallbackInput + line + input + selection + keyEquivalent + ] + name + Insert Matching Start Bracket + output + insertAsSnippet + scope + source.js.objj + uuid + CD025B3E-36B9-4E16-A81E-8DB6E8466CD1 + + diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Insert [[… alloc] init].tmCommand b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Insert [[… alloc] init].tmCommand new file mode 100644 index 000000000..2b3137e5e --- /dev/null +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Insert [[… alloc] init].tmCommand @@ -0,0 +1,42 @@ + + + + + beforeRunningCommand + nop + command + #!/usr/bin/env ruby + +def e (str); str.gsub(/[$`\\]/, '\\\\\0'); end + +line = STDIN.read +col = ENV['TM_LINE_INDEX'].to_i + +left, right = line[0...col], line[col..-1] + +if left =~ /(.*?)(\[)?(\w+)\s+$/ then + lead, bracket, cl = $1, $2, $3 + right = line[col+1..-1] unless bracket.nil? + print "#{e lead}${1/.+/[/}[[#{e cl} alloc] init$0]" + print right.empty? ? ";" : "#{e right}" +else + # this is only if we were not able to interpret the line + print "#{e left}$0#{e right}" +end + + fallbackInput + line + input + selection + name + Insert [[… alloc] init] + output + insertAsSnippet + scope + source.js.objj + tabTrigger + alloc + uuid + DF55A80D-E733-4CE2-A318-D56789B18406 + + 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 index a85993ae3..c36fb7301 100644 --- 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 @@ -53,8 +53,10 @@ else end input none + keyEquivalent + @R name - Open Document in Running Browser(s) + Run in Browsers output discard scope 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 index 9b85e3197..8de201dcd 100644 --- 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 @@ -37,8 +37,6 @@ ps -xc|grep -sq Camino && osascript -e 'tell app "Camino"' -e 'activate' input none - keyEquivalent - @r name Refresh Running Browser(s) output diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Run.tmCommand b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Run.tmCommand new file mode 100644 index 000000000..ad231d9a0 --- /dev/null +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Run.tmCommand @@ -0,0 +1,60 @@ + + + + + beforeRunningCommand + saveActiveFile + command + +[[ ! -z $TM_OBJJ_MASTER_FILE ]] && INDEXFILE="$TM_OBJJ_MASTER_FILE" + +[[ ! -z $TM_PROJECT_DIRECTORY ]] && INDEXFILE="$TM_PROJECT_DIRECTORY/index.html" + +[[ ! -z $TM_DIRECTORY ]] && INDEXFILE="$TM_DIRECTORY/index.html" + +if [ -z "$INDEXFILE" ]; then + D=`dirname "$TM_FILEPATH"` + while [ -z `find "$D" -name index.html` ]; do + D=`dirname "$D"` + done + INDEXFILE="${D}/index.html" +fi + +[[ -z $INDEXFILE ]] && echo "No start file found. Please set the shell variable 'OBJJ_MASTER_FILE'" && exit 206 + +cat <<-HTML + <script type="text/javascript" charset="utf-8"> + try { + if (TextMate.system("", function (task) { })) { + var __TM_confirm_Status; + alert = function(s){TextMate.system("\"$DIALOG\" -e -p '{messageTitle=\"JavaScript\";informativeText=\""+s.toString().replace(/\x27/g,"’").replace(/\"/g,'\\\"')+"\";}'",null);}; + confirm = function(s){TextMate.system("\"$DIALOG\" -e -p '{messageTitle=\"JavaScript\";informativeText=\""+s.toString().replace(/\x27/g,"’").replace(/\"/g,'\\\"')+"\";buttonTitles=(\"OK\",\"Cancel\");}'",null).onreadoutput=function(s){__TM_confirm_Status = s != 1;};return(__TM_confirm_Status)}; + } + } catch(e) {} + </script> +<base href="file://${INDEXFILE// /%20}"> +HTML +cat "$INDEXFILE" +[[ ! -z $(grep 'objj_exception_setOutputStream' "$INDEXFILE") ]] && exit 205 +cat <<-JS +<script type="text/javascript" charset="utf-8"> +objj_exception_setOutputStream(function(aString) { console.log(aString);alert(aString) }); +</script> +JS + +exit 205 + + input + none + keyEquivalent + @r + name + Run + output + showAsTooltip + scope + source.js.objj + uuid + 0C55A19B-3B2D-418F-B7FD-7E64B736F379 + + diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Show Documentation.tmCommand b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Show Documentation.tmCommand new file mode 100644 index 000000000..7c80f41e4 --- /dev/null +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Show Documentation.tmCommand @@ -0,0 +1,27 @@ + + + + + beforeRunningCommand + nop + command + cat <<-HTM +<body onload='javascript:window.location.href="http://cappuccino.org/learn/documentation/"'> +</body> +HTM +exit 205 + + input + none + keyEquivalent + ^H + name + Show Documentation + output + showAsTooltip + scope + source.js.objj + uuid + 344244D8-67A3-4F23-8270-397BD1696AC4 + + diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Show Obj-J Documentation for Word.tmCommand b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Show Obj-J Documentation for Word.tmCommand new file mode 100644 index 000000000..e639d6888 --- /dev/null +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Show Obj-J Documentation for Word.tmCommand @@ -0,0 +1,214 @@ + + + + + beforeRunningCommand + nop + command + [[ -z $OBJJ_HOME ]] && echo "OBJJ_HOME wasn't set!" && exit 206 +[[ ! -d "$OBJJ_HOME/Documentation" ]] && echo "Please copy the folder ‘Documentation’ to $OBJJ_HOME" && exit 206 + +function showUpClassPage { +cat <<-HTM +<body onload='javascript:window.location.href="tm-file://$OBJJ_HOME/Documentation/class$1"'> +</body> +HTM +exit 205 +} + +function showUpPage { +cat <<-HTM +<body onload='javascript:window.location.href="tm-file://$1"'> +</body> +HTM +exit 205 +} + + +DOCHEAD=$(perl -e ' + #$line_nr = defined($ENV{"TM_INPUT_START_LINE"}) ? $ENV{"TM_INPUT_START_LINE"} : 1; + $line_nr = 1; + $cur_line_nr = $ENV{"TM_LINE_NUMBER"}; + $header = ""; + while($cur_line_nr-->$line_nr) {$header.=<>;} + $tail = <>; + $header .= substr($tail,0,$ENV{"TM_LINE_INDEX"}); + print $header; +') + +# caret is inside of a class name +if [ `echo $TM_SCOPE | grep -c 'support.class.cappuccino'` -gt 0 ]; then + n=$(echo $TM_CURRENT_WORD | perl -pe 's/(.)(.)(.*)/_$1_$2_$3/;s/(?<!_)([A-Z])(?!_)/_$1/g;s/_{2,}/_/g') + showUpClassPage "$n.html" +fi + +# caret is inside of a foundation class name +if [ `echo $TM_SCOPE | grep -c 'support.variable.cappuccino.foundation'` -gt 0 ]; then + [[ "$TM_CURRENT_WORD" == "CPApp" ]] && showUpClassPage "_C_P_Application.html" +fi + +# caret is inside of a objj function +if [ `echo $TM_SCOPE | grep -c 'support.function.cappuccino'` -gt 0 ]; then + FILE=$(ruby -e ' + require File.join(ENV["TM_SUPPORT_PATH"], "lib/ui.rb") + require File.join(ENV["TM_SUPPORT_PATH"], "lib/exit_codes.rb") + cur_word = "" + cur_word << ENV["TM_CURRENT_WORD"] + cur_word.sub!("CG", "C[GP]") if cur_word[0..1] == "CG" or cur_word[0..1] == "CP" + lg = %x{egrep -rl "C[GP]RectMake" '$OBJJ_HOME/Documentation'} + urls = lg.split(/\n/).sort + if urls.length == 1 + print urls.first + else + display = urls.map{|x| x.split("/").last.sub!(".html","")} + index=TextMate::UI.menu(display) + if index != nil + print urls[index] + else + TextMate.exit_discard() + end + end + ') + FUNC=$(echo -en $TM_CURRENT_WORD | perl -pe 's/^(C[PG])(.*)/C[PG]$2/') + ANKER=`cat "$FILE" | egrep -o "\"#$FUNC.*?\"" | sed -e 's/^"//;s/".*//' | head -n 1` + [[ ! -z "$ANKER" ]] && showUpPage "$FILE$ANKER" + [[ ! -z $FILE ]] && showUpPage "$FILE" && exit 206 +fi + +# caret is inside of a constant +if [ `echo $TM_SCOPE | grep -c 'support.constant.cappuccino'` -gt 0 ]; then + FILE=$(ruby -e ' + require File.join(ENV["TM_SUPPORT_PATH"], "lib/ui.rb") + require File.join(ENV["TM_SUPPORT_PATH"], "lib/exit_codes.rb") + lg = %x{egrep -rl #{ENV["TM_CURRENT_WORD"]} '$OBJJ_HOME/Documentation'} + urls = lg.split(/\n/).sort + if urls.length == 1 + print urls.first + else + display = urls.map{|x| x.split("/").last.sub!(".html","")} + index=TextMate::UI.menu(display) + if index != nil + print urls[index] + else + TextMate.exit_discard() + end + end + ') + [[ ! -z $FILE ]] && showUpPage "$FILE" && exit 206 +fi + +# caret is inside of [method] +if [ `echo $TM_SCOPE | grep -c 'meta.bracketed.js.objj'` -gt 0 ]; then + # find [] + DECL=$(echo -en "$DOCHEAD" | perl -e ' + undef $/; + $header = <>; + $header=~s/\n/ /g; + @arr=split(//,$header);$c=0; + for($i=$#arr;$i>-1;$i--){$c-- if($arr[$i] eq "]");$c++ if($arr[$i] eq "[");last if $c>0;} + if($i==-1) { + print ""; + } else { + print substr($header,$i+1); + } + ') + + # find the class for a method + CLASS=$(echo -en "$DECL" | perl -e ' + undef $/; + $header = <>; + substr($header,0) =~ m/^\s*(\w+).*/; + $f = $1; + if (defined($f)) { + if($f=~m/CPApp/) { + print "CPApplication"; + } else { + print $f; + } + } else { + substr($header,1) =~ m/^\s*(\w+).*/; + $f = $1; + if(defined($f)) { + if($f=~m/CPApp/) { + print "CPApplication"; + } else { + print $f; + } + } + } + ') + if [ ! -e "$OBJJ_HOME/Documentation/classes/$CLASS.html" ]; then + CLASS=$(echo -en "$DOCHEAD" | ruby -e ' + require File.join(ENV["TM_SUPPORT_PATH"], "lib/ui.rb") + require File.join(ENV["TM_SUPPORT_PATH"], "lib/exit_codes.rb") + known_classes = [] + classes = [] + lg = %x{cd '$OBJJ_HOME/Documentation/classes'; egrep -rl #{ENV["TM_CURRENT_WORD"]} .} + known_classes = lg.split(/\n/).map{|x| x.sub("\.html","").sub("./","") }.sort + if known_classes.empty? + lg = %x{ls '$OBJJ_HOME/Documentation/classes'} + known_classes = lg.split(/\n/).map{|x| x.sub("\.html","").sub("./","") }.sort + end + STDIN.read().scan(/\b[_]{0,2}[NC][APS]\w+(?=[^\.])\b/) {|c| classes << c if ! classes.include?(c) && known_classes.include?(c)} + classes.sort! + if classes != known_classes + classes << "--" + classes += known_classes + end + if classes.length == 1 + if classes.first != "--" + print classes.first + else + TextMate.exit_discard() + end + else + index=TextMate::UI.menu(classes) + if index != nil + print classes[index] + else + TextMate.exit_discard() + end + end + ') + fi + [[ -z $CLASS ]] && exit 200 + [[ ! -e "$OBJJ_HOME/Documentation/classes/$CLASS.html" ]] && echo "Nothing for '$CLASS'!" && exit 206 + # tries to find only the first method for 'method1: method2: etc' + FIRSTMETHOD=$(echo -en "$DECL" | perl -e ' + undef $/;$d = <>; + $d=~m/\s*(\w+):/m; + print $1; + ') + METHOD=${FIRSTMETHOD:-$TM_CURRENT_WORD} + + # find the correct anker within CLASS.html + ANKER=`cat "$OBJJ_HOME/Documentation/classes/$CLASS.html" | egrep -o "\"#$METHOD.*?\"" | sed -e 's/^"//;s/".*//' | head -n 1` + [[ ! -z "$ANKER" ]] && showUpClassPage "$CLASS.html$ANKER" + + # check for inherited methods + ANKER=`cat "$OBJJ_HOME/Documentation/classes/$CLASS.html" | egrep -o "[^#\"]+?html#$METHOD" | head -n 1` +# echo $CLASS; echo $METHOD; echo $ANKER; exit 206 + + CLASS=$(echo -en "$ANKER" | perl -pe 's/(.*?)\.html.*/$1/;') + # find the correct anker within the new CLASS.html + ANKER=`cat "$OBJJ_HOME/Documentation/classes/$CLASS.html" | egrep -o "\"#$METHOD.*?\"" | sed -e 's/^"//;s/".*//' | head -n 1` + [[ ! -z "$ANKER" ]] && showUpClassPage "$CLASS.html$ANKER" + # [[ ! -z "$ANKER" ]] && showUpClassPage "$ANKER" + +fi + +exit 205 + input + selection + keyEquivalent + ^h + name + Documentation for Word + output + replaceSelectedText + scope + support.class.cappuccino, support.variable.cappuccino.foundation, meta.bracketed.js.objj, support.function.cappuccino + uuid + 2D05A28A-2ED7-4A9A-9A5C-8625466BC77C + + diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Preferences/Symbol List: Method.tmPreferences b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Preferences/Symbol List: Method.tmPreferences index d8722d73d..5a9a01fda 100644 --- a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Preferences/Symbol List: Method.tmPreferences +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Preferences/Symbol List: Method.tmPreferences @@ -1,5 +1,5 @@ - + name @@ -18,6 +18,6 @@ uuid - 85A46AFC-5552-4CE5-BDA0-ED34F0398399 + E65A721C-192D-4BCC-AD35-5ED5CB0DA5BE diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/@selector(…).tmSnippet b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/@selector(…).tmSnippet new file mode 100644 index 000000000..71e84bbe0 --- /dev/null +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/@selector(…).tmSnippet @@ -0,0 +1,16 @@ + + + + + content + @selector(${1:method}:) + name + @selector(…) + scope + source.js.objj + tabTrigger + sel + uuid + 13D9F280-A78F-4A4C-BE99-0DE13235738D + + diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/Accessors.tmSnippet b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/Accessors.tmSnippet index 428214f6b..af1db66ff 100644 --- a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/Accessors.tmSnippet +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/Accessors.tmSnippet @@ -1,5 +1,5 @@ - + content diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/Archiving.tmSnippet b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/Archiving.tmSnippet new file mode 100644 index 000000000..d54419fb4 --- /dev/null +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/Archiving.tmSnippet @@ -0,0 +1,31 @@ + + + + + content + @implementation ${1:CLASS} (CPCoding) + +- (id)initWithCoder:(CPCoder)aCoder +{ + if (self = [super initWithCoder:aCoder]) + { + ${2:IVAR} = [aCoder decodeObjectForKey:${3:KEY}]; + } + return self; +} + +- (void)encodeWithCoder:(CPCoder)aCoder +{ + [super encodeWithCoder:aCoder]; + + [aCoder encodeObject:${2:IVAR} forKey:${3:KEY}]; +} + +@end + + name + Archiving + uuid + A840A98A-0C5B-49CB-8235-2CCD1BF7AFC1 + + diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/CPLog(…).tmSnippet b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/CPLog(…).tmSnippet new file mode 100644 index 000000000..29cfad4db --- /dev/null +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/CPLog(…).tmSnippet @@ -0,0 +1,16 @@ + + + + + content + CPLog("$1"${1/[^%]*(%)?.*/(?1:, :\);)/}$2${1/[^%]*(%)?.*/(?1:\);)/} + name + CPLog(…) + scope + source.js.objj + tabTrigger + log + uuid + C268A928-5C8E-4284-9BAB-4FDFB07B983A + + diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/Category.tmSnippet b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/Category.tmSnippet new file mode 100644 index 000000000..a85cfcf16 --- /dev/null +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/Category.tmSnippet @@ -0,0 +1,21 @@ + + + + + content + @interface ${1:NSObject} (${2:Category}) +@end + +@implementation ${1:NSObject} (${2:Category}) +$0 +@end + name + Category + scope + source.js.objj + tabTrigger + cat + uuid + 8C001067-8A50-4BAB-9A88-BA957A84E8CF + + diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/Class.tmSnippet b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/Class.tmSnippet index d2adc60a5..4877a2ca8 100644 --- a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/Class.tmSnippet +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/Class.tmSnippet @@ -22,7 +22,7 @@ scope source.js.objj tabTrigger - cla + objj uuid 96C39647-4346-4750-9F96-58070F24EDE6 diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/Delegate Responds to Selector.tmSnippet b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/Delegate Responds to Selector.tmSnippet new file mode 100644 index 000000000..6cebd060f --- /dev/null +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/Delegate Responds to Selector.tmSnippet @@ -0,0 +1,18 @@ + + + + + content + if([${1:[self delegate]} respondsToSelector:@selector(${2:selfDidSomething:})]) + [$1 ${3:${2/((^\s*([A-Za-z0-9_]*:)\s*)|(:\s*$)|(:\s*))/(?2:$2self :\:<>)(?4::)(?5: :)/g}}]; + + name + Delegate Responds to Selector + scope + source.js.objj + tabTrigger + delegate + uuid + 3B5B858C-645E-499C-813B-BBEEED943E9B + + diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/Delegate.tmSnippet b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/Delegate.tmSnippet new file mode 100644 index 000000000..e897bfe8e --- /dev/null +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/Delegate.tmSnippet @@ -0,0 +1,24 @@ + + + + + content + - (id)delegate +{ + return $1; +} + +- (void)setDelegate:(id)aDelegate +{ + ${1:delegate} = aDelegate; +} + name + Delegate + scope + source.js.objj + tabTrigger + delacc + uuid + 0B3D4C4C-7D75-49E6-9CEC-E4BF4069223A + + diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/New CPTextField.tmSnippet b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/New CPTextField.tmSnippet new file mode 100644 index 000000000..e6c258d1d --- /dev/null +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/New CPTextField.tmSnippet @@ -0,0 +1,21 @@ + + + + + content + ${1:name} = [[CPTextField alloc] initWithFrame:CGRectMakeZero()]; +[$1 setStringValue:${2:@"${3:string}"}]; +${4:[$1 setEditable:${5:YES}]; +}${6:[$1 setFont:[CPFont systemFontOfSize:${7:12.0}]]; +}${8:[$1 sizeToFit]; +}${0:} + name + New CPTextField + scope + source.js.objj + tabTrigger + textf + uuid + C7340B17-F9EC-403F-9781-E2487023ED01 + + diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/Responds to Selector.tmSnippet b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/Responds to Selector.tmSnippet new file mode 100644 index 000000000..0adcd9e64 --- /dev/null +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/Responds to Selector.tmSnippet @@ -0,0 +1,20 @@ + + + + + content + ${TM_COMMENT_START} ${4:Send $2 to $1, if $1 supports it}${TM_COMMENT_END} +if ([${1:self} respondsToSelector:@selector(${2:someSelector:})]) +{ + [$1 ${3:${2/((:\s*$)|(:\s*))/:<>(?3: )/g}}]; +} + name + Responds to Selector + scope + source.js.objj + tabTrigger + responds + uuid + D79EC699-9839-406E-AF60-DE51F78153CB + + diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/_Accessors.tmSnippet b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/_Accessors.tmSnippet index 55665bd64..424a7c2e8 100644 --- a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/_Accessors.tmSnippet +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/_Accessors.tmSnippet @@ -1,5 +1,5 @@ - + content diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/import <…>.tmSnippet b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/import <…>.tmSnippet new file mode 100644 index 000000000..6ebc31bc9 --- /dev/null +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/import <…>.tmSnippet @@ -0,0 +1,17 @@ + + + + + content + @import <${1:`"$DIALOG" -u -p "{menuItems=({title=Foundation;},{title=AppKit;});}" | perl -e 'undef $/;$a=<>;$a=~m/<key>title(.|\n)+?<string>(.*?)</;print $2;'`}/${2:CP}$3.j> + + name + import <…> + scope + source.js.objj + tabTrigger + Imp + uuid + BE0553C0-B73B-4160-814C-840FC2B84C32 + + diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/import … (with File Menu).tmSnippet b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/import … (with File Menu).tmSnippet new file mode 100644 index 000000000..3e6738852 --- /dev/null +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/import … (with File Menu).tmSnippet @@ -0,0 +1,17 @@ + + + + + content + @import "${1:`"$TM_BUNDLE_SUPPORT/bin/import_FileMenu.sh" ".j"`}" + + name + import "…" (with File Menu) + scope + source.js.objj + tabTrigger + impp + uuid + 9BABD784-3DBE-4DA3-8A70-4E32FC7FDBB8 + + diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/import ….tmSnippet b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/import ….tmSnippet new file mode 100644 index 000000000..f06d97c36 --- /dev/null +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Snippets/import ….tmSnippet @@ -0,0 +1,17 @@ + + + + + content + @import "${1:}" + + name + import "…" + scope + source.js.objj + tabTrigger + imp + uuid + 686B995F-3183-418B-A15F-CA517DFEFE2E + + diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Support/bin/import_FileMenu.sh b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Support/bin/import_FileMenu.sh new file mode 100755 index 000000000..298e062a9 --- /dev/null +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Support/bin/import_FileMenu.sh @@ -0,0 +1,36 @@ +EXTENSION="$1" + +CURRENTDIR=`dirname $TM_FILEPATH` + +if [ -z $TM_PROJECT_DIRECTORY ]; then + + L=$((${#CURRENTDIR}+1)) + + MENUITEMS=$(find -s "$CURRENTDIR" -name "*$EXTENSION" | perl -pe "s/^.{$L}(.*?)$/{title=\"\$1\";}/" | paste -sd ',' -) + [[ -z $MENUITEMS ]] && exit 200 + "$DIALOG" -u -p "{menuItems=($MENUITEMS);}" | perl -e 'undef $/;$a=<>;$a=~m/title(.|\n)+?(.*?);$a=~m/title(.|\n)+?(.*?)Any feedback about bugs or improvements is highly welcomed! + +# Introduction + +Cappuccino cappuccino.org is an open source framework that makes it easy to build desktop-caliber applications that run in a web browser. + +# Commands + +## Run + +Run the current cappuccino web application in TextMate's HTML output window. + +If you are inside of an Objective-J file (file extension .j) this command will look for a file `index.html` starting at the current folder and upwards within the file hierarchy or if you are working with a project it will look for it at the project's root path. + +If the start HTML site differs you can set the shell variable `TM_OBJJ_MASTER_FILE` within a project. + +## Run in Browser + +Run the current cappuccino web application in the default web browser. + +If you are inside of an Objective-J file (file extension .j) this command will look for a file `index.html` starting at the current folder and upwards within the file hierarchy or if you are working with a project it will look for it at the project's root path. + +If the start HTML site differs you can set the shell variable `TM_OBJJ_MASTER_FILE` within a project. + +# Shell Variables # + +## TM_OBJJ_MASTER_FILE ## + +This variable contains the path to the application's start HTML site. + + +# Main Bundle Maintainer + +***Date: Sep 7 2009*** + +
+-  Tom Robinson tom@280north.com
+-  Hans-Jörg Bibiko  bibiko@eva.mpg.de
+
+ diff --git a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/info.plist b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/info.plist index b7c519f74..b2d7b4cab 100644 --- a/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/info.plist +++ b/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/info.plist @@ -6,33 +6,135 @@ gbz@280abegu.pbz contactName Tom Robinson + deleted + + 4689ADD7-C88A-4235-B69A-84C720034296 + 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 + excludedItems + + CD025B3E-36B9-4E16-A81E-8DB6E8466CD1 + 2D05A28A-2ED7-4A9A-9A5C-8625466BC77C + items - 96C39647-4346-4750-9F96-58070F24EDE6 - AA41BEF8-5F81-4A5A-85DE-2E81A112778B - 85B0746B-AE1C-47B3-8B9A-2B9A95F4C71E - ------------------------------------ + 0C55A19B-3B2D-418F-B7FD-7E64B736F379 36FD3695-1051-401E-8536-89FB9CEEEAB4 033BC36A-97DA-4F48-9ACB-B58C80D1A689 + ------------------------------------ + ------------------------------------ + AF27A8B3-C87F-410A-915B-D83271FDDC00 + 344244D8-67A3-4F23-8270-397BD1696AC4 + ------------------------------------ + 9BC0151E-82E8-4F2C-8AC1-7D4E6EC8FC80 + 3ABE883F-3236-4876-91E0-E899F5DE9B29 + B226514A-4024-49EA-B4BD-4307C72F7EE3 + A4BB7CC7-B06B-4034-B125-A646A22C0813 + 94B213AC-4DB1-400F-B78A-8FBCF3F93E44 + 28C6F02F-13D0-4B5B-AB6A-6F23E2CFBD5B + ------------------------------------ submenus - + + 28C6F02F-13D0-4B5B-AB6A-6F23E2CFBD5B + + items + + C7340B17-F9EC-403F-9781-E2487023ED01 + + name + UI + + 3ABE883F-3236-4876-91E0-E899F5DE9B29 + + items + + AA41BEF8-5F81-4A5A-85DE-2E81A112778B + 85B0746B-AE1C-47B3-8B9A-2B9A95F4C71E + 0B3D4C4C-7D75-49E6-9CEC-E4BF4069223A + + name + Accessor Methods For + + 94B213AC-4DB1-400F-B78A-8FBCF3F93E44 + + items + + 13D9F280-A78F-4A4C-BE99-0DE13235738D + DF55A80D-E733-4CE2-A318-D56789B18406 + + name + Misc + + 9BC0151E-82E8-4F2C-8AC1-7D4E6EC8FC80 + + items + + BE0553C0-B73B-4160-814C-840FC2B84C32 + 686B995F-3183-418B-A15F-CA517DFEFE2E + 9BABD784-3DBE-4DA3-8A70-4E32FC7FDBB8 + ------------------------------------ + 96C39647-4346-4750-9F96-58070F24EDE6 + 8C001067-8A50-4BAB-9A88-BA957A84E8CF + A840A98A-0C5B-49CB-8235-2CCD1BF7AFC1 + + name + Language Boilerplate + + A4BB7CC7-B06B-4034-B125-A646A22C0813 + + items + + D79EC699-9839-406E-AF60-DE51F78153CB + 3B5B858C-645E-499C-813B-BBEEED943E9B + + name + Idioms + + B226514A-4024-49EA-B4BD-4307C72F7EE3 + + items + + C268A928-5C8E-4284-9BAB-4FDFB07B983A + F220FEE6-6522-4281-8091-CF8C66AED44F + + name + Common Method Calls + + 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 + 0C55A19B-3B2D-418F-B7FD-7E64B736F379 36FD3695-1051-401E-8536-89FB9CEEEAB4 033BC36A-97DA-4F48-9ACB-B58C80D1A689 + AF27A8B3-C87F-410A-915B-D83271FDDC00 + 344244D8-67A3-4F23-8270-397BD1696AC4 + 2D05A28A-2ED7-4A9A-9A5C-8625466BC77C + BE0553C0-B73B-4160-814C-840FC2B84C32 + 686B995F-3183-418B-A15F-CA517DFEFE2E + 9BABD784-3DBE-4DA3-8A70-4E32FC7FDBB8 + 96C39647-4346-4750-9F96-58070F24EDE6 + 8C001067-8A50-4BAB-9A88-BA957A84E8CF + AA41BEF8-5F81-4A5A-85DE-2E81A112778B + 85B0746B-AE1C-47B3-8B9A-2B9A95F4C71E + 0B3D4C4C-7D75-49E6-9CEC-E4BF4069223A + A840A98A-0C5B-49CB-8235-2CCD1BF7AFC1 + C268A928-5C8E-4284-9BAB-4FDFB07B983A + F220FEE6-6522-4281-8091-CF8C66AED44F + D79EC699-9839-406E-AF60-DE51F78153CB + 3B5B858C-645E-499C-813B-BBEEED943E9B + C7340B17-F9EC-403F-9781-E2487023ED01 + 13D9F280-A78F-4A4C-BE99-0DE13235738D + CD025B3E-36B9-4E16-A81E-8DB6E8466CD1 + DF55A80D-E733-4CE2-A318-D56789B18406 + 58D4B98A-2110-423E-9C80-CC9E202816E7 + E65A721C-192D-4BCC-AD35-5ED5CB0DA5BE uuid 1FB3D538-84E1-4002-AA46-5705529A27E1