mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Move show_command_error to DocumentController
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
#ifndef DOCUMENT_COMMAND_H_KLPQDYHU
|
||||
#define DOCUMENT_COMMAND_H_KLPQDYHU
|
||||
|
||||
#import <oak/oak.h>
|
||||
#import <plist/uuid.h>
|
||||
|
||||
void show_command_error (std::string const& message, oak::uuid_t const& uuid, NSWindow* window = nil, std::string commandName = NULL_STR);
|
||||
|
||||
#endif /* end of include guard: DOCUMENT_COMMAND_H_KLPQDYHU */
|
||||
@@ -1,30 +0,0 @@
|
||||
#import "DocumentCommand.h"
|
||||
#import <OakAppKit/OakAppKit.h>
|
||||
#import <OakFoundation/NSString Additions.h>
|
||||
#import <BundleEditor/BundleEditor.h>
|
||||
#import <ns/ns.h>
|
||||
#import <bundles/bundles.h>
|
||||
|
||||
// ==============
|
||||
// = Public API =
|
||||
// ==============
|
||||
|
||||
void show_command_error (std::string const& message, oak::uuid_t const& uuid, NSWindow* window, std::string commandName)
|
||||
{
|
||||
bundles::item_ptr bundleItem = bundles::lookup(uuid);
|
||||
if(commandName == NULL_STR)
|
||||
commandName = bundleItem ? bundleItem->name() : "(unknown)";
|
||||
|
||||
NSAlert* alert = [[NSAlert alloc] init];
|
||||
[alert setAlertStyle:NSCriticalAlertStyle];
|
||||
[alert setMessageText:[NSString stringWithCxxString:text::format("Failure running “%.*s”.", (int)commandName.size(), commandName.data())]];
|
||||
[alert setInformativeText:[NSString stringWithCxxString:message] ?: @"No output"];
|
||||
[alert addButtonWithTitle:@"OK"];
|
||||
if(bundleItem)
|
||||
[alert addButtonWithTitle:@"Edit Command"];
|
||||
|
||||
OakShowAlertForWindow(alert, window, ^(NSInteger button){
|
||||
if(button == NSAlertSecondButtonReturn)
|
||||
[[BundleEditor sharedInstance] revealBundleItem:bundleItem];
|
||||
});
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
#import "DocumentController.h"
|
||||
#import "ProjectLayoutView.h"
|
||||
#import "DocumentCommand.h" // show_command_error
|
||||
#import "SelectGrammarViewController.h"
|
||||
#import "OakRunCommandWindowController.h"
|
||||
#import <document/collection.h>
|
||||
@@ -23,6 +22,7 @@
|
||||
#import <OakSystem/application.h>
|
||||
#import <Find/Find.h>
|
||||
#import <BundlesManager/BundlesManager.h>
|
||||
#import <BundleEditor/BundleEditor.h>
|
||||
#import <network/network.h>
|
||||
#import <file/path_info.h>
|
||||
#import <io/entries.h>
|
||||
@@ -40,6 +40,26 @@ static NSString* const kUserDefaultsHideStatusBarKey = @"hideStatusBar";
|
||||
static NSString* const kUserDefaultsDisableBundleSuggestionsKey = @"disableBundleSuggestions";
|
||||
static NSString* const kUserDefaultsGrammarsToNeverSuggestKey = @"grammarsToNeverSuggest";
|
||||
|
||||
static void show_command_error (std::string const& message, oak::uuid_t const& uuid, NSWindow* window = nil, std::string commandName = NULL_STR)
|
||||
{
|
||||
bundles::item_ptr bundleItem = bundles::lookup(uuid);
|
||||
if(commandName == NULL_STR)
|
||||
commandName = bundleItem ? bundleItem->name() : "(unknown)";
|
||||
|
||||
NSAlert* alert = [[NSAlert alloc] init];
|
||||
[alert setAlertStyle:NSCriticalAlertStyle];
|
||||
[alert setMessageText:[NSString stringWithCxxString:text::format("Failure running “%.*s”.", (int)commandName.size(), commandName.data())]];
|
||||
[alert setInformativeText:[NSString stringWithCxxString:message] ?: @"No output"];
|
||||
[alert addButtonWithTitle:@"OK"];
|
||||
if(bundleItem)
|
||||
[alert addButtonWithTitle:@"Edit Command"];
|
||||
|
||||
OakShowAlertForWindow(alert, window, ^(NSInteger button){
|
||||
if(button == NSAlertSecondButtonReturn)
|
||||
[[BundleEditor sharedInstance] revealBundleItem:bundleItem];
|
||||
});
|
||||
}
|
||||
|
||||
@interface QuickLookNSURLWrapper : NSObject <QLPreviewItem>
|
||||
@property (nonatomic) NSURL* url;
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user