diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-12-01 23:49:55 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-12-01 23:49:55 +0000 |
commit | 4801fedd91e3a6abb1ee6a7aa1174a089bf6e547 (patch) | |
tree | 83de108f27534334f95c2198de13ad4686e3164d /Source/SPAppController.m | |
parent | 842e85a37b698be1245dee0948a1abd99973638c (diff) | |
download | sequelpro-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/SPAppController.m')
-rw-r--r-- | Source/SPAppController.m | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/Source/SPAppController.m b/Source/SPAppController.m index 3cd718db..45e9892a 100644 --- a/Source/SPAppController.m +++ b/Source/SPAppController.m @@ -56,6 +56,7 @@ bundleCategories = [[NSMutableDictionary alloc] initWithCapacity:1]; bundleTriggers = [[NSMutableDictionary alloc] initWithCapacity:1]; bundleUsedScopes = [[NSMutableArray alloc] initWithCapacity:1]; + bundleHTMLOutputController = [[NSMutableArray alloc] initWithCapacity:1]; bundleKeyEquivalents = [[NSMutableDictionary alloc] initWithCapacity:1]; installedBundleUUIDs = [[NSMutableDictionary alloc] initWithCapacity:1]; runningActivitiesArray = [[NSMutableArray alloc] init]; @@ -836,6 +837,7 @@ SPBundleHTMLOutputController *c = [[SPBundleHTMLOutputController alloc] init]; [c setWindowUUID:[cmdData objectForKey:SPBundleFileUUIDKey]]; [c displayHTMLContent:output withOptions:nil]; + [[NSApp delegate] addHTMLOutputController:c]; } } } @@ -1172,13 +1174,25 @@ [bundleEditorController showWindow:self]; } +- (void)addHTMLOutputController:(id)controller +{ + [bundleHTMLOutputController addObject:controller]; +} + - (IBAction)reloadBundles:(id)sender { + for(id c in bundleHTMLOutputController) { + if(![[c window] isVisible]) { + [c release]; + } + } + BOOL foundInstalledBundles = NO; [bundleItems removeAllObjects]; [bundleUsedScopes removeAllObjects]; + [bundleHTMLOutputController removeAllObjects]; [bundleCategories removeAllObjects]; [bundleTriggers removeAllObjects]; [bundleKeyEquivalents removeAllObjects]; @@ -1240,7 +1254,7 @@ if([cmdData objectForKey:SPBundleFileTriggerKey]) { if(![bundleTriggers objectForKey:[cmdData objectForKey:SPBundleFileTriggerKey]]) [bundleTriggers setObject:[NSMutableArray array] forKey:[cmdData objectForKey:SPBundleFileTriggerKey]]; - [[bundleTriggers objectForKey:[cmdData objectForKey:SPBundleFileTriggerKey]] addObject:[NSString stringWithFormat:@"%@|%@", infoPath, [cmdData objectForKey:SPBundleFileScopeKey]]]; + [[bundleTriggers objectForKey:[cmdData objectForKey:SPBundleFileTriggerKey]] addObject:[NSString stringWithFormat:@"%@|%@|%@", infoPath, [cmdData objectForKey:SPBundleFileScopeKey], ([[cmdData objectForKey:SPBundleFileOutputActionKey] isEqualToString:SPBundleOutputActionShowAsHTML])?[cmdData objectForKey:SPBundleFileUUIDKey]:@""]]; } if([cmdData objectForKey:SPBundleFileKeyEquivalentKey] && [[cmdData objectForKey:SPBundleFileKeyEquivalentKey] length]) { @@ -1563,7 +1577,7 @@ } /** - * If Sequel Pro is terminating kill all running BASH scripts + * If Sequel Pro is terminating kill all running BASH scripts and release all HTML output controller */ - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender { @@ -1593,6 +1607,11 @@ [killTask waitUntilExit]; [killTask release]; } + + for(id c in bundleHTMLOutputController) { + [c release]; + } + return YES; } @@ -1608,6 +1627,7 @@ if(bundleItems) [bundleItems release]; if(bundleUsedScopes) [bundleUsedScopes release]; + if(bundleHTMLOutputController) [bundleHTMLOutputController release]; if(bundleCategories) [bundleCategories release]; if(bundleTriggers) [bundleTriggers release]; if(bundleKeyEquivalents) [bundleKeyEquivalents release]; |