mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-02-21 10:30:58 +00:00
DBModeler/ConsistencyChecker.m (+modelConsistencyCheck:): Honor
validation preferences. DBModeler/Modeler.m (-new:): Reimplement. (-setAdaptor:): Bail out it adaptor cannot be located. (-application:openFile:): Fine tune path checking and correct return values. (-openPrefs:): Implement. * DBModeler/Inspectors/RelationshipInspector.m (-displayName): Implement. (-selectedEntity): Validate selected row before commencing. (-selectedDestinationAttribute): Reimplement. (-updateConnectButton): Update enabled state of connect button. (-refresh): Correct handling of src/destAttrib_tableView. (-tableViewSelectionDidChange:): Allways call updateConnectButton. * DBModeler/SQLGenerator.m (-openSQLGenerator:): Reimplement. (-executeSQL:): Handle invalid adpator or connection information. (-saveAs:): Handle abort correctly. (-generate): Handle missing expression class. * DBModeler/ModelerTableEmbedibleEditor.h * DBModeler/ModelerEntityEditor.m (initWithParentEditor:): Correct autoresize behavior. (-activate): Update selection. (-needToFetch:): Do not reloadData in _topTable. (-displayGroupDidChangeSelection:): Update selection on parent. * DBModeler/ModelerTableEmbedibleEditor.m (-addDefaultTableColumnsForTableView:displayGroup:): Call tile instead of sizeToFit. * DBModeler/EOAdditions.m: Fix leaks. (setIsClassProperty): Reimplement. (-[setIsPrimaryKey:]): Ditto. (-[setIsClassProperty:]): Correct call to function. (-[isUsedForLocking]): Implement. (-[setIsUsedForLocking:]): Ditto. * DBModeler/MainModelEditor.h * DBModeler/MainModelEditor.m: Update view handling. * DBModeler/DefaultColumnProvider.m: Update handling of properties. * DBModeler/ModelerAttributeEditor.m: Update general GUI interaction. * DBModeler/Preferences.h: New file. * DBModeler/Preferences.m: Ditto. * DBModeler/Inspectors/RelationshipInspector.tiff: New file. * DBModeler/Inspectors/GNUmakefile: Add new file. * DBModeler/Resources/Preferences.gorm: New files. * DBModeler/Resources/Key_Header.tiff: Ditto. * DBModeler/Resources/ClassProperty_Header.tiff: Ditto. * DBModeler/Resources/Locking_On.tiff: Ditto. * DBModeler/Resources/Key_On.tiff: Ditto. * DBModeler/GNUmakefile: Add new files. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@23397 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5109a54a70
commit
efecac5875
27 changed files with 776 additions and 185 deletions
48
ChangeLog
48
ChangeLog
|
@ -52,6 +52,54 @@
|
||||||
(-[EOModelerEmbedibleEditor dealloc]): Implement.
|
(-[EOModelerEmbedibleEditor dealloc]): Implement.
|
||||||
(-[EOModelerEmbedibleEditor initWithParentEditor:]): Observe
|
(-[EOModelerEmbedibleEditor initWithParentEditor:]): Observe
|
||||||
EOMSelectionChangedNotification.
|
EOMSelectionChangedNotification.
|
||||||
|
|
||||||
|
DBModeler/ConsistencyChecker.m (+modelConsistencyCheck:): Honor
|
||||||
|
validation preferences.
|
||||||
|
DBModeler/Modeler.m (-new:): Reimplement.
|
||||||
|
(-setAdaptor:): Bail out it adaptor cannot be located.
|
||||||
|
(-application:openFile:): Fine tune path checking and correct return
|
||||||
|
values.
|
||||||
|
(-openPrefs:): Implement.
|
||||||
|
* DBModeler/Inspectors/RelationshipInspector.m
|
||||||
|
(-displayName): Implement.
|
||||||
|
(-selectedEntity): Validate selected row before commencing.
|
||||||
|
(-selectedDestinationAttribute): Reimplement.
|
||||||
|
(-updateConnectButton): Update enabled state of connect button.
|
||||||
|
(-refresh): Correct handling of src/destAttrib_tableView.
|
||||||
|
(-tableViewSelectionDidChange:): Allways call updateConnectButton.
|
||||||
|
* DBModeler/SQLGenerator.m (-openSQLGenerator:): Reimplement.
|
||||||
|
(-executeSQL:): Handle invalid adpator or connection information.
|
||||||
|
(-saveAs:): Handle abort correctly.
|
||||||
|
(-generate): Handle missing expression class.
|
||||||
|
* DBModeler/ModelerTableEmbedibleEditor.h
|
||||||
|
* DBModeler/ModelerEntityEditor.m (initWithParentEditor:): Correct
|
||||||
|
autoresize behavior.
|
||||||
|
(-activate): Update selection.
|
||||||
|
(-needToFetch:): Do not reloadData in _topTable.
|
||||||
|
(-displayGroupDidChangeSelection:): Update selection on parent.
|
||||||
|
* DBModeler/ModelerTableEmbedibleEditor.m
|
||||||
|
(-addDefaultTableColumnsForTableView:displayGroup:): Call tile instead
|
||||||
|
of sizeToFit.
|
||||||
|
* DBModeler/EOAdditions.m: Fix leaks.
|
||||||
|
(setIsClassProperty): Reimplement.
|
||||||
|
(-[setIsPrimaryKey:]): Ditto.
|
||||||
|
(-[setIsClassProperty:]): Correct call to function.
|
||||||
|
(-[isUsedForLocking]): Implement.
|
||||||
|
(-[setIsUsedForLocking:]): Ditto.
|
||||||
|
* DBModeler/MainModelEditor.h
|
||||||
|
* DBModeler/MainModelEditor.m: Update view handling.
|
||||||
|
* DBModeler/DefaultColumnProvider.m: Update handling of properties.
|
||||||
|
* DBModeler/ModelerAttributeEditor.m: Update general GUI interaction.
|
||||||
|
* DBModeler/Preferences.h: New file.
|
||||||
|
* DBModeler/Preferences.m: Ditto.
|
||||||
|
* DBModeler/Inspectors/RelationshipInspector.tiff: New file.
|
||||||
|
* DBModeler/Inspectors/GNUmakefile: Add new file.
|
||||||
|
* DBModeler/Resources/Preferences.gorm: New files.
|
||||||
|
* DBModeler/Resources/Key_Header.tiff: Ditto.
|
||||||
|
* DBModeler/Resources/ClassProperty_Header.tiff: Ditto.
|
||||||
|
* DBModeler/Resources/Locking_On.tiff: Ditto.
|
||||||
|
* DBModeler/Resources/Key_On.tiff: Ditto.
|
||||||
|
* DBModeler/GNUmakefile: Add new files.
|
||||||
|
|
||||||
2006-05-09 Matt Rice <ratmice@yahoo.com>
|
2006-05-09 Matt Rice <ratmice@yahoo.com>
|
||||||
David Ayers <ayers@fsfe.org>
|
David Ayers <ayers@fsfe.org>
|
||||||
|
|
|
@ -23,9 +23,8 @@
|
||||||
</license>
|
</license>
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <Foundation/NSNotification.h>
|
|
||||||
|
|
||||||
#include "ConsistencyChecker.h"
|
#include "ConsistencyChecker.h"
|
||||||
|
#include "Preferences.h"
|
||||||
|
|
||||||
#include <EOModeler/EOModelerApp.h>
|
#include <EOModeler/EOModelerApp.h>
|
||||||
#include <EOModeler/EOModelerDocument.h>
|
#include <EOModeler/EOModelerDocument.h>
|
||||||
|
@ -36,6 +35,8 @@
|
||||||
#include <EOAccess/EOModel.h>
|
#include <EOAccess/EOModel.h>
|
||||||
#include <EOAccess/EORelationship.h>
|
#include <EOAccess/EORelationship.h>
|
||||||
|
|
||||||
|
#include <Foundation/NSNotification.h>
|
||||||
|
|
||||||
#define MY_PRETTY NSMutableAttributedString \
|
#define MY_PRETTY NSMutableAttributedString \
|
||||||
mutableAttributedStringWithBoldSubstitutionsWithFormat
|
mutableAttributedStringWithBoldSubstitutionsWithFormat
|
||||||
|
|
||||||
|
@ -366,6 +367,7 @@ static BOOL isInvalid(NSString *str)
|
||||||
NSArray *arr;
|
NSArray *arr;
|
||||||
unsigned i, c, j, d;
|
unsigned i, c, j, d;
|
||||||
BOOL flag = YES;
|
BOOL flag = YES;
|
||||||
|
|
||||||
for (i = 0,c = [ents count]; i < c; i++)
|
for (i = 0,c = [ents count]; i < c; i++)
|
||||||
{
|
{
|
||||||
EOEntity *entity = [ents objectAtIndex:i];
|
EOEntity *entity = [ents objectAtIndex:i];
|
||||||
|
@ -405,12 +407,28 @@ static BOOL isInvalid(NSString *str)
|
||||||
{
|
{
|
||||||
EOModel *model = [[notif userInfo] objectForKey:EOMConsistencyModelObjectKey];
|
EOModel *model = [[notif userInfo] objectForKey:EOMConsistencyModelObjectKey];
|
||||||
doc = [notif object];
|
doc = [notif object];
|
||||||
/* TODO user defaults */
|
|
||||||
[self attributeDetailsCheckForModel:model];
|
if ([[DBModelerPrefs sharedPreferences] attributeDetailsCheck])
|
||||||
[self primaryKeyCheckForModel:model];
|
[self attributeDetailsCheckForModel:model];
|
||||||
[self externalNameCheckForModel:model];
|
|
||||||
[self relationshipCheckForModel:model];
|
if ([[DBModelerPrefs sharedPreferences] primaryKeyCheck])
|
||||||
[self inheritanceCheckForModel:model];
|
[self primaryKeyCheckForModel:model];
|
||||||
|
|
||||||
|
if ([[DBModelerPrefs sharedPreferences] externalNameCheck])
|
||||||
|
[self externalNameCheckForModel:model];
|
||||||
|
|
||||||
|
if ([[DBModelerPrefs sharedPreferences] relationshipCheck])
|
||||||
|
[self relationshipCheckForModel:model];
|
||||||
|
|
||||||
|
if ([[DBModelerPrefs sharedPreferences] inheritanceCheck])
|
||||||
|
[self inheritanceCheckForModel:model];
|
||||||
|
|
||||||
|
if ([[DBModelerPrefs sharedPreferences] storedProcedureCheck])
|
||||||
|
[self storedProcedureCheckForModel:model];
|
||||||
|
|
||||||
|
if ([[DBModelerPrefs sharedPreferences] entityStoredProcedureCheck])
|
||||||
|
[self entityStoredProcedureCheckForModel:model];
|
||||||
|
|
||||||
doc = nil;
|
doc = nil;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include <EOAccess/EOEntity.h>
|
#include <EOAccess/EOEntity.h>
|
||||||
|
|
||||||
#include <AppKit/NSTableColumn.h>
|
#include <AppKit/NSTableColumn.h>
|
||||||
|
#include <AppKit/NSTableHeaderCell.h>
|
||||||
#include <AppKit/NSCell.h>
|
#include <AppKit/NSCell.h>
|
||||||
#include <AppKit/NSTextFieldCell.h>
|
#include <AppKit/NSTextFieldCell.h>
|
||||||
#include <AppKit/NSButtonCell.h>
|
#include <AppKit/NSButtonCell.h>
|
||||||
|
@ -42,43 +43,49 @@
|
||||||
#include <Foundation/NSDictionary.h>
|
#include <Foundation/NSDictionary.h>
|
||||||
|
|
||||||
#define DICTSIZE(dict) (sizeof(dict) / sizeof(dict[0]))
|
#define DICTSIZE(dict) (sizeof(dict) / sizeof(dict[0]))
|
||||||
#define uhuh (id)1
|
|
||||||
static DefaultColumnProvider *_sharedDefaultColumnProvider;
|
static DefaultColumnProvider *_sharedDefaultColumnProvider;
|
||||||
static NSMutableDictionary *_aspectsAndKeys;
|
static NSMutableDictionary *_aspectsAndKeys;
|
||||||
|
/* todo make this a struct instead of an array */
|
||||||
/* object key default */
|
/* object key default */
|
||||||
static id attribute_columns[][3] = {
|
struct column_info {
|
||||||
{@"allowNull", @"Allows null", uhuh},
|
NSString *key;
|
||||||
{@"isClassProperty", @"Class property", uhuh},
|
NSString *name;
|
||||||
{@"columnName", @"Column name", uhuh},
|
BOOL isDefault;
|
||||||
{@"definition", @"Definition", nil},
|
};
|
||||||
{@"externalType", @"External Type", uhuh},
|
|
||||||
{@"isUsedForLocking", @"Locking", uhuh},
|
static struct column_info attribute_columns[] = {
|
||||||
{@"name", @"Name", uhuh},
|
{@"allowNull", @"Allows null", YES},
|
||||||
{@"precision", @"Precision", nil},
|
{@"isClassProperty", @"Class property", YES},
|
||||||
{@"isPrimaryKey", @"Primary key", uhuh},
|
{@"columnName", @"Column name", YES},
|
||||||
{@"readFormat", @"Read format", nil},
|
{@"definition", @"Definition", NO},
|
||||||
{@"scale", @"Scale", nil},
|
{@"externalType", @"External Type", YES},
|
||||||
{@"valueClassName", @"Value class name", uhuh},
|
{@"isUsedForLocking", @"Locking", YES},
|
||||||
{@"valueType", @"Value type", nil},
|
{@"name", @"Name", YES},
|
||||||
{@"width", @"Width", uhuh},
|
{@"precision", @"Precision", NO},
|
||||||
{@"writeFormat", @"Write format", nil}
|
{@"isPrimaryKey", @"Primary key", YES},
|
||||||
|
{@"readFormat", @"Read format", NO},
|
||||||
|
{@"scale", @"Scale", NO},
|
||||||
|
{@"valueClassName", @"Value class name", YES},
|
||||||
|
{@"valueType", @"Value type", NO},
|
||||||
|
{@"width", @"Width", YES},
|
||||||
|
{@"writeFormat", @"Write format", NO}
|
||||||
};
|
};
|
||||||
|
|
||||||
static id relationship_columns[][3]= {
|
static struct column_info relationship_columns[]= {
|
||||||
{@"isClassProperty", @"Class property", uhuh},
|
{@"isClassProperty", @"Class property", YES},
|
||||||
{@"definition", @"Definition", nil},
|
{@"definition", @"Definition", NO},
|
||||||
{@"name", @"Name", uhuh},
|
{@"name", @"Name", YES},
|
||||||
{@"destinationEntity.name", @"Destination Entity", uhuh}
|
{@"destinationEntity.name", @"Destination Entity", YES}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static id entity_columns[][3] = {
|
static struct column_info entity_columns[] = {
|
||||||
{@"name", @"Name", uhuh},
|
{@"name", @"Name", YES},
|
||||||
{@"className", @"Class name", uhuh},
|
{@"className", @"Class name", YES},
|
||||||
{@"externalName", @"External name", uhuh},
|
{@"externalName", @"External name", YES},
|
||||||
{@"externalQuery", @"External query", nil},
|
{@"externalQuery", @"External query", NO},
|
||||||
{@"parentEntity.name", @"Parent", nil}
|
{@"parentEntity.name", @"Parent", NO}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -97,7 +104,7 @@ static id entity_columns[][3] = {
|
||||||
}
|
}
|
||||||
* or something not sure if id columns[][2] would work as a method so i'll use
|
* or something not sure if id columns[][2] would work as a method so i'll use
|
||||||
* a function.. it _should_ but iirc buggy somewhere (forwarding?) */
|
* a function.. it _should_ but iirc buggy somewhere (forwarding?) */
|
||||||
void registerColumnsForClass(id columns[][3], int count, Class aClass,NSMutableArray *defaultColumnsArray)
|
void registerColumnsForClass(struct column_info columns[], int count, Class aClass,NSMutableArray *defaultColumnsArray)
|
||||||
{
|
{
|
||||||
id *objects;
|
id *objects;
|
||||||
id *keys;
|
id *keys;
|
||||||
|
@ -111,9 +118,9 @@ void registerColumnsForClass(id columns[][3], int count, Class aClass,NSMutableA
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
objects[i] = columns[i][0];
|
objects[i] = columns[i].key;
|
||||||
keys[i] = columns[i][1];
|
keys[i] = columns[i].name;
|
||||||
if (columns[i][2] == uhuh)
|
if (columns[i].isDefault == YES)
|
||||||
{
|
{
|
||||||
[defaultColumnsArray addObject:keys[i]];
|
[defaultColumnsArray addObject:keys[i]];
|
||||||
}
|
}
|
||||||
|
@ -154,6 +161,31 @@ void registerColumnsForClass(id columns[][3], int count, Class aClass,NSMutableA
|
||||||
DefaultRelationshipColumns);
|
DefaultRelationshipColumns);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) setupTitleForColumn:(NSTableColumn *)tc named:(NSString *)name
|
||||||
|
{
|
||||||
|
NSTableHeaderCell *headerCell = [tc headerCell];
|
||||||
|
if ([name isEqual:@"Primary key"])
|
||||||
|
{
|
||||||
|
NSImage *img = [NSImage imageNamed:@"Key_Header"];
|
||||||
|
[headerCell setImage:img];
|
||||||
|
}
|
||||||
|
else if ([name isEqual:@"Class property"])
|
||||||
|
[headerCell setImage:[NSImage imageNamed:@"ClassProperty_Header"]];
|
||||||
|
else if ([name isEqual:@"Locking"])
|
||||||
|
[headerCell setImage:[NSImage imageNamed:@"Locking_Header"]];
|
||||||
|
else if ([name isEqual:@"Name"])
|
||||||
|
{
|
||||||
|
[tc setWidth:100.0];
|
||||||
|
[headerCell setStringValue:name];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[headerCell setStringValue:name];
|
||||||
|
}
|
||||||
|
[tc sizeToFit];
|
||||||
|
}
|
||||||
|
|
||||||
- (NSCell *)cellForColumnNamed:(NSString *)name
|
- (NSCell *)cellForColumnNamed:(NSString *)name
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -192,7 +224,7 @@ void registerColumnsForClass(id columns[][3], int count, Class aClass,NSMutableA
|
||||||
[cell setImagePosition:NSImageOnly];
|
[cell setImagePosition:NSImageOnly];
|
||||||
[cell setBordered:NO];
|
[cell setBordered:NO];
|
||||||
[cell setBezeled:NO];
|
[cell setBezeled:NO];
|
||||||
[cell setAlternateImage:[NSImage imageNamed:@"ClassProperty_On"]];
|
[cell setAlternateImage:[NSImage imageNamed:@"Locking_On"]];
|
||||||
[cell setControlSize: NSSmallControlSize];
|
[cell setControlSize: NSSmallControlSize];
|
||||||
[cell setEditable:YES];
|
[cell setEditable:YES];
|
||||||
return AUTORELEASE(cell);
|
return AUTORELEASE(cell);
|
||||||
|
@ -233,10 +265,10 @@ void registerColumnsForClass(id columns[][3], int count, Class aClass,NSMutableA
|
||||||
aspectKey = [[_aspectsAndKeys objectForKey:class] objectForKey:columnName];
|
aspectKey = [[_aspectsAndKeys objectForKey:class] objectForKey:columnName];
|
||||||
aspect = @"value";
|
aspect = @"value";
|
||||||
association = [[EOColumnAssociation alloc] initWithObject:tc];
|
association = [[EOColumnAssociation alloc] initWithObject:tc];
|
||||||
[[tc headerCell] setStringValue:columnName];
|
|
||||||
cell = [self cellForColumnNamed:columnName];
|
cell = [self cellForColumnNamed:columnName];
|
||||||
[tc setEditable:[cell isEditable]];
|
[tc setEditable:[cell isEditable]];
|
||||||
[tc setDataCell:cell];
|
[tc setDataCell:cell];
|
||||||
|
[self setupTitleForColumn:tc named:columnName];
|
||||||
[association bindAspect:aspect displayGroup:displayGroup key:aspectKey];
|
[association bindAspect:aspect displayGroup:displayGroup key:aspectKey];
|
||||||
[association establishConnection];
|
[association establishConnection];
|
||||||
[association release];
|
[association release];
|
||||||
|
|
|
@ -33,18 +33,26 @@
|
||||||
/* this is all stuff for key value coding.. */
|
/* this is all stuff for key value coding.. */
|
||||||
static inline NSNumber * isClassProperty(id self)
|
static inline NSNumber * isClassProperty(id self)
|
||||||
{
|
{
|
||||||
return [NSNumber numberWithBool: [[[self entity] classProperties] containsObject:self]];
|
return [NSNumber numberWithBool:
|
||||||
|
[[[self entity] classProperties] containsObject:self]];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void setIsClassProperty(id self, NSNumber *flag)
|
static inline void setIsClassProperty(id self, NSNumber *flag)
|
||||||
{
|
{
|
||||||
BOOL isProp = [flag boolValue];
|
BOOL isProp = [flag boolValue];
|
||||||
NSArray *props = RETAIN([[self entity] classProperties]);
|
NSArray *props = [[self entity] classProperties];
|
||||||
|
|
||||||
if (isProp)
|
if (isProp)
|
||||||
{
|
{
|
||||||
if (![props containsObject:self])
|
if (!props)
|
||||||
[[self entity] setClassProperties: [props arrayByAddingObject:self]];
|
{
|
||||||
|
if (![[self entity] setClassProperties: [NSArray arrayWithObject:self]])
|
||||||
|
NSLog(@"invalid class property");
|
||||||
|
}
|
||||||
|
else if (![props containsObject:self])
|
||||||
|
{
|
||||||
|
[[self entity] setClassProperties: [props arrayByAddingObject:self]];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -55,25 +63,33 @@ static inline void setIsClassProperty(id self, NSNumber *flag)
|
||||||
[[self entity] setClassProperties: newProps];
|
[[self entity] setClassProperties: newProps];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RELEASE(props);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@implementation EOAttribute (ModelerAdditions)
|
@implementation EOAttribute (ModelerAdditions)
|
||||||
|
|
||||||
- (NSNumber *) isPrimaryKey
|
- (NSNumber *) isPrimaryKey
|
||||||
{
|
{
|
||||||
return [NSNumber numberWithBool: [[[self entity] primaryKeyAttributes] containsObject:self]];
|
BOOL flag = [[[self entity] primaryKeyAttributes] containsObject:self];
|
||||||
|
return [NSNumber numberWithBool: flag];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setIsPrimaryKey:(NSNumber *)flag
|
- (void) setIsPrimaryKey:(NSNumber *)flag
|
||||||
{
|
{
|
||||||
BOOL isKey = [flag boolValue];
|
BOOL isKey = [flag boolValue];
|
||||||
NSArray *pka = RETAIN([[self entity] primaryKeyAttributes]);
|
NSArray *pka = [[self entity] primaryKeyAttributes];
|
||||||
|
|
||||||
if (isKey)
|
if (isKey)
|
||||||
{
|
{
|
||||||
if (![pka containsObject:self])
|
if (!pka)
|
||||||
[[self entity] setPrimaryKeyAttributes: [pka arrayByAddingObject:self]];
|
{
|
||||||
|
[[self entity]
|
||||||
|
setPrimaryKeyAttributes: [NSArray arrayWithObject:self]];
|
||||||
|
}
|
||||||
|
else if (![pka containsObject:self])
|
||||||
|
{
|
||||||
|
[[self entity]
|
||||||
|
setPrimaryKeyAttributes: [pka arrayByAddingObject:self]];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -85,33 +101,63 @@ static inline void setIsClassProperty(id self, NSNumber *flag)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RELEASE(pka);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSNumber *) isClassProperty
|
- (NSNumber *) isClassProperty
|
||||||
{
|
{
|
||||||
return isClassProperty(self);
|
id flag = isClassProperty(self);
|
||||||
|
|
||||||
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setIsClassProperty:(NSNumber *)flag
|
- (void) setIsClassProperty:(NSNumber *)flag
|
||||||
{
|
{
|
||||||
return setIsClassProperty(self, flag);
|
setIsClassProperty(self, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSNumber *) isUsedForLocking
|
- (NSNumber *) isUsedForLocking
|
||||||
{
|
{
|
||||||
return [NSNumber numberWithBool:NO];
|
BOOL flag;
|
||||||
/* FIXME */
|
|
||||||
|
flag = [[[self entity] attributesUsedForLocking] containsObject:self];
|
||||||
|
|
||||||
|
return [NSNumber numberWithBool:flag];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setIsUsedForLocking:(NSNumber *)flag
|
- (void) setIsUsedForLocking:(NSNumber *)flag
|
||||||
{
|
{
|
||||||
/* FIXME */
|
BOOL yn = [flag boolValue];
|
||||||
|
NSArray *la = RETAIN([[self entity] attributesUsedForLocking]);
|
||||||
|
|
||||||
|
if (yn)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (la == nil)
|
||||||
|
{
|
||||||
|
[[self entity]
|
||||||
|
setAttributesUsedForLocking:[NSArray arrayWithObject:self]];
|
||||||
|
}
|
||||||
|
else if (![la containsObject:self])
|
||||||
|
{
|
||||||
|
[[self entity]
|
||||||
|
setAttributesUsedForLocking:[la arrayByAddingObject:self]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ([la containsObject:self])
|
||||||
|
{
|
||||||
|
NSMutableArray *newLA = [NSMutableArray arrayWithArray:la];
|
||||||
|
[newLA removeObject:self];
|
||||||
|
[[self entity] setAttributesUsedForLocking:newLA];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSNumber *)allowNull
|
- (NSNumber *)allowNull
|
||||||
{
|
{
|
||||||
return [NSNumber numberWithBool:[self allowsNull]];
|
BOOL flag = [self allowsNull];
|
||||||
|
return [NSNumber numberWithBool:flag];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setAllowNull:(NSNumber *)flag
|
- (void) setAllowNull:(NSNumber *)flag
|
||||||
|
@ -125,12 +171,13 @@ static inline void setIsClassProperty(id self, NSNumber *flag)
|
||||||
@implementation EORelationship (ModelerAdditions)
|
@implementation EORelationship (ModelerAdditions)
|
||||||
- (NSNumber *) isClassProperty
|
- (NSNumber *) isClassProperty
|
||||||
{
|
{
|
||||||
return isClassProperty(self);
|
id flag = isClassProperty(self);
|
||||||
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setIsClassProperty:(NSNumber *)flag
|
- (void) setIsClassProperty:(NSNumber *)flag
|
||||||
{
|
{
|
||||||
return setIsClassProperty(self, flag);
|
setIsClassProperty(self, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -20,13 +20,19 @@ endif
|
||||||
|
|
||||||
ADDITIONAL_NATIVE_LIBS += EOInterface gnustep-db2modeler
|
ADDITIONAL_NATIVE_LIBS += EOInterface gnustep-db2modeler
|
||||||
|
|
||||||
$(APP_NAME)_RESOURCE_FILES = \
|
$(APP_NAME)_RESOURCE_FILES = \
|
||||||
Resources/Key_On.tiff \
|
Resources/Key_On.tiff \
|
||||||
Resources/ClassProperty_On.tiff \
|
Resources/ClassProperty_On.tiff \
|
||||||
Resources/ModelDrag.tiff \
|
Resources/ModelDrag.tiff \
|
||||||
Resources/SQLGenerator.gorm \
|
Resources/SQLGenerator.gorm \
|
||||||
Resources/Info-gnustep.plist \
|
Resources/Info-gnustep.plist \
|
||||||
Resources/ConsistencyResults.gorm
|
Resources/Key_Header.tiff \
|
||||||
|
Resources/Locking_On.tiff \
|
||||||
|
Resources/Locking_Header.tiff \
|
||||||
|
Resources/ClassProperty_Header.tiff \
|
||||||
|
Resources/Preferences.gorm \
|
||||||
|
Resources/ConsistencyResults.gorm \
|
||||||
|
Resources/DBModeler.tiff
|
||||||
|
|
||||||
$(APP_NAME)_OBJC_FILES = \
|
$(APP_NAME)_OBJC_FILES = \
|
||||||
main.m \
|
main.m \
|
||||||
|
@ -41,6 +47,7 @@ $(APP_NAME)_OBJC_FILES = \
|
||||||
ModelerTableEmbedibleEditor.m \
|
ModelerTableEmbedibleEditor.m \
|
||||||
SQLGenerator.m \
|
SQLGenerator.m \
|
||||||
ConsistencyResults.m \
|
ConsistencyResults.m \
|
||||||
|
Preferences.m \
|
||||||
ConsistencyChecker.m
|
ConsistencyChecker.m
|
||||||
|
|
||||||
include $(GNUSTEP_MAKEFILES)/application.make
|
include $(GNUSTEP_MAKEFILES)/application.make
|
||||||
|
|
|
@ -4,7 +4,10 @@ ADDITIONAL_INCLUDE_DIRS+=-I../../
|
||||||
|
|
||||||
Inspectors_HAS_RESOURCE_BUNDLE=yes
|
Inspectors_HAS_RESOURCE_BUNDLE=yes
|
||||||
|
|
||||||
Inspectors_RESOURCE_FILES=RelationshipInspector.gorm
|
Inspectors_RESOURCE_FILES= \
|
||||||
|
RelationshipInspector.gorm \
|
||||||
|
RelationshipInspector.tiff
|
||||||
|
|
||||||
Inspectors_OBJC_FILES=RelationshipInspector.m
|
Inspectors_OBJC_FILES=RelationshipInspector.m
|
||||||
|
|
||||||
Inspectors_RESOURCE_FILES+=AttributeInspector.gorm
|
Inspectors_RESOURCE_FILES+=AttributeInspector.gorm
|
||||||
|
|
|
@ -11,11 +11,18 @@
|
||||||
#include <Foundation/NSArray.h>
|
#include <Foundation/NSArray.h>
|
||||||
|
|
||||||
@implementation RelationshipInspector
|
@implementation RelationshipInspector
|
||||||
|
|
||||||
|
- (NSString *) displayName
|
||||||
|
{
|
||||||
|
return @"Relationship inspector";
|
||||||
|
}
|
||||||
|
|
||||||
- (EOEntity *)selectedEntity
|
- (EOEntity *)selectedEntity
|
||||||
{
|
{
|
||||||
int row = [destEntity_tableView selectedRow];
|
int row = [destEntity_tableView selectedRow];
|
||||||
|
NSArray *entities = [[[EOMApp activeDocument] model] entities];
|
||||||
|
|
||||||
if (row == -1)
|
if (row == -1 || row == NSNotFound || row > [entities count])
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
return [[[[EOMApp activeDocument] model] entities] objectAtIndex:row];
|
return [[[[EOMApp activeDocument] model] entities] objectAtIndex:row];
|
||||||
|
@ -24,8 +31,9 @@
|
||||||
- (EOAttribute *)selectedDestinationAttribute
|
- (EOAttribute *)selectedDestinationAttribute
|
||||||
{
|
{
|
||||||
int row = [destAttrib_tableView selectedRow];
|
int row = [destAttrib_tableView selectedRow];
|
||||||
|
NSArray *attribs = [[self selectedEntity] attributes];
|
||||||
if (row == -1)
|
|
||||||
|
if (row == -1 || row == NSNotFound || row > [attribs count])
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
return [[[self selectedEntity] attributes]
|
return [[[self selectedEntity] attributes]
|
||||||
|
@ -35,11 +43,12 @@
|
||||||
- (EOAttribute *)selectedSourceAttribute
|
- (EOAttribute *)selectedSourceAttribute
|
||||||
{
|
{
|
||||||
int row = [srcAttrib_tableView selectedRow];
|
int row = [srcAttrib_tableView selectedRow];
|
||||||
|
NSArray *attribs = [[[self selectedObject] entity] attributes];
|
||||||
if (row == -1)
|
|
||||||
|
if (row == -1 || row == NSNotFound || row > [attribs count])
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
return [[[[self selectedObject] entity] attributes] objectAtIndex:[srcAttrib_tableView selectedRow]];
|
return [attribs objectAtIndex:[srcAttrib_tableView selectedRow]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int) indexOfSourceAttribute:(EOAttribute *)srcAttrib
|
- (int) indexOfSourceAttribute:(EOAttribute *)srcAttrib
|
||||||
|
@ -120,8 +129,9 @@
|
||||||
|
|
||||||
- (EOJoin *) selectedJoin
|
- (EOJoin *) selectedJoin
|
||||||
{
|
{
|
||||||
return [self joinWithSource:[self selectedSourceAttribute]
|
EOJoin *join = [self joinWithSource:[self selectedSourceAttribute]
|
||||||
destination:[self selectedDestinationAttribute]];
|
destination:[self selectedDestinationAttribute]];
|
||||||
|
return join;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) awakeFromNib
|
- (void) awakeFromNib
|
||||||
|
@ -143,6 +153,7 @@
|
||||||
|
|
||||||
- (void) updateConnectButton
|
- (void) updateConnectButton
|
||||||
{
|
{
|
||||||
|
[connect_button setEnabled:([self selectedDestinationAttribute] != nil)];
|
||||||
[connect_button setState: ([self selectedJoin] != nil) ? NSOnState : NSOffState];
|
[connect_button setState: ([self selectedJoin] != nil) ? NSOnState : NSOffState];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,12 +163,13 @@
|
||||||
EOEntity *destEntity;
|
EOEntity *destEntity;
|
||||||
EOAttribute *srcAttrib, *destAttrib;
|
EOAttribute *srcAttrib, *destAttrib;
|
||||||
NSArray *joins;
|
NSArray *joins;
|
||||||
unsigned int row;
|
unsigned int row = 0;
|
||||||
[name_textField setStringValue:[(EORelationship *)[self selectedObject] name]];
|
[name_textField setStringValue:[(EORelationship *)[self selectedObject] name]];
|
||||||
|
|
||||||
/* it is important that the destEntity has a selected row before the destAttrib tableview
|
[srcAttrib_tableView reloadData];
|
||||||
* reloads data */
|
[destAttrib_tableView reloadData];
|
||||||
[destEntity_tableView reloadData];
|
[destEntity_tableView reloadData];
|
||||||
|
|
||||||
destEntity = [[self selectedObject] destinationEntity];
|
destEntity = [[self selectedObject] destinationEntity];
|
||||||
if (destEntity)
|
if (destEntity)
|
||||||
{
|
{
|
||||||
|
@ -167,7 +179,7 @@
|
||||||
}
|
}
|
||||||
else if ([destEntity_tableView numberOfRows])
|
else if ([destEntity_tableView numberOfRows])
|
||||||
row = 0;
|
row = 0;
|
||||||
|
|
||||||
[destEntity_tableView selectRow:row byExtendingSelection:NO];
|
[destEntity_tableView selectRow:row byExtendingSelection:NO];
|
||||||
|
|
||||||
joins = [[self selectedObject] joins];
|
joins = [[self selectedObject] joins];
|
||||||
|
@ -178,14 +190,23 @@
|
||||||
srcAttrib = [join sourceAttribute];
|
srcAttrib = [join sourceAttribute];
|
||||||
destAttrib = [join destinationAttribute];
|
destAttrib = [join destinationAttribute];
|
||||||
row = [self indexOfSourceAttribute:srcAttrib];
|
row = [self indexOfSourceAttribute:srcAttrib];
|
||||||
[srcAttrib_tableView selectRow:row byExtendingSelection:NO];
|
if (row != NSNotFound)
|
||||||
|
[srcAttrib_tableView selectRow:row byExtendingSelection:NO];
|
||||||
row = [self indexOfDestinationAttribute:srcAttrib];
|
row = [self indexOfDestinationAttribute:srcAttrib];
|
||||||
[destAttrib_tableView selectRow:row byExtendingSelection:NO];
|
if (row != NSNotFound)
|
||||||
|
[destAttrib_tableView selectRow:row byExtendingSelection:NO];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[srcAttrib_tableView selectRow:0 byExtendingSelection:NO];
|
if ([self numberOfRowsInTableView:srcAttrib_tableView])
|
||||||
[destAttrib_tableView selectRow:0 byExtendingSelection:NO];
|
{
|
||||||
|
[srcAttrib_tableView selectRow:0 byExtendingSelection:NO];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([self numberOfRowsInTableView:destAttrib_tableView])
|
||||||
|
{
|
||||||
|
[destAttrib_tableView selectRow:0 byExtendingSelection:NO];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[self updateConnectButton];
|
[self updateConnectButton];
|
||||||
|
@ -198,7 +219,9 @@
|
||||||
{
|
{
|
||||||
EOModel *activeModel = [[EOMApp activeDocument] model];
|
EOModel *activeModel = [[EOMApp activeDocument] model];
|
||||||
if (tv == destEntity_tableView)
|
if (tv == destEntity_tableView)
|
||||||
return [[activeModel entities] count];
|
{
|
||||||
|
return [[activeModel entities] count];
|
||||||
|
}
|
||||||
else if (tv == srcAttrib_tableView)
|
else if (tv == srcAttrib_tableView)
|
||||||
return [[(EOEntity *)[[self selectedObject] entity] attributes] count];
|
return [[(EOEntity *)[[self selectedObject] entity] attributes] count];
|
||||||
else if (tv == destAttrib_tableView)
|
else if (tv == destAttrib_tableView)
|
||||||
|
@ -253,7 +276,6 @@ row:(int)rowIndex
|
||||||
if (row != NSNotFound)
|
if (row != NSNotFound)
|
||||||
[srcAttrib_tableView selectRow:row byExtendingSelection:NO];
|
[srcAttrib_tableView selectRow:row byExtendingSelection:NO];
|
||||||
|
|
||||||
[self updateConnectButton];
|
|
||||||
}
|
}
|
||||||
else if (tv == srcAttrib_tableView)
|
else if (tv == srcAttrib_tableView)
|
||||||
{
|
{
|
||||||
|
@ -262,9 +284,9 @@ row:(int)rowIndex
|
||||||
|
|
||||||
if (row != NSNotFound)
|
if (row != NSNotFound)
|
||||||
[destAttrib_tableView selectRow:row byExtendingSelection:NO];
|
[destAttrib_tableView selectRow:row byExtendingSelection:NO];
|
||||||
|
|
||||||
[self updateConnectButton];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[self updateConnectButton];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) tableView:(NSTableView *)tv shouldSelectRow:(int)rowIndex
|
- (BOOL) tableView:(NSTableView *)tv shouldSelectRow:(int)rowIndex
|
||||||
|
|
BIN
DBModeler/Inspectors/RelationshipInspector.tiff
Normal file
BIN
DBModeler/Inspectors/RelationshipInspector.tiff
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
|
@ -26,15 +26,16 @@
|
||||||
|
|
||||||
#include <EOModeler/EOModelerEditor.h>
|
#include <EOModeler/EOModelerEditor.h>
|
||||||
|
|
||||||
#include <AppKit/NSBox.h>
|
|
||||||
#include <AppKit/NSOutlineView.h>
|
#include <AppKit/NSOutlineView.h>
|
||||||
#include <AppKit/NSWindow.h>
|
#include <AppKit/NSWindow.h>
|
||||||
|
#include <AppKit/NSSplitView.h>
|
||||||
|
|
||||||
@interface MainModelEditor : EOModelerCompoundEditor
|
@interface MainModelEditor : EOModelerCompoundEditor
|
||||||
{
|
{
|
||||||
NSBox *_box;
|
NSView *_editorView;
|
||||||
NSWindow *_window;
|
NSWindow *_window;
|
||||||
NSOutlineView *_iconPath;
|
NSOutlineView *_iconPath;
|
||||||
|
NSSplitView *_vSplit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include <AppKit/NSScrollView.h>
|
#include <AppKit/NSScrollView.h>
|
||||||
#include <AppKit/NSSplitView.h>
|
#include <AppKit/NSSplitView.h>
|
||||||
#include <AppKit/NSTableColumn.h>
|
#include <AppKit/NSTableColumn.h>
|
||||||
|
#include <AppKit/NSView.h>
|
||||||
|
|
||||||
#include <Foundation/NSNotification.h>
|
#include <Foundation/NSNotification.h>
|
||||||
#define DEBUG_STUFF 0
|
#define DEBUG_STUFF 0
|
||||||
|
@ -77,12 +78,11 @@
|
||||||
if ((self = [super initWithDocument:document]))
|
if ((self = [super initWithDocument:document]))
|
||||||
{
|
{
|
||||||
NSTableColumn *_col;
|
NSTableColumn *_col;
|
||||||
NSSplitView *vSplit = [[NSSplitView alloc] initWithFrame:NSMakeRect(0,0,400,400)];
|
|
||||||
NSScrollView *sv = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,0,100,400)];
|
NSScrollView *sv = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,0,100,400)];
|
||||||
// NSImageCell *_cell;
|
|
||||||
|
_vSplit = [[NSSplitView alloc] initWithFrame:NSMakeRect(0,0,600,400)];
|
||||||
[vSplit setVertical:YES];
|
|
||||||
|
|
||||||
|
[_vSplit setVertical:YES];
|
||||||
|
|
||||||
_iconPath = [[ModelerOutlineView alloc] initWithFrame:NSMakeRect(0,0,100,400)];
|
_iconPath = [[ModelerOutlineView alloc] initWithFrame:NSMakeRect(0,0,100,400)];
|
||||||
[_iconPath setIndentationPerLevel:8.0];
|
[_iconPath setIndentationPerLevel:8.0];
|
||||||
|
@ -90,15 +90,13 @@
|
||||||
|
|
||||||
[_iconPath setDelegate:self];
|
[_iconPath setDelegate:self];
|
||||||
[_iconPath setDataSource:self];
|
[_iconPath setDataSource:self];
|
||||||
//_cell = [[NSImageCell alloc] init];
|
|
||||||
_col = [(NSTableColumn *)[NSTableColumn alloc] initWithIdentifier:@"name"];
|
_col = [(NSTableColumn *)[NSTableColumn alloc] initWithIdentifier:@"name"];
|
||||||
[_iconPath addTableColumn:_col];
|
[_iconPath addTableColumn:_col];
|
||||||
[_iconPath setOutlineTableColumn:AUTORELEASE(_col)];
|
[_iconPath setOutlineTableColumn:AUTORELEASE(_col)];
|
||||||
//[[_iconPath tableColumnWithIdentifier:@"name"] setDataCell:_cell];
|
|
||||||
[_iconPath setAutoresizesAllColumnsToFit:YES];
|
[_iconPath setAutoresizesAllColumnsToFit:YES];
|
||||||
[_iconPath sizeToFit];
|
[_iconPath sizeToFit];
|
||||||
|
|
||||||
_window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400)
|
_window = [[NSWindow alloc] initWithContentRect:NSMakeRect(20,80,600,400)
|
||||||
styleMask: NSTitledWindowMask | NSMiniaturizableWindowMask | NSClosableWindowMask | NSResizableWindowMask
|
styleMask: NSTitledWindowMask | NSMiniaturizableWindowMask | NSClosableWindowMask | NSResizableWindowMask
|
||||||
backing:NSBackingStoreBuffered
|
backing:NSBackingStoreBuffered
|
||||||
defer:YES];
|
defer:YES];
|
||||||
|
@ -110,24 +108,20 @@
|
||||||
[_iconPath setAutoresizingMask: NSViewWidthSizable|NSViewHeightSizable];
|
[_iconPath setAutoresizingMask: NSViewWidthSizable|NSViewHeightSizable];
|
||||||
[sv setDocumentView:_iconPath];
|
[sv setDocumentView:_iconPath];
|
||||||
RELEASE(_iconPath);
|
RELEASE(_iconPath);
|
||||||
[vSplit addSubview:sv];
|
[_vSplit addSubview:sv];
|
||||||
RELEASE(sv);
|
RELEASE(sv);
|
||||||
|
|
||||||
|
_editorView = [[NSBox alloc] initWithFrame:NSMakeRect(0,0,500,400)];
|
||||||
|
|
||||||
_box = [[NSBox alloc] initWithFrame:NSMakeRect(0,0,300,400)];
|
[_vSplit addSubview: _editorView];
|
||||||
[_box setTitle:@""];
|
RELEASE(_editorView);
|
||||||
[_box setBorderType:NSNoBorder];
|
|
||||||
[_box setAutoresizesSubviews:YES];
|
|
||||||
[_box setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
|
||||||
[vSplit addSubview: _box];
|
|
||||||
RELEASE(_box);
|
|
||||||
|
|
||||||
[vSplit setAutoresizesSubviews:YES];
|
[_vSplit setAutoresizesSubviews:YES];
|
||||||
[vSplit setAutoresizingMask: NSViewWidthSizable
|
[_vSplit setAutoresizingMask: NSViewWidthSizable
|
||||||
| NSViewHeightSizable];
|
| NSViewHeightSizable];
|
||||||
[vSplit adjustSubviews];
|
[_vSplit adjustSubviews];
|
||||||
[[_window contentView] addSubview:vSplit];
|
[[_window contentView] addSubview:_vSplit];
|
||||||
RELEASE(vSplit);
|
RELEASE(_vSplit);
|
||||||
|
|
||||||
/* so addEntity: addAttribute: ... menu items work */
|
/* so addEntity: addAttribute: ... menu items work */
|
||||||
[_window setDelegate: document];
|
[_window setDelegate: document];
|
||||||
|
@ -140,12 +134,14 @@
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
||||||
RELEASE(_window);
|
RELEASE(_window);
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) ecStuff:(NSNotification *)notif
|
- (void) ecStuff:(NSNotification *)notif
|
||||||
{
|
{
|
||||||
if ([[notif object] isKindOfClass:[EOEditingContext class]])
|
if ([[notif object] isKindOfClass:[EOEditingContext class]])
|
||||||
|
@ -172,10 +168,11 @@
|
||||||
}
|
}
|
||||||
[mainView setAutoresizesSubviews:YES];
|
[mainView setAutoresizesSubviews:YES];
|
||||||
[mainView setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
[mainView setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
||||||
[mainView setFrame: [_box frame]];
|
[mainView setFrame: [_editorView frame]];
|
||||||
|
|
||||||
[_box setContentView: mainView];
|
[_vSplit replaceSubview:_editorView with:mainView];
|
||||||
[_box setNeedsDisplay:YES];
|
_editorView = mainView;
|
||||||
|
[_editorView setNeedsDisplay:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)activateEditorWithClass:(Class)embedibleEditorClass
|
- (void)activateEditorWithClass:(Class)embedibleEditorClass
|
||||||
|
@ -354,6 +351,7 @@
|
||||||
EOModel *bar = [_document model];
|
EOModel *bar = [_document model];
|
||||||
id item = nil;
|
id item = nil;
|
||||||
int selectedRow = [_iconPath selectedRow];
|
int selectedRow = [_iconPath selectedRow];
|
||||||
|
|
||||||
if (selectedRow == -1)
|
if (selectedRow == -1)
|
||||||
return;
|
return;
|
||||||
while (bar != item)
|
while (bar != item)
|
||||||
|
|
|
@ -33,7 +33,9 @@
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/* runs the adaptor panel and the adaptors login panel, and sets the active
|
||||||
|
* documents connection dictionary. */
|
||||||
|
- (void) setAdaptor:(id)sender;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif // __Modeler_H_
|
#endif // __Modeler_H_
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "Modeler.h"
|
#include "Modeler.h"
|
||||||
#include "ModelerEntityEditor.h"
|
#include "ModelerEntityEditor.h"
|
||||||
#include "SQLGenerator.h"
|
#include "SQLGenerator.h"
|
||||||
|
#include "Preferences.h"
|
||||||
|
|
||||||
#include <EOModeler/EOModelerApp.h>
|
#include <EOModeler/EOModelerApp.h>
|
||||||
#include <EOModeler/EOModelerEditor.h>
|
#include <EOModeler/EOModelerEditor.h>
|
||||||
|
@ -239,11 +240,40 @@
|
||||||
{
|
{
|
||||||
EOModel *newModel = [[EOModel alloc] init];
|
EOModel *newModel = [[EOModel alloc] init];
|
||||||
NSString *modelName;
|
NSString *modelName;
|
||||||
unsigned int nDocs;
|
NSArray *docs = [EOMApp documents];
|
||||||
|
unsigned docNumber, c, i;
|
||||||
|
|
||||||
nDocs = [[EOMApp documents] count];
|
docNumber = [[EOMApp documents] count];
|
||||||
|
|
||||||
modelName=[NSString stringWithFormat:@"Model_%u",++nDocs];
|
c = [docs count];
|
||||||
|
docNumber = c;
|
||||||
|
|
||||||
|
/* look for the largest NNNN in models named "Model_NNNN"
|
||||||
|
* or the total number of models whichever is greater.
|
||||||
|
*/
|
||||||
|
for (i = 0; i < c; i++)
|
||||||
|
{
|
||||||
|
NSString *name = [(EOModel*)[[docs objectAtIndex:i] model] name];
|
||||||
|
|
||||||
|
if ([name hasPrefix:@"Model_"])
|
||||||
|
{
|
||||||
|
NSRange range;
|
||||||
|
unsigned tmp;
|
||||||
|
|
||||||
|
name = [name substringFromIndex:6];
|
||||||
|
range = [name rangeOfCharacterFromSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]];
|
||||||
|
if (!(range.location == NSNotFound) && !(range.length == 0))
|
||||||
|
continue;
|
||||||
|
range = [name rangeOfCharacterFromSet:[NSCharacterSet decimalDigitCharacterSet]];
|
||||||
|
if (!(range.location == NSNotFound) && !(range.length == 0))
|
||||||
|
{
|
||||||
|
tmp = [name intValue];
|
||||||
|
docNumber = (docNumber < ++tmp) ? tmp : docNumber;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
modelName = [NSString stringWithFormat:@"Model_%u",docNumber];
|
||||||
[newModel setName:modelName];
|
[newModel setName:modelName];
|
||||||
[self _newDocumentWithModel:newModel];
|
[self _newDocumentWithModel:newModel];
|
||||||
RELEASE(newModel);
|
RELEASE(newModel);
|
||||||
|
@ -301,6 +331,10 @@
|
||||||
|
|
||||||
adaptorName = [adaptorsPanel runAdaptorsPanel];
|
adaptorName = [adaptorsPanel runAdaptorsPanel];
|
||||||
RELEASE(adaptorsPanel);
|
RELEASE(adaptorsPanel);
|
||||||
|
|
||||||
|
if (!adaptorName)
|
||||||
|
return;
|
||||||
|
|
||||||
[[[EOMApp activeDocument] model] setAdaptorName: adaptorName];
|
[[[EOMApp activeDocument] model] setAdaptorName: adaptorName];
|
||||||
adaptor = [EOAdaptor adaptorWithName: adaptorName];
|
adaptor = [EOAdaptor adaptorWithName: adaptorName];
|
||||||
[[[EOMApp activeDocument] model] setConnectionDictionary:[adaptor runLoginPanel]];
|
[[[EOMApp activeDocument] model] setConnectionDictionary:[adaptor runLoginPanel]];
|
||||||
|
@ -312,26 +346,37 @@
|
||||||
[EOMInspectorController showInspector];
|
[EOMInspectorController showInspector];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) application:(NSApplication *)theApp openFile:(NSString *)filename
|
- (BOOL) application:(NSApplication *)theApp openFile:(NSString *)filename
|
||||||
{
|
{
|
||||||
NSFileManager *fm = [NSFileManager defaultManager];
|
NSFileManager *fm = [NSFileManager defaultManager];
|
||||||
NSString *pathExt = [[filename pathExtension] lowercaseString];
|
NSString *pathExt = [[filename pathExtension] lowercaseString];
|
||||||
|
BOOL flag;
|
||||||
if ([fm isReadableFileAtPath:filename] == YES
|
#if 0
|
||||||
&& ([pathExt isEqual:@"eomodeld"]
|
NSLog(@"%@ %@ %i %i %i %i %i", NSStringFromSelector(_cmd), filename,
|
||||||
|| [pathExt isEqual:@"eomodel"]))
|
[fm isReadableFileAtPath:filename] == YES,
|
||||||
|
[pathExt isEqual:@"eomodel"],
|
||||||
|
[pathExt isEqual:@"eomodeld"],
|
||||||
|
[fm fileExistsAtPath:filename isDirectory:&flag],
|
||||||
|
flag);
|
||||||
|
#endif
|
||||||
|
if (([fm isReadableFileAtPath:filename] == YES
|
||||||
|
&& [pathExt isEqual:@"eomodel"])
|
||||||
|
|| ([pathExt isEqual:@"eomodeld"]
|
||||||
|
&& [fm fileExistsAtPath:filename isDirectory:&flag] && flag))
|
||||||
{
|
{
|
||||||
EOModel *model;
|
EOModel *model;
|
||||||
|
|
||||||
NS_DURING
|
NS_DURING
|
||||||
model = [[EOModel alloc] initWithContentsOfFile:filename];
|
model = [[EOModel alloc] initWithContentsOfFile:filename];
|
||||||
NS_HANDLER
|
NS_HANDLER
|
||||||
return;
|
return NO;
|
||||||
NS_ENDHANDLER
|
NS_ENDHANDLER
|
||||||
|
|
||||||
[self _newDocumentWithModel:model];
|
[self _newDocumentWithModel:model];
|
||||||
RELEASE(model);
|
RELEASE(model);
|
||||||
|
return YES;
|
||||||
}
|
}
|
||||||
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) open:(id)sender
|
- (void) open:(id)sender
|
||||||
|
@ -373,5 +418,10 @@
|
||||||
[[SQLGenerator sharedGenerator] openSQLGenerator:self];
|
[[SQLGenerator sharedGenerator] openSQLGenerator:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) openPrefs:(id)sender
|
||||||
|
{
|
||||||
|
[[DBModelerPrefs sharedPreferences] showPreferences:self];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
</license>
|
</license>
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include "DefaultColumnProvider.h"
|
#include "DefaultColumnProvider.h"
|
||||||
#include "ModelerAttributeEditor.h"
|
#include "ModelerAttributeEditor.h"
|
||||||
#include "ModelerEntityEditor.h"
|
#include "ModelerEntityEditor.h"
|
||||||
|
@ -45,8 +44,7 @@
|
||||||
#include <EOInterface/EODisplayGroup.h>
|
#include <EOInterface/EODisplayGroup.h>
|
||||||
|
|
||||||
#include <Foundation/NSRunLoop.h>
|
#include <Foundation/NSRunLoop.h>
|
||||||
|
|
||||||
|
|
||||||
@interface NSArray (EOMAdditions)
|
@interface NSArray (EOMAdditions)
|
||||||
- (id) firstSelectionOfClass:(Class) aClass;
|
- (id) firstSelectionOfClass:(Class) aClass;
|
||||||
@end
|
@end
|
||||||
|
@ -60,12 +58,16 @@
|
||||||
NSMenuItem *mi = [[NSMenuItem alloc] initWithTitle:@"+" action:(SEL)nil keyEquivalent:@""];
|
NSMenuItem *mi = [[NSMenuItem alloc] initWithTitle:@"+" action:(SEL)nil keyEquivalent:@""];
|
||||||
|
|
||||||
self = [super initWithParentEditor:parentEditor];
|
self = [super initWithParentEditor:parentEditor];
|
||||||
|
|
||||||
[DefaultColumnProvider class];
|
[DefaultColumnProvider class];
|
||||||
_mainView = [[NSSplitView alloc] initWithFrame:NSMakeRect(0,0,100,100)];
|
_mainView = [[NSSplitView alloc] initWithFrame:NSMakeRect(0,0,100,100)];
|
||||||
/* setup the attributes table view */
|
/* setup the attributes table view */
|
||||||
scrollView = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,0,100,100)];
|
scrollView = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,0,100,100)];
|
||||||
_attributes_tableView = [[NSTableView alloc] initWithFrame:NSMakeRect(0,0,100,100)];
|
_attributes_tableView = [[NSTableView alloc] initWithFrame:NSMakeRect(0,0,100,100)];
|
||||||
[_attributes_tableView setAutoresizesAllColumnsToFit:YES];
|
[_attributes_tableView setAutoresizesAllColumnsToFit:NO];
|
||||||
|
[_attributes_tableView setAllowsMultipleSelection:YES];
|
||||||
|
[_attributes_tableView setAllowsEmptySelection:YES];
|
||||||
|
|
||||||
[scrollView setBorderType: NSBezelBorder];
|
[scrollView setBorderType: NSBezelBorder];
|
||||||
[scrollView setHasHorizontalScroller:YES];
|
[scrollView setHasHorizontalScroller:YES];
|
||||||
[scrollView setHasVerticalScroller:YES];
|
[scrollView setHasVerticalScroller:YES];
|
||||||
|
@ -79,7 +81,8 @@
|
||||||
[[cornerView cell] setArrowPosition:NSPopUpNoArrow];
|
[[cornerView cell] setArrowPosition:NSPopUpNoArrow];
|
||||||
[cornerView setTitle:@"+"];
|
[cornerView setTitle:@"+"];
|
||||||
[cornerView setPreferredEdge:NSMinYEdge];
|
[cornerView setPreferredEdge:NSMinYEdge];
|
||||||
|
[cornerView setBezelStyle:NSShadowlessSquareBezelStyle];
|
||||||
|
|
||||||
[[cornerView cell] setUsesItemFromMenu:NO];
|
[[cornerView cell] setUsesItemFromMenu:NO];
|
||||||
[[cornerView cell] setShowsFirstResponder:NO];
|
[[cornerView cell] setShowsFirstResponder:NO];
|
||||||
[[cornerView cell] setMenuItem:mi];
|
[[cornerView cell] setMenuItem:mi];
|
||||||
|
@ -95,6 +98,7 @@
|
||||||
[_attributes_dg setDataSource:wds1];
|
[_attributes_dg setDataSource:wds1];
|
||||||
RELEASE(wds1);
|
RELEASE(wds1);
|
||||||
[_attributes_dg setFetchesOnLoad:YES];
|
[_attributes_dg setFetchesOnLoad:YES];
|
||||||
|
[_attributes_dg setSelectsFirstObjectAfterFetch:NO];
|
||||||
[_attributes_dg setDelegate:self];
|
[_attributes_dg setDelegate:self];
|
||||||
|
|
||||||
[self setupCornerView:cornerView
|
[self setupCornerView:cornerView
|
||||||
|
@ -110,7 +114,9 @@
|
||||||
[scrollView setHasHorizontalScroller:YES];
|
[scrollView setHasHorizontalScroller:YES];
|
||||||
[scrollView setHasVerticalScroller:YES];
|
[scrollView setHasVerticalScroller:YES];
|
||||||
_relationships_tableView = [[NSTableView alloc] initWithFrame:NSMakeRect(0,0,100,100)];
|
_relationships_tableView = [[NSTableView alloc] initWithFrame:NSMakeRect(0,0,100,100)];
|
||||||
[_relationships_tableView setAutoresizesAllColumnsToFit:YES];
|
[_relationships_tableView setAutoresizesAllColumnsToFit:NO];
|
||||||
|
[_relationships_tableView setAllowsMultipleSelection:YES];
|
||||||
|
[_relationships_tableView setAllowsEmptySelection:YES];
|
||||||
[scrollView setDocumentView:_relationships_tableView];
|
[scrollView setDocumentView:_relationships_tableView];
|
||||||
RELEASE(_relationships_tableView);
|
RELEASE(_relationships_tableView);
|
||||||
[_mainView addSubview:scrollView];
|
[_mainView addSubview:scrollView];
|
||||||
|
@ -121,6 +127,7 @@
|
||||||
[cornerView setPreferredEdge:NSMinYEdge];
|
[cornerView setPreferredEdge:NSMinYEdge];
|
||||||
[[cornerView cell] setArrowPosition:NSPopUpNoArrow];
|
[[cornerView cell] setArrowPosition:NSPopUpNoArrow];
|
||||||
[cornerView setTitle:@"+"];
|
[cornerView setTitle:@"+"];
|
||||||
|
[cornerView setBezelStyle:NSShadowlessSquareBezelStyle];
|
||||||
[[cornerView cell] setUsesItemFromMenu:NO];
|
[[cornerView cell] setUsesItemFromMenu:NO];
|
||||||
[[cornerView cell] setShowsFirstResponder:NO];
|
[[cornerView cell] setShowsFirstResponder:NO];
|
||||||
[[cornerView cell] setMenuItem:mi];
|
[[cornerView cell] setMenuItem:mi];
|
||||||
|
@ -135,6 +142,7 @@
|
||||||
[_relationships_dg setDataSource:wds2];
|
[_relationships_dg setDataSource:wds2];
|
||||||
RELEASE(wds2);
|
RELEASE(wds2);
|
||||||
[_relationships_dg setFetchesOnLoad:YES];
|
[_relationships_dg setFetchesOnLoad:YES];
|
||||||
|
[_relationships_dg setSelectsFirstObjectAfterFetch:NO];
|
||||||
[_relationships_dg setDelegate:self];
|
[_relationships_dg setDelegate:self];
|
||||||
|
|
||||||
[self setupCornerView:cornerView
|
[self setupCornerView:cornerView
|
||||||
|
@ -144,7 +152,7 @@
|
||||||
|
|
||||||
[self addDefaultTableColumnsForTableView:_relationships_tableView
|
[self addDefaultTableColumnsForTableView:_relationships_tableView
|
||||||
displayGroup:_relationships_dg];
|
displayGroup:_relationships_dg];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,19 +186,39 @@
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) needToFetch:(id)arg
|
||||||
|
{
|
||||||
|
[_attributes_dg fetch];
|
||||||
|
[_relationships_dg fetch];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) activate
|
- (void) activate
|
||||||
{
|
{
|
||||||
if (_entityToObserve)
|
NSArray *selPath = [self selectionPath];
|
||||||
[EOObserverCenter removeObserver:self forObject:_entityToObserve];
|
NSArray *selWithin = [self selectionWithinViewedObject];
|
||||||
|
id newEntityToObserve = [selPath firstSelectionOfClass:[EOEntity class]];
|
||||||
_entityToObserve = [[self selectionPath] firstSelectionOfClass:[EOEntity class]];
|
if (_entityToObserve != newEntityToObserve)
|
||||||
[EOObserverCenter addObserver:self forObject:_entityToObserve];
|
{
|
||||||
|
if (_entityToObserve)
|
||||||
|
[EOObserverCenter removeObserver:self forObject:_entityToObserve];
|
||||||
|
|
||||||
|
_entityToObserve = newEntityToObserve;
|
||||||
|
[EOObserverCenter addObserver:self forObject:_entityToObserve];
|
||||||
|
[(KVDataSource *)[_attributes_dg dataSource] setDataObject: _entityToObserve];
|
||||||
|
[(KVDataSource *)[_relationships_dg dataSource] setDataObject: _entityToObserve];
|
||||||
|
}
|
||||||
|
|
||||||
[(KVDataSource *)[_attributes_dg dataSource] setDataObject: _entityToObserve];
|
[self needToFetch:self];
|
||||||
[(KVDataSource *)[_relationships_dg dataSource] setDataObject: _entityToObserve];
|
|
||||||
[_attributes_dg fetch];
|
if (![[_attributes_dg selectedObjects] isEqual:selWithin]
|
||||||
[_relationships_dg fetch];
|
&& ![_attributes_dg selectObjectsIdenticalTo:selWithin
|
||||||
|
selectFirstOnNoMatch:NO])
|
||||||
|
[_attributes_dg clearSelection];
|
||||||
|
|
||||||
|
if (![[_relationships_dg selectedObjects] isEqual:selWithin]
|
||||||
|
&& ![_relationships_dg selectObjectsIdenticalTo:selWithin
|
||||||
|
selectFirstOnNoMatch:NO])
|
||||||
|
[_relationships_dg clearSelection];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *) friendEditorClasses
|
- (NSArray *) friendEditorClasses
|
||||||
|
@ -200,17 +228,12 @@
|
||||||
|
|
||||||
- (void) objectWillChange:(id)sender
|
- (void) objectWillChange:(id)sender
|
||||||
{
|
{
|
||||||
[[NSRunLoop currentRunLoop] performSelector:@selector(needToFetch:)
|
[[NSRunLoop currentRunLoop]
|
||||||
target:self
|
performSelector:@selector(needToFetch:)
|
||||||
argument:nil
|
target:self
|
||||||
order:999
|
argument:nil
|
||||||
modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]];
|
order:999 /* this number is probably arbitrary */
|
||||||
}
|
modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]];
|
||||||
|
|
||||||
- (void) needToFetch:(id)arg
|
|
||||||
{
|
|
||||||
[_attributes_dg fetch];
|
|
||||||
[_relationships_dg fetch];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)defaultColumnNamesForClass:(Class)aClass
|
- (NSArray *)defaultColumnNamesForClass:(Class)aClass
|
||||||
|
@ -231,24 +254,13 @@
|
||||||
|
|
||||||
- (void) displayGroupDidChangeSelection:(EODisplayGroup *)displayGroup
|
- (void) displayGroupDidChangeSelection:(EODisplayGroup *)displayGroup
|
||||||
{
|
{
|
||||||
|
NSArray *selObj = [displayGroup selectedObjects];
|
||||||
|
NSArray *selWithin = [self selectionWithinViewedObject];
|
||||||
|
|
||||||
NSArray *currentSelection = [_parentEditor selectionWithinViewedObject];
|
if ([selObj count]
|
||||||
id theSelection;
|
&& (![selObj isEqual:selWithin])
|
||||||
int c = [currentSelection count];
|
&& ![selWithin containsObject:_entityToObserve])
|
||||||
|
[self setSelectionWithinViewedObject: selObj];
|
||||||
if (!c)
|
|
||||||
return;
|
|
||||||
else
|
|
||||||
theSelection = [currentSelection objectAtIndex:0];
|
|
||||||
|
|
||||||
if ([theSelection isKindOfClass:[EOEntity class]])
|
|
||||||
{
|
|
||||||
NSArray *vop;
|
|
||||||
vop = [_parentEditor viewedObjectPath];
|
|
||||||
[self setViewedObjectPath: [vop arrayByAddingObject:theSelection]];
|
|
||||||
}
|
|
||||||
|
|
||||||
[self setSelectionWithinViewedObject: [displayGroup selectedObjects]];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -102,7 +102,7 @@
|
||||||
|
|
||||||
_topTable = [[NSTableView alloc] initWithFrame:NSMakeRect(0,0,10,10)];
|
_topTable = [[NSTableView alloc] initWithFrame:NSMakeRect(0,0,10,10)];
|
||||||
_bottomTable = [[NSTableView alloc] initWithFrame:NSMakeRect(0,0,10,10)];
|
_bottomTable = [[NSTableView alloc] initWithFrame:NSMakeRect(0,0,10,10)];
|
||||||
[_topTable setAutoresizesAllColumnsToFit:YES];
|
[_topTable setAutoresizesAllColumnsToFit:NO];
|
||||||
[scrollView setDocumentView:_topTable];
|
[scrollView setDocumentView:_topTable];
|
||||||
RELEASE(_topTable);
|
RELEASE(_topTable);
|
||||||
[_splitView addSubview:scrollView];
|
[_splitView addSubview:scrollView];
|
||||||
|
@ -112,7 +112,7 @@
|
||||||
[scrollView setHasHorizontalScroller:YES];
|
[scrollView setHasHorizontalScroller:YES];
|
||||||
[scrollView setHasVerticalScroller:YES];
|
[scrollView setHasVerticalScroller:YES];
|
||||||
[scrollView setBorderType: NSBezelBorder];
|
[scrollView setBorderType: NSBezelBorder];
|
||||||
[_bottomTable setAutoresizesAllColumnsToFit:YES];
|
[_bottomTable setAutoresizesAllColumnsToFit:NO];
|
||||||
[scrollView setDocumentView:_bottomTable];
|
[scrollView setDocumentView:_bottomTable];
|
||||||
RELEASE(_bottomTable);
|
RELEASE(_bottomTable);
|
||||||
[_splitView addSubview:scrollView];
|
[_splitView addSubview:scrollView];
|
||||||
|
@ -124,6 +124,8 @@
|
||||||
cornerView = [[NSPopUpButton alloc] initWithFrame:[[_topTable cornerView] bounds] pullsDown:YES];
|
cornerView = [[NSPopUpButton alloc] initWithFrame:[[_topTable cornerView] bounds] pullsDown:YES];
|
||||||
[cornerView setPreferredEdge:NSMinYEdge];
|
[cornerView setPreferredEdge:NSMinYEdge];
|
||||||
[cornerView setTitle:@"+"];
|
[cornerView setTitle:@"+"];
|
||||||
|
[cornerView setBezelStyle:NSShadowlessSquareBezelStyle];
|
||||||
|
[[cornerView cell] setBezelStyle:NSShadowlessSquareBezelStyle];
|
||||||
[[cornerView cell] setArrowPosition:NSPopUpNoArrow];
|
[[cornerView cell] setArrowPosition:NSPopUpNoArrow];
|
||||||
//[mi setImage:[NSImage imageNamed:@"plus"]];
|
//[mi setImage:[NSImage imageNamed:@"plus"]];
|
||||||
// [mi setOnStateImage:[NSImage imageNamed:@"plus"]];
|
// [mi setOnStateImage:[NSImage imageNamed:@"plus"]];
|
||||||
|
@ -153,7 +155,7 @@
|
||||||
RELEASE(wds);
|
RELEASE(wds);
|
||||||
[dg setFetchesOnLoad:YES];
|
[dg setFetchesOnLoad:YES];
|
||||||
[dg setDelegate: self];
|
[dg setDelegate: self];
|
||||||
|
|
||||||
[self setupCornerView:cornerView
|
[self setupCornerView:cornerView
|
||||||
tableView:_topTable
|
tableView:_topTable
|
||||||
displayGroup:dg
|
displayGroup:dg
|
||||||
|
@ -183,6 +185,9 @@
|
||||||
- (void) activate
|
- (void) activate
|
||||||
{
|
{
|
||||||
[dg fetch];
|
[dg fetch];
|
||||||
|
|
||||||
|
[dg selectObjectsIdenticalTo:[self selectionWithinViewedObject]
|
||||||
|
selectFirstOnNoMatch:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSView *)mainView
|
- (NSView *)mainView
|
||||||
|
@ -192,20 +197,25 @@
|
||||||
|
|
||||||
- (void) objectWillChange:(id)anObject
|
- (void) objectWillChange:(id)anObject
|
||||||
{
|
{
|
||||||
[[NSRunLoop currentRunLoop] performSelector:@selector(needToFetch:) target:self argument:nil order:999 modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]];
|
[[NSRunLoop currentRunLoop]
|
||||||
|
performSelector:@selector(needToFetch:)
|
||||||
|
target:self
|
||||||
|
argument:nil
|
||||||
|
order:999 /* this number is probably arbitrary */
|
||||||
|
modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) needToFetch:(id)sth
|
- (void) needToFetch:(id)sth
|
||||||
{
|
{
|
||||||
[dg fetch];
|
[dg fetch];
|
||||||
[_topTable reloadData];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation ModelerEntityEditor (DisplayGroupDelegate)
|
@implementation ModelerEntityEditor (DisplayGroupDelegate)
|
||||||
- (void) displayGroupDidChangeSelection:(EODisplayGroup *)displayGroup
|
- (void) displayGroupDidChangeSelection:(EODisplayGroup *)displayGroup
|
||||||
{
|
{
|
||||||
[self setSelectionWithinViewedObject: [displayGroup selectedObjects]];
|
[[self parentEditor] setSelectionWithinViewedObject: [displayGroup selectedObjects]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
* mostly takes care of corner views right now..
|
* mostly takes care of corner views right now..
|
||||||
*/
|
*/
|
||||||
@interface ModelerTableEmbedibleEditor : EOModelerEmbedibleEditor
|
@interface ModelerTableEmbedibleEditor : EOModelerEmbedibleEditor
|
||||||
|
|
||||||
- (void) setupCornerView:(NSPopUpButton *)cornerView
|
- (void) setupCornerView:(NSPopUpButton *)cornerView
|
||||||
tableView:(NSTableView *)tableView
|
tableView:(NSTableView *)tableView
|
||||||
displayGroup:(EODisplayGroup *)dg
|
displayGroup:(EODisplayGroup *)dg
|
||||||
|
|
|
@ -85,18 +85,18 @@
|
||||||
|
|
||||||
provider = [EOMApp providerForName: columnName class:aClass];
|
provider = [EOMApp providerForName: columnName class:aClass];
|
||||||
|
|
||||||
/* THIS *MUST* be before initColumn:class:name:displayGroup:document calls */
|
/*
|
||||||
|
* THIS *MUST* be before initColumn:class:name:displayGroup:document calls */
|
||||||
[tv addTableColumn:tc];
|
[tv addTableColumn:tc];
|
||||||
RELEASE(tc);
|
RELEASE(tc);
|
||||||
|
|
||||||
[provider initColumn:tc class:aClass name:columnName
|
[provider initColumn:tc class:aClass name:columnName
|
||||||
displayGroup:dg document:[self document]];
|
displayGroup:dg document:[self document]];
|
||||||
|
|
||||||
item = (NSMenuItem *)[cv itemWithTitle:columnName];
|
item = (NSMenuItem *)[cv itemWithTitle:columnName];
|
||||||
[item setRepresentedObject:tc];
|
[item setRepresentedObject:tc];
|
||||||
[item setState:NSOnState];
|
[item setState:NSOnState];
|
||||||
}
|
}
|
||||||
[tv sizeToFit];
|
[tv tile];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) addTableColumnForItem:(NSMenuItem <NSMenuItem>*)item
|
- (void) addTableColumnForItem:(NSMenuItem <NSMenuItem>*)item
|
||||||
|
@ -120,8 +120,8 @@
|
||||||
name:columnName
|
name:columnName
|
||||||
displayGroup:[[tv delegate] displayGroupForAspect:@"source"] // <-+-^
|
displayGroup:[[tv delegate] displayGroupForAspect:@"source"] // <-+-^
|
||||||
document:[self document]];
|
document:[self document]];
|
||||||
|
[tc sizeToFit];
|
||||||
[tv sizeToFit];
|
[tv tile];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) removeTableColumnForItem:(NSMenuItem <NSMenuItem>*)item
|
- (void) removeTableColumnForItem:(NSMenuItem <NSMenuItem>*)item
|
||||||
|
|
63
DBModeler/Preferences.h
Normal file
63
DBModeler/Preferences.h
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
/**
|
||||||
|
Preferences.h
|
||||||
|
|
||||||
|
Author: Matt Rice <ratmice@yahoo.com>
|
||||||
|
Date: Mar 2006
|
||||||
|
|
||||||
|
This file is part of DBModeler.
|
||||||
|
|
||||||
|
<license>
|
||||||
|
DBModeler 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.
|
||||||
|
|
||||||
|
DBModeler 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 DBModeler; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
</license>
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include <Foundation/NSObject.h>
|
||||||
|
#include <AppKit/NSNibDeclarations.h>
|
||||||
|
|
||||||
|
@class NSWindow;
|
||||||
|
@class NSButton;
|
||||||
|
@class NSTableView;
|
||||||
|
@class NSMatrix;
|
||||||
|
@class NSMutableArray;
|
||||||
|
|
||||||
|
@interface DBModelerPrefs : NSObject
|
||||||
|
{
|
||||||
|
IBOutlet NSWindow *prefsWindow;
|
||||||
|
IBOutlet NSButton *consistencyCheckOnSave;
|
||||||
|
IBOutlet NSTableView *bundlesToLoad;
|
||||||
|
/* consistency checks */
|
||||||
|
IBOutlet NSMatrix *check_matrix;
|
||||||
|
NSMutableArray *_bundles;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (DBModelerPrefs *) sharedPreferences;
|
||||||
|
|
||||||
|
- (void) showPreferences:(id)sender;
|
||||||
|
|
||||||
|
- (BOOL) consistencyCheckOnSave;
|
||||||
|
- (BOOL) attributeDetailsCheck;
|
||||||
|
- (BOOL) storedProcedureCheck;
|
||||||
|
- (BOOL) relationshipCheck;
|
||||||
|
- (BOOL) primaryKeyCheck;
|
||||||
|
- (BOOL) inheritanceCheck;
|
||||||
|
- (BOOL) externalNameCheck;
|
||||||
|
- (BOOL) entityStoredProcedureCheck;
|
||||||
|
- (NSArray *)bundlesToLoad;
|
||||||
|
|
||||||
|
- (IBAction) switchButtonChanged:(id)sender;
|
||||||
|
- (IBAction) checkOnSaveChanged:(id)sender;
|
||||||
|
- (IBAction) addBundle:(id)sender;
|
||||||
|
- (IBAction) removeBundle:(id)sender;
|
||||||
|
@end
|
206
DBModeler/Preferences.m
Normal file
206
DBModeler/Preferences.m
Normal file
|
@ -0,0 +1,206 @@
|
||||||
|
/**
|
||||||
|
Preferences.m
|
||||||
|
|
||||||
|
Author: Matt Rice <ratmice@yahoo.com>
|
||||||
|
Date: Mar 2006
|
||||||
|
|
||||||
|
This file is part of DBModeler.
|
||||||
|
|
||||||
|
<license>
|
||||||
|
DBModeler 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.
|
||||||
|
|
||||||
|
DBModeler 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 DBModeler; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
</license>
|
||||||
|
**/
|
||||||
|
|
||||||
|
|
||||||
|
#include "Preferences.h"
|
||||||
|
|
||||||
|
#include <Foundation/NSInvocation.h>
|
||||||
|
#include <Foundation/NSUserDefaults.h>
|
||||||
|
|
||||||
|
#include <AppKit/NSNibLoading.h>
|
||||||
|
#include <AppKit/NSWindow.h>
|
||||||
|
#include <AppKit/NSButton.h>
|
||||||
|
#include <AppKit/NSTableView.h>
|
||||||
|
#include <AppKit/NSMatrix.h>
|
||||||
|
|
||||||
|
#define DisableAttributeDetailsCheck @"DisableAttributeDetailsCheck"
|
||||||
|
#define DisableEntityStoredProcedureCheck @"DisableEntityStoredProcedureCheck"
|
||||||
|
#define DisableExternalNameCheck @"DisableExternalNameCheck"
|
||||||
|
#define DisableInheritanceCheck @"DisableInheritanceCheck"
|
||||||
|
#define DisablePrimaryKeyCheck @"DisablePrimaryKeyCheck"
|
||||||
|
#define DisableRelationshipCheck @"DisableRelationshipCheck"
|
||||||
|
#define DisableStoredProcedureCheck @"DisableStoredProcedureCheck"
|
||||||
|
static NSString *BundlesToLoad = @"BundlesToLoad";
|
||||||
|
static NSString *DisableConsistencyCheckOnSave=@"DisableConsistencyCheckOnSave";
|
||||||
|
|
||||||
|
|
||||||
|
static NSUserDefaults *ud;
|
||||||
|
static DBModelerPrefs *_sharedPrefs;
|
||||||
|
|
||||||
|
/* do it this way so i can add the switch title later instead of being
|
||||||
|
* hard coded into the .gorm */
|
||||||
|
static NSString *_switches[][2] =
|
||||||
|
{
|
||||||
|
{DisableAttributeDetailsCheck, @"Attribute details"},
|
||||||
|
{DisableExternalNameCheck, @"External name"},
|
||||||
|
{DisablePrimaryKeyCheck, @"Primary key"},
|
||||||
|
{DisableRelationshipCheck, @"Relationship"},
|
||||||
|
{DisableEntityStoredProcedureCheck, @"Entity stored procedure"},
|
||||||
|
{DisableStoredProcedureCheck, @"Stored procedure"},
|
||||||
|
{DisableInheritanceCheck, @"Inheritance"}
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FROBKEY(key) [ud boolForKey:key] ? NO : YES
|
||||||
|
#define COUNT(key) sizeof(key) / sizeof(key[0])
|
||||||
|
|
||||||
|
@implementation DBModelerPrefs : NSObject
|
||||||
|
+ (DBModelerPrefs *) sharedPreferences
|
||||||
|
{
|
||||||
|
return _sharedPrefs ? _sharedPrefs : _sharedPrefs = [self new];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) init
|
||||||
|
{
|
||||||
|
self = [super init];
|
||||||
|
/* setup ud before -awakeFromNib is called... */
|
||||||
|
ud = [NSUserDefaults standardUserDefaults];
|
||||||
|
_bundles = [[NSMutableArray alloc] init];
|
||||||
|
[_bundles addObjectsFromArray:[self bundlesToLoad]];
|
||||||
|
[NSBundle loadNibNamed:@"Preferences" owner:self];
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) awakeFromNib
|
||||||
|
{
|
||||||
|
int i, c = COUNT(_switches);
|
||||||
|
|
||||||
|
[check_matrix renewRows:c columns:1];
|
||||||
|
|
||||||
|
for (i = 0; i < c; i++)
|
||||||
|
{
|
||||||
|
NSButtonCell *cell = [check_matrix cellAtRow:i column:0];
|
||||||
|
BOOL flag;
|
||||||
|
|
||||||
|
flag = [ud boolForKey:_switches[i][0]];
|
||||||
|
[cell setState: (flag == NO) ? NSOnState : NSOffState];
|
||||||
|
[cell setTitle: _switches[i][1]];
|
||||||
|
}
|
||||||
|
[check_matrix sizeToCells];
|
||||||
|
[consistencyCheckOnSave
|
||||||
|
setState:[ud boolForKey:DisableConsistencyCheckOnSave]
|
||||||
|
? NSOffState
|
||||||
|
: NSOnState];
|
||||||
|
[bundlesToLoad reloadData];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) showPreferences:(id)sender
|
||||||
|
{
|
||||||
|
[prefsWindow makeKeyAndOrderFront:self];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) switchButtonChanged:(id)sender
|
||||||
|
{
|
||||||
|
[ud setBool:([[sender selectedCell] state] == NSOffState)
|
||||||
|
forKey:_switches[[sender selectedRow]][0]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) checkOnSaveChanged:(id)sender
|
||||||
|
{
|
||||||
|
[ud setBool:([sender state] == NSOffState)
|
||||||
|
forKey:DisableConsistencyCheckOnSave];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSArray *)bundlesToLoad
|
||||||
|
{
|
||||||
|
return [ud arrayForKey:BundlesToLoad];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) consistencyCheckOnSave
|
||||||
|
{
|
||||||
|
return FROBKEY(DisableConsistencyCheckOnSave);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) attributeDetailsCheck
|
||||||
|
{
|
||||||
|
return FROBKEY(DisableAttributeDetailsCheck);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) entityStoredProcedureCheck
|
||||||
|
{
|
||||||
|
return FROBKEY(DisableEntityStoredProcedureCheck);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) externalNameCheck
|
||||||
|
{
|
||||||
|
return FROBKEY(DisableExternalNameCheck);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) inheritanceCheck
|
||||||
|
{
|
||||||
|
return FROBKEY(DisableInheritanceCheck);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) primaryKeyCheck
|
||||||
|
{
|
||||||
|
return FROBKEY(DisablePrimaryKeyCheck);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) relationshipCheck
|
||||||
|
{
|
||||||
|
return FROBKEY(DisableRelationshipCheck);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) storedProcedureCheck
|
||||||
|
{
|
||||||
|
return FROBKEY(DisableStoredProcedureCheck);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (int) numberOfRowsInTableView:(NSTableView *)tv
|
||||||
|
{
|
||||||
|
int num = [_bundles count];
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) tableView:(NSTableView *)tv objectValueForTableColumn:(NSTableColumn *)tc row:(int)rowIndex
|
||||||
|
{
|
||||||
|
id ov = [_bundles objectAtIndex:rowIndex];
|
||||||
|
return ov;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) tableView:(NSTableView *)tv
|
||||||
|
setObjectValue:(id)newVal
|
||||||
|
forTableColumn:(NSTableColumn *)tc
|
||||||
|
row:(int)rowIndex
|
||||||
|
{
|
||||||
|
[_bundles replaceObjectAtIndex:rowIndex withObject:newVal];
|
||||||
|
[ud setObject:_bundles forKey:BundlesToLoad];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) addBundle:(id)sender
|
||||||
|
{
|
||||||
|
[_bundles addObject:@""];
|
||||||
|
[bundlesToLoad reloadData];
|
||||||
|
[bundlesToLoad selectRow:[_bundles count] - 1 byExtendingSelection:NO];
|
||||||
|
[bundlesToLoad editColumn:0 row:[_bundles count] - 1 withEvent:nil select:YES];
|
||||||
|
}
|
||||||
|
- (void) removeBundle:(id)sender
|
||||||
|
{
|
||||||
|
[_bundles removeObjectAtIndex:[bundlesToLoad selectedRow]];
|
||||||
|
[bundlesToLoad reloadData];
|
||||||
|
[ud setObject:_bundles forKey:BundlesToLoad];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
BIN
DBModeler/Resources/ClassProperty_Header.tiff
Normal file
BIN
DBModeler/Resources/ClassProperty_Header.tiff
Normal file
Binary file not shown.
Binary file not shown.
BIN
DBModeler/Resources/Key_Header.tiff
Normal file
BIN
DBModeler/Resources/Key_Header.tiff
Normal file
Binary file not shown.
Binary file not shown.
BIN
DBModeler/Resources/Locking_On.tiff
Normal file
BIN
DBModeler/Resources/Locking_On.tiff
Normal file
Binary file not shown.
29
DBModeler/Resources/Preferences.gorm/data.classes
Normal file
29
DBModeler/Resources/Preferences.gorm/data.classes
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
{
|
||||||
|
"## Comment" = "Do NOT change this file, Gorm maintains it";
|
||||||
|
DBModelerPrefs = {
|
||||||
|
Actions = (
|
||||||
|
"switchButtonChanged:",
|
||||||
|
"checkOnSaveChanged:",
|
||||||
|
"addBundle:",
|
||||||
|
"removeBundle:"
|
||||||
|
);
|
||||||
|
Outlets = (
|
||||||
|
prefsWindow,
|
||||||
|
consistencyCheckOnSave,
|
||||||
|
bundlesToLoad,
|
||||||
|
addBundleButton,
|
||||||
|
check_matrix,
|
||||||
|
removeBundleButton
|
||||||
|
);
|
||||||
|
Super = NSObject;
|
||||||
|
};
|
||||||
|
FirstResponder = {
|
||||||
|
Actions = (
|
||||||
|
"addBundle:",
|
||||||
|
"checkOnSaveChanged:",
|
||||||
|
"removeBundle:",
|
||||||
|
"switchButtonChanged:"
|
||||||
|
);
|
||||||
|
Super = NSObject;
|
||||||
|
};
|
||||||
|
}
|
BIN
DBModeler/Resources/Preferences.gorm/data.info
Normal file
BIN
DBModeler/Resources/Preferences.gorm/data.info
Normal file
Binary file not shown.
BIN
DBModeler/Resources/Preferences.gorm/objects.gorm
Normal file
BIN
DBModeler/Resources/Preferences.gorm/objects.gorm
Normal file
Binary file not shown.
|
@ -24,6 +24,7 @@
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include "SQLGenerator.h"
|
#include "SQLGenerator.h"
|
||||||
|
#include "Modeler.h"
|
||||||
|
|
||||||
#include <Foundation/NSException.h>
|
#include <Foundation/NSException.h>
|
||||||
#include <Foundation/NSDictionary.h>
|
#include <Foundation/NSDictionary.h>
|
||||||
|
@ -101,11 +102,23 @@ static NSString *_otherScript;
|
||||||
|
|
||||||
- (void) openSQLGenerator:(id)sender;
|
- (void) openSQLGenerator:(id)sender;
|
||||||
{
|
{
|
||||||
|
EOAdaptor *adaptor;
|
||||||
|
|
||||||
while (loadedNib && !goodToGo)
|
while (loadedNib && !goodToGo)
|
||||||
{
|
{
|
||||||
/* wait.. */
|
/* wait.. */
|
||||||
}
|
}
|
||||||
[_window makeKeyAndOrderFront:self];
|
|
||||||
|
adaptor = [[EOMApp activeDocument] adaptor];
|
||||||
|
if (!adaptor)
|
||||||
|
{
|
||||||
|
[[EOMApp delegate] setAdaptor:self];
|
||||||
|
}
|
||||||
|
|
||||||
|
adaptor = [[EOMApp activeDocument] adaptor];
|
||||||
|
|
||||||
|
if (adaptor)
|
||||||
|
[_window makeKeyAndOrderFront:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction) executeSQL:(id)sender
|
- (IBAction) executeSQL:(id)sender
|
||||||
|
@ -120,6 +133,30 @@ static NSString *_otherScript;
|
||||||
if ([[_sqlOutput string] length] == 0)
|
if ([[_sqlOutput string] length] == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!adaptor)
|
||||||
|
{
|
||||||
|
[[EOMApp delegate] setAdaptor:self];
|
||||||
|
adaptor = [[EOMApp activeDocument] adaptor];
|
||||||
|
connDict = [adaptor connectionDictionary];
|
||||||
|
}
|
||||||
|
else if ([[connDict allKeys] count] == 0)
|
||||||
|
{
|
||||||
|
connDict = [adaptor runLoginPanel];
|
||||||
|
|
||||||
|
if (connDict)
|
||||||
|
[adaptor setConnectionDictionary:connDict];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!adaptor || [[connDict allKeys] count] == 0)
|
||||||
|
{
|
||||||
|
NSRunAlertPanel(@"Error",
|
||||||
|
@"SQL generator requires a valid adaptor and connection dictionary",
|
||||||
|
@"Ok",
|
||||||
|
nil,
|
||||||
|
nil);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ([adaptor hasOpenChannels])
|
if ([adaptor hasOpenChannels])
|
||||||
{
|
{
|
||||||
NSArray *contexts = [adaptor contexts];
|
NSArray *contexts = [adaptor contexts];
|
||||||
|
@ -204,13 +241,13 @@ static NSString *_otherScript;
|
||||||
- (IBAction) saveAs:(id)sender
|
- (IBAction) saveAs:(id)sender
|
||||||
{
|
{
|
||||||
id savePanel = [NSSavePanel savePanel];
|
id savePanel = [NSSavePanel savePanel];
|
||||||
NSString *path;
|
|
||||||
int result = [savePanel runModal];
|
int result = [savePanel runModal];
|
||||||
if (result == NSOKButton)
|
if (result == NSOKButton)
|
||||||
{
|
{
|
||||||
|
NSString *path;
|
||||||
path = [savePanel filename];
|
path = [savePanel filename];
|
||||||
|
[[_sqlOutput string] writeToFile:path atomically:YES];
|
||||||
}
|
}
|
||||||
[[_sqlOutput string] writeToFile:path atomically:YES];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction) switchChanged:(id)sender
|
- (IBAction) switchChanged:(id)sender
|
||||||
|
@ -227,6 +264,13 @@ static NSString *_otherScript;
|
||||||
int i, c;
|
int i, c;
|
||||||
NSButton *btn;
|
NSButton *btn;
|
||||||
|
|
||||||
|
if (!expr)
|
||||||
|
{
|
||||||
|
[[EOMApp delegate] setAdaptor:self];
|
||||||
|
expr = [[[EOMApp activeDocument] adaptor] expressionClass];
|
||||||
|
if (!expr) return;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0, c = [adminSwitchButtons count]; i < c; i++)
|
for (i = 0, c = [adminSwitchButtons count]; i < c; i++)
|
||||||
{
|
{
|
||||||
btn = [adminSwitchButtons objectAtIndex:i];
|
btn = [adminSwitchButtons objectAtIndex:i];
|
||||||
|
|
Loading…
Reference in a new issue