aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorsqlprodev <sqlprodev@northofthree.com>2011-08-02 00:23:17 +0000
committersqlprodev <sqlprodev@northofthree.com>2011-08-02 00:23:17 +0000
commit566f784ae03776dd3f5cfda20a357240d2e73a77 (patch)
treecf156cbd06ec8b60da628a53d15955d9527feba6 /Source
parent34dc6a658202bd624971c81633ea484e3f4f1e74 (diff)
downloadsequelpro-566f784ae03776dd3f5cfda20a357240d2e73a77.tar.gz
sequelpro-566f784ae03776dd3f5cfda20a357240d2e73a77.tar.bz2
sequelpro-566f784ae03776dd3f5cfda20a357240d2e73a77.zip
merged latest SP_REFACTOR changes
Diffstat (limited to 'Source')
-rw-r--r--Source/SPConnectionController.m2
-rw-r--r--Source/SPContentFilterManager.h5
-rw-r--r--Source/SPCustomQuery.h5
-rw-r--r--Source/SPCustomQuery.m12
-rw-r--r--Source/SPDatabaseDocument.h24
-rw-r--r--Source/SPDatabaseDocument.m96
-rw-r--r--Source/SPFieldEditorController.h5
-rw-r--r--Source/SPFieldEditorController.m10
-rw-r--r--Source/SPIndexesController.h5
-rw-r--r--Source/SPQueryController.h4
-rw-r--r--Source/SPQueryController.m4
-rw-r--r--Source/SPQueryFavoriteManager.h5
-rw-r--r--Source/SPTableContent.h5
-rw-r--r--Source/SPTableContent.m2
-rw-r--r--Source/SPTableStructure.h5
-rw-r--r--Source/SPTablesList.h58
-rw-r--r--Source/SPTablesList.m136
17 files changed, 284 insertions, 99 deletions
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m
index 79dddba4..e7a70caf 100644
--- a/Source/SPConnectionController.m
+++ b/Source/SPConnectionController.m
@@ -221,7 +221,9 @@
// If this action was triggered via a double-click on the favorites outline view,
// ensure that one of the connections was double-clicked, not the area above or below
+#ifndef SP_REFACTOR
if (sender == favoritesTable && [favoritesTable clickedRow] <= 0) return;
+#endif
// Ensure that host is not empty if this is a TCP/IP or SSH connection
if (([self type] == SPTCPIPConnection || [self type] == SPSSHTunnelConnection) && ![[self host] length]) {
diff --git a/Source/SPContentFilterManager.h b/Source/SPContentFilterManager.h
index dda8995c..ec23afe6 100644
--- a/Source/SPContentFilterManager.h
+++ b/Source/SPContentFilterManager.h
@@ -31,9 +31,10 @@
@end
+#ifndef SP_REFACTOR /* ivars */
@interface SPContentFilterManager : NSWindowController
-#ifdef SP_REFACTOR /* ivars */
-<NSOpenSavePanelDelegate>
+#else
+@interface SPContentFilterManager : NSWindowController <NSOpenSavePanelDelegate>
#endif
{
#ifndef SP_REFACTOR /* ivars */
diff --git a/Source/SPCustomQuery.h b/Source/SPCustomQuery.h
index 8d289f70..16aaca14 100644
--- a/Source/SPCustomQuery.h
+++ b/Source/SPCustomQuery.h
@@ -52,9 +52,10 @@
@class SPCopyTable, SPQueryFavoriteManager, SPDataStorage, NSSplitView, SPFieldEditorController;
#endif
+#ifndef SP_REFACTOR
@interface SPCustomQuery : NSObject
-#ifdef SP_REFACTOR
-<NSTableViewDataSource, NSWindowDelegate, NSTableViewDelegate>
+#else
+@interface SPCustomQuery : NSObject <NSTableViewDataSource, NSWindowDelegate, NSTableViewDelegate>
#endif
{
IBOutlet id tableDocumentInstance;
diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m
index 1108e6d6..151bd681 100644
--- a/Source/SPCustomQuery.m
+++ b/Source/SPCustomQuery.m
@@ -596,11 +596,7 @@
#endif
// Notify listeners that a query has started
-#ifndef SP_REFACTOR
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
-#else
- [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
-#endif
#ifndef SP_REFACTOR /* growl */
// Start the notification timer to allow notifications to be shown even if frontmost for long queries
@@ -867,11 +863,7 @@
[customQueryView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:YES];
// Notify any listeners that the query has completed
-#ifndef SP_REFACTOR
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
-#else
- [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
-#endif
#ifndef SP_REFACTOR /* growl */
// Perform the Growl notification for query completion
@@ -904,11 +896,7 @@
}
//query finished
-#ifndef SP_REFACTOR
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
-#else
- [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
-#endif
#ifndef SP_REFACTOR /* growl */
// Query finished Growl notification
diff --git a/Source/SPDatabaseDocument.h b/Source/SPDatabaseDocument.h
index 8f67ccc4..f7474943 100644
--- a/Source/SPDatabaseDocument.h
+++ b/Source/SPDatabaseDocument.h
@@ -34,14 +34,18 @@
#ifndef SP_REFACTOR /* class forward decls */
SPProcessListController, SPServerVariablesController, SPUserManager, SPWindowController,
#endif
-SPTablesList, SPTableStructure, SPTableContent, SPTableData, SPServerSupport, SPCustomQuery;
+SPDatabaseData, SPTablesList, SPTableStructure, SPTableContent, SPTableData, SPServerSupport, SPCustomQuery;
#import "SPConnectionControllerDelegateProtocol.h"
/**
* The SPDatabaseDocument class controls the primary database view window.
*/
-@interface SPDatabaseDocument : NSObject <SPConnectionControllerDelegateProtocol>
+@interface SPDatabaseDocument : NSObject <SPConnectionControllerDelegateProtocol
+#ifdef SP_REFACTOR /* patch */
+ , NSTextFieldDelegate
+#endif
+>
{
#ifdef SP_REFACTOR /* patch */
id delegate;
@@ -237,6 +241,7 @@ SPTablesList, SPTableStructure, SPTableContent, SPTableData, SPServerSupport, SP
@property (assign) id delegate;
@property (readonly) NSMutableArray* allDatabases;
@property (assign) NSProgressIndicator* queryProgressBar;
+@property (assign) NSWindow* databaseSheet;
#endif
#ifndef SP_REFACTOR /* ivars */
@@ -251,8 +256,10 @@ SPTablesList, SPTableStructure, SPTableContent, SPTableData, SPServerSupport, SP
#ifndef SP_REFACTOR /* method decls */
- (BOOL)isUntitled;
+#endif
- (BOOL)couldCommitCurrentViewActions;
+#ifndef SP_REFACTOR /* method decls */
- (void)initQueryEditorWithString:(NSString *)query;
// Connection callback and methods
@@ -267,12 +274,14 @@ SPTablesList, SPTableStructure, SPTableContent, SPTableData, SPServerSupport, SP
- (IBAction)chooseDatabase:(id)sender;
#endif
- (void)selectDatabase:(NSString *)aDatabase item:(NSString *)anItem;
-#ifndef SP_REFACTOR /* method decls */
- (IBAction)addDatabase:(id)sender;
- (IBAction)removeDatabase:(id)sender;
+#ifndef SP_REFACTOR /* method decls */
- (IBAction)refreshTables:(id)sender;
- (IBAction)copyDatabase:(id)sender;
+#endif
- (IBAction)renameDatabase:(id)sender;
+#ifndef SP_REFACTOR /* method decls */
- (IBAction)showMySQLHelp:(id)sender;
- (IBAction)showServerVariables:(id)sender;
- (IBAction)showServerProcesses:(id)sender;
@@ -436,8 +445,17 @@ SPTablesList, SPTableStructure, SPTableContent, SPTableData, SPServerSupport, SP
- (void)setTableSourceInstance:(SPTableStructure*)source;
- (void)setTableContentInstance:(SPTableContent*)content;
+@property (assign) SPDatabaseData* databaseDataInstance;
@property (assign) SPTableData* tableDataInstance;
@property (assign) SPCustomQuery* customQueryInstance;
+@property (assign) id databaseNameField;
+@property (assign) id databaseEncodingButton;
+@property (assign) id addDatabaseButton;
+
+@property (assign) id databaseRenameNameField;
+@property (assign) id renameDatabaseButton;
+@property (assign) id databaseRenameSheet;
+
#endif
@end
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index bb2846c7..c211376d 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -48,7 +48,9 @@
#ifndef SP_REFACTOR /* headers */
#import "SPSQLParser.h"
#import "SPTableData.h"
+#endif
#import "SPDatabaseData.h"
+#ifndef SP_REFACTOR /* headers */
#import "SPAppController.h"
#import "SPExtendedTableInfo.h"
#import "SPHistoryController.h"
@@ -78,6 +80,7 @@
#import "SPAlertSheets.h"
#import "NSNotificationAdditions.h"
#import "SPCustomQuery.h"
+#import "SPDatabaseRename.h"
#endif
// Constants
@@ -87,12 +90,12 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
@interface SPDatabaseDocument ()
-#ifndef SP_REFACTOR /* method decls */
- (void)_addDatabase;
+#ifndef SP_REFACTOR /* method decls */
- (void)_copyDatabase;
+#endif
- (void)_renameDatabase;
- (void)_removeDatabase;
-#endif
- (void)_selectDatabaseAndItem:(NSDictionary *)selectionDetails;
@end
@@ -115,6 +118,14 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
@synthesize tableDataInstance;
@synthesize customQueryInstance;
@synthesize queryProgressBar;
+@synthesize databaseSheet;
+@synthesize databaseNameField;
+@synthesize databaseEncodingButton;
+@synthesize addDatabaseButton;
+@synthesize databaseDataInstance;
+@synthesize databaseRenameSheet;
+@synthesize databaseRenameNameField;
+@synthesize renameDatabaseButton;
#endif
- (id)init
@@ -408,14 +419,13 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
[databaseDataInstance setConnection:mySQLConnection];
-#ifndef SP_REFACTOR /* setServerSupport: */
// Pass the support class to the data instance
[databaseDataInstance setServerSupport:serverSupport];
-#endif
#ifdef SP_REFACTOR /* glue */
tablesListInstance = [[SPTablesList alloc] init];
[tablesListInstance setDatabaseDocument:self];
+ [tablesListInstance awakeFromNib];
#endif
// Set the connection on the tables list instance - this updates the table list while the connection
@@ -678,7 +688,6 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
}
}
-#ifndef SP_REFACTOR /* operations on whole databases */
/**
* opens the add-db sheet and creates the new db
*/
@@ -730,6 +739,7 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
}
+#ifndef SP_REFACTOR /* operations on whole databases */
/**
* opens the copy database sheet and copies the databsae
*/
@@ -746,6 +756,7 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
contextInfo:@"copyDatabase"];
}
+#endif
/**
* opens the rename database sheet and renames the databsae
@@ -769,8 +780,10 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
*/
- (IBAction)removeDatabase:(id)sender
{
+#ifndef SP_REFACTOR
// No database selected, bail
if ([chooseDatabaseButton indexOfSelectedItem] == 0) return;
+#endif
if (![tablesListInstance selectionShouldChangeInTableView:nil]) return;
@@ -792,6 +805,7 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
[alert beginSheetModalForWindow:parentWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"removeDatabase"];
}
+#ifndef SP_REFACTOR
/**
* Refreshes the tables list by calling SPTablesList's updateTables.
*/
@@ -851,7 +865,6 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
return allSystemDatabases;
}
-#ifndef SP_REFACTOR /* sheetDidEnd: */
/**
* Alert sheet method. Invoked when an alert sheet is dismissed.
*
@@ -862,11 +875,12 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
*/
- (void)sheetDidEnd:(id)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
-
+#ifndef SP_REFACTOR
if([contextInfo isEqualToString:@"saveDocPrefSheetStatus"]) {
saveDocPrefSheetStatus = returnCode;
return;
}
+#endif
// Order out current sheet to suppress overlapping of sheets
if ([sheet respondsToSelector:@selector(orderOut:)])
@@ -896,23 +910,27 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
[chooseDatabaseButton selectItemAtIndex:0];
}
}
+#ifndef SP_REFACTOR
else if ([contextInfo isEqualToString:@"copyDatabase"]) {
if (returnCode == NSOKButton) {
[self _copyDatabase];
}
}
+#endif
else if ([contextInfo isEqualToString:@"renameDatabase"]) {
if (returnCode == NSOKButton) {
[self _renameDatabase];
}
}
+#ifndef SP_REFACTOR
// Close error status sheet for OPTIMIZE, CHECK, REPAIR etc.
else if ([contextInfo isEqualToString:@"statusError"]) {
if (statusValues) [statusValues release], statusValues = nil;
}
-
+#endif
}
+#ifndef SP_REFACTOR /* sheetDidEnd: */
/**
* Show Error sheet (can be called from inside of a endSheet selector)
* via [self performSelector:@selector(showErrorSheetWithTitle:) withObject: afterDelay:]
@@ -2207,6 +2225,7 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
{
queryEditorInitString = [query retain];
}
+#endif
/**
* Invoked when user hits the cancel button or close button in
@@ -2226,6 +2245,7 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
[[sender window] orderOut:self];
}
+#ifndef SP_REFACTOR
/**
* Displays the user account manager.
*/
@@ -4123,8 +4143,7 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
[connection setObject:[connectionController sshHost] forKey:@"ssh_host"];
[connection setObject:[connectionController sshUser] forKey:@"ssh_user"];
[connection setObject:[NSNumber numberWithInt:[connectionController sshKeyLocationEnabled]] forKey:@"ssh_keyLocationEnabled"];
- if ([connectionController sshKeyLocation])
- [connection setObject:[connectionController sshKeyLocation] forKey:@"ssh_keyLocation"];
+ [connection setObject:[connectionController sshKeyLocation] forKey:@"ssh_keyLocation"];
if ([connectionController sshPort] && [[connectionController sshPort] length])
[connection setObject:[NSNumber numberWithInteger:[[connectionController sshPort] integerValue]] forKey:@"ssh_port"];
break;
@@ -4144,8 +4163,11 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
if (includePasswords) {
NSString *pw = [self keychainPasswordForConnection:nil];
- if (!pw) pw = [connectionController password];
- if (pw) [connection setObject:pw forKey:@"password"];
+ if (![pw length]) pw = [connectionController password];
+ if (pw)
+ [connection setObject:pw forKey:@"password"];
+ else
+ [connection setObject:@"" forKey:@"password"];
if ([connectionController type] == SPSSHTunnelConnection) {
NSString *sshpw = [self keychainPasswordForSSHConnection:nil];
@@ -5613,6 +5635,11 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
#endif
if (runningActivitiesArray) [runningActivitiesArray release];
+#ifdef SP_REFACTOR
+ if ( tablesListInstance ) [tablesListInstance release];
+ if ( customQueryInstance ) [customQueryInstance release];
+#endif
+
[super dealloc];
}
@@ -5656,6 +5683,7 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
// Update DB list
[self setDatabases:self];
}
+#endif
- (void)_renameDatabase
{
@@ -5682,6 +5710,20 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
// Update DB list
[self setDatabases:self];
+
+#ifdef SP_REFACTOR
+ if ( delegate && [delegate respondsToSelector:@selector(refreshDatabasePopup)] )
+ [delegate performSelector:@selector(refreshDatabasePopup) withObject:nil];
+
+ if ( delegate && [delegate respondsToSelector:@selector(selectDatabaseInPopup:)] )
+ {
+ if ( [allDatabases count] > 0 )
+ {
+ NSString* db = [databaseRenameNameField stringValue];
+ [delegate performSelector:@selector(selectDatabaseInPopup:) withObject:db];
+ }
+ }
+#endif
}
/**
@@ -5735,7 +5777,21 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
[tablesListInstance setConnection:mySQLConnection];
[tableDumpInstance setConnection:mySQLConnection];
+#ifndef SP_REFACTOR
[self updateWindowTitle:self];
+#endif
+#ifdef SP_REFACTOR /* glue */
+ if ( delegate && [delegate respondsToSelector:@selector(refreshDatabasePopup)] )
+ [delegate performSelector:@selector(refreshDatabasePopup) withObject:nil];
+
+ if ( delegate && [delegate respondsToSelector:@selector(selectDatabaseInPopup:)] )
+ {
+ if ( [allDatabases count] > 0 )
+ {
+ [delegate performSelector:@selector(selectDatabaseInPopup:) withObject:selectedDatabase];
+ }
+ }
+#endif
}
/**
@@ -5774,10 +5830,24 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
[tablesListInstance setConnection:mySQLConnection];
[tableDumpInstance setConnection:mySQLConnection];
+#ifndef SP_REFACTOR
[self updateWindowTitle:self];
+#endif
+#ifdef SP_REFACTOR /* glue */
+ if ( delegate && [delegate respondsToSelector:@selector(refreshDatabasePopup)] )
+ [delegate performSelector:@selector(refreshDatabasePopup) withObject:nil];
+
+ if ( delegate && [delegate respondsToSelector:@selector(selectDatabaseInPopup:)] )
+ {
+ if ( [allDatabases count] > 0 )
+ {
+ NSString* db = [allDatabases objectAtIndex:0];
+ [delegate performSelector:@selector(selectDatabaseInPopup:) withObject:db];
+ }
+ }
+#endif
}
-#endif
/**
* Select the specified database and, optionally, table.
diff --git a/Source/SPFieldEditorController.h b/Source/SPFieldEditorController.h
index 29d4c445..e2cc3195 100644
--- a/Source/SPFieldEditorController.h
+++ b/Source/SPFieldEditorController.h
@@ -32,9 +32,10 @@
* This class offers a sheet for editing different kind of data such as text, blobs (including images) as
* editSheet and bit fields as bitSheet.
*/
+#ifndef SP_REFACTOR
@interface SPFieldEditorController : NSWindowController
-#ifdef SP_REFACTOR
-<NSComboBoxDataSource>
+#else
+@interface SPFieldEditorController : NSWindowController <NSComboBoxDataSource>
#endif
{
IBOutlet id editSheetProgressBar;
diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m
index 4fba243d..3ad7e077 100644
--- a/Source/SPFieldEditorController.m
+++ b/Source/SPFieldEditorController.m
@@ -23,7 +23,9 @@
// More info at <http://code.google.com/p/sequel-pro/>
#import "SPFieldEditorController.h"
+#ifndef SP_REFACTOR
#import "QLPreviewPanel.h"
+#endif
#import "SPDataCellFormatter.h"
#import "RegexKitLite.h"
#import "SPDataCellFormatter.h"
@@ -148,10 +150,12 @@
{
[NSObject cancelPreviousPerformRequestsWithTarget:self];
+#ifndef SP_REFACTOR
// On Mac OSX 10.6 QuickLook runs non-modal thus order out the panel
// if still visible
if([[NSClassFromString(@"QLPreviewPanel") sharedPreviewPanel] isVisible])
[[NSClassFromString(@"QLPreviewPanel") sharedPreviewPanel] orderOut:nil];
+#endif
if ( sheetEditData ) [sheetEditData release];
#ifndef SP_REFACTOR
@@ -828,7 +832,7 @@
*/
- (void)invokeQuickLookOfType:(NSString *)type treatAsText:(BOOL)isText
{
-
+#ifndef SP_REFACTOR
// Load QL via private framework (SDK 10.5)
if([[NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/QuickLookUI.framework"] load]) {
@@ -906,7 +910,7 @@
} else {
[SPTooltip showWithObject:[NSString stringWithFormat:@"QuickLook is not available on that platform."]];
}
-
+#endif
}
/**
@@ -914,6 +918,7 @@
*/
- (void)beginPreviewPanelControl:(id)panel
{
+#ifndef SP_REFACTOR
// This document is now responsible of the preview panel
[panel setDelegate:self];
@@ -921,6 +926,7 @@
// Due to the unknown image format disable image sharing
[panel setShowsAddToiPhotoButton:NO];
+#endif
}
diff --git a/Source/SPIndexesController.h b/Source/SPIndexesController.h
index b91481bc..6b755bcc 100644
--- a/Source/SPIndexesController.h
+++ b/Source/SPIndexesController.h
@@ -29,9 +29,10 @@
@class SPDatabaseDocument, SPTablesList, SPTableData, SPTableStructure, MCPConnection, SPTableView;
#endif
+#ifndef SP_REFACTOR
@interface SPIndexesController : NSWindowController
-#ifdef SP_REFACTOR
-<NSTableViewDelegate, NSTableViewDataSource>
+#else
+@interface SPIndexesController : NSWindowController <NSTableViewDelegate, NSTableViewDataSource>
#endif
{
// Controllers
diff --git a/Source/SPQueryController.h b/Source/SPQueryController.h
index 27756708..fdbddb70 100644
--- a/Source/SPQueryController.h
+++ b/Source/SPQueryController.h
@@ -63,8 +63,12 @@
#endif
}
+#ifndef SP_REFACTOR
+
@property (readwrite, retain) NSFont *consoleFont;
+#endif
+
+ (SPQueryController *)sharedQueryController;
// QueryConsoleController
diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m
index d135b13c..08678f83 100644
--- a/Source/SPQueryController.m
+++ b/Source/SPQueryController.m
@@ -50,8 +50,12 @@ static SPQueryController *sharedQueryController = nil;
@implementation SPQueryController
+#ifndef SP_REFACTOR
+
@synthesize consoleFont;
+#endif
+
/**
* Returns the shared query console.
*/
diff --git a/Source/SPQueryFavoriteManager.h b/Source/SPQueryFavoriteManager.h
index 66d43778..0ebdc837 100644
--- a/Source/SPQueryFavoriteManager.h
+++ b/Source/SPQueryFavoriteManager.h
@@ -31,9 +31,10 @@
@end
+#ifndef SP_REFACTOR
@interface SPQueryFavoriteManager : NSWindowController
-#ifdef SP_REFACTOR
-<NSOpenSavePanelDelegate>
+#else
+@interface SPQueryFavoriteManager : NSWindowController <NSOpenSavePanelDelegate>
#endif
{
#ifndef SP_REFACTOR /* ivars */
diff --git a/Source/SPTableContent.h b/Source/SPTableContent.h
index fcde1f6b..7ca2584d 100644
--- a/Source/SPTableContent.h
+++ b/Source/SPTableContent.h
@@ -31,9 +31,10 @@
@class SPTableData, SPDatabaseDocument, SPTablesList, SPTableStructure, SPTableList;
+#ifndef SP_REFACTOR
@interface SPTableContent : NSObject
-#ifdef SP_REFACTOR
-<NSTableViewDelegate, NSTableViewDataSource, NSComboBoxDataSource, NSComboBoxDelegate>
+#else
+@interface SPTableContent : NSObject <NSTableViewDelegate, NSTableViewDataSource, NSComboBoxDataSource, NSComboBoxDelegate>
#endif
{
IBOutlet SPDatabaseDocument *tableDocumentInstance;
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index f9e66525..768eee12 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -36,7 +36,9 @@
#import "SPTableData.h"
#import "SPQueryController.h"
#import "SPTextAndLinkCell.h"
+#ifndef SP_REFACTOR
#import "QLPreviewPanel.h"
+#endif
#import "SPFieldEditorController.h"
#import "SPTooltip.h"
#import "RegexKitLite.h"
diff --git a/Source/SPTableStructure.h b/Source/SPTableStructure.h
index 9b09b847..0a608b89 100644
--- a/Source/SPTableStructure.h
+++ b/Source/SPTableStructure.h
@@ -27,9 +27,10 @@
@class SPDatabaseDocument, SPTableFieldValidation, SPTableData, SPDatabaseData, SPTablesList, SPIndexesController, SPTableView;
+#ifndef SP_REFACTOR
@interface SPTableStructure : NSObject
-#ifdef SP_REFACTOR
-<NSTableViewDelegate, NSTableViewDataSource>
+#else
+@interface SPTableStructure : NSObject <NSTableViewDelegate, NSTableViewDataSource, NSComboBoxCellDataSource>
#endif
{
IBOutlet SPTablesList* tablesListInstance;
diff --git a/Source/SPTablesList.h b/Source/SPTablesList.h
index 50a5f4c0..baf7a0d5 100644
--- a/Source/SPTablesList.h
+++ b/Source/SPTablesList.h
@@ -26,7 +26,11 @@
#import <MCPKit/MCPKit.h>
@class SPHistoryController, SPTableView;
-@class SPDatabaseDocument;
+@class SPDatabaseDocument, SPDatabaseData, SPTableStructure, SPTableContent;
+
+#ifdef SP_REFACTOR
+@class SQLSidebarViewController;
+#endif
@interface NSObject (NSSplitView)
@@ -38,34 +42,48 @@
@end
@interface SPTablesList : NSObject
+#ifdef SP_REFACTOR
+<NSTextFieldDelegate>
+#endif
{
IBOutlet SPDatabaseDocument* tableDocumentInstance;
+ IBOutlet SPTableStructure* tableSourceInstance;
+ IBOutlet SPTableContent* tableContentInstance;
#ifndef SP_REFACTOR /* ivars */
- IBOutlet id tableSourceInstance;
- IBOutlet id tableContentInstance;
IBOutlet id customQueryInstance;
IBOutlet id tableDumpInstance;
IBOutlet id tableDataInstance;
IBOutlet id extendedTableInfoInstance;
- IBOutlet id databaseDataInstance;
+#endif
+ IBOutlet SPDatabaseData* databaseDataInstance;
+#ifndef SP_REFACTOR /* ivars */
IBOutlet id tableInfoInstance;
IBOutlet id tableTriggersInstance;
IBOutlet SPHistoryController *spHistoryControllerInstance;
IBOutlet id copyTableSheet;
- IBOutlet SPTableView *tablesListView;
+#endif
+ IBOutlet NSTableView *tablesListView;
+#ifndef SP_REFACTOR /* ivars */
IBOutlet id copyTableButton;
IBOutlet id copyTableNameField;
IBOutlet id copyTableMessageField;
IBOutlet NSButton *copyTableContentSwitch;
+#endif
IBOutlet id tableSheet;
IBOutlet id tableNameField;
IBOutlet id tableEncodingButton;
IBOutlet id tableTypeButton;
IBOutlet id toolbarAddButton;
+#ifdef SP_REFACTOR
+ id toolbarDeleteButton;
+#endif
+#ifndef SP_REFACTOR
IBOutlet id toolbarActionsButton;
IBOutlet id toolbarReloadButton;
+#endif
IBOutlet id addTableButton;
+#ifndef SP_REFACTOR
IBOutlet id truncateTableButton;
IBOutlet NSSplitView *tableListSplitView;
IBOutlet NSSplitView *tableListFilterSplitView;
@@ -100,34 +118,32 @@
#endif
NSMutableArray *tables;
-#ifndef SP_REFACTOR /* ivars */
NSMutableArray *filteredTables;
-#endif
NSMutableArray *tableTypes;
-#ifndef SP_REFACTOR /* ivars */
NSMutableArray *filteredTableTypes;
-#endif
NSInteger selectedTableType;
NSString *selectedTableName;
-#ifndef SP_REFACTOR /* ivars */
BOOL isTableListFiltered;
BOOL tableListIsSelectable;
-#endif
BOOL tableListContainsViews;
-#ifndef SP_REFACTOR /* ivars */
BOOL alertSheetOpened;
+#ifndef SP_REFACTOR /* ivars */
NSFont *smallSystemFont;
#endif
+
+#ifdef SP_REFACTOR
+ SQLSidebarViewController* sidebarViewController;
+#endif
}
// IBAction methods
- (IBAction)updateTables:(id)sender;
-#ifndef SP_REFACTOR /* method decls */
- (IBAction)addTable:(id)sender;
- (IBAction)closeSheet:(id)sender;
- (IBAction)removeTable:(id)sender;
+#ifndef SP_REFACTOR /* method decls */
- (IBAction)copyTable:(id)sender;
- (IBAction)renameTable:(id)sender;
- (IBAction)truncateTable:(id)sender;
@@ -168,17 +184,31 @@
- (void) showFilter;
- (void) hideFilter;
- (void) clearFilter;
+#endif
- (IBAction) updateFilter:(id)sender;
// Task interaction
- (void) startDocumentTaskForTab:(NSNotification *)aNotification;
- (void) endDocumentTaskForTab:(NSNotification *)aNotification;
- (void) setTableListSelectability:(BOOL)isSelectable;
-#endif
- (BOOL)isTableNameValid:(NSString *)tableName forType:(SPTableType)tableType;
- (BOOL)isTableNameValid:(NSString *)tableName forType:(SPTableType)tableType ignoringSelectedTable:(BOOL)ignoreSelectedTable;
#ifdef SP_REFACTOR /* method decls */
+@property (assign) SPTableStructure* tableSourceInstance;
+@property (assign) SPTableContent* tableContentInstance;
+@property (assign) id toolbarAddButton;
+@property (assign) id toolbarDeleteButton;
+@property (assign) id tableSheet;
+@property (assign) id tableNameField;
+@property (assign) id tableEncodingButton;
+@property (assign) id tableTypeButton;
+@property (assign) id databaseDataInstance;
+@property (assign) id addTableButton;
+@property (assign) NSTableView* tablesListView;
+@property (assign) SQLSidebarViewController* sidebarViewController;
+
+- (BOOL)selectionShouldChangeInTableView:(NSTableView *)aTableView;
- (void)setDatabaseDocument:(SPDatabaseDocument*)val;
#endif
@end
diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m
index 6cbf5f82..acb366fb 100644
--- a/Source/SPTablesList.m
+++ b/Source/SPTablesList.m
@@ -41,34 +41,63 @@
#import "SPTableView.h"
#import "ImageAndTextCell.h"
#import "RegexKitLite.h"
+#endif
#import "SPDatabaseData.h"
#import "SPAlertSheets.h"
+#ifndef SP_REFACTOR /* headers */
#import "SPNavigatorController.h"
#import "SPHistoryController.h"
+#endif
#import "SPServerSupport.h"
+#ifndef SP_REFACTOR /* headers */
#import "SPWindowController.h"
#import "SPAppController.h"
+#endif
+
+#ifdef SP_REFACTOR
+#import "SQLSidebarViewController.h"
+#endif
// Constants
static NSString *SPAddRow = @"SPAddRow";
static NSString *SPAddNewTable = @"SPAddNewTable";
static NSString *SPRemoveTable = @"SPRemoveTable";
+#ifndef SP_REFACTOR
static NSString *SPTruncateTable = @"SPTruncateTable";
static NSString *SPDuplicateTable = @"SPDuplicateTable";
+#endif
@interface SPTablesList ()
+#ifndef SP_REFACTOR
- (void)_removeTable;
- (void)_truncateTable;
+#endif
- (void)_addTable;
+#ifndef SP_REFACTOR
- (void)_copyTable;
- (void)_renameTableOfType:(SPTableType)tableType from:(NSString *)oldTableName to:(NSString *)newTableName;
+#endif
@end
-#endif
@implementation SPTablesList
+#ifdef SP_REFACTOR
+@synthesize sidebarViewController;
+@synthesize databaseDataInstance;
+@synthesize toolbarAddButton;
+@synthesize toolbarDeleteButton;
+@synthesize tableSourceInstance;
+@synthesize tableContentInstance;
+@synthesize tableSheet;
+@synthesize tableNameField;
+@synthesize tableEncodingButton;
+@synthesize tableTypeButton;
+@synthesize addTableButton;
+@synthesize tablesListView;
+#endif
+
#pragma mark -
#pragma mark IBAction methods
@@ -82,9 +111,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
NSUInteger i;
NSString *previousSelectedTable = nil;
NSString *previousFilterString = nil;
-#ifndef SP_REFACTOR /* table list filtering */
BOOL previousTableListIsSelectable = tableListIsSelectable;
-#endif
BOOL changeEncoding = ![[mySQLConnection encoding] isEqualToString:@"utf8"];
if (selectedTableName) previousSelectedTable = [[NSString alloc] initWithString:selectedTableName];
@@ -99,8 +126,9 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
[[self onMainThread] clearFilter];
}
tableListContainsViews = NO;
-
+#endif
tableListIsSelectable = YES;
+#ifndef SP_REFACTOR
[[tablesListView onMainThread] deselectAll:self];
tableListIsSelectable = previousTableListIsSelectable;
#endif
@@ -278,11 +306,11 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
// or if the table name contains characters which are not supported by the current set encoding
if ( ![sender isKindOfClass:[SPTableData class]] && previousSelectedTable != nil && [tables indexOfObject:previousSelectedTable] < [tables count]) {
NSInteger itemToReselect = [tables indexOfObject:previousSelectedTable];
-#ifndef SP_REFACTOR /* ui manipulation */
tableListIsSelectable = YES;
+#ifndef SP_REFACTOR /* ui manipulation */
[[tablesListView onMainThread] selectRowIndexes:[NSIndexSet indexSetWithIndex:itemToReselect] byExtendingSelection:NO];
- tableListIsSelectable = previousTableListIsSelectable;
#endif
+ tableListIsSelectable = previousTableListIsSelectable;
if (selectedTableName) [selectedTableName release];
selectedTableName = [[NSString alloc] initWithString:[tables objectAtIndex:itemToReselect]];
selectedTableType = (SPTableType)[[tableTypes objectAtIndex:itemToReselect] integerValue];
@@ -323,7 +351,6 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
// User press refresh button ergo force update
[NSThread detachNewThreadSelector:@selector(queryDbStructureWithUserInfo:) toTarget:mySQLConnection withObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], @"forceUpdate", [NSNumber numberWithBool:YES], @"cancelQuerying", nil]];
}
-#ifndef SP_REFACTOR /* whole table operations */
/**
* Adds a new table to the tables-array (no changes in mysql-db)
@@ -340,7 +367,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
NSArray *engines = [databaseDataInstance getDatabaseStorageEngines];
// Add default menu item
- [tableTypeButton addItemWithTitle:NSLocalizedString(@"Default",@"New Table Sheet : Table Engine Dropdown : Default")];
+ [tableTypeButton addItemWithTitle:@"Default"];
[[tableTypeButton menu] addItem:[NSMenuItem separatorItem]];
for (NSDictionary *engine in engines)
@@ -350,7 +377,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
// Populate the table encoding popup button with a default menu item
[tableEncodingButton removeAllItems];
- [tableEncodingButton addItemWithTitle:NSLocalizedString(@"Default",@"New Table Sheet : Table Encoding Dropdown : Default")];
+ [tableEncodingButton addItemWithTitle:@"Default"];
// Retrieve the server-supported encodings and add them to the menu
NSArray *encodings = [databaseDataInstance getDatabaseCharacterSetEncodings];
@@ -481,6 +508,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
[alert beginSheetModalForWindow:[tableDocumentInstance parentWindow] modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:SPRemoveTable];
}
+#ifndef SP_REFACTOR /* whole table operations */
/**
* Copies a table/view/proc/func, if desired with content
*/
@@ -651,6 +679,8 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
[tableInfoCollapseButton setToolTip:([tableInfoCollapseButton state] == NSOffState) ? NSLocalizedString(@"Show Table Information", @"Show Table Information") : NSLocalizedString(@"Hide Table Information", @"Hide Table Information")];
}
+#endif
+
#pragma mark -
#pragma mark Alert sheet methods
@@ -673,28 +703,31 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
[self performSelector:@selector(_removeTable) withObject:nil afterDelay:0.0];
}
}
+#ifndef SP_REFACTOR
else if ([contextInfo isEqualToString:SPTruncateTable]) {
if (returnCode == NSAlertDefaultReturn) {
[self _truncateTable];
}
}
- else if ([contextInfo isEqualToString:SPAddNewTable]) {
+ else
+#endif
+ if ([contextInfo isEqualToString:SPAddNewTable]) {
if (returnCode == NSOKButton) {
[self _addTable];
}
}
+#ifndef SP_REFACTOR
else if ([contextInfo isEqualToString:SPDuplicateTable]) {
if (returnCode == NSOKButton) {
[self _copyTable];
}
}
+#endif
}
#pragma mark -
#pragma mark Additional methods
-#endif
-
/**
* Sets the connection (received from SPDatabaseDocument) and makes things that have to be done only once
*/
@@ -704,8 +737,6 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
[self updateTables:self];
}
-#ifndef SP_REFACTOR /* ui validation */
-
/**
* Performs interface validation for various controls.
*/
@@ -716,10 +747,12 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
if (object == tableNameField) {
[addTableButton setEnabled:[self isTableNameValid:[tableNameField stringValue] forType: SPTableTypeTable]];
}
+#ifndef SP_REFACTOR
else if (object == copyTableNameField) {
[copyTableButton setEnabled:[self isTableNameValid:[copyTableNameField stringValue] forType:[self tableType]]];
}
+#endif
}
/**
@@ -737,11 +770,13 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
if (object == tableNameField) {
[addTableButton performClick:object];
}
+#ifndef SP_REFACTOR
else if (object == copyTableNameField) {
[copyTableButton performClick:object];
}
-}
#endif
+}
+
/**
* Updates application state to match the current selection, including
@@ -755,12 +790,16 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
{
// First handle empty or multiple selections
if (!selectionDetails || ![selectionDetails objectForKey:@"name"]) {
-#ifndef SP_REFACTOR /* ui manipulation */
NSIndexSet *indexes = [tablesListView selectedRowIndexes];
-#endif
// Update the selected table name and type
if (selectedTableName) [selectedTableName release];
- selectedTableName = nil;
+
+ if ([indexes count]) {
+ selectedTableName = [[NSString alloc] initWithString:@""];
+ }
+ else {
+ selectedTableName = nil;
+ }
#ifndef SP_REFACTOR /* ui manipulation */
// Set gear menu items Remove/Duplicate table/view according to the table types
@@ -1268,9 +1307,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
if (selectedTableName) [selectedTableName release];
selectedTableName = [[NSString alloc] initWithString:[tables objectAtIndex:itemIndex]];
selectedTableType = [[tableTypes objectAtIndex:itemIndex] integerValue];
-#ifndef SP_REFACTOR /* table list filtering */
[self updateFilter:self];
-#endif
[tableDocumentInstance loadTable:selectedTableName ofType:selectedTableType];
#ifndef SP_REFACTOR /* table list filtering */
}
@@ -1424,8 +1461,6 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
}
-#ifndef SP_REFACTOR
-
/**
* Renames a table (in tables-array and mysql-db).
*/
@@ -1485,7 +1520,6 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
// Query the structure of all databases in the background (mainly for completion)
[NSThread detachNewThreadSelector:@selector(queryDbStructureWithUserInfo:) toTarget:mySQLConnection withObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], @"forceUpdate", nil]];
}
-#endif
#pragma mark -
#pragma mark TableView delegate methods
@@ -1513,6 +1547,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
return FALSE;
}
}
+#endif
/**
* Table view delegate method
@@ -1534,6 +1569,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
return [tableDocumentInstance couldCommitCurrentViewActions];
}
+#ifndef SP_REFACTOR
/**
* Loads a table in content or source view (if tab selected)
*/
@@ -1542,12 +1578,8 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
if ([tablesListView numberOfSelectedRows] != 1) {
// Ensure the state is cleared
- if ([tableDocumentInstance table]) {
- [tableDocumentInstance loadTable:nil ofType:SPTableTypeNone];
- } else {
- [self setSelectionState:nil];
- [tableInfoInstance tableChanged:nil];
- }
+ if ([tableDocumentInstance table]) [tableDocumentInstance loadTable:nil ofType:SPTableTypeNone];
+ else [self setSelectionState:nil];
if (selectedTableName) [selectedTableName release], selectedTableName = nil;
selectedTableType = SPTableTypeNone;
return;
@@ -1785,6 +1817,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
}
}
+#endif
/**
* Update the filter search.
@@ -1798,6 +1831,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
if (selectedTableName) [selectedTableName release], selectedTableName = nil;
}
+#ifndef SP_REFACTOR
if ([[listFilterField stringValue] length]) {
if (isTableListFiltered) {
[filteredTables release];
@@ -1860,14 +1894,25 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
} else if (isTableListFiltered) {
isTableListFiltered = NO;
[filteredTables release];
+#endif
filteredTables = tables;
+#ifndef SP_REFACTOR
[filteredTableTypes release];
filteredTableTypes = tableTypes;
}
+#endif
+#ifdef SP_REFACTOR
+ [sidebarViewController setTableNames:[self allTableNames]];
+#endif
+
// Reselect correct row and reload the table view display
if ([tablesListView numberOfRows] < (NSInteger)[filteredTables count]) [tablesListView noteNumberOfRowsChanged];
- if (selectedTableName) [tablesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:[filteredTables indexOfObject:selectedTableName]] byExtendingSelection:NO];
+ if (selectedTableName) [tablesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:[filteredTables indexOfObject:selectedTableName]
+#ifdef SP_REFACTOR
+ - 1
+#endif
+ ] byExtendingSelection:NO];
[tablesListView reloadData];
}
@@ -1878,8 +1923,13 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
- (void) selectTableAtIndex:(NSNumber *)row
{
NSUInteger rowIndex = [row unsignedIntegerValue];
+#ifndef SP_REFACTOR
if (rowIndex == NSNotFound || rowIndex > [filteredTables count] || [[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SPTableTypeNone)
return;
+#else
+ if (rowIndex == NSNotFound)
+ return;
+#endif
[tablesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:rowIndex] byExtendingSelection:NO];
}
@@ -1894,8 +1944,10 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
{
tableListIsSelectable = NO;
[toolbarAddButton setEnabled:NO];
+#ifndef SP_REFACTOR
[toolbarActionsButton setEnabled:NO];
[toolbarReloadButton setEnabled:NO];
+#endif
}
/**
@@ -1905,8 +1957,10 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
{
tableListIsSelectable = YES;
[toolbarAddButton setEnabled:YES];
+#ifndef SP_REFACTOR
[toolbarActionsButton setEnabled:YES];
[toolbarReloadButton setEnabled:YES];
+#endif
}
/**
@@ -1917,6 +1971,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
tableListIsSelectable = isSelectable;
}
+#ifndef SP_REFACTOR
#pragma mark -
#pragma mark SplitView Delegate Methods
@@ -1937,15 +1992,11 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
{
if ((self = [super init])) {
tables = [[NSMutableArray alloc] init];
-#ifndef SP_REFACTOR
filteredTables = tables;
-#endif
tableTypes = [[NSMutableArray alloc] init];
-#ifndef SP_REFACTOR
filteredTableTypes = tableTypes;
isTableListFiltered = NO;
tableListIsSelectable = YES;
-#endif
tableListContainsViews = NO;
selectedTableType = SPTableTypeNone;
selectedTableName = nil;
@@ -1958,13 +2009,12 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
return self;
}
-#ifndef SP_REFACTOR /* awakeFromNib */
/**
* Standard awakeFromNib method for interface loading.
*/
- (void)awakeFromNib
{
-
+#ifndef SP_REFACTOR
// Collapse the table information pane if preference to do so is set
if ([[[NSUserDefaults standardUserDefaults] objectForKey:SPTableInformationPanelCollapsed] boolValue]
&& [tableListSplitView collapsibleSubview]) {
@@ -1990,6 +2040,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
// Disable tab edit behaviour in the tables list
[tablesListView setTabEditingDisabled:YES];
+#endif
// Add observers for document task activity
[[NSNotificationCenter defaultCenter] addObserver:self
@@ -2001,11 +2052,10 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
name:SPDocumentTaskEndNotification
object:tableDocumentInstance];
-
+#ifndef SP_REFACTOR
[tablesListView registerForDraggedTypes:[NSArray arrayWithObjects:SPNavigatorTableDataPasteboardDragType, nil]];
-
-}
#endif
+}
/**
* Standard dealloc method.
@@ -2091,7 +2141,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
[alert addButtonWithTitle:NSLocalizedString(@"Stop", @"stop button")];
}
[alert setMessageText:NSLocalizedString(@"Error", @"error")];
- [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Couldn't delete '%@'.\n\nMySQL said: %@", @"message of panel when an item cannot be deleted"), [filteredTables objectAtIndex:currentIndex], [mySQLConnection getLastErrorMessage]]];
+ [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Couldn't delete '%@'.\nMySQL said: %@", @"message of panel when an item cannot be deleted"), [tables objectAtIndex:currentIndex], [mySQLConnection getLastErrorMessage]]];
[alert setAlertStyle:NSWarningAlertStyle];
if ([indexes indexLessThanIndex:currentIndex] == NSNotFound) {
[alert beginSheetModalForWindow:[tableDocumentInstance parentWindow] modalDelegate:self didEndSelector:nil contextInfo:nil];
@@ -2170,6 +2220,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
[tableDataInstance resetStatusData];
}
+#endif
/**
* Adds a new table table to the database using the selected character set encoding and storage engine.
@@ -2201,7 +2252,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
engineStatement = [NSString stringWithFormat:@"%@ = %@", [[tableDocumentInstance serverSupport] engineTypeQueryName], [tableType backtickQuotedString]];
}
- NSString *createStatement = [NSString stringWithFormat:@"CREATE TABLE %@ (id INT(11) UNSIGNED NOT NULL%@) %@ %@", [tableName backtickQuotedString], [tableType isEqualToString:@"CSV"] ? @"" : @" PRIMARY KEY AUTO_INCREMENT", charSetStatement, engineStatement];
+ NSString *createStatement = [NSString stringWithFormat:@"CREATE TABLE %@ (%@) %@ %@", [tableName backtickQuotedString], ([tableType isEqualToString:@"CSV"]) ? @"id INT NOT NULL" : @"id INT", charSetStatement, engineStatement];
// Create the table
[mySQLConnection queryString:createStatement];
@@ -2247,7 +2298,9 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
// Select the newly created table and switch to the table structure view for easier setup
[tableDocumentInstance loadTable:selectedTableName ofType:selectedTableType];
+#ifndef SP_REFACTOR
[tableDocumentInstance viewStructure:self];
+#endif
// Query the structure of all databases in the background (mainly for completion)
[NSThread detachNewThreadSelector:@selector(queryDbStructureWithUserInfo:) toTarget:mySQLConnection withObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], @"forceUpdate", nil]];
@@ -2270,6 +2323,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
[tableNameField setStringValue:@""];
}
+#ifndef SP_REFACTOR
/**
* Copies the currently selected object (table, view, procedure, function, etc.).
*/