I sneaked out of bed early this morning to invest some time in setting up Eclipse, hoping it can speed up my current tedious build/check/fix/build routine while working in Scratchbox.
- You’ll want to install the recommended eclipse-gcj package as well as the eclipse package, because it seems to make it faster.
- The Laika plugin requires a newer CDT (C/C++ development plugin for Eclipse), because Ubuntu Edgy has an old (and apparently incompatible) one. You can install that via Help/Software Updates/Find and Install/Search for new features to install/Callisto Discovery Site/yadda yadda yadda.
I guess this will clash one day with the Ubuntu-packaged CDT, when they update it, but that’s some fun for later.
- You’ll get “permission denied” and “file does not exist” errors during the install unless you fix the permissions (maybe this is OK in a fresh Ubuntu Edgy install?), like so:
/usr/lib/eclipse$ sudo chown youruser:youruser plugins
/usr/lib/eclipse$ sudo chown youruser:youruser features
Update: In later versions, you will also need to do the same thing in /usr/local/lib/eclipse/
- Install the Laika plugin by the same method, after adding the http://www.cs.tut.fi/~laika/update remote location. Don’t use the URL as the human-readable name for that location, or it will fail.
- In Window/Preferences, there are now Scratchbox preferences. The defaults are mostly good, but you’ll want to change the X Environment preferences to run your start_xephyr script instead of vnc. There are details about this in the Laika manual (in the left-hand menu on their web site).
When using File/New/Project, you’ll now have extra wizards under C and C++, such as “Standard Make C Project inside Scratchbox”. When you create one of these projects you’ll see convenient toolbar buttons to start the X Server, and to start the Maemo desktop (af-sb-init.sh start) inside scratchbox, on that display. You can even start your project with a GTK+ helloworld.
Note that clicking the Run button will show an “Internal Error” until you open that Run combobox, select “Run …” and select a path to a generated executable in the “Application” entry (the second one).
Eclipse has awfully obscure UI, and I can’t be the only one who thinks this. I wonder why it isn’t getting better as a result of being open, or maybe it used to be worse. Unfortunately, people have become used to IDEs that hate them (MS Visual Studio).
Now there’s just the usual IDE problem of it forcing you to import (copy) your projects from other directories instead of just letting you open your existing project. (This is not Laika’s fault.)
As I’ve mentioned before, I don’t understand why Eclipse defaults to forcing me to put my source code in $HOME/workspaces, and copying existing projects into there. Just let me edit my files and build my executables without pretending you’re special. It’s good to make it easy to make your first helloworld project, but don’t make it hard for me to actually work with this thing afterwards.
The fix for this is to:
- Open Window/Preferences, choose General/Startup and Shutdown, and select “prompt for workspace on startup”. Notice how it’s cryptically named – it affects project creation, not program startup, and it doesn’t prompt, it just lets you choose a non-standard workspace, without telling you why you’d want to do that (see the next point). And it’s hidden away among hundreds of other options, without even a tooltip to guide the user.
- When creating a project (The import feature is now unnecessary), the Project Contents frame now lets you select an existing project’s path instead of $HOME/workspace. If there’s a project there already then it will just add the Eclipse files without moving or copying your existing files. If there had been no files there, it would have offered to create some. That’s implicit, hidden, and unexpected. This “feature” should be made explicitly available.
- Update: Aargh, no, it silently overwrites your build files, such as autogen.sh, configure.ac, all your Makefile.am files, and even the license (!) in COPYING. Bastard.
Further ranting: Why oh why can’t an Eclipse project contain characters such as “-“? Why go to the trouble of implementing UI to prevent users from entering this, instead of just fixing whatever text escaping bug it’s hiding.
Update: I was looking forward to code-completion, but I had to turn it off in Window/Preferences/C/C++/Editor/Content Assist and unclicking all 3 triggers. One minute of hang (100% CPU) whenever I type -> is not working out for me. (Or only 20 seconds when I tell it to search only the current project and not the include files.) When the user clicks or types away from the line, the code-completion search really should silently cancel.