aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDatabaseViewController.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-12-01 23:49:55 +0000
committerBibiko <bibiko@eva.mpg.de>2010-12-01 23:49:55 +0000
commit4801fedd91e3a6abb1ee6a7aa1174a089bf6e547 (patch)
tree83de108f27534334f95c2198de13ad4686e3164d /Source/SPDatabaseViewController.m
parent842e85a37b698be1245dee0948a1abd99973638c (diff)
downloadsequelpro-4801fedd91e3a6abb1ee6a7aa1174a089bf6e547.tar.gz
sequelpro-4801fedd91e3a6abb1ee6a7aa1174a089bf6e547.tar.bz2
sequelpro-4801fedd91e3a6abb1ee6a7aa1174a089bf6e547.zip
• Bundle Commands
- make sure that each HTML output window will be released - if a triggered command will outputs its result in an HTML window invoke it only if the HTML output window is already open; this enables the user to "switch on/off" such a trigger
Diffstat (limited to 'Source/SPDatabaseViewController.m')
-rw-r--r--Source/SPDatabaseViewController.m36
1 files changed, 27 insertions, 9 deletions
diff --git a/Source/SPDatabaseViewController.m b/Source/SPDatabaseViewController.m
index 8cf97998..e95b6b41 100644
--- a/Source/SPDatabaseViewController.m
+++ b/Source/SPDatabaseViewController.m
@@ -488,16 +488,34 @@
NSMenuItem *aMenuItem = [[[NSMenuItem alloc] init] autorelease];
[aMenuItem setTag:0];
[aMenuItem setToolTip:[data objectAtIndex:0]];
- if([[data objectAtIndex:1] isEqualToString:SPBundleScopeGeneral]) {
- [[[NSApp delegate] onMainThread] executeBundleItemForApp:aMenuItem];
- }
- else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeDataTable]) {
- if([[[[NSApp mainWindow] firstResponder] description] isEqualToString:@"SPCopyTable"])
- [[[[NSApp mainWindow] firstResponder] onMainThread] executeBundleItemForDataTable:aMenuItem];
+
+ // For HTML output check if corresponding window already exists
+ BOOL stopTrigger = NO;
+ if([[data objectAtIndex:2] length]) {
+ BOOL correspondingWindowFound = NO;
+ NSString *uuid = [data objectAtIndex:2];
+ for(id win in [NSApp windows]) {
+ if([[[[win delegate] class] description] isEqualToString:@"SPBundleHTMLOutputController"]) {
+ if([[[win delegate] windowUUID] isEqualToString:uuid]) {
+ correspondingWindowFound = YES;
+ break;
+ }
+ }
+ }
+ if(!correspondingWindowFound) stopTrigger = YES;
}
- else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeInputField]) {
- if([[[NSApp mainWindow] firstResponder] isKindOfClass:[NSTextView class]])
- [[[[NSApp mainWindow] firstResponder] onMainThread] executeBundleItemForInputField:aMenuItem];
+ if(!stopTrigger) {
+ if([[data objectAtIndex:1] isEqualToString:SPBundleScopeGeneral]) {
+ [[[NSApp delegate] onMainThread] executeBundleItemForApp:aMenuItem];
+ }
+ else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeDataTable]) {
+ if([[[[[NSApp mainWindow] firstResponder] class] description] isEqualToString:@"SPCopyTable"])
+ [[[[NSApp mainWindow] firstResponder] onMainThread] executeBundleItemForDataTable:aMenuItem];
+ }
+ else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeInputField]) {
+ if([[[NSApp mainWindow] firstResponder] isKindOfClass:[NSTextView class]])
+ [[[[NSApp mainWindow] firstResponder] onMainThread] executeBundleItemForInputField:aMenuItem];
+ }
}
}