Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated to newer APIs

  • Loading branch information...
commit 7a527b3471f235c6be11c2c3937128e47ea7e810 1 parent 4ba9215
@ccgus authored
Showing with 20 additions and 20 deletions.
  1. +20 −20 src/JSTAppDelegate.m
View
40 src/JSTAppDelegate.m
@@ -132,9 +132,26 @@ - (void)loadExternalEditorPrefs {
}
- (void)openPanelDidEndForExternalEditor:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo {
- if (returnCode) {
+
+}
+
+- (void)chooseExternalEditor:(id)sender {
+
+ NSOpenPanel *p = [NSOpenPanel openPanel];
+
+ [p setCanChooseFiles:YES];
+ [p setCanChooseDirectories:NO];
+ [p setAllowsMultipleSelection:NO];
+
+ [p setAllowedFileTypes:[NSArray arrayWithObjects:@"app", @"APPL", nil]];
+
+ [p beginSheetModalForWindow:prefsWindow completionHandler:^(NSInteger result) {
- NSString *path = [[sheet URL] path];
+ if (!result) {
+ return;
+ }
+
+ NSString *path = [[p URL] path];
NSBundle *appBundle = [NSBundle bundleWithPath:path];
NSString *bundleId = [appBundle bundleIdentifier];
@@ -148,25 +165,8 @@ - (void)openPanelDidEndForExternalEditor:(NSOpenPanel *)sheet returnCode:(int)re
[[NSUserDefaults standardUserDefaults] setObject:bundleId forKey:@"externalEditor"];
[self loadExternalEditorPrefs];
-
- }
-}
-
-- (void)chooseExternalEditor:(id)sender {
-
- NSOpenPanel *p = [NSOpenPanel openPanel];
-
- [p setCanChooseFiles:YES];
- [p setCanChooseDirectories:NO];
- [p setAllowsMultipleSelection:NO];
+ }];
- [p beginSheetForDirectory:@"/Applications"
- file:nil
- types:[NSArray arrayWithObjects:@"app", @"APPL", nil]
- modalForWindow:prefsWindow
- modalDelegate:self
- didEndSelector:@selector(openPanelDidEndForExternalEditor:returnCode:contextInfo:)
- contextInfo:nil];
}
- (void)prefsChoosefont:(id)sender {
Please sign in to comment.
Something went wrong with that request. Please try again.