formatting and now subclassing is tested by Open a document

This commit is contained in:
ggsato
2012-05-26 11:08:57 +09:00
parent 310422adb1
commit fabe1d8991
5 changed files with 17 additions and 10 deletions
-2
View File
@@ -234,9 +234,7 @@ CPRunContinuesResponse = -1002;
var delegateClass = objj_getClass(delegateClassName);
if (delegateClass)
{
[self setDelegate:[[delegateClass alloc] init]];
}
}
var defaultCenter = [CPNotificationCenter defaultCenter];
@@ -17,10 +17,6 @@
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
// This is called when the application is done loading.
var sharedDocController = [CPDocumentController sharedDocumentController];
var docController = [[DocumentController alloc] init];
var cpAlert = [CPAlert alertWithMessageText:@"Is this the shared instance? " + (sharedDocController == docController) defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:nil];
[cpAlert beginSheetModalForWindow:[[CPApplication sharedApplication] mainWindow]];
}
- (void)applicationWillFinishLaunching:(CPNotification)aNotification
@@ -12,4 +12,12 @@
return [CPDocumentController sharedDocumentController];
}
/* Instead of throwing error in browser environment, show an alert
*/
- (void)openDocument:(id)aSender
{
var anAlert = [CPAlert alertWithError:@"Opening a document is not available!"];
[anAlert beginSheetModalForWindow:[[CPApplication sharedApplication] mainWindow]];
}
@end
@@ -12,20 +12,17 @@
@implementation AppController : CPObject
{
CPDocumentController subclassedCPDocumentController;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
// This is called when the application is done loading.
var cpAlert = [CPAlert alertWithMessageText:@"Is this the shared instance? " + ([CPDocumentController sharedDocumentController] == subclassedCPDocumentController) defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:nil];
[cpAlert beginSheetModalForWindow:[[CPApplication sharedApplication] mainWindow]];
}
- (void)applicationWillFinishLaunching:(CPNotification)aNotification
{
// instantiate a subclass of DocumentController
subclassedCPDocumentController = [[DocumentController alloc] init];
[[DocumentController alloc] init];
}
- (void)awakeFromCib
@@ -12,4 +12,12 @@
return self;
}
/* Instead of throwing error in browser environment, show an alert
*/
- (void)openDocument:(id)aSender
{
var anAlert = [CPAlert alertWithError:@"Opening a document is not available!"];
[anAlert beginSheetModalForWindow:[[CPApplication sharedApplication] mainWindow]];
}
@end