Created
May 26, 2012 19:32
-
-
Save kattrali/2795060 to your computer and use it in GitHub Desktop.
redcar/plugins/edit_view_swt/lib/edit_view_swt.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#how grammar is set | |
def update_grammar(new_mirror) | |
title = new_mirror.title | |
contents = new_mirror.read | |
first_line = contents.to_s.split("\n").first | |
# @mate_text is a MateText object (see javamateview project) | |
grammar_name = @mate_text.set_grammar_by_first_line(first_line) if first_line | |
unless grammar_name | |
grammar_name = @mate_text.set_grammar_by_filename(title) | |
end | |
grammar_name ||= "Plain Text" | |
@model.set_grammar(grammar_name) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yay Ruby!!