-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLibFileController.j
More file actions
39 lines (31 loc) · 944 Bytes
/
LibFileController.j
File metadata and controls
39 lines (31 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// (c) 2010-2011 by Anton Korenyushkin
@import "BaseFileController.j"
var fileContents = {};
@implementation LibFileController : BaseFileController
{
CPString fileURL;
}
- (id)initWithApp:(App)anApp buffer:(Buffer)aBuffer // public
{
fileURL = [aBuffer.lib URL] + aBuffer.path;
return [super initWithApp:anApp
buffer:aBuffer
fileName:aBuffer.path.substring(aBuffer.path.lastIndexOf("/"))
fileURL:fileURL
readOnly:YES];
}
- (CPString)fileContent // protected
{
return fileContents.hasOwnProperty(fileURL) ? fileContents[fileURL] : nil;
}
- (void)load // protected
{
[[[HTTPRequest alloc] initWithMethod:"GET" URL:fileURL target:self action:@selector(didLoadContent:)] send];
}
- (void)didLoadContent:(CPString)content // private
{
[buffer setProcessing:NO];
fileContents[fileURL] = content;
[self setupEditor];
}
@end