Changed a log and added some exception handling.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@21480 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2005-07-15 04:51:27 +00:00
parent 5c90039127
commit 2f9ccc2a40
3 changed files with 64 additions and 25 deletions

View file

@ -1,3 +1,10 @@
2005-07-15 00:54 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormClassEditor.m: Added exception handling to portions
of code which call itemAtIndex: method on the outline view to
prevent any problems.
* GormCore/GormInspectorsManager.m: Changed a NSLog to NSDebugLog.
2005-07-14 12:39 Gregory John Casamento <greg_casamento@yahoo.com> 2005-07-14 12:39 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormDocument.m: Minor change to changeView: to * GormCore/GormDocument.m: Minor change to changeView: to

View file

@ -178,7 +178,7 @@ NSString *GormSwitchViewPreferencesNotification = @"GormSwitchViewPreferencesNot
- (void) switchView - (void) switchView
{ {
NSString *viewType = [[NSUserDefaults standardUserDefaults] stringForKey: @"ClassViewType"]; NSString *viewType = [[NSUserDefaults standardUserDefaults] stringForKey: @"ClassViewType"];
NSString *selectedClassName = [self selectedClassName]; // NSString *selectedClassName = [self selectedClassName];
[self setContentViewMargins: NSZeroSize]; [self setContentViewMargins: NSZeroSize];
if([viewType isEqual: @"Outline"] || viewType == nil) if([viewType isEqual: @"Outline"] || viewType == nil)
@ -228,14 +228,17 @@ NSString *GormSwitchViewPreferencesNotification = @"GormSwitchViewPreferencesNot
{ {
id className = nil; id className = nil;
NS_DURING
{
if([self contentView] == scrollView) if([self contentView] == scrollView)
{ {
int row = [outlineView selectedRow]; int row = [outlineView selectedRow];
if ( row == -1 ) if ( row == -1 )
{
row = 0; row = 0;
#warning add exception }
className = [outlineView itemAtRow: row];
className = [outlineView itemAtRow: row];
if ([className isKindOfClass: [GormOutletActionHolder class]]) if ([className isKindOfClass: [GormOutletActionHolder class]])
{ {
className = [outlineView itemBeingEdited]; className = [outlineView itemBeingEdited];
@ -245,6 +248,12 @@ NSString *GormSwitchViewPreferencesNotification = @"GormSwitchViewPreferencesNot
{ {
className = [[browserView selectedCell] stringValue]; className = [[browserView selectedCell] stringValue];
} }
}
NS_HANDLER
{
NSLog(@"%@",[localException reason]);
}
NS_ENDHANDLER;
return className; return className;
} }
@ -261,7 +270,6 @@ NSString *GormSwitchViewPreferencesNotification = @"GormSwitchViewPreferencesNot
NSArray *classes, *subclasses; NSArray *classes, *subclasses;
NSMutableArray *subClassesArray = [NSMutableArray array]; NSMutableArray *subClassesArray = [NSMutableArray array];
NSEnumerator *en; NSEnumerator *en;
NSString *superClass;
int row = 0; int row = 0;
int col = 0; int col = 0;
@ -291,7 +299,7 @@ NSString *GormSwitchViewPreferencesNotification = @"GormSwitchViewPreferencesNot
} }
// select class in browser... // select class in browser...
subClassesArray = [classManager allSuperClassesOf: className]; subClassesArray = AUTORELEASE([[classManager allSuperClassesOf: className] mutableCopy]);
if ((subClassesArray == nil || [subClassesArray count] == 0) && if ((subClassesArray == nil || [subClassesArray count] == 0) &&
[classManager isRootClass: className] == NO) [classManager isRootClass: className] == NO)
{ {
@ -375,13 +383,20 @@ NSString *GormSwitchViewPreferencesNotification = @"GormSwitchViewPreferencesNot
if (i >= 0 && i <= ([outlineView numberOfRows] - 1)) if (i >= 0 && i <= ([outlineView numberOfRows] - 1))
{ {
#warning Add exception NS_DURING
{
id object = [outlineView itemAtRow: i]; id object = [outlineView itemAtRow: i];
if([object isKindOfClass: [NSString class]]) if([object isKindOfClass: [NSString class]])
{ {
result = YES; result = YES;
} }
} }
NS_HANDLER
{
NSLog(@"%@",[localException reason]);
}
NS_ENDHANDLER;
}
} }
else if([self contentView] == browserView) else if([self contentView] == browserView)
{ {
@ -492,8 +507,18 @@ NSString *GormSwitchViewPreferencesNotification = @"GormSwitchViewPreferencesNot
{ {
return; return;
} }
#warning add exception
// get the item, and catch the exception, if there's a problem.
NS_DURING
{
anitem = [outlineView itemAtRow: i]; anitem = [outlineView itemAtRow: i];
}
NS_HANDLER
{
anitem = nil;
}
NS_ENDHANDLER;
if ([anitem isKindOfClass: [GormOutletActionHolder class]]) if ([anitem isKindOfClass: [GormOutletActionHolder class]])
{ {
id itemBeingEdited = [outlineView itemBeingEdited]; id itemBeingEdited = [outlineView itemBeingEdited];
@ -1126,13 +1151,20 @@ shouldEditTableColumn: (NSTableColumn *)tableColumn
if(row != -1) if(row != -1)
{ {
#warning add exception NS_DURING
{
id item = [object itemAtRow: [object selectedRow]]; id item = [object itemAtRow: [object selectedRow]];
if (![item isKindOfClass: [GormOutletActionHolder class]]) if (![item isKindOfClass: [GormOutletActionHolder class]])
{ {
[self editClass]; [self editClass];
} }
} }
NS_HANDLER
{
NSLog(@"%@",[localException reason]);
}
NS_ENDHANDLER;
}
} }
@end // end of data source @end // end of data source

View file

@ -468,7 +468,7 @@
current = 0; current = 0;
} }
NSLog(@"current %i",current); NSDebugLog(@"current %i",current);
// Operate on the document view if the selected object is a NSScrollView // Operate on the document view if the selected object is a NSScrollView
if ([obj isKindOfClass: [NSScrollView class]] if ([obj isKindOfClass: [NSScrollView class]]