Sha256: 41b7800ce0e6bb857233e6c702b344cc67796b3e90a5b7166825f3b97f8e8de9

Contents?: true

Size: 1.16 KB

Versions: 53

Compression:

Stored size: 1.16 KB

Contents

module Redcar
  class Declarations
    class SelectTagDialog < FilterListDialog

      def initialize(matches)
        super()
        @matches = matches
      end

      def close
        super
      end

      def update_list(filter)
        @last_list    = @matches
        filtered_list = @matches
        if filter.length >= 1
          filtered_list = filter_and_rank_by(filtered_list, filter, filtered_list.length) do |match|
            match[:file].split(::File::SEPARATOR).last
          end
          @last_list = filtered_list
        end
        align_matches_for_display(filtered_list)
      end

      def selected(text, ix, closing=false)
        if @last_list
          close
          Redcar::Declarations.go_to_definition(@last_list[ix])
        end
      end

      private

      def align_matches_for_display(filtered_list)
        filtered_list.collect do |match|
          file_path     = match[:file]
          file          = file_path.split(::File::SEPARATOR).last
          relative_path = file_path.gsub(Regexp.compile(Project::Manager.focussed_project.path + '/'), '')
          "%s (%s)" % [file, relative_path]
        end
      end
    end
  end
end

Version data entries

53 entries across 53 versions & 2 rubygems

Version Path
redcar-0.13 plugins/declarations/lib/declarations/select_tag_dialog.rb
redcar-dev-0.13.5dev plugins/declarations/lib/declarations/select_tag_dialog.rb
redcar-dev-0.13.4dev plugins/declarations/lib/declarations/select_tag_dialog.rb
redcar-dev-0.13.3dev plugins/declarations/lib/declarations/select_tag_dialog.rb
redcar-dev-0.13.2dev plugins/declarations/lib/declarations/select_tag_dialog.rb
redcar-dev-0.13.1dev plugins/declarations/lib/declarations/select_tag_dialog.rb
redcar-0.12.1 plugins/declarations/lib/declarations/select_tag_dialog.rb
redcar-dev-0.13.0dev plugins/declarations/lib/declarations/select_tag_dialog.rb
redcar-0.12 plugins/declarations/lib/declarations/select_tag_dialog.rb
redcar-dev-0.12.27dev plugins/declarations/lib/declarations/select_tag_dialog.rb
redcar-dev-0.12.26dev plugins/declarations/lib/declarations/select_tag_dialog.rb
redcar-dev-0.12.25dev plugins/declarations/lib/declarations/select_tag_dialog.rb
redcar-dev-0.12.24dev plugins/declarations/lib/declarations/select_tag_dialog.rb
redcar-dev-0.12.23dev plugins/declarations/lib/declarations/select_tag_dialog.rb
redcar-dev-0.12.22dev plugins/declarations/lib/declarations/select_tag_dialog.rb
redcar-dev-0.12.21dev plugins/declarations/lib/declarations/select_tag_dialog.rb
redcar-dev-0.12.20dev plugins/declarations/lib/declarations/select_tag_dialog.rb
redcar-dev-0.12.19dev plugins/declarations/lib/declarations/select_tag_dialog.rb
redcar-dev-0.12.18dev plugins/declarations/lib/declarations/select_tag_dialog.rb
redcar-dev-0.12.17dev plugins/declarations/lib/declarations/select_tag_dialog.rb