mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-02-15 08:00:56 +00:00
* Framework/PCBundleManager.m,
* Headers/ProjectCenter/PCBundleManager.h: Make massive cleaup. some methods changed, some deleted, some added. * Framework/PCProjectManager.m, * Framework/PCProjectEditor.m: Make use of changed PCBundleManager. * TextFinder.m: (-enterSelection:): Add sanity check for text variable. (-jumpToSelection:): Ditto. * Modules/Parsers/ProjectCenter/Resources/Info.table: Fix value of "Name" key. * Headers/Protocols/CodeEditor.h: Remove declaration of openExternalEditor:withPath:projectEditor: method. It will be provided by Custom.editor bundle (will be added soon). * Headers/ProjectCenter/PCProjectEditor.h: Cleanup. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@25504 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e8e18614e8
commit
26dc666444
9 changed files with 300 additions and 175 deletions
|
@ -1,5 +1,22 @@
|
|||
2007-09-24 Sergii Stoian <stoyan255@gmail.com>
|
||||
|
||||
* Framework/PCBundleManager.m,
|
||||
* Headers/ProjectCenter/PCBundleManager.h: Make massive cleaup.
|
||||
some methods changed, some deleted, some added.
|
||||
* Framework/PCProjectManager.m,
|
||||
* Framework/PCProjectEditor.m: Make use of changed PCBundleManager.
|
||||
* TextFinder.m:
|
||||
(-enterSelection:): Add sanity check for text variable.
|
||||
(-jumpToSelection:): Ditto.
|
||||
* Modules/Parsers/ProjectCenter/Resources/Info.table: Fix value of
|
||||
"Name" key.
|
||||
* Headers/Protocols/CodeEditor.h: Remove declaration of
|
||||
openExternalEditor:withPath:projectEditor: method. It will be provided
|
||||
by Custom.editor bundle (will be added soon).
|
||||
* Headers/ProjectCenter/PCProjectEditor.h: Cleanup.
|
||||
|
||||
2007-09-24 Sergii Stoian <stoyan255@gmail.com>
|
||||
|
||||
* English.lproj/FindPanel.gorm: Added Find panel.
|
||||
* PCMenuController.m: Added Find panel support.
|
||||
* TextFinder.[hm]: Added implementation of Find panel.
|
||||
|
|
|
@ -23,6 +23,14 @@
|
|||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
// TODO: Finish support for third party bundles.
|
||||
// It involves support for user defined bundle directories
|
||||
// through preferences. Now supported are:
|
||||
// - PC application resource dir
|
||||
// (GNUSTEP_SYSTEM_APPS/ProjectCenter.app/Resources)
|
||||
// - GNUSTEP_SYSTEM_LIBRARY/Bundles/ProjectCenter
|
||||
// (NSApplicationSupportDirectory)
|
||||
|
||||
#include <ProjectCenter/PCBundleManager.h>
|
||||
#include <ProjectCenter/PCDefines.h>
|
||||
|
||||
|
@ -68,11 +76,13 @@
|
|||
return path;
|
||||
}
|
||||
|
||||
//
|
||||
// --- Handling of bundles' Info.table dictionaries without actual
|
||||
// --- bundles loading
|
||||
|
||||
// bundlesInfo is a dictionary. key/value pair is the following:
|
||||
// (NSString *) (NSDictionary *)
|
||||
// "full path of a bundle" = "Info.table contents"
|
||||
// propertyValueOfClass:withKey:
|
||||
- (NSDictionary *)infoForBundlesOfType:(NSString *)extension
|
||||
- (NSDictionary *)infoForBundlesType:(NSString *)extension
|
||||
{
|
||||
NSArray *bundles;
|
||||
NSEnumerator *enumerator;
|
||||
|
@ -90,6 +100,8 @@
|
|||
{
|
||||
infoTablePath = [NSString
|
||||
stringWithFormat:@"%@/Resources/Info.table", bundlePath];
|
||||
// TODO: fill 'reqBundlesInfo' with element from 'bundlesInfo' if
|
||||
// exists
|
||||
infoTable = [NSDictionary dictionaryWithContentsOfFile:infoTablePath];
|
||||
[reqBundlesInfo setObject:infoTable forKey:bundlePath];
|
||||
[bundlesInfo setObject:infoTable forKey:bundlePath];
|
||||
|
@ -98,6 +110,95 @@
|
|||
return reqBundlesInfo;
|
||||
}
|
||||
|
||||
// Key value can be checked against NSString and NSArray values only.
|
||||
- (NSDictionary *)infoForBundleType:(NSString *)extension
|
||||
keyName:(NSString *)key
|
||||
keyContains:(NSString *)value
|
||||
{
|
||||
NSDictionary *reqBundlesInfo;
|
||||
NSEnumerator *enumerator;
|
||||
NSString *bundlePath;
|
||||
id keyValue;
|
||||
NSDictionary *infoTable;
|
||||
|
||||
if (extension == nil)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
reqBundlesInfo = [self infoForBundlesType:extension];
|
||||
enumerator = [[reqBundlesInfo allKeys] objectEnumerator];
|
||||
|
||||
while ((bundlePath = [enumerator nextObject]))
|
||||
{
|
||||
infoTable = [reqBundlesInfo objectForKey:bundlePath];
|
||||
|
||||
if (key == nil || value == nil)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
keyValue = [infoTable objectForKey:key];
|
||||
|
||||
if ([keyValue isKindOfClass:[NSString class]] &&
|
||||
[keyValue isEqualToString:value])
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if ([keyValue isKindOfClass:[NSArray class]] &&
|
||||
[keyValue containsObject:value])
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
infoTable = nil;
|
||||
}
|
||||
}
|
||||
|
||||
return infoTable;
|
||||
}
|
||||
|
||||
- (NSDictionary *)infoForBundleName:(NSString *)name
|
||||
type:(NSString *)type
|
||||
{
|
||||
NSDictionary *reqBundlesInfo = [self infoForBundlesType:type];
|
||||
NSEnumerator *enumerator = [[reqBundlesInfo allKeys] objectEnumerator];
|
||||
NSString *bundlePath;
|
||||
NSDictionary *infoTable;
|
||||
|
||||
while ((bundlePath = [enumerator nextObject]))
|
||||
{
|
||||
infoTable = [reqBundlesInfo objectForKey:bundlePath];
|
||||
if ([[infoTable objectForKey:@"Name"] isEqualToString:name])
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
infoTable = nil;
|
||||
}
|
||||
}
|
||||
|
||||
return infoTable;
|
||||
}
|
||||
|
||||
- (NSString *)classNameForBundleType:(NSString*)type
|
||||
fileName:(NSString *)fileName
|
||||
{
|
||||
NSString *fileExtension = [fileName pathExtension];
|
||||
NSDictionary *infoTable = nil;
|
||||
NSString *className = nil;
|
||||
|
||||
infoTable = [self infoForBundleType:type
|
||||
keyName:@"FileTypes"
|
||||
keyContains:fileExtension];
|
||||
|
||||
className = [infoTable objectForKey:@"PrincipalClassName"];
|
||||
|
||||
return className;
|
||||
}
|
||||
|
||||
- (NSString *)bundlePathWithName:(NSString *)bundleName
|
||||
{
|
||||
NSArray *bundlePaths = nil;
|
||||
|
@ -108,6 +209,9 @@
|
|||
bundlePaths = [bundlesInfo allKeys];
|
||||
enumerator = [bundlePaths objectEnumerator];
|
||||
|
||||
NSLog(@"Bundle fullpath method #1: %@",
|
||||
[[self resourcePath] stringByAppendingPathComponent:bundleName]);
|
||||
|
||||
while ((bundleFullPath = [enumerator nextObject]))
|
||||
{
|
||||
if ([[bundleFullPath lastPathComponent] isEqualToString:bundleName])
|
||||
|
@ -116,14 +220,73 @@
|
|||
}
|
||||
}
|
||||
|
||||
NSLog(@"Bundle fullpath method #2: %@", bundleFullPath);
|
||||
|
||||
return bundleFullPath;
|
||||
}
|
||||
|
||||
- (NSBundle *)bundleOfType:(NSString *)type forClassName:(NSString *)className
|
||||
// --- Invokes loading of bundle
|
||||
|
||||
- (id)objectForClassName:(NSString *)className
|
||||
bundleType:(NSString *)bundleExtension
|
||||
protocol:(Protocol *)proto
|
||||
{
|
||||
Class objectClass;
|
||||
|
||||
if ([self bundleOfType:bundleExtension withClassName:className] == nil)
|
||||
{
|
||||
NSLog(@"Bundle for class %@ NOT FOUND!", className);
|
||||
return nil;
|
||||
}
|
||||
|
||||
objectClass = NSClassFromString(className);
|
||||
|
||||
if (proto != nil && ![objectClass conformsToProtocol:proto])
|
||||
{
|
||||
[NSException raise:NOT_A_PROJECT_TYPE_EXCEPTION
|
||||
format:@"%@ does not conform to protocol!", className];
|
||||
return nil;
|
||||
}
|
||||
|
||||
return [[objectClass alloc] init];
|
||||
}
|
||||
|
||||
- (id)objectForBundleWithName:(NSString *)name
|
||||
type:(NSString *)extension
|
||||
protocol:(Protocol *)proto
|
||||
{
|
||||
NSDictionary *infoTable;
|
||||
NSString *className;
|
||||
|
||||
infoTable = [self infoForBundleName:name type:extension];
|
||||
className = [infoTable objectForKey:@"PrincipalClassName"];
|
||||
|
||||
return [self objectForClassName:className
|
||||
bundleType:extension
|
||||
protocol:proto];
|
||||
}
|
||||
|
||||
- (id)objectForBundleType:(NSString *)extension
|
||||
protocol:(Protocol *)proto
|
||||
fileName:(NSString *)fileName
|
||||
{
|
||||
NSString *className;
|
||||
|
||||
className = [self classNameForBundleType:extension fileName:fileName];
|
||||
|
||||
return [self objectForClassName:className
|
||||
bundleType:extension
|
||||
protocol:proto];
|
||||
}
|
||||
|
||||
// --- Bundle loading
|
||||
|
||||
- (NSBundle *)bundleOfType:(NSString *)type
|
||||
withClassName:(NSString *)className
|
||||
{
|
||||
NSArray *bundlePaths = nil;
|
||||
NSDictionary *infoTable = nil;
|
||||
NSString *bundleFullPath = nil;
|
||||
NSDictionary *infoTable = nil;
|
||||
NSEnumerator *enumerator = nil;
|
||||
NSString *bundleName = nil;
|
||||
NSString *principalClass;
|
||||
|
@ -158,35 +321,9 @@
|
|||
return [loadedBundles objectForKey:bundleFullPath];
|
||||
}
|
||||
|
||||
- (id)objectForClassName:(NSString *)className
|
||||
withProtocol:(Protocol *)proto
|
||||
inBundleType:(NSString *)type
|
||||
{
|
||||
Class objectClass;
|
||||
|
||||
if ([self bundleOfType:type forClassName:className] == nil)
|
||||
{
|
||||
NSLog(@"Bundle for class %@ NOT FOUND!", className);
|
||||
return nil;
|
||||
}
|
||||
|
||||
objectClass = NSClassFromString(className);
|
||||
|
||||
if (proto != nil && ![objectClass conformsToProtocol:proto])
|
||||
{
|
||||
[NSException raise:NOT_A_PROJECT_TYPE_EXCEPTION
|
||||
format:@"%@ does not conform to protocol!", className];
|
||||
return nil;
|
||||
}
|
||||
|
||||
return [[objectClass alloc] init];
|
||||
}
|
||||
|
||||
- (BOOL)loadBundleIfNeededWithName:(NSString *)bundleName
|
||||
{
|
||||
NSString *bundleFullPath;
|
||||
|
||||
bundleFullPath = [self bundlePathWithName:bundleName];
|
||||
NSString *bundleFullPath = [self bundlePathWithName:bundleName];
|
||||
|
||||
// Check if bundle allready loaded
|
||||
if ([[loadedBundles allKeys] containsObject:bundleFullPath] == NO)
|
||||
|
@ -197,7 +334,6 @@
|
|||
return YES;
|
||||
}
|
||||
|
||||
// ---
|
||||
- (void)loadBundlesWithExtension:(NSString *)extension
|
||||
{
|
||||
NSEnumerator *enumerator;
|
||||
|
@ -216,10 +352,9 @@
|
|||
objectEnumerator];
|
||||
while ((path = [enumerator nextObject]) != nil)
|
||||
{
|
||||
path = [path stringByAppendingPathComponent: @"ProjectCenter"];
|
||||
path = [path stringByAppendingPathComponent:@"ProjectCenter"];
|
||||
|
||||
if ([fileManager fileExistsAtPath: path isDirectory: &isDir]
|
||||
&& isDir)
|
||||
if ([fileManager fileExistsAtPath:path isDirectory:&isDir] && isDir)
|
||||
{
|
||||
PCLogInfo(self, @"Loading bundles at %@", path);
|
||||
[self loadBundlesAtPath:path withExtension:extension];
|
||||
|
|
|
@ -115,7 +115,6 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
|
||||
- (id)initWithProject:(PCProject *)aProject
|
||||
{
|
||||
PCBundleManager *bundleManager;
|
||||
NSAssert(aProject, @"No project specified!");
|
||||
|
||||
if ((self = [super init]))
|
||||
|
@ -125,15 +124,6 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
componentView = nil;
|
||||
editorsDict = [[NSMutableDictionary alloc] init];
|
||||
|
||||
// Bundles
|
||||
bundleManager = [[project projectManager] bundleManager];
|
||||
|
||||
// Editor bundles
|
||||
editorBundlesInfo = [[bundleManager infoForBundlesOfType:@"editor"] copy];
|
||||
|
||||
// Parser bundles
|
||||
parserBundlesInfo = [[bundleManager infoForBundlesOfType:@"parser"] copy];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(editorDidOpen:)
|
||||
|
@ -182,8 +172,6 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
RELEASE(componentView);
|
||||
}
|
||||
|
||||
RELEASE(editorBundlesInfo);
|
||||
RELEASE(parserBundlesInfo);
|
||||
RELEASE(editorsDict);
|
||||
|
||||
[super dealloc];
|
||||
|
@ -208,63 +196,12 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
// ==== Project and Editor handling
|
||||
// ===========================================================================
|
||||
|
||||
- (NSDictionary *)infoTableForBundleType:(NSString *)type
|
||||
andFileType:(NSString *)extension
|
||||
{
|
||||
NSDictionary *bundlesInfo = nil;
|
||||
NSEnumerator *enumerator = nil;
|
||||
NSString *bundlePathKey = nil;
|
||||
NSDictionary *infoTable = nil;
|
||||
|
||||
if ([type isEqualToString:@"editor"])
|
||||
{
|
||||
bundlesInfo = editorBundlesInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
bundlesInfo = parserBundlesInfo;
|
||||
}
|
||||
|
||||
enumerator = [[bundlesInfo allKeys] objectEnumerator];
|
||||
while ((bundlePathKey = [enumerator nextObject]))
|
||||
{
|
||||
infoTable = [bundlesInfo objectForKey:bundlePathKey];
|
||||
if ([[infoTable objectForKey:@"FileTypes"] containsObject:extension])
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
infoTable = nil;
|
||||
}
|
||||
}
|
||||
|
||||
return infoTable;
|
||||
}
|
||||
|
||||
- (NSString *)classNameForBundleType:(NSString*)type
|
||||
andFile:(NSString *)file
|
||||
{
|
||||
NSString *fileExtension = [file pathExtension];
|
||||
NSDictionary *infoTable = nil;
|
||||
NSString *className = nil;
|
||||
|
||||
infoTable = [self infoTableForBundleType:type andFileType:fileExtension];
|
||||
className = [infoTable objectForKey:@"PrincipalClassName"];
|
||||
|
||||
if (className == nil && [type isEqualToString:@"editor"])
|
||||
{
|
||||
className = [NSString stringWithString:@"PCEditor"];
|
||||
}
|
||||
|
||||
return className;
|
||||
}
|
||||
|
||||
// TODO: Should it be editor or parser?
|
||||
- (BOOL)editorProvidesBrowserItemsForItem:(NSString *)item
|
||||
{
|
||||
NSString *file = [[project projectBrowser] nameOfSelectedFile];
|
||||
NSDictionary *infoTable = nil;
|
||||
NSString *file = [[project projectBrowser] nameOfSelectedFile];
|
||||
PCBundleManager *bundleManager = [[project projectManager] bundleManager];
|
||||
NSDictionary *infoTable = nil;
|
||||
|
||||
// File selected and editor should already be loaded
|
||||
if (file != nil)
|
||||
|
@ -276,8 +213,9 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
}
|
||||
|
||||
// Category selected
|
||||
infoTable = [self infoTableForBundleType:@"editor"
|
||||
andFileType:[item pathExtension]];
|
||||
infoTable = [bundleManager infoForBundleType:@"editor"
|
||||
keyName:@"FileTypes"
|
||||
keyContains:[item pathExtension]];
|
||||
|
||||
if ([[infoTable objectForKey:@"ProvidesBrowserItems"] isEqualToString:@"YES"])
|
||||
{
|
||||
|
@ -381,48 +319,35 @@ NSString *PCEditorDidResignActiveNotification =
|
|||
editable:(BOOL)editable
|
||||
windowed:(BOOL)windowed
|
||||
{
|
||||
// NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
// NSString *ed = [ud objectForKey:Editor];
|
||||
PCBundleManager *bundleManager = [[project projectManager] bundleManager];
|
||||
NSString *editorClassName = nil;
|
||||
NSString *parserClassName = nil;
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
NSString *ed = [ud objectForKey:Editor];
|
||||
NSString *fileName = [path lastPathComponent];
|
||||
id<CodeEditor> editor;
|
||||
id<CodeParser> parser;
|
||||
|
||||
NSLog(@"PCPE: categoryPath: \"%@\"", categoryPath);
|
||||
|
||||
// TODO: Include external editor code into editor bundle?
|
||||
/* if (![ed isEqualToString:@"ProjectCenter"])
|
||||
{
|
||||
[editor initExternalEditor:ed withPath:path projectEditor:self];
|
||||
return editor;
|
||||
}*/
|
||||
|
||||
if (!(editor = [editorsDict objectForKey:path]))
|
||||
{
|
||||
// Editor
|
||||
editorClassName = [self classNameForBundleType:@"editor"
|
||||
andFile:[path lastPathComponent]];
|
||||
editor = [bundleManager objectForClassName:editorClassName
|
||||
withProtocol:@protocol(CodeEditor)
|
||||
inBundleType:@"editor"];
|
||||
if (!editor)
|
||||
editor = [bundleManager objectForBundleWithName:ed
|
||||
type:@"editor"
|
||||
protocol:@protocol(CodeEditor)];
|
||||
if (editor == nil)
|
||||
{
|
||||
editor = [bundleManager
|
||||
objectForBundleWithName:@"ProjectCenter"
|
||||
type:@"editor"
|
||||
protocol:@protocol(CodeEditor)];
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Parser
|
||||
parserClassName = [self classNameForBundleType:@"parser"
|
||||
andFile:[path lastPathComponent]];
|
||||
if (parserClassName != nil)
|
||||
{
|
||||
NSLog(@"PCPE: parser: %@", parserClassName);
|
||||
parser = [bundleManager objectForClassName:parserClassName
|
||||
withProtocol:@protocol(CodeParser)
|
||||
inBundleType:@"parser"];
|
||||
[editor setParser:parser];
|
||||
RELEASE(parser);
|
||||
}
|
||||
parser = [bundleManager objectForBundleType:@"parser"
|
||||
protocol:@protocol(CodeParser)
|
||||
fileName:fileName];
|
||||
[editor setParser:parser];
|
||||
|
||||
[editor openFileAtPath:path
|
||||
categoryPath:categoryPath
|
||||
|
|
|
@ -178,7 +178,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
if (projectTypes == nil)
|
||||
{
|
||||
projectTypes = [[NSMutableDictionary alloc] init];
|
||||
bundlesInfo = [bundleManager infoForBundlesOfType:@"project"];
|
||||
bundlesInfo = [bundleManager infoForBundlesType:@"project"];
|
||||
|
||||
bundlePaths = [bundlesInfo allKeys];
|
||||
enumerator = [bundlePaths objectEnumerator];
|
||||
|
@ -521,8 +521,8 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
stringByAppendingPathComponent:@"PC.project"];
|
||||
|
||||
project = [bundleManager objectForClassName:projectClassName
|
||||
withProtocol:@protocol(ProjectType)
|
||||
inBundleType:@"project"];
|
||||
bundleType:@"project"
|
||||
protocol:@protocol(ProjectType)];
|
||||
|
||||
projectTypeName = [project projectTypeName];
|
||||
[pDict setObject:projectTypeName forKey:PCProjectType];
|
||||
|
@ -565,8 +565,8 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
return nil;
|
||||
}
|
||||
project = [bundleManager objectForClassName:projectClassName
|
||||
withProtocol:@protocol(ProjectType)
|
||||
inBundleType:@"project"];
|
||||
bundleType:@"project"
|
||||
protocol:@protocol(ProjectType)];
|
||||
}
|
||||
|
||||
if (![project openWithDictionaryAt:aPath])
|
||||
|
@ -652,8 +652,8 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
}
|
||||
|
||||
projectCreator = [bundleManager objectForClassName:className
|
||||
withProtocol:@protocol(ProjectType)
|
||||
inBundleType:@"project"];
|
||||
bundleType:@"project"
|
||||
protocol:@protocol(ProjectType)];
|
||||
// NSLog(@"%@ CLASS: %@", className, projectCreator);
|
||||
if (!projectCreator)
|
||||
{
|
||||
|
@ -1076,21 +1076,19 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
|
||||
- (void)openFileWithEditor:(NSString *)path
|
||||
{
|
||||
/* id<CodeEditor> editor;
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
// id<CodeEditor> editor;
|
||||
/* NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
NSString *editor = [ud objectForKey:Editor];
|
||||
|
||||
editor = [PCProjectEditor openFileInEditor:path];
|
||||
|
||||
if (![editor isEqualToString:@"ProjectCenter"])
|
||||
{
|
||||
NSArray *ea = [editor componentsSeparatedByString:@" "];
|
||||
NSString *app = [ea objectAtIndex: 0];
|
||||
NSString *app = [ea objectAtIndex:0];
|
||||
|
||||
if ([[app pathExtension] isEqualToString:@"app"])
|
||||
{
|
||||
BOOL ret = [[NSWorkspace sharedWorkspace] openFile:path
|
||||
withApplication:app];
|
||||
withApplication:app];
|
||||
|
||||
if (ret == NO)
|
||||
{
|
||||
|
@ -1101,24 +1099,22 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
}
|
||||
|
||||
editor = [[editorClass alloc] initExternalEditor:editor
|
||||
withPath:path
|
||||
projectEditor:self];
|
||||
withPath:path
|
||||
projectEditor:self];
|
||||
}
|
||||
else
|
||||
{
|
||||
id<CodeEditor> editor;
|
||||
|
||||
editor = [[editorClass alloc] initWithPath:path
|
||||
categoryPath:nil
|
||||
projectEditor:self];
|
||||
categoryPath:nil
|
||||
projectEditor:self];
|
||||
[editor setWindowed:YES];
|
||||
[editor show];
|
||||
|
||||
return editor;
|
||||
}
|
||||
|
||||
return nil;
|
||||
|
||||
[nonProjectEditors setObject:editor forKey:path];
|
||||
|
||||
[editor release];*/
|
||||
|
@ -1251,8 +1247,8 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
}*/
|
||||
|
||||
projectCreator = [bundleManager objectForClassName:className
|
||||
withProtocol:@protocol(ProjectType)
|
||||
inBundleType:@"project"];
|
||||
bundleType:@"project"
|
||||
protocol:@protocol(ProjectType)];
|
||||
if (!(subproject = [projectCreator createProjectAt:aPath]))
|
||||
{
|
||||
return nil;
|
||||
|
|
|
@ -43,14 +43,44 @@
|
|||
|
||||
- (NSString *)resourcePath;
|
||||
|
||||
- (NSDictionary *)infoForBundlesOfType:(NSString *)extension;
|
||||
- (NSString *)bundlePathWithName:(NSString *)bundleName;
|
||||
- (NSBundle *)bundleOfType:(NSString *)type forClassName:(NSString *)className;
|
||||
- (id)objectForClassName:(NSString *)className
|
||||
withProtocol:(Protocol *)proto
|
||||
inBundleType:(NSString *)type;
|
||||
- (BOOL)loadBundleIfNeededWithName:(NSString *)bundleName;
|
||||
// --- Handling of bundles' Info.table dictionaries without actual
|
||||
// --- bundles loading
|
||||
|
||||
- (NSDictionary *)infoForBundlesType:(NSString *)extension;
|
||||
|
||||
// Key value can be checked against NSString and NSArray values only.
|
||||
- (NSDictionary *)infoForBundleType:(NSString *)extension
|
||||
keyName:(NSString *)key
|
||||
keyContains:(NSString *)value;
|
||||
|
||||
- (NSDictionary *)infoForBundleName:(NSString *)name
|
||||
type:(NSString *)type;
|
||||
|
||||
- (NSString *)classNameForBundleType:(NSString*)type
|
||||
fileName:(NSString *)fileName;
|
||||
|
||||
- (NSString *)bundlePathWithName:(NSString *)bundleName;
|
||||
|
||||
// --- Invokes loading of bundle
|
||||
|
||||
- (id)objectForClassName:(NSString *)className
|
||||
bundleType:(NSString *)bundleExtension
|
||||
protocol:(Protocol *)proto;
|
||||
|
||||
- (id)objectForBundleWithName:(NSString *)name
|
||||
type:(NSString *)extension
|
||||
protocol:(Protocol *)proto;
|
||||
|
||||
- (id)objectForBundleType:(NSString *)extension
|
||||
protocol:(Protocol *)proto
|
||||
fileName:(NSString *)fileName;
|
||||
|
||||
- (NSBundle *)bundleOfType:(NSString *)type
|
||||
withClassName:(NSString *)className;
|
||||
|
||||
// --- Bundle loading
|
||||
|
||||
- (BOOL)loadBundleIfNeededWithName:(NSString *)bundleName;
|
||||
// Load all bundles found in the BundlePaths
|
||||
- (void)loadBundlesWithExtension:(NSString *)extension;
|
||||
- (void)loadBundlesAtPath:(NSString *)path withExtension:(NSString *)extension;
|
||||
|
|
|
@ -67,12 +67,6 @@
|
|||
// ==== Project and Editor handling
|
||||
// ===========================================================================
|
||||
|
||||
- (NSDictionary *)infoTableForBundleType:(NSString *)type
|
||||
andFileType:(NSString *)extension;
|
||||
|
||||
- (NSString *)classNameForBundleType:(NSString*)type
|
||||
andFile:(NSString *)file;
|
||||
|
||||
- (BOOL)editorProvidesBrowserItemsForItem:(NSString *)item;
|
||||
|
||||
// Returns nil if editor is not opened
|
||||
|
|
|
@ -40,10 +40,6 @@
|
|||
projectEditor:(id)aProjectEditor
|
||||
editable:(BOOL)editable;
|
||||
|
||||
- (id)openExternalEditor:(NSString *)editor
|
||||
withPath:(NSString *)file
|
||||
projectEditor:(id)aProjectEditor;
|
||||
|
||||
- (void)show;
|
||||
- (void)setWindowed:(BOOL)yn;
|
||||
- (BOOL)isWindowed;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
Type = "Parser";
|
||||
Name = "CodeEditor ObjectiveC parser";
|
||||
Name = "ProjectCenter";
|
||||
Description = "Parser for C and ObjectiveC language";
|
||||
PrincipalClassName = "PCParser";
|
||||
FileTypes = (C,c,m,M,h,H,cc,CC);
|
||||
|
|
40
TextFinder.m
40
TextFinder.m
|
@ -280,18 +280,22 @@ static id sharedFindObject = nil;
|
|||
- (void)enterSelection:(id)sender
|
||||
{
|
||||
NSTextView *text = [self textObjectToSearchIn];
|
||||
NSRange range = [text selectedRange];
|
||||
NSString *string = [text string];
|
||||
|
||||
[self setFindString:[string substringWithRange:range]];
|
||||
if (text && string)
|
||||
{
|
||||
[self setFindString:[string substringWithRange:[text selectedRange]]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)jumpToSelection:(id)sender
|
||||
{
|
||||
NSTextView *text = [self textObjectToSearchIn];
|
||||
NSRange range = [text selectedRange];
|
||||
|
||||
[text scrollRangeToVisible:range];
|
||||
if (text)
|
||||
{
|
||||
[text scrollRangeToVisible:[text selectedRange]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)replace:(id)sender
|
||||
|
@ -386,6 +390,34 @@ static id sharedFindObject = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (BOOL)validateMenuItem:(NSMenuItem *)anItem
|
||||
{
|
||||
|
||||
if ([anItem action] == @selector(orderFrontFindPanel:))
|
||||
{
|
||||
return ([self textObjectToSearchIn] != NULL);
|
||||
}
|
||||
if ([anItem action] == @selector(findNext:))
|
||||
{
|
||||
return ([self textObjectToSearchIn] != NULL);
|
||||
}
|
||||
if ([anItem action] == @selector(findPrevious:))
|
||||
{
|
||||
return ([self textObjectToSearchIn] != NULL);
|
||||
}
|
||||
if ([anItem action] == @selector(enterSelection:))
|
||||
{
|
||||
return ([self textObjectToSearchIn] != NULL);
|
||||
}
|
||||
if ([anItem action] == @selector(jumpToSelection:))
|
||||
{
|
||||
return ([self textObjectToSearchIn] != NULL);
|
||||
}
|
||||
// if it isn't one of our menu items, we'll let the
|
||||
// superclass take care of it
|
||||
return [super validateMenuItem:anItem];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue