mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-02-19 17:50:47 +00:00
* EOModeler/EOMInspectorController.m (-init): Don't release the window
on close. (_selectionChanged:): Fix view swapping. Set view as needing display. * EOModeler/EOModelExtensions.m: (+mutableAttributedStringWithBoldSubstitutionsWithFormat:): Implement. * EOModeler/EOModelerApp.h: Add -removeDocument:, -documentAtPath:, and -loadDocumentAtPath: methods. * EOModeler/EOModelerApp.m (-init:): Add parentheses around assignment. (-allPasteboardTypes): Initial implementation. (-removeDocument:): If removing the active document, set the active document to nil. (-documentWithPath:): Change array iterators to unsigned. (-registerColumNames:forClass:provider:): Ditto. (-modelContainingFetchSpecification:): Temporarily return nil. (-nameForFetchSpecification:): Ditto. * EOModeler/EOModelerDocument.h: Declare consistency check notification constants. Add -adaptor, -appendConsistencyCheckErrorText:, -appendConsistencyCheckSuccessText:, -addEntity:, -addRelationship, -addAttribute and -delete. * EOModeler/EOModelerDocument.m: Add consistency check notification constants. Add private category interface. (-firstSelectionOfClass:): Change array iterators to unsigned. Remove debugging logs. (-validateMenuItem:): Initial implementation. (-initWithModel:): Add parentheses around assignment. Add the model to the default model group. (-dealloc, -delete:): Initial implementation. (-isDirty, -prepareToSave,-checkCloseDocument): Return no temporarily until implemented. (-saveToPath:): Break long messages into separate lines. (-addDefaultEditor:, -addEntity:, -addAttribute:): Ditto. (-addRelationship:, ): (-activate): Remove commented out code. (-closeEditor:, -checkCloseEditor:): Add comments. (-canFlattenSelectedAttribute): Add temporary return value. (-windowWillClose:): Remove self from the open documents. (-checkConsistency:): Implement. (-appendConsistencyCheckErrorText:): Ditto. (-appendConsistencyCheckSuccessText:): Ditto. * EOModeler/EOModelerEditor.m (-initWithDocument:): Add parentheses around assignment. Don't retain our document. (-selectionPath:, -viewedObjectPath): Return nil. (-[EOModelerCompoundEditor dealloc]): Implement. (-[EOModelerCompoundEditor initWithParentObject:): Add parentheses around assignment. (-[EOModelerEmbedibleEditor pathViewPreferenceHint:): Return nil. * EOModeler/GNUmakefile: Remove extra whitespace. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@21440 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b70ec2777a
commit
93221c9bc9
9 changed files with 309 additions and 59 deletions
51
ChangeLog
51
ChangeLog
|
@ -1,3 +1,54 @@
|
|||
2005-07-09 Matt Rice <ratmice@yahoo.com>
|
||||
|
||||
* EOModeler/EOMInspectorController.m (-init): Don't release the window
|
||||
on close.
|
||||
(_selectionChanged:): Fix view swapping. Set view as needing display.
|
||||
* EOModeler/EOModelExtensions.m:
|
||||
(+mutableAttributedStringWithBoldSubstitutionsWithFormat:): Implement.
|
||||
* EOModeler/EOModelerApp.h: Add -removeDocument:, -documentAtPath:,
|
||||
and -loadDocumentAtPath: methods.
|
||||
* EOModeler/EOModelerApp.m (-init:): Add parentheses around
|
||||
assignment.
|
||||
(-allPasteboardTypes): Initial implementation.
|
||||
(-removeDocument:): If removing the active document, set the active
|
||||
document to nil.
|
||||
(-documentWithPath:): Change array iterators to unsigned.
|
||||
(-registerColumNames:forClass:provider:): Ditto.
|
||||
(-modelContainingFetchSpecification:): Temporarily return nil.
|
||||
(-nameForFetchSpecification:): Ditto.
|
||||
* EOModeler/EOModelerDocument.h: Declare consistency check
|
||||
notification constants. Add -adaptor, -appendConsistencyCheckErrorText:,
|
||||
-appendConsistencyCheckSuccessText:, -addEntity:, -addRelationship,
|
||||
-addAttribute and -delete.
|
||||
* EOModeler/EOModelerDocument.m: Add consistency check notification
|
||||
constants. Add private category interface.
|
||||
(-firstSelectionOfClass:): Change array iterators to unsigned.
|
||||
Remove debugging logs.
|
||||
(-validateMenuItem:): Initial implementation.
|
||||
(-initWithModel:): Add parentheses around assignment. Add the model
|
||||
to the default model group.
|
||||
(-dealloc, -delete:): Initial implementation.
|
||||
(-isDirty, -prepareToSave,-checkCloseDocument): Return no temporarily
|
||||
until implemented.
|
||||
(-saveToPath:): Break long messages into separate lines.
|
||||
(-addDefaultEditor:, -addEntity:, -addAttribute:): Ditto.
|
||||
(-addRelationship:, ):
|
||||
(-activate): Remove commented out code.
|
||||
(-closeEditor:, -checkCloseEditor:): Add comments.
|
||||
(-canFlattenSelectedAttribute): Add temporary return value.
|
||||
(-windowWillClose:): Remove self from the open documents.
|
||||
(-checkConsistency:): Implement.
|
||||
(-appendConsistencyCheckErrorText:): Ditto.
|
||||
(-appendConsistencyCheckSuccessText:): Ditto.
|
||||
* EOModeler/EOModelerEditor.m (-initWithDocument:): Add parentheses
|
||||
around assignment. Don't retain our document.
|
||||
(-selectionPath:, -viewedObjectPath): Return nil.
|
||||
(-[EOModelerCompoundEditor dealloc]): Implement.
|
||||
(-[EOModelerCompoundEditor initWithParentObject:): Add parentheses
|
||||
around assignment.
|
||||
(-[EOModelerEmbedibleEditor pathViewPreferenceHint:): Return nil.
|
||||
* EOModeler/GNUmakefile: Remove extra whitespace.
|
||||
|
||||
2005-07-08 Matt Rice <ratmice@yahoo.com>
|
||||
|
||||
* EOInterface/EOAssociation.m: New variable _objectToAssociations.
|
||||
|
|
|
@ -58,6 +58,7 @@ static NSBox *_placeHolderView;
|
|||
styleMask:NSTitledWindowMask | NSClosableWindowMask
|
||||
backing:NSBackingStoreBuffered
|
||||
defer:YES];
|
||||
[window setReleasedWhenClosed:NO];
|
||||
scrollView = [[NSScrollView alloc] initWithFrame: NSMakeRect(0, 0, 250, 68)];
|
||||
_placeHolderView = [[NSBox alloc] initWithFrame:NSMakeRect(0,68,250,333)];
|
||||
|
||||
|
@ -103,17 +104,25 @@ static NSBox *_placeHolderView;
|
|||
if ([selection count])
|
||||
{
|
||||
NSArray *inspectors = [EOMInspector allInspectorsThatCanInspectObject: [selection objectAtIndex:0]];
|
||||
|
||||
|
||||
if ([inspectors count])
|
||||
{
|
||||
inspector = [inspectors objectAtIndex:0];
|
||||
[inspector prepareForDisplay];
|
||||
[[window contentView] replaceSubview:[lastInspector view] with:[inspector view]];
|
||||
if ([lastInspector view])
|
||||
[[window contentView] removeSubview:[lastInspector view]];
|
||||
|
||||
if ([inspector view])
|
||||
[[window contentView] addSubview:[inspector view]];
|
||||
|
||||
[[inspector view] setNeedsDisplay:YES];
|
||||
[inspector refresh];
|
||||
lastInspector = inspector;
|
||||
}
|
||||
else
|
||||
{
|
||||
[[lastInspector view] removeFromSuperview];
|
||||
lastInspector = nil;
|
||||
NSLog(@"no inspector");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,11 @@
|
|||
|
||||
#include <EOModeler/EOModelExtensions.h>
|
||||
#include <EOControl/EODebug.h>
|
||||
|
||||
#include <AppKit/NSFont.h>
|
||||
#include <AppKit/NSAttributedString.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSScanner.h>
|
||||
|
||||
@implementation EOEntity (EOModelExtensions)
|
||||
|
||||
|
@ -261,9 +265,42 @@
|
|||
|
||||
+ (NSMutableAttributedString *)mutableAttributedStringWithBoldSubstitutionsWithFormat:(NSString *)format, ...
|
||||
{
|
||||
[self notImplemented:_cmd];
|
||||
|
||||
return nil;
|
||||
va_list ap;
|
||||
NSMutableAttributedString *s = [[NSMutableAttributedString alloc] init];
|
||||
NSScanner *scanner = [NSScanner scannerWithString:format];
|
||||
NSString *tmp;
|
||||
NSDictionary *boldAttributes;
|
||||
|
||||
boldAttributes =
|
||||
[[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
[NSFont boldSystemFontOfSize:[NSFont systemFontSize]],
|
||||
NSFontAttributeName,
|
||||
nil];
|
||||
|
||||
[scanner setCharactersToBeSkipped:nil];
|
||||
if (format == nil)
|
||||
return nil;
|
||||
|
||||
va_start(ap, format);
|
||||
[scanner scanUpToString:@"%@" intoString:&tmp];
|
||||
[s appendAttributedString:AUTORELEASE([[NSAttributedString alloc]
|
||||
initWithString:tmp])];
|
||||
while ([scanner scanString:@"%@" intoString:NULL])
|
||||
{
|
||||
NSAttributedString *boldStr;
|
||||
|
||||
boldStr = [[NSAttributedString alloc]
|
||||
initWithString:(NSString *)va_arg(ap, NSString *)
|
||||
attributes: boldAttributes];
|
||||
[s appendAttributedString:AUTORELEASE(boldStr)];
|
||||
if ([scanner scanUpToString:@"%@" intoString:&tmp])
|
||||
[s appendAttributedString:AUTORELEASE([[NSAttributedString alloc]
|
||||
initWithString:tmp])];
|
||||
}
|
||||
|
||||
va_end(ap);
|
||||
RELEASE(boldAttributes);
|
||||
return AUTORELEASE(s);
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -58,13 +58,15 @@ GDL2MODELER_EXPORT NSString *EOMPropertyPboardType;
|
|||
- (void)setCurrentEditor:(EOModelerEditor *)editor;
|
||||
- (NSArray *)documents;
|
||||
- (void) addDocument:(EOModelerDocument *)document;
|
||||
- (void) removeDocument:(EOModelerDocument *)document;
|
||||
- (NSArray *)columnNamesForClass:(Class)aClass;
|
||||
- (id <EOMColumnProvider>) providerForName:(NSString *)name class:(Class)objectClass;
|
||||
- (void) registerColumnName:(NSString *)columnNames forClass:(Class)objectClass
|
||||
provider:(id <EOMColumnProvider>)provider;
|
||||
- (void) registerColumnNames:(NSArray *)columnNames forClass:(Class)objectClass
|
||||
provider:(id <EOMColumnProvider>)provider;
|
||||
|
||||
- (EOModelerDocument *) documentWithPath:(NSString *)path;
|
||||
- (EOModelerDocument *) loadDocumentAtPath:(NSString *)path;
|
||||
@end
|
||||
|
||||
#endif // __EOModelerApp_H__
|
||||
|
|
|
@ -46,7 +46,7 @@ static EOModelerDocument *_activeDocument;
|
|||
|
||||
- (id) init
|
||||
{
|
||||
if (self = [super init])
|
||||
if ((self = [super init]))
|
||||
{
|
||||
EOMApp = (EOModelerApp*)NSApp;
|
||||
_documents = [[NSMutableArray alloc] init];
|
||||
|
@ -58,7 +58,7 @@ static EOModelerDocument *_activeDocument;
|
|||
|
||||
- (NSArray *)allPasteboardTypes
|
||||
{
|
||||
|
||||
return [NSArray arrayWithObject:EOMPropertyPboardType];
|
||||
}
|
||||
|
||||
- (EOModelerEditor *)currentEditor;
|
||||
|
@ -78,6 +78,8 @@ static EOModelerDocument *_activeDocument;
|
|||
|
||||
- (void)removeDocument:(EOModelerDocument *)document
|
||||
{
|
||||
if (_activeDocument == document)
|
||||
_activeDocument = nil;
|
||||
[_documents removeObject: document];
|
||||
}
|
||||
|
||||
|
@ -105,7 +107,7 @@ static EOModelerDocument *_activeDocument;
|
|||
|
||||
- (EOModelerDocument *)documentWithPath:(NSString *)path
|
||||
{
|
||||
int i = 0;
|
||||
unsigned i = 0;
|
||||
for (i=0; i < [_documents count]; i++)
|
||||
{
|
||||
if ([[[_documents objectAtIndex:i] documentPath] isEqual: path])
|
||||
|
@ -132,7 +134,7 @@ static EOModelerDocument *_activeDocument;
|
|||
forClass:(Class)class
|
||||
provider:(id <EOMColumnProvider>)provider
|
||||
{
|
||||
int i,count = [names count];
|
||||
unsigned i,count = [names count];
|
||||
NSMutableDictionary *classDict = [_columnsByClass objectForKey: class];
|
||||
|
||||
if (!classDict)
|
||||
|
@ -142,7 +144,7 @@ static EOModelerDocument *_activeDocument;
|
|||
RELEASE(classDict);
|
||||
}
|
||||
|
||||
for (i=0; i < count; i++)
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
[classDict setObject:provider forKey:[names objectAtIndex:i]];
|
||||
}
|
||||
|
@ -168,15 +170,19 @@ static EOModelerDocument *_activeDocument;
|
|||
|
||||
+ (EOModel *)modelContainingFetchSpecification:(EOFetchSpecification *)fs
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (NSString *)nameForFetchSpecification:(EOFetchSpecification *)fs
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
return nil;
|
||||
}
|
||||
|
||||
-(void)_setActiveDocument:(EOModelerDocument*)ad
|
||||
{
|
||||
_activeDocument = ad;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -27,12 +27,22 @@
|
|||
*/
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
|
||||
#include <EOModeler/EODefines.h>
|
||||
@class EOModel;
|
||||
@class NSMutableArray;
|
||||
@class NSDictionary;
|
||||
@class EOEditingContext;
|
||||
@class EOModelerEditor;
|
||||
@class EOAdaptor;
|
||||
@class NSAttributedString;
|
||||
@class NSString;
|
||||
|
||||
GDL2MODELER_EXPORT NSString *EOMCheckConsistencyBeginNotification;
|
||||
GDL2MODELER_EXPORT NSString *EOMCheckConsistencyEndNotification;
|
||||
GDL2MODELER_EXPORT NSString *EOMCheckConsistencyForModelNotification;
|
||||
|
||||
GDL2MODELER_EXPORT NSString *EOMConsistencyModelObjectKey;
|
||||
|
||||
|
||||
@interface EOModelerDocument : NSObject
|
||||
{
|
||||
|
@ -47,8 +57,16 @@
|
|||
- (void) saveAs:(id)sender;
|
||||
- (NSString *)documentPath;
|
||||
- (EOModel *)model;
|
||||
- (EOAdaptor *)adaptor;
|
||||
- (EOModelerEditor *) addDefaultEditor;
|
||||
- (void) activate;
|
||||
- (void) appendConsistencyCheckErrorText:(NSAttributedString *)errorText;
|
||||
- (void) appendConsistencyCheckSuccessText:(NSAttributedString *)successText;
|
||||
/* actions */
|
||||
- (void) addEntity:(id)sender;
|
||||
- (void) addRelationship:(id)sender;
|
||||
- (void) addAttribute:(id)sender;
|
||||
- (void) delete:(id)sender;
|
||||
@end
|
||||
|
||||
#endif // __EOModelerDocument_H__
|
||||
|
|
|
@ -25,14 +25,17 @@
|
|||
</license>
|
||||
**/
|
||||
|
||||
#include <AppKit/NSMenuItem.h>
|
||||
#include <AppKit/NSOpenPanel.h>
|
||||
|
||||
#include <Foundation/NSUndoManager.h>
|
||||
#include <Foundation/NSNotification.h>
|
||||
#include <EOInterface/EODisplayGroup.h>
|
||||
|
||||
#include <EOAccess/EOAdaptor.h>
|
||||
#include <EOAccess/EOAttribute.h>
|
||||
#include <EOAccess/EOEntity.h>
|
||||
#include <EOAccess/EOModel.h>
|
||||
#include <EOAccess/EOModelGroup.h>
|
||||
#include <EOAccess/EORelationship.h>
|
||||
|
||||
#include <EOControl/EOEditingContext.h>
|
||||
|
@ -49,6 +52,37 @@
|
|||
static Class _defaultEditorClass;
|
||||
static EOModelerEditor *_currentEditorForDocument;
|
||||
|
||||
/** Notification sent when beginning consistency checks.
|
||||
* The notifications object is the EOModelerDocument.
|
||||
* The receiver should call -appendConsistencyCheckErrorText:
|
||||
* on the notifications object for any consistency check failures */
|
||||
NSString *EOMCheckConsistencyBeginNotification =
|
||||
@"EOMCheckConsistencyBeginNotification";
|
||||
|
||||
/** Notification sent when ending consistency checks.
|
||||
* The notifications object is the EOModelerDocument.
|
||||
* The receiver should call -appendConsistencyCheckSuccessText:
|
||||
* on the notifications object for any consistency checks that passed. */
|
||||
NSString *EOMCheckConsistencyEndNotification =
|
||||
@"EOMCheckConsistencyEndNotification";
|
||||
|
||||
/** Notification sent when beginning EOModel consistency checks.
|
||||
* The notifications object is the EOModelerDocument.
|
||||
* The receiver should call -appendConsistencyCheckErrorText:
|
||||
* on the notifications object for any consistency check failures
|
||||
* the userInfo dictionary contains an EOModel instance for the
|
||||
* EOMConsistencyModelObjectKey key. */
|
||||
NSString *EOMCheckConsistencyForModelNotification =
|
||||
@"EOMCheckConsistencyForModelNotification";
|
||||
NSString *EOMConsistencyModelObjectKey = @"EOMConsistencyModelObjectKey";
|
||||
|
||||
/* private methods for the consistency checker implemented in DBModeler */
|
||||
@interface NSObject (DBModelerPrivate)
|
||||
- (void) showConsistencyCheckResults:(id)sender
|
||||
cancelButton:(BOOL)foo
|
||||
showOnSuccess:(BOOL)bar;
|
||||
@end
|
||||
|
||||
@interface EOModelerApp (PrivateStuff)
|
||||
- (void) _setActiveDocument:(EOModelerDocument *)newDocument;
|
||||
@end
|
||||
|
@ -59,7 +93,7 @@ static EOModelerEditor *_currentEditorForDocument;
|
|||
@implementation NSArray (EOMAdditions)
|
||||
- (id) firstSelectionOfClass:(Class)aClass
|
||||
{
|
||||
int i, c;
|
||||
unsigned i, c;
|
||||
id obj;
|
||||
for (i = 0, c = [self count]; i < c; i++)
|
||||
{
|
||||
|
@ -84,14 +118,9 @@ static EOModelerEditor *_currentEditorForDocument;
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (![obj isKindOfClass:aClass])
|
||||
{
|
||||
NSLog(@"blah:");
|
||||
for (i = 0; c < [self count]; i++)
|
||||
NSLog(@"## %@", [self objectAtIndex:i]);
|
||||
/* [[NSException exceptionWithName:NSInternalInconsistencyException
|
||||
reason:[NSString stringWithFormat:@"Couldn't find a selected %@", aClass]
|
||||
userInfo:[NSDictionary dictionaryWithObject:self forKey:@"array"]] raise];*/
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
@ -101,11 +130,24 @@ static EOModelerEditor *_currentEditorForDocument;
|
|||
|
||||
@implementation EOModelerDocument
|
||||
|
||||
- (BOOL) validateMenuItem:(NSMenuItem <NSMenuItem>*)menuItem
|
||||
{
|
||||
NSArray *selection = [[EOMApp currentEditor] selectionPath];
|
||||
|
||||
if ([[menuItem title] isEqualToString:@"Add attribute"])
|
||||
return ([selection firstSelectionOfClass:[EOEntity class]] != nil);
|
||||
else if ([[menuItem title] isEqualToString:@"Add relationship"])
|
||||
return ([selection firstSelectionOfClass:[EOAttribute class]] != nil);
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (id)initWithModel:(EOModel*)model
|
||||
{
|
||||
if (self = [super init])
|
||||
if ((self = [super init]))
|
||||
{
|
||||
_model = RETAIN(model);
|
||||
[[EOModelGroup defaultGroup] addModel:model];
|
||||
_userInfo = nil;
|
||||
_editors = [[NSMutableArray alloc] init];
|
||||
_editingContext = [[EOEditingContext alloc] init];
|
||||
|
@ -114,6 +156,18 @@ static EOModelerEditor *_currentEditorForDocument;
|
|||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[[_editingContext undoManager] removeAllActionsWithTarget:_editingContext];
|
||||
|
||||
[[EOModelGroup defaultGroup] removeModel:_model];
|
||||
RELEASE(_model);
|
||||
RELEASE(_userInfo);
|
||||
RELEASE(_editors);
|
||||
RELEASE(_editingContext);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (EOAdaptor *)adaptor
|
||||
{
|
||||
NS_DURING
|
||||
|
@ -135,12 +189,12 @@ static EOModelerEditor *_currentEditorForDocument;
|
|||
|
||||
- (BOOL) isDirty
|
||||
{
|
||||
|
||||
return NO; /* FIXME*/
|
||||
}
|
||||
|
||||
- (BOOL) prepareToSave
|
||||
{
|
||||
|
||||
return NO; /* FIXME */
|
||||
}
|
||||
|
||||
- (NSString *)documentPath
|
||||
|
@ -156,33 +210,26 @@ static EOModelerEditor *_currentEditorForDocument;
|
|||
[_model writeToFile: path];
|
||||
return YES;
|
||||
NS_HANDLER
|
||||
NSRunAlertPanel(@"Error",@"Save failed: %@",@"Ok",NULL,NULL,[localException reason]);
|
||||
NSRunAlertPanel(@"Error",
|
||||
@"Save failed: %@",
|
||||
@"Ok",
|
||||
NULL,
|
||||
NULL,
|
||||
[localException reason]);
|
||||
return NO;
|
||||
NS_ENDHANDLER
|
||||
}
|
||||
|
||||
- (BOOL)checkCloseDocument
|
||||
{
|
||||
|
||||
/* FIXME */
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)activate
|
||||
{
|
||||
[EOMApp _setActiveDocument: self];
|
||||
[[_editors objectAtIndex:0] activate];
|
||||
|
||||
//[[EOMApp currentEditor] activate];
|
||||
// int i,count=[_editors count];
|
||||
/* should we really activate the _defaultEditorClass or have some _currentEditor private variable? */
|
||||
/* for (i = 0; i < count; i++)
|
||||
{
|
||||
EOModelerEditor *anEditor = [_editors objectAtIndex:i];
|
||||
if ([anEditor isKindOfClass: _defaultEditorClass])
|
||||
{
|
||||
[anEditor activate];
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/* Editors stuff */
|
||||
|
@ -200,17 +247,20 @@ static EOModelerEditor *_currentEditorForDocument;
|
|||
|
||||
- (void) closeEditor:(EOModelerEditor *)editor
|
||||
{
|
||||
|
||||
/* call checkCloseEditor */
|
||||
}
|
||||
|
||||
- (BOOL)checkCloseEditor:(EOModelerEditor *)editor
|
||||
{
|
||||
|
||||
/* FIXME call consistency checker */
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (EOModelerEditor *) addDefaultEditor
|
||||
{
|
||||
EOModelerEditor *defaultEditor = [[_defaultEditorClass alloc] initWithDocument:self];
|
||||
EOModelerEditor *defaultEditor;
|
||||
|
||||
defaultEditor = [[_defaultEditorClass alloc] initWithDocument:self];
|
||||
[self addEditor: defaultEditor];
|
||||
_currentEditorForDocument = defaultEditor;
|
||||
RELEASE(defaultEditor);
|
||||
|
@ -225,12 +275,16 @@ static EOModelerEditor *_currentEditorForDocument;
|
|||
|
||||
if (![_editors containsObject:[EOMApp currentEditor]])
|
||||
{
|
||||
[[NSException exceptionWithName:NSInternalInconsistencyException reason:@"currentEditor not in edited document exception" userInfo:nil] raise];
|
||||
[[NSException exceptionWithName:NSInternalInconsistencyException
|
||||
reason:@"current editor not in edited document"
|
||||
userInfo:nil] raise];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
[newEntity setName: entityCount ? [NSString stringWithFormat: @"Entity%i",entityCount + 1] : @"Entity"];
|
||||
[newEntity setName: entityCount
|
||||
? [NSString stringWithFormat: @"Entity%i",entityCount + 1]
|
||||
: @"Entity"];
|
||||
[newEntity setClassName:@"EOGenericRecord"];
|
||||
attrb = [EOAttribute new];
|
||||
[attrb setName:@"Attribute"];
|
||||
|
@ -250,7 +304,9 @@ static EOModelerEditor *_currentEditorForDocument;
|
|||
/* the currentEditor must be in this document */
|
||||
if (![_editors containsObject:currEd])
|
||||
{
|
||||
[[NSException exceptionWithName:NSInternalInconsistencyException reason:@"currentEditor not in edited document exception" userInfo:nil] raise];
|
||||
[[NSException exceptionWithName:NSInternalInconsistencyException
|
||||
reason:@"current editor not in edited document"
|
||||
userInfo:nil] raise];
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -275,20 +331,45 @@ static EOModelerEditor *_currentEditorForDocument;
|
|||
|
||||
if (![_editors containsObject:currentEditor])
|
||||
{
|
||||
[[NSException exceptionWithName:NSInternalInconsistencyException reason:@"currentEditor not in edited document exception" userInfo:nil] raise];
|
||||
[[NSException exceptionWithName:NSInternalInconsistencyException
|
||||
reason:@"currentEditor not in edited document exception"
|
||||
userInfo:nil] raise];
|
||||
return;
|
||||
}
|
||||
|
||||
srcEntity = [[currentEditor selectionPath] firstSelectionOfClass:[EOEntity class]];
|
||||
srcEntity = [[currentEditor selectionPath]
|
||||
firstSelectionOfClass:[EOEntity class]];
|
||||
count = [[srcEntity relationships] count];
|
||||
newRel = [[EORelationship alloc] init];
|
||||
[newRel setName: count ? [NSString stringWithFormat:@"Relationship%i", count + 1] : @"Relationship"];
|
||||
[newRel setName: count
|
||||
? [NSString stringWithFormat:@"Relationship%i", count + 1]
|
||||
: @"Relationship"];
|
||||
[srcEntity addRelationship:newRel];
|
||||
[_editingContext insertObject:newRel];
|
||||
//[[(EOModelerCompoundEditor *)[EOMApp currentEditor] activeEditor] setSelectionWithinViewedObject:[NSArray arrayWithObject: srcEntity]];
|
||||
[(EOModelerCompoundEditor *)[EOMApp currentEditor] viewSelectedObject];
|
||||
}
|
||||
- (void)delete:(id)sender
|
||||
{
|
||||
NSArray *objects = [[EOMApp currentEditor] selectionWithinViewedObject];
|
||||
unsigned i,c;
|
||||
|
||||
for (i = 0, c = [objects count]; i < c; i++)
|
||||
{
|
||||
id object = [objects objectAtIndex:i];
|
||||
if ([object isKindOfClass:[EOAttribute class]])
|
||||
{
|
||||
[[object entity] removeAttribute:object];
|
||||
}
|
||||
else if ([object isKindOfClass:[EOEntity class]])
|
||||
{
|
||||
[[object model] removeEntity:object];
|
||||
}
|
||||
else if ([object isKindOfClass:[EORelationship class]])
|
||||
{
|
||||
[[object entity] removeRelationship: object];
|
||||
}
|
||||
}
|
||||
}
|
||||
- (void)addFetchSpecification:(id)sender
|
||||
{
|
||||
|
||||
|
@ -306,6 +387,7 @@ static EOModelerEditor *_currentEditorForDocument;
|
|||
|
||||
- (BOOL)canFlattenSelectedAttribute;
|
||||
{
|
||||
return NO;
|
||||
// no idea
|
||||
}
|
||||
|
||||
|
@ -395,5 +477,41 @@ static EOModelerEditor *_currentEditorForDocument;
|
|||
[self activate];
|
||||
}
|
||||
|
||||
- (void) windowWillClose:(NSNotification *)notif
|
||||
{
|
||||
[EOMApp removeDocument:self];
|
||||
}
|
||||
|
||||
static id consistencyChecker;
|
||||
- (void) checkConsistency:(id)sender
|
||||
{
|
||||
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
|
||||
|
||||
consistencyChecker = [sender representedObject];
|
||||
[center postNotificationName:EOMCheckConsistencyBeginNotification
|
||||
object:self];
|
||||
[center postNotificationName:EOMCheckConsistencyForModelNotification
|
||||
object:self
|
||||
userInfo:[NSDictionary dictionaryWithObject:[self model]
|
||||
forKey:EOMConsistencyModelObjectKey]];
|
||||
[center postNotificationName:EOMCheckConsistencyEndNotification
|
||||
object:self];
|
||||
|
||||
[consistencyChecker showConsistencyCheckResults:self
|
||||
cancelButton:NO
|
||||
showOnSuccess:YES];
|
||||
consistencyChecker = nil;
|
||||
}
|
||||
|
||||
- (void) appendConsistencyCheckErrorText:(NSAttributedString *)errorText
|
||||
{
|
||||
[consistencyChecker appendConsistencyCheckErrorText:errorText];
|
||||
}
|
||||
|
||||
- (void) appendConsistencyCheckSuccessText:(NSAttributedString *)successText
|
||||
{
|
||||
[consistencyChecker appendConsistencyCheckSuccessText:successText];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
</license>
|
||||
**/
|
||||
|
||||
//#include <EOModeler/EOModeler.h>
|
||||
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSObject.h>
|
||||
|
||||
|
@ -40,12 +38,16 @@
|
|||
#include <AppKit/NSView.h>
|
||||
|
||||
@implementation EOModelerEditor
|
||||
- (void) dealloc
|
||||
{
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (EOModelerEditor *)initWithDocument:(EOModelerDocument *)document
|
||||
{
|
||||
if (self = [super init])
|
||||
if ((self = [super init]))
|
||||
{
|
||||
ASSIGN(_document,document);
|
||||
_document = document;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -63,6 +65,7 @@
|
|||
- (NSArray *)selectionPath
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)activate
|
||||
|
@ -88,12 +91,19 @@
|
|||
- (NSArray *)viewedObjectPath
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation EOModelerCompoundEditor
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(_editors);
|
||||
RELEASE(_viewedObjectPath);
|
||||
RELEASE(_selectionWithinViewedObject);
|
||||
[super dealloc];
|
||||
}
|
||||
- (id) initWithDocument:(id)doc
|
||||
{
|
||||
self = [super initWithDocument:doc];
|
||||
|
@ -308,7 +318,7 @@
|
|||
|
||||
- (EOModelerEmbedibleEditor *) initWithParentEditor:(EOModelerCompoundEditor *)parentEditor
|
||||
{
|
||||
if (self = [super initWithDocument: [parentEditor document]])
|
||||
if ((self = [super initWithDocument: [parentEditor document]]))
|
||||
{
|
||||
_parentEditor = parentEditor;
|
||||
}
|
||||
|
@ -348,6 +358,7 @@
|
|||
- (NSString *)pathViewPreferenceHint
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)print
|
||||
|
|
|
@ -59,8 +59,6 @@ EOModelerApp.h \
|
|||
EOModelerEditor.h \
|
||||
EODefines.h
|
||||
|
||||
|
||||
|
||||
-include Makefile.preamble
|
||||
|
||||
-include GNUmakefile.local
|
||||
|
|
Loading…
Reference in a new issue