If we have a directory, we check if it is a bundle that an app can open it and open it through NSWorkspace

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@38631 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Riccardo Mottola 2015-06-13 18:01:17 +00:00
parent 94538f96d0
commit f46b6e594a
2 changed files with 16 additions and 1 deletions

View file

@ -3,6 +3,9 @@
* Framework/PCProjectEditor.m
Re-enable wrongly uncommented statement.
* Framework/PCEditorManager.m
If we have a directory, we check if it is a bundle that an app can open it and open it through NSWorkspace.
2015-06-12 Riccardo Mottola <rm@gnu.org>
* Modules/Editors/ProjectCenter/PCEditor.m

View file

@ -191,15 +191,27 @@ NSString *PCEditorDidResignActiveNotification =
@"Couldn't open editor for file '%@'.\n"
@"File is not plain text.",
@"Close", nil, nil, filePath);*/
PCLogInfo(self, @"Not a text file %@", filePath);
return nil;
}
}
else
{
NSString *app;
/* Check for bundles and if possible let them be opened by Workspace */
app = [[NSWorkspace sharedWorkspace] getBestAppInRole:@"Editor" forExtension:[fileName pathExtension]];
if (app)
{
if ([[NSWorkspace sharedWorkspace] openFile: filePath])
return nil;
}
}
// NSLog(@"EditorManager 1: %@", _editorsDict);
editor = [_editorsDict objectForKey: filePath];
if (editor == nil)
{
NSLog(@"Opening new editor. Editor: %@", editorName);
// Editor
editor = [bundleManager objectForBundleWithName:editorName
type:@"editor"