-
Notifications
You must be signed in to change notification settings - Fork 0
/
Scripting.m
65 lines (57 loc) · 1.77 KB
/
Scripting.m
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//----------------------------------------------------------------------------------------
// Scripting.m - Open Scripting Architecture support
//
// Created by Dominique Peretti on 11/12/04.
// Copyright 2004 __MyCompanyName__. All rights reserved.
// Copyright © Chris, 2008 - 2010. All rights reserved.
//----------------------------------------------------------------------------------------
#import "Scripting.h"
#import "MyApp.h"
#import "CommonUtils.h"
@implementation Scripting
- (id) performDefaultImplementation
{
ConstString commandName = [[self commandDescription] commandName];
const id directParam = [self directParameter],
directParam0 = ISA(directParam, NSArray)
? [directParam lastObject] : directParam;
ConstString string0 = ISA(directParam0, NSString) ? directParam0
: nil;
MyApp* const target = [NSApp delegate];
// dprintf("%@", self);
// switch ([[self commandDescription] appleEventClassCode])
// switch ([[self commandDescription] appleEventCode])
if ([commandName isEqualToString: @"displayHistory"] ||
[commandName isEqualToString: @"fileHistoryOpenSheetForItem"])
{
if (string0)
[target displayHistory: string0];
}
else if ([commandName isEqualToString: @"openWorkingCopy"])
{
if (string0)
[target openWorkingCopy: string0];
}
else if ([commandName isEqualToString: @"openRepository"])
{
if (string0)
[target openRepository: string0];
}
else if ([commandName isEqualToString: @"openFiles"])
{
if (string0)
[target openFiles: directParam];
}
else if ([commandName isEqualToString: @"diffFiles"])
{
if (string0)
[target diffFiles: directParam];
}
else if ([commandName isEqualToString: @"resolveFiles"])
{
if (string0)
[target resolveFiles: directParam];
}
return nil;
}
@end // Scripting