"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.
Loading recent content...





Post Comments
Add Your Comment!
nike air max http://www.nike-nike.com
nike air max 90 http://www.nike-nike.com
nike air max shoes http://www.nike-nike.com
MBT shoes http://www.mbtshoes.cc
anti shoes http://www.mbtshoes.cc
cheap mbt http://www.mbtshoes.cc
coach bags http://www.coachonsale.net
coach outlet http://www.coachonsale.net
coach outlet store online http://www.coachonsale.net
chanel bags http://www.chanels.cc
chanel online http://www.chanels.cc
chanel handbags http://www.chanels.cc
louis vuitton bags http://www.uselv.com
LV handbags http://www.uselv.com
louis vuitton outlet http://www.uselv.com
coach outlet http://www.coachs.cc
coach outlet store online http://www.coachs.cc
coach handbags http://www.coachs.cc
I recently to visit your blog, reading, I very much enjoy, and above the content is great.
I don’t understand whether we are mutual here but oh my, that is one of my favorite quotes too. ‘The files are inside the computer’ has an in-depth meaning to it as well in my opinion. I wonder where the cast of Zoolander got this quote. I really appreciate them for bringing in such a phrase. However the fact that it wasn’t easy doesn’t surprise me much as I very well knew from the beginning that was the case with it! Stereolithography
I don’t understand whether we are mutual here but oh my, that is one of my favorite quotes too. ‘The files are inside the computer’ has an in-depth meaning to it as well in my opinion. I wonder where the cast of Zoolander got this quote. I really appreciate them for bringing in such a phrase. However the fact that it wasn’t easy doesn’t surprise me much as I very well knew from the beginning that was the case with it!
I am very interested in it, so I would like to learn more. Thank you for your great efforts!
As for me this is very interesting information!
Thank you very much.
I'm using stub on a file generator, so the new file is opened for edition right after creation.
Also, I've noticed that stub won't open files inside folders. (ie: stub folder1/folder2/my_file.rb does nothing)
Best regards.
Hi Thomas, glad you liked it. I did not know about realpath. It looks like a much simpler approach, cool!
thx
ken
Hey you, cool Plug-In. Exactly what I am was looking for.
I modified your Shell Script, I am using realpath instead dirname and basename.
Thank You
P.S. I like my Python version because it
Python version of steb executable.
(In an amazing coincidence, I came back to this page to send along my python version of the steb executable, only to find that someone else had posted a ruby version just today! I'm including it inline because it is very simple.)
#!/bin/env python
import sys, os.path, socket
if len(sys.argv) < 2:
sys.stderr.write("usage: %s <file> [<file2> ... <filen>]\n" % sys.argv[0])
sys.exit(1)
for path in sys.argv[1:]:
full_path = os.path.abspath(path)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', 4404))
s.send(full_path)
s.close()
shadowbq, glad you find steb useful! Ruby client looks cool...but maybe file-not-exist check isn't needed? Eclipse will create new files for you if they don't already exist...
Ruby version of steb executable
http://gist.github.com/325430
Works great on windows with winscp and aptana studio(eclipse) to have "live" ssh editing!
Thanks so much!
PrzemekM, that is a great idea! I am working on that and being able to use named pipe instead of socket now and hope to have another release out shortly.
Wow, a truly excellent idea!
Though if we go this far, it would be nice if the solution also allowed to move to a specific line in the opened file, for instance like it is possible with vim or gedit when you can launch the program giving the file name and "+line_number" on the command line :-)
I've just released 0.2.3 which fixes an annoying bug. If you have a closed project in your workspace that contains a given file you're trying to edit from the shell, previous versions would fail with an error. This has been addressed. Still looking into more secure approaches like named pipes.
Nice post,
Keep up the good work,
Anyway, thanks for the post
Ken,
I just glanced at the wikipedia on named pipes ( http://en.wikipedia.org/wiki/Named_pipe ). It mentions support for windows. I'm just not sure how that would hook into java :/ Sorry for trying to make your simple helper utility into a convoluted nightmare!
Hi Ron,
I see what you mean. How about a named pipe? I'm not sure that will allow non-Linux users but I could enable it as an option at the least. Are you aware of a better cross platform IPC approach?
thx
ken
Ken,
This plugin is attempting to solve a very real limitation with eclipse, and it does so in an innovative way. By problem is using a blatantly opened port. I was able to connect via telnet and send garbage characters through (control characters specifically). An outside machine was able to connect to the port briefly before being disconnected (the space between socket.accept() and the isLoopbackAddress check). Is there a different IPC mechanism that you could piggyback on? It just seems a little risky to have that port dangling there...
Ron
I revised the client program. It has some issues with some relative paths. I used the technique identified on this page:
http://www.robertpeaslee.com/index.php/converting-a-relative-path-to-an-absolute-path-in-bash/
Here is my new client:
#!/bin/bash
# Client script for Linux Shell Eclipse Bridge (steb)
# Copyright (C) 2009 Ken Gilmer
tpath=`dirname $1`
echo "`cd $tpath; pwd`/`basename "$1"`" | nc localhost 4404
» Comments RSS