Sha256: 7994030b517cc47c5d179e854f3c0e31362dffebb7e3427a4e13b1913d6cb209

Contents?: true

Size: 1.07 KB

Versions: 5

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

5 entries across 5 versions & 1 rubygems

Version Path
redcar-0.5.5dev plugins/edit_view_swt/vendor/java-mateview.rb
redcar-0.5.4dev plugins/edit_view_swt/vendor/java-mateview.rb
redcar-0.5.3dev plugins/edit_view_swt/vendor/java-mateview.rb
redcar-0.5.2dev plugins/edit_view_swt/vendor/java-mateview.rb
redcar-0.5.1dev plugins/edit_view_swt/vendor/java-mateview.rb