diff options
author | drx777 <david.rekowski@gmx.de> | 2010-04-29 18:00:09 +0000 |
---|---|---|
committer | drx777 <david.rekowski@gmx.de> | 2010-04-29 18:00:09 +0000 |
commit | 47d42106c45d7663c05aaf6d3f0feab71798b51c (patch) | |
tree | 8d33140d9ed7713318bd4dcf1ec40c67fbceb385 /Source | |
parent | a980040e8546060e71166c363d2247407af12179 (diff) | |
download | sequelpro-47d42106c45d7663c05aaf6d3f0feab71798b51c.tar.gz sequelpro-47d42106c45d7663c05aaf6d3f0feab71798b51c.tar.bz2 sequelpro-47d42106c45d7663c05aaf6d3f0feab71798b51c.zip |
Added class SPDBActionCommons providing common functionality to all derived DatabaseActions classes, thus reducing code duplicates.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPDBActionCommons.h | 54 | ||||
-rw-r--r-- | Source/SPDBActionCommons.m | 36 | ||||
-rw-r--r-- | Source/SPDatabaseCopy.h | 18 | ||||
-rw-r--r-- | Source/SPDatabaseCopy.m | 9 | ||||
-rw-r--r-- | Source/SPDatabaseInfo.h | 18 | ||||
-rw-r--r-- | Source/SPDatabaseInfo.m | 7 | ||||
-rw-r--r-- | Source/SPDatabaseRename.h | 19 | ||||
-rw-r--r-- | Source/SPDatabaseRename.m | 9 | ||||
-rw-r--r-- | Source/SPTableCopy.h | 17 | ||||
-rw-r--r-- | Source/SPTableCopy.m | 8 |
10 files changed, 102 insertions, 93 deletions
diff --git a/Source/SPDBActionCommons.h b/Source/SPDBActionCommons.h new file mode 100644 index 00000000..042fd5dc --- /dev/null +++ b/Source/SPDBActionCommons.h @@ -0,0 +1,54 @@ +// +// $Id$ +// +// SPDBActionCommons.h +// sequel-pro +// +// Created by David Rekowski on Apr 29, 2010 +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at <http://code.google.com/p/sequel-pro/> + +#import <Foundation/Foundation.h> +#import <Cocoa/Cocoa.h> +#import <MCPKit/MCPConnection.h> +#import <MCPKit/MCPResult.h> +#import "SPAlertSheets.h" +#import "SPStringAdditions.h" +#import "Sequel-Pro.pch" + +@interface SPDBActionCommons : NSObject { + MCPConnection *connection; + NSObject *parent; + NSDocument *messageDocument; +} + +/** + * @property MCPConnection references the MCPKit connection to MySQL; it has to be set. + */ +@property (retain) MCPConnection *connection; + +/** + * @property the parent object that issues the action, needs to provide stuff like tableWindow for messages + */ +@property (retain) NSObject *parent; + +/** + * @property the NSDocument instance to send message sheets to + */ +@property (retain) NSDocument *messageDocument; + +@end diff --git a/Source/SPDBActionCommons.m b/Source/SPDBActionCommons.m new file mode 100644 index 00000000..c0580622 --- /dev/null +++ b/Source/SPDBActionCommons.m @@ -0,0 +1,36 @@ +// +// $Id$ +// +// SPDBActionCommons.m +// sequel-pro +// +// Created by David Rekowski on Apr 29, 2010 +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at <http://code.google.com/p/sequel-pro/> + +#import "SPDBActionCommons.h" +#import "SPAlertSheets.h" +#import "SPStringAdditions.h" +#import "Sequel-Pro.pch" + +@implementation SPDBActionCommons + +@synthesize connection; +@synthesize parent; +@synthesize messageDocument; + +@end diff --git a/Source/SPDatabaseCopy.h b/Source/SPDatabaseCopy.h index 48219298..3776d5a1 100644 --- a/Source/SPDatabaseCopy.h +++ b/Source/SPDatabaseCopy.h @@ -23,36 +23,22 @@ // More info at <http://code.google.com/p/sequel-pro/> -#import <Foundation/Foundation.h> -#import <MCPKit/MCPConnection.h> +#import "SPDBActionCommons.h" #import "SPDatabaseInfo.h" /** * The SPDatabaseCopy class povides functionality to create a copy of a database. */ -@interface SPDatabaseCopy : NSObject { - MCPConnection *connection; +@interface SPDatabaseCopy : SPDBActionCommons { SPDatabaseInfo *dbInfo; - NSObject *parent; } /** - * @property MCPConnection references the MCPKit connection to MySQL; it has to be set. - */ -@property (retain) MCPConnection *connection; - -/** * @property SPDatabaseInfo an instance of the database info class */ @property (retain) SPDatabaseInfo *dbInfo; /** - * @property the parent object that issues the action, needs to provide stuff like tableWindow for messages - */ -@property (retain) NSObject *parent; - - -/** * This method retrieves the dbInfo object if it exists; otherwise it is generated and the * connection is passed to it. * diff --git a/Source/SPDatabaseCopy.m b/Source/SPDatabaseCopy.m index e12d650c..e5daae0c 100644 --- a/Source/SPDatabaseCopy.m +++ b/Source/SPDatabaseCopy.m @@ -22,20 +22,13 @@ // // More info at <http://code.google.com/p/sequel-pro/> -#import <MCPKit/MCPConnection.h> -#import <MCPKit/MCPResult.h> -#import "SPAlertSheets.h" -#import "SPStringAdditions.h" +#import "SPDBActionCommons.h" #import "SPDatabaseCopy.h" #import "SPTableCopy.h" -#import "SPDatabaseInfo.h" -#import "Sequel-Pro.pch" @implementation SPDatabaseCopy -@synthesize connection; @synthesize dbInfo; -@synthesize parent; - (SPDatabaseInfo *)getDBInfoObject { if (dbInfo != nil) { diff --git a/Source/SPDatabaseInfo.h b/Source/SPDatabaseInfo.h index 45583e5c..3f68b773 100644 --- a/Source/SPDatabaseInfo.h +++ b/Source/SPDatabaseInfo.h @@ -22,29 +22,15 @@ // // More info at <http://code.google.com/p/sequel-pro/> -#import <Foundation/Foundation.h> -#import "MCPConnection.h" -#import "MCPResult.h" +#import "SPDBActionCommons.h" /* * The SPDatabaseInfo class provides means of retrieving a list of database names */ -@interface SPDatabaseInfo : NSObject { - MCPConnection *connection; - NSObject *parent; +@interface SPDatabaseInfo : SPDBActionCommons { } /** - * @property MCPConnection references the MCPKit connection to MySQL; it has to be set. - */ -@property (retain) MCPConnection *connection; - -/** - * @property the parent object that issues the action, needs to provide stuff like tableWindow for messages - */ -@property (retain) NSObject *parent; - -/** * This method checks, whether a database exists. * * @param databaseName the name of the database to check diff --git a/Source/SPDatabaseInfo.m b/Source/SPDatabaseInfo.m index 6e5cbcc6..9dbf2098 100644 --- a/Source/SPDatabaseInfo.m +++ b/Source/SPDatabaseInfo.m @@ -22,16 +22,11 @@ // // More info at <http://code.google.com/p/sequel-pro/> -#import "SPAlertSheets.h" +#import "SPDBActionCommons.h" #import "SPDatabaseInfo.h" -#import "SPStringAdditions.h" -#import "Sequel-Pro.pch" @implementation SPDatabaseInfo -@synthesize connection; -@synthesize parent; - - (NSObject *)getTableWindow { return [NSApp mainWindow]; } diff --git a/Source/SPDatabaseRename.h b/Source/SPDatabaseRename.h index 9085cc54..bd52a86f 100644 --- a/Source/SPDatabaseRename.h +++ b/Source/SPDatabaseRename.h @@ -23,37 +23,22 @@ // More info at <http://code.google.com/p/sequel-pro/> -#import <Foundation/Foundation.h> -#import <MCPKit/MCPConnection.h> +#import "SPDBActionCommons.h" #import "SPDatabaseInfo.h" -#import "SPStringAdditions.h" /** * The SPDatabaseRename class povides functionality to rename a database. */ -@interface SPDatabaseRename : NSObject { - MCPConnection *connection; +@interface SPDatabaseRename : SPDBActionCommons { SPDatabaseInfo *dbInfo; - NSObject *parent; } /** - * @property MCPConnection references the MCPKit connection to MySQL; it has to be set. - */ -@property (retain) MCPConnection *connection; - -/** * @property SPDatabaseInfo an instance of the database info class */ @property (retain) SPDatabaseInfo *dbInfo; /** - * @property the parent object that issues the action, needs to provide stuff like tableWindow for messages - */ -@property (retain) NSObject *parent; - - -/** * This method retrieves the dbInfo object if it exists; otherwise it is generated and the * connection is passed to it. * diff --git a/Source/SPDatabaseRename.m b/Source/SPDatabaseRename.m index 7ff91b29..75478412 100644 --- a/Source/SPDatabaseRename.m +++ b/Source/SPDatabaseRename.m @@ -23,20 +23,13 @@ // More info at <http://code.google.com/p/sequel-pro/> -#import <MCPKit/MCPConnection.h> -#import <MCPKit/MCPResult.h> -#import "SPAlertSheets.h" -#import "SPStringAdditions.h" +#import "SPDBActionCommons.h" #import "SPDatabaseRename.h" -#import "SPDatabaseInfo.h" #import "SPTableCopy.h" -#import "Sequel-Pro.pch" @implementation SPDatabaseRename -@synthesize connection; @synthesize dbInfo; -@synthesize parent; - (SPDatabaseInfo *)getDBInfoObject { if (dbInfo != nil) { diff --git a/Source/SPTableCopy.h b/Source/SPTableCopy.h index a9c1f389..37ed452a 100644 --- a/Source/SPTableCopy.h +++ b/Source/SPTableCopy.h @@ -22,28 +22,15 @@ // // More info at <http://code.google.com/p/sequel-pro/> -#import <Foundation/Foundation.h> -#import <MCPKit/MCPConnection.h> +#import "SPDBActionCommons.h" /** * The SPTableCopy class povides functionality to copy tables between databases. */ -@interface SPTableCopy : NSObject { - MCPConnection *connection; - NSObject *parent; +@interface SPTableCopy : SPDBActionCommons { } /** - * @property MCPConnection references the MCPKit connection to MySQL; it has to be set. - */ -@property (retain) MCPConnection *connection; - -/** - * @property the parent object that issues the action, needs to provide stuff like tableWindow for messages - */ -@property (retain) NSObject *parent; - -/** * This method copies a table structure from one db to another. * * @param name name of the table in the source database diff --git a/Source/SPTableCopy.m b/Source/SPTableCopy.m index f9bb159a..6a73bb20 100644 --- a/Source/SPTableCopy.m +++ b/Source/SPTableCopy.m @@ -22,17 +22,11 @@ // // More info at <http://code.google.com/p/sequel-pro/> -#import <MCPKit/MCPConnection.h> -#import "SPAlertSheets.h" -#import "SPStringAdditions.h" +#import "SPDBActionCommons.h" #import "SPTableCopy.h" -#import "Sequel-Pro.pch" @implementation SPTableCopy -@synthesize connection; -@synthesize parent; - - (NSObject *)getTableWindow { return [NSApp mainWindow]; } |