Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

Commit

Permalink
Merge branch 'master-skrew'
Browse files Browse the repository at this point in the history
Auto saving in Xcode before injection
  • Loading branch information
PaulTaykalo committed May 7, 2015
2 parents 0db5f8d + f3c32ea commit 710b3b9
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Support/Xcode/Binary/SFDYCIPlugin.xcplugin/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>14A314h</string>
<string>14D136</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
Expand All @@ -23,17 +23,17 @@
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>6A279r</string>
<string>6D1002</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>14A314e</string>
<string>14D125</string>
<key>DTSDKName</key>
<string>macosx10.10</string>
<key>DTXcode</key>
<string>0600</string>
<string>0631</string>
<key>DTXcodeBuild</key>
<string>6A279r</string>
<string>6D1002</string>
<key>DVTPlugInCompatibilityUUIDs</key>
<array>
<string>640F884E-CE55-4B40-87C0-8869546CAB7A</string>
Expand Down
Binary file not shown.
27 changes: 27 additions & 0 deletions Support/Xcode/Source/Classes/SFDYCIHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,33 @@
#import <AppKit/AppKit.h>


@interface IDEEditorContext : NSObject
- (id)editor;
@end

@interface IDEEditorDocument : NSDocument
- (void)ide_saveDocument:(id)arg1;
@end

@interface IDEEditorArea : NSObject
- (IDEEditorContext *)lastActiveEditorContext;
@property(readonly) IDEEditorDocument *primaryEditorDocument;
@end

@interface IDENavigatorArea : NSObject
- (id)currentNavigator;
@end

@interface IDEWorkspaceTabController : NSObject
@property (readonly) IDENavigatorArea *navigatorArea;
@end

@interface IDEWorkspaceWindowController : NSObject
@property (readonly) IDEWorkspaceTabController *activeWorkspaceTabController;
- (IDEEditorArea *)editorArea;
@end


@interface SFDYCIHelper : NSObject {

}
Expand Down
22 changes: 22 additions & 0 deletions Support/Xcode/Source/Classes/SFDYCIHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,29 @@ - (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
}


- (IDEEditorDocument *)currentDocument
{
NSWindowController *currentWindowController = [[NSApp keyWindow] windowController];
if ([currentWindowController isKindOfClass:NSClassFromString(@"IDEWorkspaceWindowController")]) {
IDEWorkspaceWindowController *workspaceController = (IDEWorkspaceWindowController *)currentWindowController;
IDEEditorArea *editorArea = [workspaceController editorArea];
return editorArea.primaryEditorDocument;
}
return nil;
}

- (void)recompileAndInject:(id)sender {

if ([self currentDocument]) {
[[self currentDocument] saveDocument:nil];
}

dispatch_async(dispatch_get_main_queue(), ^{ // This add a little delay for saving, maybe a perform:withDelay will be better ?
[self recompileAndInjectAfterSave: nil];
});
}

- (void)recompileAndInjectAfterSave:(id)sender {
NSLog(@"Yupee :)");
NSResponder * firstResponder = [[NSApp keyWindow] firstResponder];
NSLog(@"firstResponder = %@", firstResponder);
Expand Down

0 comments on commit 710b3b9

Please sign in to comment.