2 // PcsxPluginDocument.m
5 // Created by Gil Pedersen on Thu Jul 01 2004.
6 // Copyright (c) 2004 __MyCompanyName__. All rights reserved.
9 #import "PcsxPluginDocument.h"
12 @implementation PcsxPluginDocument
14 - (BOOL)showAddPluginSheet:(NSWindow *)window forName:(NSString *)name
15 // User has asked to see the custom display. Display it.
18 [NSBundle loadNibNamed:@"AddPluginSheet" owner:self];
20 [pluginName setObjectValue:name];
22 [NSApp beginSheet:addPluginSheet
27 [NSApp runModalForWindow:addPluginSheet];
29 [NSApp endSheet:addPluginSheet];
30 [addPluginSheet orderOut:self];
35 - (IBAction)closeAddPluginSheet:(id)sender
37 if ([[sender keyEquivalent] isEqualToString:@"\r"]) {
45 - (BOOL)loadDataRepresentation:(NSData *)docData ofType:(NSString *)docType
47 //NSLog(@"loadDataRepresentation");
51 - (BOOL)loadFileWrapperRepresentation:(NSFileWrapper *)wrapper ofType:(NSString *)docType
53 if ([self showAddPluginSheet:nil forName:[wrapper filename]]) {
54 NSString *dst = [NSString stringWithFormat:@"%@/%@",
55 [[NSBundle mainBundle] builtInPlugInsPath],
58 if ([wrapper writeToFile:dst atomically:NO updateFilenames:NO]) {
59 [[NSWorkspace sharedWorkspace] noteFileSystemChanged:[[NSBundle mainBundle] builtInPlugInsPath]];
60 NSRunInformationalAlertPanel(NSLocalizedString(@"Installation Succesfull", nil),
61 NSLocalizedString(@"The installation of the specified plugin was succesfull. In order to use it, please restart the application.", nil),
64 NSRunAlertPanel(NSLocalizedString(@"Installation Failed!", nil),
65 NSLocalizedString(@"The installation of the specified plugin failed. Please try again, or make a manual install.", nil),
70 // Tell the NSDocument that we can't handle the file, since we are already done with it
74 - (id)openDocumentWithContentsOfFile:(NSString *)fileName display:(BOOL)flag
80 - (NSString *)windowNibName {
81 // Implement this to return a nib to load OR implement -makeWindowControllers to manually create your controllers.
82 return @"PcsxPluginDocument";
85 - (NSData *)dataRepresentationOfType:(NSString *)type {
86 // Implement to provide a persistent data representation of your document OR remove this and implement the file-wrapper or file path based save methods.
90 - (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)type {
91 // Implement to load a persistent data representation of your document OR remove this and implement the file-wrapper or file path based load methods.