Eclipse Usage: Difference between revisions

From Elvanör's Technical Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 75: Line 75:


[[Eclipse Plugins and Features]]
[[Eclipse Plugins and Features]]
== Java Development Tools ==
If you are using a Java project, a file named ".classpath" will be created in the root directory of your project. It contains the paths to all the external libraries you may be using in your project. This file should not be under version control if you want that each developer maintains these paths separately.
== 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).
* Things are somehow better now with release 0.7 RC3. Still has problems though.
== 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 [http://subclipse.tigris.org/issues/show_bug.cgi?id=511 511 in the Subclipse Bugzilla.]
== FTP Synchronization ==
* This is included in the standard mirrors, so installation is easy (probably will be already installed).
* This feature seems useful, it is unmaintained however. The Eclipse Target Management seems to be where development is headed at.


== Eclipse and Gentoo amd64 ==
== Eclipse and Gentoo amd64 ==

Revision as of 11:21, 6 June 2007

This articles focuses on Eclipse usage and configuration.

Terminology

  • Something appearing on the right side of the editor as a color mark (for examples, errors or warnings) is called an annotation in Eclipse.

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.
  • To install Subversion support via the Subclipse plugin, add the http://subclipse.tigris.org/update_1.2.x download site to the list of Eclipse sites. You will need to close and reopen projects using Subversion when you install it for the first time. A simple Refresh on the projects is not enough.

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. This can be accomplished directly by modifying GTK properties since Eclipse uses GTK. On KDE, I installed the GTK-QT engine so that GTK programs use the Qt styles.
  • 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.
  • Update: almost everything is indeed removable if you look well, but some is not (for example the set containing New, Save...). In Eclipse 3.3 you can remove the toolbar entirely.
  • The space on the bottom should normally contain the "Background Activity tab". This is not evident as this tab is not resizable and blank most of the time. I don't know yet if it possible at all to remove the whole space at the bottom.
  • Warning: if you go to Preferences -> General -> Appearance, and you change the theme to the system default, it will override any properties you may have defined for the fonts, etc.

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.
  • Anyway the Eclipse help is rarely of use. Google searches or the IRC channel #eclipse on Freenode are much more useful.

Eclipse Plugins and Features

Eclipse Plugins and Features

Eclipse and Gentoo amd64

  • 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. Update: the Gentoo version was not the culprit. Running the Gentoo ebuild is OK.
  • 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.

File Associations

  • To associate a file type (by extension, like *.groovy, *.gsp), go to:
Preferences -> General -> Editors -> File Associations
  • Another place to look is at:
Preferences -> General -> Content Types

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.

Current problems

  • I would like to be able to remove the space at the bottom of the screen.