Sha256: 25fea29174379f4bb5dac9021b6f67688d1c7ea0d3017cf041a6adda8f6ea1fe

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 KB

Contents

require "java-mateview-#{Redcar::VERSION}"

module JavaMateView
  import com.redcareditor.mate.Bundle
  import com.redcareditor.mate.Grammar
  import com.redcareditor.mate.MateText
  import com.redcareditor.mate.Parser
  import com.redcareditor.mate.ParserScheduler
  import com.redcareditor.mate.Pattern
  import com.redcareditor.mate.Scope
  import com.redcareditor.mate.ScopeMatcher
  import com.redcareditor.theme.Theme
  import com.redcareditor.theme.ThemeManager
  
  class MateText
    def set_root_scope_by_content_name(grammar_name, name)
      scope = JavaMateView::Scope.new(self, "re")
      bs = JavaMateView::Bundle.bundles
      ruby = bs.detect {|b| b.name == grammar_name}
      ps = ruby.grammars.first.patterns
      dps = ps.select {|pt| pt.is_a?(Java::ComRedcareditorMate::DoublePattern) }  
      rps = dps.detect {|pt| pt.contentName == name }
      scope.pattern = rps
      scope.isOpen = true
      self.parser.root = scope
    end
    
    def delay_parsing
      parser.parserScheduler.deactivate
      yield
      parser.parserScheduler.reactivate
    end
  end
end

 

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
redcar-0.5.1 plugins/edit_view_swt/vendor/java-mateview.rb
redcar-0.5 plugins/edit_view_swt/vendor/java-mateview.rb
redcar-0.5.6dev plugins/edit_view_swt/vendor/java-mateview.rb