After having been here about 6 months I have finally succumbed to the pressure from my boss to make a blog post. Normally my ideas for such posts would be large and grand, take too long to type out, and slip into the infinite chasm that is otherwise known as a draft…
I like Aptana, I like the Outline view. What I don’t like is that you always have to expand it. So thus, I never used it, I’m simple and lazy, and not afraid to admit it. Andy Davies reignited my interest in the Outline view earlier today in a round about way. Andy pointed out the lesser noticed Scripts menu in Aptana. Specifically Experimental -> Colorize as HTML. A nice quick and neat tool. Not that I’d use it much mind. But then below its entry I saw “Expand outline”. Bingo!
What followed is my discovery of Monkey Script. I figured getting expand outline on a keyboard shorcut would be good, and perhaps renew my interest in it. But then I noticed the mention of listeners… Queue a bit of creative Googlin and this post by Ingo on the PartService event handler.
Hacking the existing expand outline script into this proved painless so here we have it:
You’ll notice I hooked the Activated event rather than the Opened one this was because on opening expandOutline executed before the active editor had switched to the new file so the outline was expended on an already opened file. This way has a slight caveat that if you collapse the outline and then go back to the file it’ll expand it again, but that doesn’t bother me at all.
To use the above script simply drop it in a file with a .js suffix and place it in a folder called “scripts” in a project that is currently open on your workspace. I created a new project just for this purpose.
I hope someone found this useful 🙂