Using Eclipse

Tuesday 31 January 2006This is over 18 years old. Be careful.

A friend asked what IDE I’m using for Python these days. Because it was already in use at my new job, I’m using Eclipse. Here are my impressions so far.

One co-worker doesn’t use Eclipse because “it’s a pig”, but I have found it to be quite snappy, and very native feeling. And it uses far less memory than Firefox porked up with all the interesting extensions.

For Python, the PyDev plug-in is pretty good. It has code completion, although I haven’t found it very useful with Python’s dynamic nature. One annoyance: Ctrl-Tab is bound to re-tabbing the code or something, and I can’t seem to re-bind it back to switching among the editor windows. I tried the debugger, but found it to be unusably slow, for example, 10 seconds to single-step to the next line. More recent builds claim to have fixed some simple things to speed that up, but I haven’t tried it again.

I would have preferred to use a native Python IDE, but the free ones still don’t seem ready to me. I still have high hopes for SPE, and am keeping my eye on it. One thing I’d like about SPE is since it’s in Python, I could get in there and contribute to its development. (Of course, one thing I like about Eclipse is that since it’s in Java, I can’t fool myself into thinking that I can get in there and contribute to its development!)

Things I like about Eclipse:

  • It’s a serious project run with discipline. For example, here’s the page about the recent 3.1.2 release, complete with goals, milestones, list of bugs fixed, and so on.
  • It provides the closing paren when you open the paren, but when the time comes, if you also type the closing paren, it cleverly skips over the automatically provided one, instead of leaving you with two.
  • It’s very professional. Too often, free IDE’s look like everyone and their brother added a coulple of menu items, until you have a monstrosity that collapses under its own weight. Considering all that it can do, Eclipse has a very small menu tree.
  • It’s free.

Things I don’t like about Eclipse:

  • I haven’t found a way to jump to the next search result, either within a file (what Microsoft tools would have bound to F3), or in a multi-file search (F8). There are next-result arrows on the search view, but I want a keystroke I can use in an editor to jump to the next result.
  • Also on search: the Find/Replace dialog has Whole Word as an option, but File Search does not. WTF?
  • The icon is a blue circle, just like Thunderbird: one of them has to change. It’s too confusing.
  • Eclipse seems to have gotten over its phobia of dealing with files as files, though some of that still shows through. Open File is a menu item, but it isn’t mapped to Ctrl+O, for example. And for some reason, the files I open from my project have line numbers displayed, but a file I open with Open File does not?
  • Another thing about the file system: if I update my tree with Subversion on the command line, the next file search I do in Eclipse tells me that there were problems (because the project navigator is no longer in sync with the file system). Then I have to go to the navigator and refresh it. Why doesn’t it just refresh it? What’s the big deal?
  • I can’t turn off Java IDE features. I don’t code in Java, so I don’t want to see Java features. I can’t uninstall the Java plugins, so there are lots of choices about Java in my face. Even worse: why bug me about plug-in development? I know it’s important to Eclipse, but can’t I declare once and for all that I am not developing a plug-in, and lighten the environment or something?

One recommendation: The GotoFile plug-in is great for finding files within your project. Open Resource already let you type in names to find files, but GotoFile lets you use discontiguous characters. “mcozpl” could find “MyCoolWhizzyPlugin.py” for example.

I had been using the Subclipse plug-in for Subversion support, but found it to be both very slow and unreliable. I’ve gone back to the command line to do my updates and commits, which works fine so long as I remember to do a refresh from my project navigator. The plug-in is still back there decorating my navigator, but it didn’t seem to add much value to the meat and potatoes of Subversion use.

All in all, after a number of earlier attempts to “get” Eclipse, this time it has stuck, and I am productive with it. SPE is probably in my future, but not yet.

Comments

[gravatar]
"I haven't found a way to jump to the next search result, either within a file (what Microsoft tools would have bound to F3), or in a multi-file search (F8). There are next-result arrows on the search view, but I want a keystroke I can use in an editor to jump to the next result."

For single-file search, you can use Ctrl+K to jump to the next search result. For multi-file, no idea :p
[gravatar]
Thanks. Now that you've pointed me to it, I see it in the menu: Edit - Find Next. I overlooked it because I thought all the Find stuff was on the Search menu. But now I see that the two entries there (Search - Search and Search - File...) take me to the same dialog!
[gravatar]
Ned,
You may have already found this, but there are a couple of handy keyboard shortcut references for eclipse available here:
http://eclipse-tools.sourceforge.net/shortcuts.html

Also, Eclipse 3.x has something called capabilities..
Window->Preferences->General->Capabilities
I have never used them myself but I believe that the settings can be used to enable/disable parts of the IDE (i.e. plug-in development).
Good luck - Jeff
[gravatar]
"I can't turn off Java IDE features. I don't code in Java, so I don't want to see Java features. I can't uninstall the Java plugins, so there are lots of choices about Java in my face."

Ned, this is a little long. I want to throw some Eclipse theory at you because you might be interested. The really practical point is near the bottom.

First, I think you can uninstall the Java plugins. In Eclipse 3.x, the Java plugins are part of a feature called JDT. If you look at \Eclipse\features\org.eclipse.jdt_3.x.x\feature.xml, you should see a list of plugins that make up the feature. If you delete all the corresponding plugin directories, the JDT is gone. I have not tried this!, but that's the theory.

Nervous about removing the plugin directories? In theory you should be able to disable features in Help - Software Updates - Manage Configuration. Unfortunately, it looks like the JDT feature is nested deep inside the SDK feature. Apparently, you can only disable top-level features.

In my experience you have finer control over what plugins get loaded in the target platform (Window - Preferences - Plugin Development - Target Platform). If you look at that dialog, you can disable individual plugins. Unfortunately, that only affects what plugins are loaded when you launch an Eclipse application from Eclipse itself. You probably don't want to launch a second instance just to do Python editing.

In short, there are a few ways to create an Eclipse configuration that does not include the JDT, but I think that is really all besides the point. The PyDev plugin should really create a separate perspective for editing Python files. That way the JDT feature and the PyDev feature can coexist. The JDT UI shouldn't bleed into the PyDev perspective. You would just switch perspectives when doing your Python work.

Have you tried Window - Open Perspective - Other? Is there a hidden PyDev perspective there?
[gravatar]
Capabilities are something I hadn't understood, and they do seem to remove some noise.

PyDev has a perspective, but I figured it was just a matter of laying out views. Does it also subset menus and such?
[gravatar]
Do you run Linux or Windows? I have a text editor for Linux written in Python that may meet your
needs. It seems Eclipse is more of a hindrance than an aid.

My editor does the following which I have found useful for Python editing:

1). Automatic word completion
2). Automatic bracket completion
3). Bookmarks
4). Various text manipulating operations you find in VIM/Emacs (selecting lines, joining lines, selecting words, deleting lines, uppercase, lowercase, selecting statements, etc)
5). Snippets (ala Textmate, to be released this friday)
6). Syntax Highlight etc

And it has a very simple unobstrusive interface. Unfortunately, it only works for Linux and its designed with a lot of bias towards GNOME.

Here is a flash movie demonstrating it's capabilities:

http://scribes.sf.net/snippets.htm

It may or may not serve your needs, but I thought it was worth mentioning since I had the exact
same issues with Eclipse.
[gravatar]

"Why doesn't it just refresh it? What's the big deal?"


Look in Preferences for the "Refresh automatically" checkbox under General->Workspace. I don't know why it isn't selected by default...

[gravatar]

An annoying bug is that the PyDev editor is not in the default "Open With" editor list; it only opens *.py files automatically. Any other script
name without .py extension I have to manually associate with the pydev editor.
My preferred solution for such files would be parsing of Vi or Emacs file type markers, eg. -*- makefile -*- in a comment at the first or second line


Another missing feature: visible displaying of whitespace characters, for examples displaying TABs as little arrows. Useful for python since whitespace is significant.

[gravatar]
Ned said:

"PyDev has a perspective, but I figured it was just a matter of laying out views. Does it also subset menus and such?"

Perspectives contribute menu items, but so do editors. For example, if I have no editors open and I am in the Java perspective, I see a few Java dev menu items like Navigate - Open Type. On the other hand, if I have no editors open and I am in the Resource perspective, there are no Java dev items in the menus. If I stay in the Resource perspective and open a Java file, the editor adds top-level menus like Source and Refactor. It also adds individual items to Navigate and Project.

So if you stay in the PyDev perspective and never open a Java file, you shouldn't see any Java dev menu items. Of course, that assumes the PyDev plugin is well written.
[gravatar]
Arrrghh! I can't stand it when people tell you to delete plugin directories!!! This is *not* the proper way to do this. Let's take a step back and take a deep breath. Ahh. Ok.

The point about capabilities was a good one. This feature was implemented to do just what you want - remove clutter. If I don't develop Java, then I can turn those features/contributions off so they are not always in my face. The problem is, they are not widely used yet, so capability support is minimal at best. The intention (I think) was to have the capability for a feature initially turned *off*, but have top-level things like a New Java Project, or New Java Class wizard be available. When the user tried to do a particular "top-level" task the platform would prompt them with something like "It looks like you're trying to make a Java project. Do you want to turn on the Java development features?", and go from there. Hopefully there won't be a funny paperclip character in our futures...

Now, back to removing plugins. The proper way to uninstall or remove a *feature* (and all of its contained plugins) is to go to Help > Software Updates > Manage Configuration. Here you will see the JDT feature, which you could "disable". This does not delete it from your machine, but removes it from your UI entirely. If you find that is what you want, you would go back to that dialog, where you can now "uninstall" disabled features (you have to click the button "Show Disabled Features" first). This will completely delete the plugins and features from your hard drive.
Having said that, I know that the PyDev feature *requires* the JDT (I filed a bug about this a long time ago...why should I need Java tooling to develop Python code??) basically because of the Jython support. IMHO the Jython part should be an optional thing to remove this dependency, but it hasn't been fixed yet. At any rate, because of this dependency you will not be able to disable the JDT feature if you have PyDev installed. And manually deleting it from the filesystem as someone else suggested would most surely break your Eclipse install!
[gravatar]
Mark said:

"Arrrghh! I can't stand it when people tell you to delete plugin directories!!!"

I think you are referring to my earlier post. Just for the record, I never recommended deleting plugin directories. I was trying the explain how Eclipse works. In Eclipse, everything is a contribution, including the JDT menus. If you were to delete the JDT plugin directories, the JDT contributions would be completely gone.

I also mentioned Help - Software Updates - Manage Configuration. However, in my installation of Eclipse SDK 3.1.1, I cannot disable the JDT feature. When I select the feature, there just isn't a Disable option.
[gravatar]
Yeah, I see that you did mention the Manage Configuration portion, but even mentioning deleting the plugin directories is just asking for trouble. Sorry if I seemed a little over the top there... ;o) I just see tons of Eclipse newbies getting frustrated because their new plugin doesn't work, and it is usually because they have used a poorly deployed feature (unzipping a zipfile on top of their Eclipse install...that also bugs me BTW...), or they went and deleted some, but not all of the plugins and/or features folders in an effort to "disable" things.
I guess if a plugin is distributed as a zipfile, that really is your only option so your explanation was warranted, but not in the context of the JDT as it is properly implemented as a fully updateable feature.

You probably can't disable your because it is required by other features (PyDev for instance).
[gravatar]
Have you tried eric3? I've found it few days ago and it seems very nice for me. It's in python too.
[gravatar]
Ned, any general comments on what the IDE gives you that a text editor doesn't?
[gravatar]
Paul, that's one of the things I've been trying to figure out. It may be that a syntax-colored text editor with an outline view and a good find in files would do the trick.
[gravatar]
Hi Ned... answering some of your doubts:

1.Multi-file 'next': Ctrl+. (needs focus on the search view)
2.There is an 'auto-refresh', just turn it on: window > preferences > general > workspaces
3. If you don't want those java things in your menu, disable them in your perspective: window > customize perspective. Just go and uncheck the java things under shortcuts and commands.

Some other things:
- Have you checked Pydev Extensions? (http://www.fabioz.com/pydev) It gives you better code analysis, code-completion with auto import, a much better go-to-definition, etc.

- IDE: gives you 'most' things you usually need in a single tool. Eg.: cvs integration, Ctrl+Shift+R: find a resource quickly in the workspace (you need the perspective customized with the 'Resource Navigation' command for that)... Also, check the code-completion with auto-import in Pydev Extensions... It's hard to see any editor giving this to you, etc... I'm keeping the list short here ;-)

Basically, I believe that the main difference is that an IDE acts upon a whole set of files, whereas an Editor works on a single file... You can have 'editors' that give you some of those things, but after you add those... is it still only an editor? ;-P

Cheers,

Fabio

Add a comment:

Ignore this:
Leave this empty:
Name is required. Either email or web are required. Email won't be displayed and I won't spam you. Your web site won't be indexed by search engines.
Don't put anything here:
Leave this empty:
Comment text is Markdown.