diff options
Diffstat (limited to 'Source/SPBundleEditorController.m')
-rw-r--r-- | Source/SPBundleEditorController.m | 68 |
1 files changed, 67 insertions, 1 deletions
diff --git a/Source/SPBundleEditorController.m b/Source/SPBundleEditorController.m index 2eb58edc..4091e606 100644 --- a/Source/SPBundleEditorController.m +++ b/Source/SPBundleEditorController.m @@ -95,6 +95,8 @@ [triggerGeneralArray release]; [withBlobDataTableArray release]; + [shellVariableSuggestions release]; + if(touchedBundleArray) [touchedBundleArray release], touchedBundleArray = nil; if(commandBundleTree) [commandBundleTree release], commandBundleTree = nil; if(sortDescriptor) [sortDescriptor release], sortDescriptor = nil; @@ -306,6 +308,48 @@ [commandBundleTreeController setSortDescriptors:[NSArray arrayWithObjects:sortDescriptor, nil]]; + shellVariableSuggestions = [[NSArray arrayWithObjects: + @"SP_ALL_DATABASES", + @"SP_ALL_FUNCTIONS", + @"SP_ALL_PROCEDURES", + @"SP_ALL_TABLES", + @"SP_ALL_VIEWS", + @"SP_APP_RESOURCES_DIRECTORY", + @"SP_BUNDLE_EXIT_INSERT_AS_SNIPPET", + @"SP_BUNDLE_EXIT_INSERT_AS_TEXT", + @"SP_BUNDLE_EXIT_NONE", + @"SP_BUNDLE_EXIT_REPLACE_CONTENT", + @"SP_BUNDLE_EXIT_REPLACE_SELECTION", + @"SP_BUNDLE_EXIT_SHOW_AS_HTML", + @"SP_BUNDLE_EXIT_SHOW_AS_HTML_TOOLTIP", + @"SP_BUNDLE_EXIT_SHOW_AS_TEXT_TOOLTIP", + @"SP_BUNDLE_INPUT", + @"SP_BUNDLE_INPUT_TABLE_METADATA", + @"SP_BUNDLE_PATH", + @"SP_BUNDLE_SCOPE", + @"SP_CURRENT_HOST", + @"SP_CURRENT_LINE", + @"SP_CURRENT_PORT", + @"SP_CURRENT_QUERY", + @"SP_CURRENT_USER", + @"SP_CURRENT_WORD", + @"SP_DATABASE_ENCODING", + @"SP_ICON_FILE", + @"SP_PROCESS_ID", + @"SP_QUERY_FILE", + @"SP_QUERY_RESULT_FILE", + @"SP_QUERY_RESULT_META_FILE", + @"SP_QUERY_RESULT_STATUS_FILE", + @"SP_RDBMS_TYPE", + @"SP_RDBMS_VERSION", + @"SP_SELECTED_DATABASE", + @"SP_SELECTED_ROW_INDICES", + @"SP_SELECTED_TABLE", + @"SP_SELECTED_TABLES", + @"SP_USED_QUERY_FOR_TABLE", + nil + ] retain]; + [self _initTree]; } @@ -662,6 +706,9 @@ */ - (IBAction)removeCommandBundle:(id)sender { + + [commandsOutlineView abortEditing]; + NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Remove selected Bundle?", @"remove selected bundle message") defaultButton:NSLocalizedString(@"Remove", @"remove button") alternateButton:NSLocalizedString(@"Cancel", @"cancel button") @@ -745,6 +792,12 @@ } +- (IBAction)performClose:(id)sender +{ + [self _initTree]; + [self close]; +} + /** * Save all touched bundles to disk and close the Bundle Editor window */ @@ -1451,10 +1504,23 @@ cycleCounter = 0; } - [self performSelector:@selector(setAllowedUndo) withObject:nil afterDelay:0.09]; + [self performSelector:@selector(setAllowedUndo) withObject:nil afterDelay:0.0005]; } } +/** + * Add shell variable names to the completion list + */ +- (NSArray *)textView:(NSTextView *)textView completions:(NSArray *)words forPartialWordRange:(NSRange)charRange indexOfSelectedItem:(NSInteger *)index +{ + + NSMutableArray *suggestions = [NSMutableArray array]; + NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF BEGINSWITH %@ ", [[textView string] substringWithRange:charRange]]; + [suggestions addObjectsFromArray:[shellVariableSuggestions filteredArrayUsingPredicate:predicate]]; + [suggestions addObjectsFromArray:words]; + return suggestions; + +} #pragma mark - #pragma mark UndoManager methods |