Update
Appcelerator just announced that they’ve acquired Aptana. Not sure if it had anything to do with me pointing them in that direction via my plugin, but that would probably mean that I eventually stop maintaing this, since they’ll produce a much more integrated solution. Looking forward to it though!!!!
Original
I’ve been using Accelerator Titanium to create iPhone applications in JavaScript. One thing JavaScript is missing is really good editor with autocompletion / code completion. I recently found Aptana and wanted a way to autocomplete from the Titanium API in that. I’ve created ScriptDoc compatible JavaScript header file that does the job.
Installation
1) Install Aptana standalone or as an eclipse plugin.
2) Download the javascript header file
3) Switch to the Aptana perspective in eclipse
4) Set Aptana as the default javascript editor in preferences
5) Add the timobile.js to the references
Other points of interest:
– You can download the PHP file here that I use to create the JavaScript header file from the Titanium API JSON file. Run the PHP script in the same directory as the api.json file from Titanium.
– I’m working on an Eclipse plugin, you can view the source here.
– If you’re wondering why there are function names like Titanium_UI_Window, these are to act as dummy return types, because Aptana ScriptDoc didn’t allow me to return an Object in a name space like Titanium.UI.Window.
– Mbirth has a JSDoc code completion file here, but Adobe no longer seem to distribute JSEclipse so I’m not sure how it would work in Eclipse.
AWESOME! I’m trying this on a mac (Snow Leopard) with Aptana standalone version 2, followed your video to the tee, and don’t see the Titanium API stuff in my autocompletes that appear. Do I perhaps need to use eclipse with the aptana plugin instead?
I see the variables that are in the JS file but I have a feeling that’s just Aptana recognizing what’s in my app.js already. Any ideas as to what I can try?
Hmmm not sure. I think Aptana has some settings within a project that might allow you to check which references to use.
Aptana stand alone is pretty much eclipse down to the tee, so it shouldn’t be that, but you could always try. Did you make sure Aptana was set as the javascript editor?
Excellent approach, thanks a lot. I started to use this extremely helpful tool yesterday and noticed that timobile.js does not contain all objects, e.g. Titanium.Filesystem.File, Titanium.Contacts.Group, … are completely missing, at least I can’t find them. To me it seems that sometimes only top level modules are contained, while the module’s objects are not contained at all.
Additionally, the file has errors, e.g. Titanium.Filesystem.getFile, which in fact returns Titanium.Filesystem.File, is listed with “getFile: function (path) { return {}; }” (maybe a side effect of the missing Titanium.Filesystem.File). Also, e.g. Titanium.Contacts lists only 3 out of 15 methods (also maybe a side effect).
Will you have the chance to fix this? Would be most appreciated …
Thanks again, Thomas
Excellent work! Very useful. Thanks for sharing this.
I’ll have a look at it. I wasn’t using those methods so I didn’t check, but I thought I was reading the data from the son correctly so maybe its missing from there or it was an older release.
Will also try to get the Ti name space working.
I’ve updated to version 1.4 of the API
At a total loss here … how do you install Aptana as an Eclipse plugin?
I can’t find that documented anywhere :(
Nevemind … color me stoopid … I found it :)
Excellent work … works perfectly … thanks James
Very cool!
Hi Thomas,
Im trying to follow the titanium autocomplete installation steps. For some reason my eclipse version with Aptana plugin does not have provision to add File References.
I use Eclipse 3.6.1 JAVA EE version and Aptana Studio 3 plugin.
Do I need to use different eclipse version??
Thanks for your help.
-Kumar.
You can also use this in Visual Studio by adding
///
-
Sorry,
///
Damnit…
///
Pingback: AppCelerator Titanium + Aptana + IntelliSense « Alejandro Weblog
-
-
-
Pingback: Titanium Autocomplete |try {} except
-
-
-
-
Pingback: Cross-platform mobile app development | iotashan's blog
-
-
-
-
-
Pingback: Updated Titanium autocomplete for 1.5.1 using Eclipse and Aptana |try {} except
-
-
-
-
-
-
-
-
-
-
-
-
Pingback: Che editor usare per Appcelerator Titanium? | Rainbowbreeze
-
-
Pingback: Titanium Eclipseì—ì„œ 코드 ìžë™ì™„성 사용하기 | Titanium can be an art
-
-
Pingback: コンピューターã¨ã®è§¦åª’ » Twitter Updates for 2011-05-18
-
Pingback: Converting the Appcelerator Titanium JSON API to JavaScript « Navin Peiris
-
Pingback: Appcelerator Titanium JavaScript Code Completion in IntelliJ « Navin Peiris
-
Is the eclipse plugin usable? Can I just used the plugin instead of the javascript reference?
Not at the moment, I’d love to get it working sometime, but for now just use the JS file.
Very nice piece of work James.
One detail that is easy to miss, is that the tiimobile.js file should be added to the default profile, not the dummy profile that you have to create before eclipse shows the default one.
Awesome job. Thanks for this. the Ti namespace would also be appreciated. I’ll be sending Paypal donation. Keep up the great work!
Thanks man!
Will be sure to update it to 1.5.0 once it’s out!
I love the autocompeteness this brings. Do you plan to update your file to v1.5.1 of the API?
Yep, just updated it, same link as before!
Is their an easy way to get it so we can just type Ti.
instead of Titanium?
Has anyone got this working with Aptana v3 (standalone)?
There is no “references” view that I can find?
I followed the tutorial, and have it setup in Eclipse with
Aptana plugin. So I added the project Kitchen Sink, but when I test
the autocomplete, eclipse hangs for a while then I get a GC
overhead limit esceeded message. Basically out of memory. Is this
because I used the KitchenSink example to run my test?
I apologize, Issue was a bad timobile.js file.
Thanks.
Hi James, I am very new to mobile dev, i looked at you
Titanium autocomple sample, and i have a few questions. what is
timobile.js? why do i need it? does it come with the titanium
install package? and finally when i create a project on titanium
developer, then import it to eclipse is there a way i can run it
through eclipse? Many thanks in advance!
Great little script. Your probably right about Aptana + titanium creating some streamline system for developing but imo Titanium desperately needed it. Your script here feels like a stepping stone in the right direction for Titanium. Keep up the good work and thanks again.
Any info on how to get this to work in the current Aptana 3 beta? Thanks!
I think I couldn’t so I ended up sticking with 2. The new Aptana/Appcelerator integration should produce something better in the future. I think they release a beta in march.
Thanks a lot, great, great work!
For those who had problems getting it to work: just download a fresh Eclipse (the JavaScript version 3.6) and install the Aptana plug-in as described.
I didn’t get things to work with Aptana 2.0.5 (non-plug-in version).
Indeed, there is no “references view” in Aptana Studio 3…
I tried the “Project References” that can reference a whole project.
So I created a “Titanium project” with only the titanium.js file and referenced it in my project, but it did not work neither…
Switching back to Eclipse + Aptana-plugin…
Thanks.. works perfectly!.. references for all are not included in the timobile.js file on this page. Check here for the latest (http://www.tryexcept.com/wp-content/uploads/2011/01/timobile151.js).
Well, this works perfectly on my MacBook Pro but on windows 7, I just cant get the Aptana perspective nor the references tab!! :(
Doesnt work for me. Only difference I am using exclipse ide for js web developers version. When I type Titanium.UI, I do not get Titanium, I get stuff like Titanium_Android_Calender??? no Titanium in list and no associated .UI method. I do not see this in the js header file? What am I doing wrong?
Thanks
I try this that you show here, but, when I type “Ti.” for example and click CTRL + Space to show what goes after but nothing about the timobilo.js is shown, what I am doing wrong, I do everything that you show here.
Tks,
Jairo.
Great plugin and guide. Thanks for posting such a nice blog and steps to build auto complete for Titanium API’s in Javascript.
Your blog has been very extremely useful…. Thanks once again…
installed the plugin, but there IS no aptana perspective. Dear God, I hate Eclipse. Screwing around with community hacked files and endless version clashes to get the most basic functionality.