Sha256: 7d56bbe059e84a2bac00e7d43a41f61a6ffa036823bada92b230c7c678810fd9

Contents?: true

Size: 1.76 KB

Versions: 8

Compression:

Stored size: 1.76 KB

Contents

require "outline_view/commands"

module Redcar
  class OutlineView
    
    def self.menus
      Menu::Builder.build do
        sub_menu "View" do
          item "Current Document Outline", :command => OutlineView::OpenOutlineViewCommand, :priority => :first
        end
      end
    end
    
    def self.keymaps
      linwin = Keymap.build("main", [:linux, :windows]) do
        link "Ctrl+I", OutlineView::OpenOutlineViewCommand
      end
      osx = Keymap.build("main", [:osx]) do
        link "Cmd+I", OutlineView::OpenOutlineViewCommand
      end
      [linwin, osx]
    end
    
    class OutlineViewDialog < FilterListDialog
      include Redcar::Model
      include Redcar::Observable
      
      attr_accessor :document
      attr_accessor :last_list
      
      def initialize(document)
        self.controller = Redcar::OutlineViewSWT.new(self)
        @document = document
        @last_list = {}
      end
      
      def close
        super
      end
      
      def update_list(filter)
        file = Declarations::File.new(@document.path)
        file.add_tags_for_paths([@document.path])
        re = make_regex(filter)
        @last_list.clear
        result = {}
        file.tags.each do |name, _, match|
          if name =~ re
            @last_list[match] = name
            result[match] = {:name => name, :kind => Declarations.match_kind(@document.path, match)}
          end
        end
        result
      end
      
      def selected(match, closing=true)
        if @last_list
          Redcar.app.navigation_history.save(@document)
          DocumentSearch::FindNextRegex.new(Regexp.new(Regexp.quote(match)), true).run_in_focussed_tab_edit_view
          Redcar.app.navigation_history.save(@document)
          close if closing
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
redcar-dev-0.12.19dev plugins/outline_view/lib/outline_view.rb
redcar-dev-0.12.18dev plugins/outline_view/lib/outline_view.rb
redcar-dev-0.12.17dev plugins/outline_view/lib/outline_view.rb
redcar-dev-0.12.16dev-java plugins/outline_view/lib/outline_view.rb
redcar-dev-0.12.15dev-java plugins/outline_view/lib/outline_view.rb
redcar-dev-0.12.14dev-java plugins/outline_view/lib/outline_view.rb
redcar-dev-0.12.13dev-java plugins/outline_view/lib/outline_view.rb
redcar-dev-0.12.12dev-java plugins/outline_view/lib/outline_view.rb