C++ Editor

I’m working on a C++ editor.
How do I make it so that when I double-click a file associated with my app, it will set the contents of it into the main text field? I’ve tried this:

on open (f)
	set (the contents of text view 1 of scroll view 1 of window 1) to read file f
end open

and it doesn’t work. Can someone please help? :o

Also, if I save the file in another program, like simpletext, then it associates it with xcode.
I’ve already added this to the infoPlist.strings:

Here’s the code I’m using to open files (+o)

set savepath to choose file with prompt "Open..."
		set the contents of text field 1 of window 1 to savepath as string
		set f to paragraph 2 of "
" & (savepath)
		set (the contents of text view 1 of scroll view 1 of window 1) to read file f

To open all C++ files in your application, select one, get info, expand “Open With…”, select your app in the popup menu, then click the Change All… button.

This should work… I have no clue why you’re doing the “paragraph 2” thing…

on doOpen()
	set savepath to (choose file with prompt "Open...")
	my open(savepath)
end doOpen

on open theFile
	-- a check for multiple files being opened here would be nice
	set the contents of text field 1 of window 1 to (theFile as string)
	set fileContents to (read theFile)
	set (the contents of text view 1 of scroll view 1 of window 1) to fileContents
end