pmuellr is Patrick Mueller

other pmuellr thangs: home page, twitter, flickr, github

Wednesday, March 15, 2006

Eclipse Monkey publishing

Thought I'd paste in one of my scripts using the publishing help Eclipse Monkey supports. Just to try it out. You may be wondering what the wacky heading and trailing are all about. They are eclipse flavored lines from Jabberwocky. And they are easy to find in Google.

You'll want to grab the alert.js file from here.

--- Came wiffling through the eclipsey wood ---
 * Menu: test > alert
 * DOM:

alert = ScriptLoader.loadProjectFile("MyEclipseMonkeyScripts", "monkey/lib/alert.js")

function main() {

 alert("Hello, World!")

--- And burbled as it ran! ---

update - 2006/03/20 - added title (keep forgetting that!) and added a link to the alert.js post

ScriptLoader available

I finished up my ScriptLoader Eclipse Monkey DOM last night. Spent more time building the freaking plugin, feature, site.xml, etc than on the actual code. But once all the feature stuff working, it is pretty nice. If you're interested in my vanilla Ant script that does this, look for the project source zip on the web site. Although my feature only has one plugin, I think this could scale to a multi-plugin feature if you were willing to have the feature and all the plugins at the same version number every time.

I also put the lamo web page for it (link above) in Eclipse as a help document. It's nice to have simple examples of doing this, like the eclipsemonkey plugin did. Thanks!

Something really bad happened while I was editing the HTML page, at one point. I lost the source some how. Deleted it accidently or something. I've never figured out the local editing stuff in Eclipse, or never seen it work in action, so I figured all was lost. A bummer too, because there was at least 1/2 hour worth of typing in there. But, I did have the page open in a web browser with the full content. hmmmm. Clearly I could cut-paste the code into a text editor and redo all the formatting. Or maybe paste into Word and try to recover from whatever bad HTML it would have generated. Then I remembered a little note on a blog I saw last week. Someone wanted to get the source for their page easily, and they had a little javascript: url you could plop in the address bar that would show you the source. Something like a document.innherHTML or something. Tried it and it didn't work, but then I thought I should try it in the JavaScript Shell, which is a really nice little bookmarklet thingamajigee. Brought it up, and after a few tries, found that document.body.parentNode.innerHTML got me exactly what I needed, except the HTML elements at the beginning and end. Swipe, copy, paste back into Eclipse. And it was a single, hugely long line. Sigh. I didn't have time to figure out if pasting somewhere else (Word or a text editor) might have left the line delimiters intact, so I decided to re-layout by hand. But boy was I glad I could at least get all the text + markup saved.

I'm starting to work on some little utilities with Eclipse Monkey + ScriptLoader. Experiencing what I have before in losing the one nice bene of overly strict typing in Java: code assist. Based on some of the snippets I've been typing, it seems to me like some static and flow analysis could yield pretty good typing information, given all the Java glorp I'm actually doing in JavaScript. Can't imagine anyone ever doing this though, and I'm not interested enough to do it myself.

First thing I'm going to try to build is a EM script to toggle showing unchanged (in the team sense) projects in the navigator. I really hate it when I have changes to commit across multiple projects, which are widely separated visually. I'd like to have a 'working set' which was programmatically defined: 'projects that are dirty in the team sense'. And be able to toggle that on and off easily.

Lots of stuff to learn.

Tuesday, March 14, 2006

Dash Time

I called into the Dash Time conference today. It was Bjorn and Ward and a little later, Wayne Beaton. And me. I don't think anyone else joined.

I completed hogged all the time chatting about Eclipse Monkey. What luxury to get these guy's ears for a little while. Wayne gave me an idea on how to fix my classloader issue with my scriptloader DOM, and I've got a hack in for it. Think I'll go ahead and package up what I got, to give me a chance to figure out how to create a freaking update site again (it's been two years since I've done this), and write some doc. I'll upload to my web site when I have something, but until bug 131360 is available in an Eclipse Monkey release, using ScriptLoader will also require a hack to the eclipsemonkey plugin MANIFEST.MF to export the javascript packages.