* Framework/PCProjectManager.m: Corrections in alert panel names.

Make "Add Files" panel run in modal mode.
* Framework/PCProject.m: Corrections in alert panel names.
* Framework/PCFileCreator.[mh]: Partial rewrite. Check existance of files 
  wich will be added. Make panel run in modal mode. Add "Add Header File"
  option button.
* Documentation/TODO: Update.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@27826 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Sergii Stoian 2009-02-10 00:31:55 +00:00
parent 58757ae6d4
commit 3c30f7fbd0
12 changed files with 232 additions and 149 deletions

View file

@ -47,9 +47,9 @@ ProjectCenter 0.6
- Implement support for integrated debugging [90% done] - Implement support for integrated debugging [90% done]
- change project type from file to bundle casamento/mottola - change project type from file to bundle casamento/mottola
- Finish FileNameIcon (draggable, files can be dragged to it) [done!] - Finish FileNameIcon (draggable, files can be dragged to it) [done!]
- Review all situations when dialogs must be popped up stoyan - More options for file creation [done!]
- Review all situations when dialogs must be popped up [50% done]
- Rewrite Preferences (3rd party sections etc.) stoyan - Rewrite Preferences (3rd party sections etc.) stoyan
- More options for file creation stoyan
--- Project Editor --------------------------------------------- --- Project Editor ---------------------------------------------
- Implement indentation stoyan - Implement indentation stoyan
- Implement interaction with Builder (errors, warnings) stoyan - Implement interaction with Builder (errors, warnings) stoyan

Binary file not shown.

Binary file not shown.

View file

@ -21,7 +21,8 @@
nfDescriptionTV, nfDescriptionTV,
nfNameField, nfNameField,
nfCancelButton, nfCancelButton,
nfCreateButton nfCreateButton,
nfAddHeaderButton
); );
Super = NSObject; Super = NSObject;
}; };

View file

@ -46,50 +46,79 @@ static NSDictionary *dict = nil;
NSDictionary *protocolDict; NSDictionary *protocolDict;
NSDictionary *gsmarkupDict; NSDictionary *gsmarkupDict;
NSString *descr; NSString *descr;
NSString *template;
NSBundle *bundle;
_creator = [[[self class] alloc] init]; _creator = [[[self class] alloc] init];
bundle = [NSBundle bundleForClass:[self class]];
// Setting up the dictionary needed for registration! // Setting up the dictionary needed for registration!
descr = [NSString stringWithString:@"Generic Objective-C class.\n\nThis is a plain subclass of NSObject which includes only Foundation.h."];
classDict = [NSDictionary dictionaryWithObjectsAndKeys:
_creator,@"Creator",
PCClasses,@"ProjectKey",
descr,@"TypeDescription",
nil];
descr = [NSString stringWithString:@"Generic Objective-C header.\n\nThis is a plain interface subclassing NSObject. The file includes Foundation.h"]; // Objective C Class
descr = [NSString stringWithString:
@"Generic Objective-C class.\n\nThis is a plain subclass of NSObject which includes only Foundation.h."];
template = [bundle pathForResource:@"class" ofType:@"template"];
classDict = [NSDictionary dictionaryWithObjectsAndKeys:
PCClasses, @"ProjectKey",
descr, @"TypeDescription",
template,@"TemplateFile",
nil];
// Objective C Header
descr = [NSString stringWithString:
@"Generic Objective-C header.\n\n"
"This is a plain interface subclassing NSObject."
" The file includes Foundation.h"];
template = [bundle pathForResource:@"header" ofType:@"template"];
headerDict =[NSDictionary dictionaryWithObjectsAndKeys: headerDict =[NSDictionary dictionaryWithObjectsAndKeys:
_creator,@"Creator",
PCHeaders,@"ProjectKey", PCHeaders,@"ProjectKey",
descr,@"TypeDescription", descr,@"TypeDescription",
template,@"TemplateFile",
nil]; nil];
descr = [NSString stringWithString:@"Generic ANSI-C implementation file.\n\nThis file contains no Objective-C dependency in any form."]; // C File
descr = [NSString stringWithString:
@"Generic ANSI-C implementation file.\n\n"
"This file contains no Objective-C dependency in any form."];
template = [bundle pathForResource:@"cfile" ofType:@"template"];
ccDict = [NSDictionary dictionaryWithObjectsAndKeys: ccDict = [NSDictionary dictionaryWithObjectsAndKeys:
_creator,@"Creator",
PCOtherSources,@"ProjectKey", PCOtherSources,@"ProjectKey",
descr,@"TypeDescription", descr,@"TypeDescription",
template,@"TemplateFile",
nil]; nil];
descr = [NSString stringWithString:@"Generic ANSI-C header.\n\nThis file contains no Objective-C dependency in any form."]; // C Header
descr = [NSString stringWithString:
@"Generic ANSI-C header.\n\n"
"This file contains no Objective-C dependency in any form."];
template = [bundle pathForResource:@"cheader" ofType:@"template"];
chDict = [NSDictionary dictionaryWithObjectsAndKeys: chDict = [NSDictionary dictionaryWithObjectsAndKeys:
_creator,@"Creator",
PCHeaders,@"ProjectKey", PCHeaders,@"ProjectKey",
descr,@"TypeDescription", descr,@"TypeDescription",
template,@"TemplateFile",
nil]; nil];
descr = [NSString stringWithString:@"Generic Objective-C protocol.\n\nThis is common Objective-C protocol, comparable i.e. to a Java interface."]; // Objective C Protocol
descr = [NSString stringWithString:
@"Generic Objective-C protocol.\n\n"
"This is common Objective-C protocol, comparable"
" i.e. to a Java interface."];
template = [bundle pathForResource:@"protocol" ofType:@"template"];
protocolDict = [NSDictionary dictionaryWithObjectsAndKeys: protocolDict = [NSDictionary dictionaryWithObjectsAndKeys:
_creator,@"Creator",
PCHeaders,@"ProjectKey", PCHeaders,@"ProjectKey",
descr,@"TypeDescription", descr,@"TypeDescription",
template,@"TemplateFile",
nil]; nil];
descr = [NSString stringWithString:@"Generic GSMarkup File.\n\nThis is the interface description of GNUstep Renaissance."]; // GSMarkup
descr = [NSString stringWithString:
@"Generic GSMarkup File.\n\n"
"This is the interface description of GNUstep Renaissance."];
template = [bundle pathForResource:@"gsmarkup" ofType:@"template"];
gsmarkupDict =[NSDictionary dictionaryWithObjectsAndKeys: gsmarkupDict =[NSDictionary dictionaryWithObjectsAndKeys:
_creator,@"Creator",
PCGSMarkupFiles,@"ProjectKey", PCGSMarkupFiles,@"ProjectKey",
descr,@"TypeDescription", descr,@"TypeDescription",
template, @"TemplateFile",
nil]; nil];
@ -103,6 +132,8 @@ static NSDictionary *dict = nil;
nil]; nil];
} }
[dict writeToFile:@"PCFileTypes.plist" atomically:NO];
return _creator; return _creator;
} }
@ -134,111 +165,109 @@ static NSDictionary *dict = nil;
[self showNewFilePanel]; [self showNewFilePanel];
} }
- (NSDictionary *)createFileOfType:(NSString *)type - (void)createFileOfType:(NSString *)fileType
path:(NSString *)path path:(NSString *)path
project:(PCProject *)aProject project:(PCProject *)project
{
NSDictionary *newFiles;
newFiles = [self filesToCreateForFileOfType:fileType
path:path
withComplementary:YES];
[self createFiles:newFiles inProject:project];
}
- (NSDictionary *)filesToCreateForFileOfType:(NSString *)type
path:(NSString *)path
withComplementary:(BOOL)complementary
{ {
PCFileManager *pcfm = [PCFileManager defaultManager];
NSString *_file = nil;
NSString *newFile = nil;
NSMutableDictionary *files = nil; NSMutableDictionary *files = nil;
NSBundle *bundle = nil; NSString *newFile = nil;
// A class and possibly a header // A class and possibly a header
files = [NSMutableDictionary dictionaryWithCapacity:2]; files = [NSMutableDictionary dictionaryWithCapacity:2];
PCLogStatus(self, @"create %@ at %@", type, path);
bundle = [NSBundle bundleForClass:[self class]];
newFile = [path copy];
// Remove file extension from "path" // Remove file extension from "path"
if (![[path pathExtension] isEqualToString: @""]) if (![[path pathExtension] isEqualToString: @""])
{ {
path = [path stringByDeletingPathExtension]; path = [path stringByDeletingPathExtension];
} }
/* // Objective-C Class
* Objective-C Class
*/
if ([type isEqualToString:ObjCClass]) if ([type isEqualToString:ObjCClass])
{ {
_file = [bundle pathForResource:@"class" ofType:@"template"];
newFile = [path stringByAppendingPathExtension:@"m"]; newFile = [path stringByAppendingPathExtension:@"m"];
[pcfm copyFile:_file toFile:newFile]; [files setObject:[dict objectForKey:ObjCClass] forKey:newFile];
[self replaceTagsInFileAtPath:newFile withProject:aProject];
[files setObject:ObjCClass forKey:newFile];
} }
// C File
/* else if ([type isEqualToString:CFile])
* Objective-C Header
* When creating Objective C Class file also create Objective C Header file
*/
if ([type isEqualToString:ObjCHeader] ||
[type isEqualToString:ObjCClass])
{ {
_file = [bundle pathForResource:@"header" ofType:@"template"];
newFile = [path stringByAppendingPathExtension:@"h"];
[pcfm copyFile:_file toFile:newFile];
[self replaceTagsInFileAtPath:newFile withProject:aProject];
[files setObject:ObjCHeader forKey:newFile];
}
/*
* C File
*/
if ([type isEqualToString:CFile])
{
_file = [bundle pathForResource:@"cfile" ofType:@"template"];
newFile = [path stringByAppendingPathExtension:@"c"]; newFile = [path stringByAppendingPathExtension:@"c"];
[pcfm copyFile:_file toFile:newFile]; [files setObject:[dict objectForKey:CFile] forKey:newFile];
[self replaceTagsInFileAtPath:newFile withProject:aProject];
[files setObject:CFile forKey:newFile];
} }
/* // C Header
* C Header // When creating C file also create C Header file
* When creating C file also create C Header file
*/
if ([type isEqualToString:CHeader] || if ([type isEqualToString:CHeader] ||
[type isEqualToString:CFile]) ([type isEqualToString:CFile] && complementary))
{ {
_file = [bundle pathForResource:@"cheader" ofType:@"template"];
newFile = [path stringByAppendingPathExtension:@"h"]; newFile = [path stringByAppendingPathExtension:@"h"];
[pcfm copyFile:_file toFile:newFile]; [files setObject:[dict objectForKey:CHeader] forKey:newFile];
[self replaceTagsInFileAtPath:newFile withProject:aProject];
[files setObject:CHeader forKey:newFile];
} }
/* // Objective-C Header
* GSMarkup // When creating Objective C Class file also create Objective C Header file
*/ else if ([type isEqualToString:ObjCHeader] ||
([type isEqualToString:ObjCClass] && complementary))
{
newFile = [path stringByAppendingPathExtension:@"h"];
[files setObject:[dict objectForKey:ObjCHeader] forKey:newFile];
}
// GSMarkup
else if ([type isEqualToString:GSMarkupFile]) else if ([type isEqualToString:GSMarkupFile])
{ {
_file = [bundle pathForResource:@"gsmarkup" ofType:@"template"];
newFile = [path stringByAppendingPathExtension:@"gsmarkup"]; newFile = [path stringByAppendingPathExtension:@"gsmarkup"];
[pcfm copyFile:_file toFile:newFile]; [files setObject:[dict objectForKey:GSMarkupFile] forKey:newFile];
[files setObject:GSMarkupFile forKey:newFile];
} }
/* // Objective-C Protocol
* Objective-C Protocol
*/
else if ([type isEqualToString:ProtocolFile]) else if ([type isEqualToString:ProtocolFile])
{ {
_file = [bundle pathForResource:@"protocol" ofType:@"template"];
newFile = [path stringByAppendingPathExtension:@"h"]; newFile = [path stringByAppendingPathExtension:@"h"];
[pcfm copyFile:_file toFile:newFile]; [files setObject:[dict objectForKey:ProtocolFile] forKey:newFile];
[self replaceTagsInFileAtPath:newFile withProject:aProject];
[files setObject:ProtocolFile forKey:newFile];
} }
/* return files;
* Notify the browser! }
*/
- (BOOL)createFiles:(NSDictionary *)fileList
inProject:(PCProject *)aProject
{
PCFileManager *pcfm = [PCFileManager defaultManager];
NSEnumerator *enumerator = [[fileList allKeys] objectEnumerator];
NSString *template = nil;
NSString *newFile = nil;
NSDictionary *fileType = nil;
NSString *key = nil;
while ((newFile = [enumerator nextObject]))
{
fileType = [fileList objectForKey:newFile];
key = [fileType objectForKey:@"ProjectKey"];
template = [fileType objectForKey:@"TemplateFile"];
[pcfm copyFile:template toFile:newFile];
[self replaceTagsInFileAtPath:newFile withProject:aProject];
[aProject addFiles:[NSArray arrayWithObject:newFile]
forKey:key
notify:YES];
}
// Notify the browser!
[[NSNotificationCenter defaultCenter] [[NSNotificationCenter defaultCenter]
postNotificationName:@"ProjectDictDidChangeNotification" postNotificationName:@"ProjectDictDidChangeNotification"
object:self]; object:self];
return files; return YES;
} }
- (void)replaceTagsInFileAtPath:(NSString *)newFile - (void)replaceTagsInFileAtPath:(NSString *)newFile
@ -321,7 +350,6 @@ static NSDictionary *dict = nil;
{ {
[newFilePanel center]; [newFilePanel center];
} }
[newFilePanel center];
[nfImage setImage:[NSApp applicationIconImage]]; [nfImage setImage:[NSApp applicationIconImage]];
[nfTypePB setRefusesFirstResponder:YES]; [nfTypePB setRefusesFirstResponder:YES];
[nfTypePB removeAllItems]; [nfTypePB removeAllItems];
@ -329,8 +357,9 @@ static NSDictionary *dict = nil;
[[dict allKeys] [[dict allKeys]
sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]]; sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]];
[nfTypePB selectItemAtIndex:0]; [nfTypePB selectItemAtIndex:0];
[nfCancleButton setRefusesFirstResponder:YES]; [nfCancelButton setRefusesFirstResponder:YES];
[nfCreateButton setRefusesFirstResponder:YES]; [nfCreateButton setRefusesFirstResponder:YES];
[nfAddHeaderButton setRefusesFirstResponder:YES];
[newFilePanel setDefaultButtonCell:[nfCreateButton cell]]; [newFilePanel setDefaultButtonCell:[nfCreateButton cell]];
} }
@ -339,29 +368,50 @@ static NSDictionary *dict = nil;
[newFilePanel makeKeyAndOrderFront:self]; [newFilePanel makeKeyAndOrderFront:self];
[nfNameField setStringValue:@""]; [nfNameField setStringValue:@""];
[newFilePanel makeFirstResponder:nfNameField]; [newFilePanel makeFirstResponder:nfNameField];
[newFilePanel setLevel:NSModalPanelWindowLevel];
[NSApp runModalForWindow:newFilePanel];
} }
- (void)closeNewFilePanel:(id)sender - (void)closeNewFilePanel:(id)sender
{ {
[newFilePanel orderOut:self]; [newFilePanel orderOut:self];
[NSApp stopModal];
activeProject = nil; activeProject = nil;
} }
- (void)createFile:(id)sender - (void)createFile:(id)sender
{ {
[self createFile]; if ([self createFile])
[self closeNewFilePanel:self]; {
activeProject = nil; [self closeNewFilePanel:self];
}
else
{
[newFilePanel makeKeyAndOrderFront:self];
}
} }
- (void)newFilePopupChanged:(id)sender - (void)newFilePopupChanged:(id)sender
{ {
NSString *type = [sender titleOfSelectedItem]; NSString *typeTitle = [sender titleOfSelectedItem];
NSDictionary *creator = [dict objectForKey:type]; NSDictionary *fileType = [dict objectForKey:typeTitle];
if (type) if (!fileType)
{ {
[nfDescriptionTV setString:[creator objectForKey:@"TypeDescription"]]; return;
}
[nfDescriptionTV setString:[fileType objectForKey:@"TypeDescription"]];
if ([typeTitle isEqualToString:ObjCClass] ||
[typeTitle isEqualToString:CFile])
{
[nfAddHeaderButton setEnabled:YES];
}
else
{
[nfAddHeaderButton setEnabled:NO];
} }
} }
@ -383,52 +433,72 @@ static NSDictionary *dict = nil;
} }
} }
- (void)createFile - (BOOL)createFile
{ {
NSString *path = nil; NSString *fileName = [nfNameField stringValue];
NSString *fileName = [nfNameField stringValue]; NSString *fileType = [nfTypePB titleOfSelectedItem];
NSString *fileType = [nfTypePB titleOfSelectedItem]; NSString *path = nil;
NSDictionary *fileDict = [dict objectForKey:fileType]; NSString *key = nil;
NSString *projectKey = [fileDict objectForKey:@"ProjectKey"]; NSDictionary *newFiles = nil;
NSEnumerator *enumerator = nil;
NSString *filePath = nil;
NSFileManager *fm = [NSFileManager defaultManager];
// PCLogInfo(self, @"[createFile] %@", fileName); /* NSLog(@"PCFileCreator: [createFile] %@ in category: %@",
fileName, projectKey);*/
if ([activeProject doesAcceptFile:fileName forKey:projectKey])
{
path = [[activeProject projectPath]
stringByAppendingPathComponent:fileName];
}
// PCLogInfo(self, @"creating file at %@", path);
path = [[activeProject projectPath] stringByAppendingPathComponent:fileName];
// Create file // Create file
if (path) if (path)
{ {
NSDictionary *newFiles = nil; // Get file list for creation
NSEnumerator *enumerator; newFiles = [self
NSString *aFile; filesToCreateForFileOfType:fileType
path:path
withComplementary:[nfAddHeaderButton state]==NSOnState ? YES : NO];
// Do it finally... // Check if project already has files with such names
newFiles = [self createFileOfType:fileType
path:path
project:activeProject];
// Add files to a project
enumerator = [[newFiles allKeys] objectEnumerator]; enumerator = [[newFiles allKeys] objectEnumerator];
while ((aFile = [enumerator nextObject])) while ((filePath = [enumerator nextObject]))
{ {
fileType = [newFiles objectForKey:aFile]; key = [[newFiles objectForKey:filePath] objectForKey:@"ProjectKey"];
fileDict = [dict objectForKey:fileType]; fileName = [filePath lastPathComponent];
projectKey = [fileDict objectForKey:@"ProjectKey"]; if (![activeProject doesAcceptFile:fileName forKey:key])
if ([activeProject doesAcceptFile:aFile forKey:projectKey])
{ {
[activeProject addFiles:[NSArray arrayWithObject:aFile] NSRunAlertPanel(@"New File in Project",
forKey:projectKey @"Project %@ already has file %@ in %@",
notify:YES]; @"OK", nil, nil,
[activeProject projectName], fileName, key);
return NO;
}
if ([fm fileExistsAtPath:filePath])
{
int ret;
ret = NSRunAlertPanel
(@"New File in Project",
@"Project directory %@ already has file %@.\n"
"Do you want to overwrite it?",
@"Stop", @"Overwrite", nil,
[filePath stringByDeletingLastPathComponent],
fileName);
if (ret == NSAlertDefaultReturn) // Stop
{
return NO;
}
else // Overwrite. Remove destination of copy operation
{
[fm removeFileAtPath:filePath handler:nil];
}
} }
} }
// Create files
return [self createFiles:newFiles inProject:activeProject];
} }
return NO;
} }
@end @end

View file

@ -489,7 +489,7 @@ NSString
{ {
int ret; int ret;
ret = NSRunAlertPanel(@"Alert", ret = NSRunAlertPanel(@"Close Project",
@"Project or subprojects are modified", @"Project or subprojects are modified",
@"Save and Close",@"Don't save",@"Cancel"); @"Save and Close",@"Don't save",@"Cancel");
switch (ret) switch (ret)
@ -1145,9 +1145,9 @@ NSString
{ {
if (![fileManager copyFiles:fileList intoDirectory:directory]) if (![fileManager copyFiles:fileList intoDirectory:directory])
{ {
NSRunAlertPanel(@"Alert", NSRunAlertPanel(@"Add File(s)",
@"Error adding files to project %@!", @"Error adding files %@ to project %@!",
@"OK", nil, nil, projectName); @"OK", nil, nil, fileList, projectName);
return NO; return NO;
} }
@ -1156,9 +1156,9 @@ NSString
if (![fileManager copyFiles:complementaryFiles if (![fileManager copyFiles:complementaryFiles
intoDirectory:complementaryDir]) intoDirectory:complementaryDir])
{ {
NSRunAlertPanel(@"Alert", NSRunAlertPanel(@"Add File(s)",
@"Error adding complementary files to project %@!", @"Error adding files %@ to project %@!",
@"OK", nil, nil, projectName); @"OK", nil, nil, complementaryFiles, projectName);
return NO; return NO;
} }
} }

View file

@ -734,7 +734,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
if (!(project = [self createProjectOfType:projectType path:filePath])) if (!(project = [self createProjectOfType:projectType path:filePath]))
{ {
NSRunAlertPanel(@"Attention!", NSRunAlertPanel(@"New Project",
@"Failed to create %@!", @"Failed to create %@!",
@"OK",nil,nil,filePath); @"OK",nil,nil,filePath);
} }
@ -759,7 +759,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
// Save PC.project and the makefiles! // Save PC.project and the makefiles!
if ([rootProject save] == NO) if ([rootProject save] == NO)
{ {
NSRunAlertPanel(@"Attention!", NSRunAlertPanel(@"Save Project",
@"Couldn't save project %@!", @"Couldn't save project %@!",
@"OK",nil,nil,[activeProject projectName]); @"OK",nil,nil,[activeProject projectName]);
return NO; return NO;
@ -857,7 +857,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
if ([categoryKey isEqualToString:PCLibraries]) if ([categoryKey isEqualToString:PCLibraries])
{ {
ret = NSRunAlertPanel(@"Remove", ret = NSRunAlertPanel(@"Remove File",
@"Remove libraries from Project?", @"Remove libraries from Project?",
@"Remove", @"Remove",
@"Cancel", @"Cancel",
@ -865,7 +865,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
} }
else else
{ {
ret = NSRunAlertPanel(@"Remove", ret = NSRunAlertPanel(@"Remove File",
removeString, removeString,
@"...from Project and Disk", @"...from Project and Disk",
@"...from Project only", @"...from Project only",
@ -900,7 +900,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
if (!ret) if (!ret)
{ {
NSRunAlertPanel(@"Alert", NSRunAlertPanel(@"Remove File",
@"Error removing files from project %@!", @"Error removing files from project %@!",
@"OK", nil, nil, [activeProject projectName]); @"OK", nil, nil, [activeProject projectName]);
return NO; return NO;
@ -908,7 +908,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
else if (flag) else if (flag)
{ {
// Save project because we've removed file(s) from disk // Save project because we've removed file(s) from disk
// Should be fixed later (add pending removal of files?) // TODO: Should be fixed later (add pending removal of files?)
[activeProject save]; [activeProject save];
} }
} }
@ -1161,17 +1161,21 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
[nsNameField setStringValue:@""]; [nsNameField setStringValue:@""];
[nsPanel makeFirstResponder:nsNameField]; [nsPanel makeFirstResponder:nsNameField];
[nsPanel setLevel:NSModalPanelWindowLevel];
[NSApp runModalForWindow:nsPanel];
return YES; return YES;
} }
- (void)closeNewSubprojectPanel:(id)sender - (void)closeNewSubprojectPanel:(id)sender
{ {
[nsPanel orderOut:self]; [nsPanel orderOut:self];
[NSApp stopModal];
} }
- (BOOL)createSubproject:(id)sender - (BOOL)createSubproject:(id)sender
{ {
[nsPanel orderOut:self]; [self closeNewSubprojectPanel:self];
return [self createSubproject]; return [self createSubproject];
} }

View file

@ -48,8 +48,9 @@
IBOutlet NSPopUpButton *nfTypePB; IBOutlet NSPopUpButton *nfTypePB;
IBOutlet NSTextView *nfDescriptionTV; IBOutlet NSTextView *nfDescriptionTV;
IBOutlet NSTextField *nfNameField; IBOutlet NSTextField *nfNameField;
IBOutlet NSButton *nfCancleButton; IBOutlet NSButton *nfCancelButton;
IBOutlet NSButton *nfCreateButton; IBOutlet NSButton *nfCreateButton;
IBOutlet NSButton *nfAddHeaderButton;
} }
+ (id)sharedCreator; + (id)sharedCreator;
@ -57,10 +58,17 @@
- (NSDictionary *)creatorDictionary; - (NSDictionary *)creatorDictionary;
- (void)newFileInProject:(PCProject *)aProject; - (void)newFileInProject:(PCProject *)aProject;
// The implementation needs some heavy cleanup!
- (NSDictionary *)createFileOfType:(NSString *)type - (void)createFileOfType:(NSString *)fileType
path:(NSString *)path path:(NSString *)path
project:(PCProject *)aProject; project:(PCProject *)project;
// Return list of file paths for creation
- (NSDictionary *)filesToCreateForFileOfType:(NSString *)type
path:(NSString *)path
withComplementary:(BOOL)complementary;
- (BOOL)createFiles:(NSDictionary *)fileList
inProject:(PCProject *)aProject;
- (void)replaceTagsInFileAtPath:(NSString *)newFile - (void)replaceTagsInFileAtPath:(NSString *)newFile
withProject:(PCProject *)aProject; withProject:(PCProject *)aProject;
@ -74,7 +82,7 @@
- (void)createFile:(id)sender; - (void)createFile:(id)sender;
- (void)newFilePopupChanged:(id)sender; - (void)newFilePopupChanged:(id)sender;
- (void)controlTextDidChange:(NSNotification *)aNotif; - (void)controlTextDidChange:(NSNotification *)aNotif;
- (void)createFile; - (BOOL)createFile;
@end @end