aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPAppController.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPAppController.m')
-rw-r--r--Source/SPAppController.m28
1 files changed, 10 insertions, 18 deletions
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index da70ceb9..d89abe19 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -51,21 +51,11 @@
#import "SPBundleCommandRunner.h"
#import "SPWindowManagement.h"
#import "SPCopyTable.h"
+#import "SPSyntaxParser.h"
#import <PSMTabBar/PSMTabBarControl.h>
#import <Sparkle/Sparkle.h>
-#pragma mark Lex init
-
-/*
-* Include all the extern variables and prototypes required for flex (used for syntax highlighting)
-*/
-extern NSUInteger yylex();
-extern NSUInteger yyuoffset, yyuleng;
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-void yy_switch_to_buffer(YY_BUFFER_STATE);
-YY_BUFFER_STATE yy_scan_string (const char *);
-
@interface SPAppController ()
- (void)_copyDefaultThemes;
@@ -222,6 +212,7 @@ YY_BUFFER_STATE yy_scan_string (const char *);
}
NSOpenPanel *panel = [NSOpenPanel openPanel];
+
[panel setDelegate:self];
[panel setCanSelectHiddenExtension:YES];
[panel setCanChooseDirectories:NO];
@@ -266,6 +257,7 @@ YY_BUFFER_STATE yy_scan_string (const char *);
{
if (returnCode) {
[panel orderOut:self];
+
[self application:nil openFiles:[panel filenames]];
}
@@ -278,15 +270,15 @@ YY_BUFFER_STATE yy_scan_string (const char *);
*/
- (void)application:(NSApplication *)app openFiles:(NSArray *)filenames
{
-
for (NSString *filename in filenames)
{
// Opens a sql file and insert its content into the Custom Query editor
- if([[[filename pathExtension] lowercaseString] isEqualToString:[SPFileExtensionSQL lowercaseString]]) {
+ if ([[[filename pathExtension] lowercaseString] isEqualToString:[SPFileExtensionSQL lowercaseString]]) {
// Check size and NSFileType
- NSDictionary *attr = [[NSFileManager defaultManager] fileAttributesAtPath:filename traverseLink:YES];
- if(attr)
+ NSDictionary *attr = [[NSFileManager defaultManager] attributesOfItemAtPath:filename error:nil];
+
+ if (attr)
{
NSNumber *filesize = [attr objectForKey:NSFileSize];
NSString *filetype = [attr objectForKey:NSFileType];
@@ -772,7 +764,7 @@ YY_BUFFER_STATE yy_scan_string (const char *);
return;
}
- NSString *activeProcessID = [[[[self frontDocumentWindow] delegate] selectedTableDocument] processID];
+ NSString *activeProcessID = [[(SPWindowController *)[[self frontDocumentWindow] delegate] selectedTableDocument] processID];
SPDatabaseDocument *processDocument = nil;
@@ -780,7 +772,7 @@ YY_BUFFER_STATE yy_scan_string (const char *);
// For speed check the front most first otherwise iterate through all
if(passedProcessID && [passedProcessID length]) {
if([activeProcessID isEqualToString:passedProcessID]) {
- processDocument = [[[self frontDocumentWindow] delegate] selectedTableDocument];
+ processDocument = [(SPWindowController *)[[self frontDocumentWindow] delegate] selectedTableDocument];
} else {
for (NSWindow *aWindow in [NSApp orderedWindows]) {
if([[aWindow windowController] isMemberOfClass:[SPWindowController class]]) {
@@ -799,7 +791,7 @@ YY_BUFFER_STATE yy_scan_string (const char *);
// if no processDoc found and no passedProcessID was passed execute
// command at front most doc
if(!processDocument && !passedProcessID)
- processDocument = [[[self frontDocumentWindow] delegate] selectedTableDocument];
+ processDocument = [(SPWindowController *)[[self frontDocumentWindow] delegate] selectedTableDocument];
if(processDocument && command) {
if([command isEqualToString:@"passToDoc"]) {