line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Goo::JumpManager; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
############################################################################### |
4
|
|
|
|
|
|
|
# Nigel Hamilton |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Copyright Nigel Hamilton 2005 |
7
|
|
|
|
|
|
|
# All Rights Reserved |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# Author: Nigel Hamilton |
10
|
|
|
|
|
|
|
# Filename: Goo::JumpManager.pm |
11
|
|
|
|
|
|
|
# Description: Jumping to a specific line in the program |
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
# Date Change |
14
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
15
|
|
|
|
|
|
|
# 11/03/2005 Auto generated file |
16
|
|
|
|
|
|
|
# 11/03/2005 Needed to jump quickly between things jumps to the method |
17
|
|
|
|
|
|
|
# definition <<< jumps to a list of callers() for the current method |
18
|
|
|
|
|
|
|
# Include a ThereDoc ... to jump to there! |
19
|
|
|
|
|
|
|
# 03/08/2005 Added simple line number jumping and index jumping |
20
|
|
|
|
|
|
|
# 12/08/2005 Added method: startThis |
21
|
|
|
|
|
|
|
# 13/08/2005 Added ability to jump to a line number or string |
22
|
|
|
|
|
|
|
# |
23
|
|
|
|
|
|
|
############################################################################### |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
4762
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
1
|
|
7
|
use Goo::Object; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
22
|
|
28
|
1
|
|
|
1
|
|
8
|
use Goo::Loader; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
22
|
|
29
|
1
|
|
|
1
|
|
7
|
use Goo::Prompter; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
30
|
1
|
|
|
1
|
|
7
|
use Goo::TypeManager; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
31
|
1
|
|
|
1
|
|
561
|
use Goo::TextUtilities; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
39
|
|
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
1
|
|
8
|
use base qw(Goo::Object); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
401
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
############################################################################### |
36
|
|
|
|
|
|
|
# |
37
|
|
|
|
|
|
|
# jump_to_thing - do the jump to another thing |
38
|
|
|
|
|
|
|
# |
39
|
|
|
|
|
|
|
############################################################################### |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub jump_to_thing { |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
0
|
1
|
|
my ($this, $target) = @_; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
my $new_thing; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
foreach my $type (Goo::TypeManager::get_all_types()) { |
48
|
|
|
|
|
|
|
|
49
|
0
|
0
|
|
|
|
|
if ($target =~ /\.$type$/) { |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# load a new Thing! |
52
|
0
|
|
|
|
|
|
$new_thing = Goo::Loader::load($target); |
53
|
0
|
|
|
|
|
|
last; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
0
|
0
|
|
|
|
|
if ($new_thing) { |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# jump to the profile of this new thing |
60
|
0
|
|
|
|
|
|
$new_thing->do_action("P"); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} else { |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
Goo::Prompter::notify("No Thing matches $target. Press a key."); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
############################################################################### |
71
|
|
|
|
|
|
|
# |
72
|
|
|
|
|
|
|
# run - do the jump! |
73
|
|
|
|
|
|
|
# |
74
|
|
|
|
|
|
|
############################################################################### |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub run { |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
0
|
1
|
|
my ($this, $thing, $option) = @_; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# if the target is already set the user has selected a menu option, used the |
81
|
|
|
|
|
|
|
# command line, or inserted a HERE or THEREDOC |
82
|
0
|
0
|
|
|
|
|
unless ($option) { |
83
|
0
|
|
|
|
|
|
$option = Goo::Prompter::ask("Jump to line number, string or another Thing?"); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
my $line_number; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# is it a number? |
89
|
0
|
0
|
|
|
|
|
if ($option =~ /^\d+$/) { |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# a jump to a line number in the current thing! |
92
|
|
|
|
|
|
|
# go edit it |
93
|
0
|
|
|
|
|
|
$line_number = $option; |
94
|
0
|
|
|
|
|
|
$thing->do_action("E", $line_number); |
95
|
0
|
|
|
|
|
|
return; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
0
|
0
|
|
|
|
|
if ($option =~ /\./) { |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
# could be a new "Thing" |
101
|
0
|
|
|
|
|
|
$this->jump_to_thing($option); |
102
|
0
|
|
|
|
|
|
return; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
# is it word? |
107
|
0
|
0
|
|
|
|
|
if ($option =~ /\w+/) { |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
# do a regex match on the file and return the matching line number |
110
|
0
|
|
|
|
|
|
$line_number = Goo::TextUtilities::get_matching_line_number($option, $thing->get_file()); |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
# jump there! |
113
|
0
|
|
|
|
|
|
$thing->do_action("E", $line_number); |
114
|
0
|
|
|
|
|
|
return; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
1; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
__END__ |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 NAME |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Goo::JumpManager - Jump to a specific line, string or another Thing |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 SYNOPSIS |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
use Goo::JumpManager; |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 DESCRIPTION |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Top level action handler for jumping to a line number, string or another Thing (i.e., [J]ump). |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 METHODS |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=over |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=item jump_to_thing |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
do the jump to another thing |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item run |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
handle the jump action |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=back |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 AUTHOR |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Nigel Hamilton <nigel@trexy.com> |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 SEE ALSO |
155
|
|
|
|
|
|
|
|