Create File

This commit is contained in:
Matthias Neeracher 2015-01-12 05:46:26 +01:00 committed by Matthias Neeracher
parent 0da47af13f
commit 6d6215d47f
2 changed files with 13 additions and 1 deletions

View File

@ -434,6 +434,18 @@ class ASProjDoc: NSDocument, NSOutlineViewDelegate, NSMenuDelegate, NSOpenSavePa
outline.reloadData()
}
@IBAction func createFile(AnyObject) {
let savePanel = NSSavePanel()
savePanel.allowedFileTypes =
[kUTTypeCSource, kUTTypeCHeader, kUTTypeCPlusPlusSource, kUTTypeCSource,
"public.assembly-source", "net.daringfireball.markdown"]
savePanel.beginSheetModalForWindow(outline.window!, completionHandler: { (returnCode) -> Void in
if returnCode == NSFileHandlingPanelOKButton {
self.createFileAtURL(savePanel.URL!)
}
})
}
// MARK: Editor configuration
@IBAction func changeTheme(item: NSMenuItem) {

View File

@ -80,7 +80,7 @@
<items>
<menuItem title="File" keyEquivalent="n" id="Was-JA-tGl">
<connections>
<action selector="newDocument:" target="-1" id="4Si-XN-c54"/>
<action selector="createFile:" target="-1" id="rEL-As-mOF"/>
</connections>
</menuItem>
<menuItem title="Sketch" keyEquivalent="N" id="2hE-2e-TSR">