mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-02-20 18:32:17 +00:00
PCProject's doesAcceptFile:forKey: fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@19576 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9084d3fa4b
commit
aab56397c9
10 changed files with 90 additions and 44 deletions
|
@ -1,3 +1,15 @@
|
||||||
|
2004-06-22 Serg Stoyan <stoyan255@ukr.net>
|
||||||
|
|
||||||
|
* Library/PCFileManager.m:
|
||||||
|
(panel:shouldShowFilename:): Treat .gorm dirs not as dirs.
|
||||||
|
|
||||||
|
* Library/PCProject.m:
|
||||||
|
(doesAcceptFile:forKey:): Check existance of file in
|
||||||
|
sourceFileKeys and resourceFileKeys.
|
||||||
|
|
||||||
|
* Modules/*: Made cleanup in sourceFileKeys, resourceFileKeys and
|
||||||
|
otherKeys methods.
|
||||||
|
|
||||||
2004-06-21 Serg Stoyan <stoyan255@ukr.net>
|
2004-06-21 Serg Stoyan <stoyan255@ukr.net>
|
||||||
|
|
||||||
* Library/PCFileManager.m:
|
* Library/PCFileManager.m:
|
||||||
|
|
|
@ -440,27 +440,32 @@ static PCFileManager *_mgr = nil;
|
||||||
NSString *fileType = nil;
|
NSString *fileType = nil;
|
||||||
NSString *categoryKey = nil;
|
NSString *categoryKey = nil;
|
||||||
|
|
||||||
if (sender == addFilesPanel
|
[fileManager fileExistsAtPath:filename isDirectory:&isDir];
|
||||||
&& [fileManager fileExistsAtPath:filename isDirectory:&isDir]
|
|
||||||
&& !isDir)
|
if ([[filename pathExtension] isEqualToString:@"gorm"])
|
||||||
{
|
{
|
||||||
project = [projectManager activeProject];
|
isDir = NO;
|
||||||
fileType = [fileTypePopup titleOfSelectedItem];
|
}
|
||||||
categoryKey = [project keyForCategory:fileType];
|
|
||||||
fileTypes = [project fileTypesForCategoryKey:categoryKey];
|
|
||||||
// Wrong file extension
|
|
||||||
if (fileTypes
|
|
||||||
&& ![fileTypes containsObject:[filename pathExtension]])
|
|
||||||
{
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
// File is already in project
|
|
||||||
if (![project doesAcceptFile:filename forKey:categoryKey])
|
|
||||||
{
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (sender == addFilesPanel && !isDir)
|
||||||
|
{
|
||||||
|
project = [projectManager activeProject];
|
||||||
|
fileType = [fileTypePopup titleOfSelectedItem];
|
||||||
|
categoryKey = [project keyForCategory:fileType];
|
||||||
|
fileTypes = [project fileTypesForCategoryKey:categoryKey];
|
||||||
|
// Wrong file extension
|
||||||
|
if (fileTypes
|
||||||
|
&& ![fileTypes containsObject:[filename pathExtension]])
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
// File is already in project
|
||||||
|
if (![project doesAcceptFile:filename forKey:categoryKey])
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,9 @@ extern NSString *PCProjectDictDidSaveNotification;
|
||||||
- (void)setLocalizableFile:(NSString *)file public:(BOOL)yn;
|
- (void)setLocalizableFile:(NSString *)file public:(BOOL)yn;
|
||||||
|
|
||||||
- (NSArray *)buildTargets;
|
- (NSArray *)buildTargets;
|
||||||
|
// Files placed into /
|
||||||
- (NSArray *)sourceFileKeys;
|
- (NSArray *)sourceFileKeys;
|
||||||
|
// Files placed into /Resources or /Language.lproj
|
||||||
- (NSArray *)resourceFileKeys;
|
- (NSArray *)resourceFileKeys;
|
||||||
- (NSArray *)otherKeys;
|
- (NSArray *)otherKeys;
|
||||||
- (NSArray *)allowableSubprojectTypes;
|
- (NSArray *)allowableSubprojectTypes;
|
||||||
|
|
|
@ -636,18 +636,36 @@ NSString
|
||||||
|
|
||||||
- (BOOL)doesAcceptFile:(NSString *)file forKey:(NSString *)type
|
- (BOOL)doesAcceptFile:(NSString *)file forKey:(NSString *)type
|
||||||
{
|
{
|
||||||
NSArray *projectFiles = [projectDict objectForKey:type];
|
NSString *pFile = [self projectFileFromFile:file forKey:type];
|
||||||
NSString *pFile = [self projectFileFromFile:file forKey:type];
|
NSArray *sourceKeys = [self sourceFileKeys];
|
||||||
|
NSArray *resourceKeys = [self resourceFileKeys];
|
||||||
|
NSEnumerator *keyEnum = nil;
|
||||||
|
NSString *key = nil;
|
||||||
|
NSArray *projectFiles = nil;
|
||||||
|
|
||||||
if ([[projectDict allKeys] containsObject:type])
|
if ([sourceKeys containsObject:type])
|
||||||
{
|
{
|
||||||
if (![projectFiles containsObject:pFile])
|
keyEnum = [sourceKeys objectEnumerator];
|
||||||
|
}
|
||||||
|
else if ([resourceKeys containsObject:type])
|
||||||
|
{
|
||||||
|
keyEnum = [resourceKeys objectEnumerator];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (key = [keyEnum nextObject])
|
||||||
|
{
|
||||||
|
projectFiles = [projectDict objectForKey:key];
|
||||||
|
if ([projectFiles containsObject:pFile])
|
||||||
{
|
{
|
||||||
return YES;
|
return NO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NO;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)addAndCopyFiles:(NSArray *)files forKey:(NSString *)key
|
- (BOOL)addAndCopyFiles:(NSArray *)files forKey:(NSString *)key
|
||||||
|
|
|
@ -81,10 +81,16 @@
|
||||||
return @"Project that contains subprojects.";
|
return @"Project that contains subprojects.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSArray *)sourceFileKeys
|
||||||
|
{
|
||||||
|
return [NSArray arrayWithObjects:
|
||||||
|
PCSupportingFiles, PCSubprojects, nil];
|
||||||
|
}
|
||||||
|
|
||||||
- (NSArray *)otherKeys
|
- (NSArray *)otherKeys
|
||||||
{
|
{
|
||||||
return [NSArray arrayWithObjects:
|
return [NSArray arrayWithObjects:
|
||||||
PCSubprojects, PCSupportingFiles, PCNonProject, nil];
|
PCNonProject, nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)allowableSubprojectTypes
|
- (NSArray *)allowableSubprojectTypes
|
||||||
|
|
|
@ -101,7 +101,9 @@
|
||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
|
#idef DEVELOPMENT
|
||||||
NSLog (@"PCAppProject: dealloc");
|
NSLog (@"PCAppProject: dealloc");
|
||||||
|
#endif
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||||
|
|
||||||
|
@ -148,7 +150,8 @@
|
||||||
- (NSArray *)sourceFileKeys
|
- (NSArray *)sourceFileKeys
|
||||||
{
|
{
|
||||||
return [NSArray arrayWithObjects:
|
return [NSArray arrayWithObjects:
|
||||||
PCClasses, PCHeaders, PCOtherSources, nil];
|
PCClasses, PCHeaders, PCOtherSources,
|
||||||
|
PCSupportingFiles, PCSubprojects, nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)resourceFileKeys
|
- (NSArray *)resourceFileKeys
|
||||||
|
@ -160,8 +163,7 @@
|
||||||
- (NSArray *)otherKeys
|
- (NSArray *)otherKeys
|
||||||
{
|
{
|
||||||
return [NSArray arrayWithObjects:
|
return [NSArray arrayWithObjects:
|
||||||
PCDocuFiles, PCLibraries, PCSubprojects, PCSupportingFiles, PCNonProject,
|
PCLibraries, PCNonProject, nil];
|
||||||
nil];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)allowableSubprojectTypes
|
- (NSArray *)allowableSubprojectTypes
|
||||||
|
|
|
@ -110,20 +110,20 @@
|
||||||
- (NSArray *)sourceFileKeys
|
- (NSArray *)sourceFileKeys
|
||||||
{
|
{
|
||||||
return [NSArray arrayWithObjects:
|
return [NSArray arrayWithObjects:
|
||||||
PCClasses, PCHeaders, PCOtherSources, nil];
|
PCClasses, PCHeaders, PCOtherSources,
|
||||||
|
PCSubprojects, PCSupportingFiles, nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)resourceFileKeys
|
- (NSArray *)resourceFileKeys
|
||||||
{
|
{
|
||||||
return [NSArray arrayWithObjects:
|
return [NSArray arrayWithObjects:
|
||||||
PCInterfaces, PCOtherResources, PCImages, nil];
|
PCInterfaces, PCOtherResources, PCImages, PCDocuFiles, nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)otherKeys
|
- (NSArray *)otherKeys
|
||||||
{
|
{
|
||||||
return [NSArray arrayWithObjects:
|
return [NSArray arrayWithObjects:
|
||||||
PCDocuFiles, PCLibraries, PCSubprojects, PCSupportingFiles, PCNonProject,
|
PCLibraries, PCNonProject, nil];
|
||||||
nil];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)allowableSubprojectTypes
|
- (NSArray *)allowableSubprojectTypes
|
||||||
|
|
|
@ -129,19 +129,20 @@
|
||||||
- (NSArray *)sourceFileKeys
|
- (NSArray *)sourceFileKeys
|
||||||
{
|
{
|
||||||
return [NSArray arrayWithObjects:
|
return [NSArray arrayWithObjects:
|
||||||
PCClasses, PCHeaders, PCOtherSources,nil];
|
PCClasses, PCHeaders, PCOtherSources,
|
||||||
|
PCSubprojects, PCSupportingFiles, nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)resourceFileKeys
|
- (NSArray *)resourceFileKeys
|
||||||
{
|
{
|
||||||
return [NSArray arrayWithObjects:
|
return [NSArray arrayWithObjects:
|
||||||
PCInterfaces, PCImages, PCOtherResources, nil];
|
PCInterfaces, PCImages, PCOtherResources, PCDocuFiles, nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)otherKeys
|
- (NSArray *)otherKeys
|
||||||
{
|
{
|
||||||
return [NSArray arrayWithObjects:
|
return [NSArray arrayWithObjects:
|
||||||
PCDocuFiles, PCLibraries, PCSubprojects, PCSupportingFiles, nil];
|
PCLibraries, PCNonProject, nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)allowableSubprojectTypes
|
- (NSArray *)allowableSubprojectTypes
|
||||||
|
|
|
@ -147,20 +147,20 @@
|
||||||
- (NSArray *)sourceFileKeys
|
- (NSArray *)sourceFileKeys
|
||||||
{
|
{
|
||||||
return [NSArray arrayWithObjects:
|
return [NSArray arrayWithObjects:
|
||||||
PCClasses, PCHeaders, PCOtherSources, nil];
|
PCClasses, PCHeaders, PCOtherSources,
|
||||||
|
PCSupportingFiles, PCSubprojects, nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)resourceFileKeys
|
- (NSArray *)resourceFileKeys
|
||||||
{
|
{
|
||||||
return [NSArray arrayWithObjects:
|
return [NSArray arrayWithObjects:
|
||||||
PCInterfaces, PCImages, PCOtherResources, nil];
|
PCInterfaces, PCImages, PCOtherResources, PCDocuFiles, nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)otherKeys
|
- (NSArray *)otherKeys
|
||||||
{
|
{
|
||||||
return [NSArray arrayWithObjects:
|
return [NSArray arrayWithObjects:
|
||||||
PCDocuFiles, PCLibraries, PCSubprojects, PCSupportingFiles, PCNonProject,
|
PCLibraries, PCNonProject, nil];
|
||||||
nil];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)allowableSubprojectTypes
|
- (NSArray *)allowableSubprojectTypes
|
||||||
|
|
|
@ -134,19 +134,19 @@
|
||||||
- (NSArray *)sourceFileKeys
|
- (NSArray *)sourceFileKeys
|
||||||
{
|
{
|
||||||
return [NSArray arrayWithObjects:
|
return [NSArray arrayWithObjects:
|
||||||
PCClasses, PCHeaders, PCOtherSources, nil];
|
PCClasses, PCHeaders, PCOtherSources, PCSupportingFiles, nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)resourceFileKeys
|
- (NSArray *)resourceFileKeys
|
||||||
{
|
{
|
||||||
return [NSArray arrayWithObjects:
|
return [NSArray arrayWithObjects:
|
||||||
PCImages, PCOtherResources, nil];
|
PCImages, PCOtherResources, PCDocuFiles, PCSubprojects, nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)otherKeys
|
- (NSArray *)otherKeys
|
||||||
{
|
{
|
||||||
return [NSArray arrayWithObjects:
|
return [NSArray arrayWithObjects:
|
||||||
PCSubprojects, PCLibraries, PCDocuFiles, PCSupportingFiles, nil];
|
PCLibraries, PCNonProject, nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)allowableSubprojectTypes
|
- (NSArray *)allowableSubprojectTypes
|
||||||
|
|
Loading…
Reference in a new issue