From 0e0e710000e9135e1b3f612a78fc9d97035f41b0 Mon Sep 17 00:00:00 2001 From: Ronald Wampler Date: Fri, 4 Dec 2015 16:34:27 -0500 Subject: [PATCH] Avoid calling abort in commands Instead of aborting, we report errors via a tool tip. --- Commands/Move to Parent Listfile.tmCommand | 17 +++++++++++---- .../Move to Subdirectory Listfile.tmCommand | 21 +++++++++++++------ 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/Commands/Move to Parent Listfile.tmCommand b/Commands/Move to Parent Listfile.tmCommand index 0739cb0..1936521 100644 --- a/Commands/Move to Parent Listfile.tmCommand +++ b/Commands/Move to Parent Listfile.tmCommand @@ -6,12 +6,13 @@ nop command #!/usr/bin/env ruby18 +require ENV['TM_SUPPORT_PATH'] + '/lib/exit_codes' require ENV['TM_SUPPORT_PATH'] + '/lib/textmate' -abort "Unsaved file" unless ENV['TM_FILEPATH'] +TextMate::exit_show_tool_tip("Unsaved file") unless ENV['TM_FILEPATH'] path = File.dirname(File.dirname(ENV['TM_FILEPATH'])) + "/CMakeLists.txt" -abort "No parent listfile" unless File.exist?(path) +TextMate::exit_show_tool_tip("No parent listfile") unless File.exist?(path) TextMate.go_to(:file => path) @@ -19,15 +20,23 @@ TextMate.go_to(:file => path) line input none + inputFormat + text keyEquivalent ~@ name Move to Parent Listfile - output - showAsTooltip + outputCaret + afterOutput + outputFormat + text + outputLocation + toolTip scope source.cmake uuid 48A1D967-E8CF-4C16-A58F-60471E9469E3 + version + 2 diff --git a/Commands/Move to Subdirectory Listfile.tmCommand b/Commands/Move to Subdirectory Listfile.tmCommand index a5f9770..c8b6b52 100644 --- a/Commands/Move to Subdirectory Listfile.tmCommand +++ b/Commands/Move to Subdirectory Listfile.tmCommand @@ -6,10 +6,11 @@ nop command #!/usr/bin/env ruby18 +require ENV['TM_SUPPORT_PATH'] + '/lib/exit_codes' require ENV['TM_SUPPORT_PATH'] + '/lib/textmate' require ENV['TM_SUPPORT_PATH'] + '/lib/ui' -abort "Unsaved file" unless ENV['TM_FILEPATH'] +TextMate::exit_show_tool_tip("Unsaved file") unless ENV['TM_FILEPATH'] line = STDIN.read dir = File.dirname(ENV['TM_FILEPATH']) @@ -19,16 +20,16 @@ if line =~ /ADD_SUBDIRECTORY\s*\((.+?)\)/i subdir = $1 else subdirs = Dir[dir + "/*/CMakeLists.txt"].map { |p| File.basename(File.dirname(p)) }.sort - abort "No listfile found in subdirectories" if subdirs.empty? + TextMate::exit_show_tool_tip("No listfile found in subdirectories") if subdirs.empty? choice = TextMate::UI.menu(subdirs) - abort "Cancelled" unless choice + TextMate::exit_discard unless choice subdir = subdirs[choice] end if subdir file = subdir + "/CMakeLists.txt" path = File.join(dir, file) - abort "The file at #{file} doesn't exist" unless File.exist?(path) + TextMate::exit_show_tool_tip("The file at #{file} doesn't exist") unless File.exist?(path) TextMate.go_to(:file => path) end @@ -36,15 +37,23 @@ end line input selection + inputFormat + text keyEquivalent ~@ name Move to Subdirectory Listfile - output - showAsTooltip + outputCaret + afterOutput + outputFormat + text + outputLocation + toolTip scope source.cmake uuid 6F326FB4-8DC0-49BE-B74C-7B49CFA5283F + version + 2