Eclipse Usage

From Elvanör's Technical Wiki
Jump to navigation Jump to search

This articles focuses on Eclipse usage and configuration.

Line Wrapping

Line wrapping (soft-wrap as well as hard-wrap) seems to be one of Eclipse's current weakness. I hope the situation improves soon, because it is a pity that such a simple (but essential) feature is absent. In the meantime I have found the following solutions:

  • Line wrapping by Eclipse works for certain types of files. For Java code, for example, you can go to Preferences->Java->Code Style->Formatter. Then click "Show..." and you will have access to line wrapping. But this is not present for C++ code via the CDT tools... It also does not work for PHP and plain text files.
  • In Preferences->Java->Code Style->Formatter you may define a certain number of profiles. To make sure these profiles are actually used within your project, you should *disable* project specific settings on your project (via Properties->Code Style->Formatter). That feature can be useful, but then in order to apply changes you have to edit directly your project properties, not the global profiles.
  • Soft wrapping can be done via a very useful plugin. See this page for details.

Installation Features

  • Under Gentoo and Eclipse 3.2.1, the mirrors for the Update/Install of plugins are apparently not saved. A workaround is to select the "Automatic Mirror Selection" feature in the Preferences.

Controlling manually the download sites and mirrors

To change the download/update URL of a feature, go to features/my_feature/feature.xml. For example with PDT:

nano features/org.eclipse.php_feature_0.7.0.v20070221------9FhPQOPhhd/feature.xml

Then look for the correct XML node (<url></url>).

Appearance customization

Eclipse uses views and perspectives. Perspectives are in fact a set of views; many plugins come with their own views and perspectives. You can define your own perspective; however developing views is harder (you probably need to code).

Font customization is available in Preferences->General->Appearance. However some text seems to be set on a system-level, for example the font on the navigator view. I don't know yet how to set these texts.

By customizing perspectives, you can remove almost all buttons in the toolbars, and choose which one you want to be there. You can accomplish that by choosing Windows->Customize Perspective... However there are still some stuff I cannot remove or change.

Configuring custom keys

All the custom keys configuration is in Preferences->General->Keys. You can define what custom key you want for almost all of Eclipse actions. Note that the best way to set a custom key is to first locate the command you want to bind to (in a pop menu or in a menu on the menu bar), then search for the action associated with the default current key. Once you know the command and the *group*, you can change it.

What I currently like:

  • F6: Maximize / Restore
  • F7: Format / Format Document (adding correct tabs, etc).
  • Control + NumKey 4: Shift Left
  • Control + NumKey 6: Shift Right
  • Control + NumKey 8: Toggle Comment
  • Control + NumKey Enter: Jump to next annotation

Warning: the Java and PHP plugins use the same category/menu named "Source". This can get confusing, in particular you should use the "Format" command in Java, and the "Format Document" command in PHP. "Format" when editing Ant build files is also under the Java source category!

Viewing Help

Online help is better viewed with an external browser (Firefox) than with Eclipse slow and buggy integrated browser. You can select in Preferences->Help the browser you want to use.

PHP Development Tools (PDT)

This plugin, as of March 2007, is still in active development. I have lots of stability problems with the current integration build (of February 2007).

Subclipse

  • Warning: do not create a project that is in Subversion, and then another project contained into the first project (in a subdirectory)! This will confuse Subclipse to the point of making Eclipse unusable. This is bug 511 in the Subclipse Bugzilla.

Eclipse and Gentoo amd64

  • Eclipse currently seems unfortunately very unstable on Gentoo AMD64. Many bugs, some plugins don't work correctly, etc...
  • As of March 2007 it seems better to download the binary version from the Eclipse web site rather than build Eclipse through Portage. In my case Eclipse seems stabler with the binary version.
  • Eclipse currently can not seem to handle large files (1 MB or more). This is a real problem and even seems to happen on other platforms than Linux x86_64.
  • It seems imperative to add the following arguments when launching Eclipse:
-vmargs -Xms256m -Xmx512m -XX:PermSize=64M -XX:MaxPermSize=128M

Else Eclipse will be very slow and will keep crashing. Just configuring these settings seemed to make Eclipse run MUCH faster.

Eclipse Preferences, Cache, and other information

  • Preferences seem to be stored in the workspace/.metadata folder. For example, key shortcuts are stored there - do not delete this folder or you will lose all your custom keys!
  • Some Eclipse cache is also stored there. For example, there is a cache per project at workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/.
  • Note that information from some external plugins (Subclipse for example) is stored in this org.eclipse.core.resources folder, so if you don't see information stored in the plugin folder, don't assume it is not stored elsewhere.

Reporting Eclipse bugs

Since everything is stored in the workspace, the best is to zip your workspace and send it to the Eclipse developers. In this case try to copy the problematic projects INSIDE the workspace, instead of keeping them out.