Method deprecated or moved
This method is deprecated or moved on the latest stable version.
The last existing version (v1_9_2_180) is shown here.
ask_for_find_term(search = nil)
public
Ask for a find term to search for in the tree. Returns the term as a
string.
Show source
def ask_for_find_term(search = nil)
dialog = Dialog.new(
"Find a node matching regex in tree.",
nil, nil,
[ Stock::OK, Dialog::RESPONSE_ACCEPT ],
[ Stock::CANCEL, Dialog::RESPONSE_REJECT ]
)
hbox = HBox.new(false, 5)
hbox.pack_start(Label.new("Regex:"), false)
hbox.pack_start(regex_input = Entry.new)
hbox.pack_start(icase_checkbox = CheckButton.new('Icase'), false)
regex_input.width_chars = 60
if search
regex_input.text = search.source
icase_checkbox.active = search.casefold?
end
dialog.vbox.pack_start(hbox, false)
dialog.signal_connect(:'key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER)
dialog.show_all
self.focus = dialog
dialog.run do |response|
if response == Dialog::RESPONSE_ACCEPT
begin
return Regexp.new(regex_input.text, icase_checkbox.active? ? Regexp::IGNORECASE : 0)
rescue => e
Editor.error_dialog(self, "Evaluation of regex /#{regex_input.text}/ failed: #{e}!")
return
end
end
end
return
ensure
dialog.destroy if dialog
end