aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-12-17 15:20:01 +0000
committerBibiko <bibiko@eva.mpg.de>2010-12-17 15:20:01 +0000
commit072a730f22e3c06fed48acf31ac5708259c93a32 (patch)
treea26034abdc488fe00eb4b7d6d506574c2e48f79e
parent521c78fc8e87734c8bdf7a30024ba51c3ec1a306 (diff)
downloadsequelpro-072a730f22e3c06fed48acf31ac5708259c93a32.tar.gz
sequelpro-072a730f22e3c06fed48acf31ac5708259c93a32.tar.bz2
sequelpro-072a730f22e3c06fed48acf31ac5708259c93a32.zip
• minor improvements, commenting, cleaning for URL scheme commands
-rw-r--r--Source/SPAppController.m30
-rw-r--r--Source/SPDatabaseDocument.m17
2 files changed, 19 insertions, 28 deletions
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index a90876fa..046628b3 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -659,35 +659,11 @@
}
}
- if(!processDocument)
+ // if no processDoc found and no passedProcessID was passed execute
+ // command at front most doc
+ if(!processDocument && !passedProcessID)
processDocument = [[[self frontDocumentWindow] delegate] selectedTableDocument];
-
- BOOL userTerminated = NO;
-
- // while(1) {
- // NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask
- // untilDate:[NSDate distantPast]
- // inMode:NSDefaultRunLoopMode
- // dequeue:YES];
- //
- // if ([event type] == NSKeyDown) {
- // unichar key = [[event characters] length] == 1 ? [[event characters] characterAtIndex:0] : 0;
- // if (([event modifierFlags] & NSCommandKeyMask) && key == '.') {
- // userTerminated = YES;
- // break;
- // }
- // }
- // [NSApp sendEvent:event];
- // if(![processDocument isWorking]) break;
- // usleep(1000);
- // }
- //
- // if(userTerminated) {
- // NSBeep();
- // return;
- // }
-
if(processDocument && command) {
if([command isEqualToString:@"passToDoc"]) {
NSMutableDictionary *cmdDict = [NSMutableDictionary dictionary];
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 0c2b7de7..8557eeba 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -4556,6 +4556,9 @@ YY_BUFFER_STATE yy_scan_string (const char *);
#pragma mark -
#pragma mark Scheme scripting methods
+/**
+ * Return an HTML formatted string representing the passed SQL string syntax highlighted
+ */
- (NSString*)doSQLSyntaxHighlightForString:(NSString*)sqlText cssLike:(BOOL)cssLike
{
@@ -4633,16 +4636,28 @@ YY_BUFFER_STATE yy_scan_string (const char *);
}
+/**
+ * Called by handleSchemeCommand: to break a while loop
+ */
- (void)setTimeout
{
_workingTimeout = YES;
}
+/**
+ * Process passed URL scheme command and wait (timeouted) for the document if it's busy or not yet connected
+ */
- (void)handleSchemeCommand:(NSDictionary*)commandDict
{
+ if(!commandDict) return;
+
NSArray *params = [commandDict objectForKey:@"parameter"];
- if(![params count]) return;
+ if(![params count]) {
+ NSLog(@"No URL scheme command passed");
+ NSBeep();
+ return;
+ }
NSString *command = [params objectAtIndex:0];
NSString *docProcessID = [self processID];