-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
164 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,4 @@ | |
#endif | ||
|
||
extern NSString * const kECDocumentDidChange; | ||
extern NSString * const kECTextViewDidSetDocument; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// NSView+EditorConfig.h | ||
// editorconfig-textmate | ||
// | ||
// Created by Rob Brackett on 7/27/12. | ||
// Copyright (c) 2012 Rob Brackett. All rights reserved. | ||
// | ||
|
||
|
||
|
||
@interface NSView (EditorConfig) | ||
|
||
// This MUST be called at plugin initialization time; it swizzles things. | ||
+ (void)ec_init; | ||
|
||
- (void)ec_setDocument:(id)document; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// NSView+EditorConfig.m | ||
// editorconfig-textmate | ||
// | ||
// Created by Rob Brackett on 7/27/12. | ||
// Copyright (c) 2012 Rob Brackett. All rights reserved. | ||
// | ||
|
||
#import "ECConstants.h" | ||
#import "NSObject+ECSwizzle.h" | ||
#import "NSView+EditorConfig.h" | ||
|
||
@implementation NSView (EditorConfig) | ||
|
||
+ (void)ec_init { | ||
[self ec_swizzleMethod:@selector(setDocument:) | ||
withMethod:@selector(ec_setDocument:)]; | ||
} | ||
|
||
- (void)ec_setDocument:(id)document { | ||
[self ec_setDocument:document]; | ||
|
||
NSString *fileName = self.window.representedFilename; | ||
if (fileName == nil) { | ||
fileName = [self.window.windowController representedFilename]; | ||
if (fileName == nil) { | ||
fileName = @""; | ||
} | ||
} | ||
|
||
NSDictionary *info = [NSDictionary dictionaryWithObject:fileName forKey:@"fileName"]; | ||
[[NSNotificationCenter defaultCenter] postNotificationName:kECTextViewDidSetDocument | ||
object:self | ||
userInfo:info]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters