mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-04-22 04:40:44 +00:00
* EOAccess/EOModel.m
include GNUstepBase/NSObject+GNUstepBase.h _removePropertiesReferencingEntity: fix selector name removeEntity: add comment, call _removeEntity: implemented removeEntityAndReferences: * EOAccess/EOAttribute.m include GNUstepBase/NSObject+GNUstepBase.h add comment * EOAccess/EOModel.h add comment * Apps/EOModelEditor/EOMEDocument.m deleting of attributes, arguments (stored procedures) and entities works now * Apps/EOModelEditor/EOMEDocument.h add methods to avoid warnings git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@30554 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c7dd0c4077
commit
682383c008
6 changed files with 85 additions and 28 deletions
|
@ -68,6 +68,9 @@ GDL2MODELER_EXPORT NSString *EOMConsistencyModelObjectKey;
|
|||
|
||||
- (void) setAdaptor:(id)sender;
|
||||
|
||||
- (void) startObserving;
|
||||
- (void) stopObserving;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
|
|
@ -907,25 +907,51 @@ NSString *EOMConsistencyModelObjectKey = @"EOMConsistencyModelObjectKey";
|
|||
NSEnumerator * objEnumer = [[NSArray arrayWithArray:_selectedObjects] objectEnumerator];
|
||||
id currentObj = nil;
|
||||
BOOL topTableViewNeedsRefresh = NO;
|
||||
BOOL storedProcTableViewNeedsRefresh = NO;
|
||||
BOOL outlineViewNeedsRefresh = NO;
|
||||
|
||||
[self setSelectedObjects:nil];
|
||||
|
||||
|
||||
while ((currentObj = [objEnumer nextObject])) {
|
||||
|
||||
if (([currentObj class] == [EOAttribute class])) {
|
||||
EOEntity * entity = [currentObj entity];
|
||||
EOEntity * entity = [(EOAttribute*)currentObj parent];
|
||||
|
||||
[_eomodel _removePropertiesReferencingProperty:currentObj];
|
||||
[entity removeAttribute:currentObj];
|
||||
topTableViewNeedsRefresh = YES;
|
||||
|
||||
if ([entity class] == [EOEntity class]) {
|
||||
[entity removeAttribute:currentObj];
|
||||
topTableViewNeedsRefresh = YES;
|
||||
} else {
|
||||
// EOStoredProcedure
|
||||
EOStoredProcedure* sProc = (EOStoredProcedure*) entity;
|
||||
NSMutableArray * arguments = [NSMutableArray arrayWithArray:[sProc arguments]];
|
||||
[arguments removeObject: currentObj];
|
||||
[sProc setArguments: arguments];
|
||||
storedProcTableViewNeedsRefresh = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (([currentObj class] == [EOEntity class])) {
|
||||
[_eomodel removeEntityAndReferences:(EOEntity*) currentObj];
|
||||
outlineViewNeedsRefresh = YES;
|
||||
}
|
||||
|
||||
} // while
|
||||
|
||||
if (topTableViewNeedsRefresh) {
|
||||
[_topTableViewController setRepresentedObject:[_outlineSelection attributes]];
|
||||
[_topTableView reloadData];
|
||||
}
|
||||
|
||||
if (storedProcTableViewNeedsRefresh) {
|
||||
[_procTableViewController setRepresentedObject:[(EOStoredProcedure*)_outlineSelection arguments]];
|
||||
[_storedProcedureTableView reloadData];
|
||||
}
|
||||
|
||||
if (outlineViewNeedsRefresh) {
|
||||
[_outlineView reloadData];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
2010-06-03 David Wetzel <dave@turbocat.de>
|
||||
* EOAccess/EOModel.m
|
||||
include GNUstepBase/NSObject+GNUstepBase.h
|
||||
_removePropertiesReferencingEntity: fix selector name
|
||||
removeEntity: add comment, call _removeEntity:
|
||||
implemented removeEntityAndReferences:
|
||||
* EOAccess/EOAttribute.m
|
||||
include GNUstepBase/NSObject+GNUstepBase.h
|
||||
add comment
|
||||
* EOAccess/EOModel.h
|
||||
add comment
|
||||
* Apps/EOModelEditor/EOMEDocument.m
|
||||
deleting of attributes, arguments (stored procedures) and entities works now
|
||||
* Apps/EOModelEditor/EOMEDocument.h
|
||||
add methods to avoid warnings
|
||||
|
||||
|
||||
2010-06-02 David Wetzel <dave@turbocat.de>
|
||||
* EOAccess/EOModel.m/h
|
||||
new (still empty) _loadFetchSpecificationDictionaryForEntityNamed:
|
||||
|
|
|
@ -55,12 +55,10 @@ RCS_ID("$Id$")
|
|||
#include <Foundation/NSValue.h>
|
||||
#else
|
||||
#include <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
#ifndef GNUSTEP
|
||||
#include <GNUstepBase/GNUstep.h>
|
||||
#include <GNUstepBase/GSObjCRuntime.h>
|
||||
#include <GNUstepBase/NSDebug+GNUstepBase.h>
|
||||
#include <GNUstepBase/NSObject+GNUstepBase.h>
|
||||
#endif
|
||||
|
||||
#include <EOControl/EONull.h>
|
||||
|
@ -424,7 +422,14 @@ RCS_ID("$Id$")
|
|||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
/**
|
||||
4.5 Docs say:
|
||||
Returns the entity that owns the attribute, or nil if this attribute is acting as an argument for a
|
||||
stored procedure.
|
||||
|
||||
5.x returns the parent
|
||||
*/
|
||||
- (EOEntity *)entity
|
||||
{
|
||||
if (_flags.isParentAnEOEntity)
|
||||
|
|
|
@ -173,6 +173,11 @@
|
|||
- (void)setUserInfo: (NSDictionary *)userInfo;
|
||||
|
||||
- (void)addEntity: (EOEntity *)entity;
|
||||
|
||||
/**
|
||||
* Removes the entity without performing any referential integrity checking.
|
||||
*/
|
||||
|
||||
- (void)removeEntity: (EOEntity *)entity;
|
||||
- (void)removeEntityAndReferences: (EOEntity *)entity;
|
||||
|
||||
|
|
|
@ -48,13 +48,12 @@ RCS_ID("$Id$")
|
|||
#include <Foundation/NSDebug.h>
|
||||
#else
|
||||
#include <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
#ifndef GNUSTEP
|
||||
#include <GNUstepBase/GNUstep.h>
|
||||
#include <GNUstepBase/NSDebug+GNUstepBase.h>
|
||||
#include <GNUstepBase/NSObject+GNUstepBase.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <GNUstepBase/GSObjCRuntime.h>
|
||||
|
||||
#include <EOControl/EOGenericRecord.h>
|
||||
|
@ -1304,7 +1303,7 @@ NSString *EOEntityLoadedNotification = @"EOEntityLoadedNotification";
|
|||
attrsOrRels = [entity relationships];
|
||||
}
|
||||
// get name from the array
|
||||
names = [attrsOrRels resultsOfPerformingSelector:@selector(name:)];
|
||||
names = [attrsOrRels resultsOfPerformingSelector:@selector(name)];
|
||||
|
||||
for (count = [names count]; index < count; index++)
|
||||
{
|
||||
|
@ -1538,29 +1537,31 @@ NSString *EOEntityLoadedNotification = @"EOEntityLoadedNotification";
|
|||
[entity _setModel: self];
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the entity without performing any referential integrity checking.
|
||||
*/
|
||||
- (void) removeEntity: (EOEntity *)entity
|
||||
{
|
||||
NSString *className = nil;
|
||||
|
||||
/* as a special case this method can call _setModel: with nil */
|
||||
[entity _setModel: nil];
|
||||
[_entitiesByName removeObjectForKey: [entity name]];
|
||||
|
||||
NSAssert(_entitiesByClass, @"No _entitiesByClass");
|
||||
|
||||
className = [entity className];
|
||||
NSAssert1(className, @"No className in %@", entity);
|
||||
[self willChange];
|
||||
NSMapRemove(_entitiesByClass, className);
|
||||
|
||||
/* Do not access _entities until cache is triggered */
|
||||
[(NSMutableArray *)[self entities] removeObject: entity];
|
||||
// TODO: find out why removeEntity: and _removeEntity: exists
|
||||
[self _removeEntity:entity];
|
||||
}
|
||||
|
||||
- (void) removeEntityAndReferences: (EOEntity *)entity
|
||||
{
|
||||
NSArray * subEntities;
|
||||
NSEnumerator * subEnumer;
|
||||
EOEntity * subEntity;
|
||||
|
||||
[self _removePropertiesReferencingEntity:entity];
|
||||
subEntities = [NSArray arrayWithArray:[entity subEntities]];
|
||||
subEnumer = [subEntities objectEnumerator];
|
||||
|
||||
|
||||
while ((subEntity = [subEnumer nextObject])) {
|
||||
[entity removeSubEntity:subEntity];
|
||||
}
|
||||
|
||||
[self removeEntity: entity];
|
||||
// TODO;
|
||||
}
|
||||
|
||||
- (void)addStoredProcedure: (EOStoredProcedure *)storedProcedure
|
||||
|
|
Loading…
Reference in a new issue