Getting the files into Eclipse: steb
“The files are inside the computer..” is one of my favorite quotes from the movie Zoolander. However, it’s not that easy…there is a probelm. I keep finding myself in the middle of some serious development effort and am coordinating between two or more different editor programs. Usually it’s vi and Eclipse. Sometimes Mousepad comes along for the ride. It works alright but causes me extra work, having to keep in mind the key bindings and commands for all these various editors. Recently I stepped back and said: ‘why am I doing this?‘ Why not just use one editor and be done with it? Well, of course Eclipse being my favorite editor the next question was: ‘why am I using vi and mousepad all the time?’. The answer was simple: they are easy to envoke from a shell. I am an average Linux user and use the shell for many things. A shell session is like a conversation you have with your machine. Leaving the shell and going into Eclipse (or any other program) is a mental jump and often it’s easier just to run something local to that shell. So, what I wanted was something that would let me edit a file from the shell as easily as I can with vi our mousepad. Enter steb.
As usual when I think I have some kind of Great Idea, I do some googling and find it’s been done before, usually many times. This is a good thing and in most cases I happily go on my way consuming the great efforts of some previous masterpiece. In this case the mythic Ed Burnette had produced something similiar with Windows UI integration. This work seems to have been lost to the sands of time. After that came Sunshade from Matt Conway. The code was really more for Windows DnD integration, less for the shell. But, most of the code I needed was already there, and I also only needed Shell integration, nothing else. So, with Ed and Matt’s code in mind I wrote steb. From the command line, simply type:
$ steb myfile.txt
And boom, all of a sudden your already-running Eclipse instance pops up loaded with the file! Why the name ‘steb’ you ask? Well it sounds friendly doesn’t it? I can see myself saying, ‘Hey steb while you’re up can you get me a cold one from the fridge?’. Also, it happens to correspond to Shell to Eclipse Bridge, which I think is nice. Essentially I have a plugin that listens for file paths on a port. I then have a client program that, complements of netcat, pipes a filename to that port. Poof, Eclipse and Terminal are talking like old friends. Also, if you’re a gnome-do user, steb integrates just as nicely there, as long as the client program is on your path.
If you’re interested in tighter integration between Eclipse and your shell conversations check out steb’s updatesite at http://bugcommunity.com/downloads/files/steb/updatesite. BSD-licensed source is available at svn://svn.buglabs.net/ote/branches/steb. After installing steb, you’ll want to install the clien program somewhere on your path. My client program is available at http://bugcommunity.com/downloads/files/steb/steb. You could make something else, maybe that loads Eclipse if it’s not running. I’ve only tested on Gentoo Linux, but it should work with any Linux. Mac and Windows support would probably require some other client program, but the plugin should be generic.