Zobrazují se příspěvky se štítkemEclipse. Zobrazit všechny příspěvky
Zobrazují se příspěvky se štítkemEclipse. Zobrazit všechny příspěvky

pátek 20. ledna 2012

Eclipse: Manual and Automatic Code Formatting

I like automatic code formatting in the Eclipse IDE. For Java see the settings in Window -> Preferences -> Java -> Code Style -> Formatter. I Just hit CTRL+SHIFT+F time from time and let the IDE do the boring job for me.

Occasionally, I want the different result then the Eclipse Formatter produce. Especially when a method has many parameters. Sometimes I like to have all of them on one line, sometimes I like to break them into multiple times. Of course, the Eclipse automatic formatter cannot be configured to meet wishes.

The Eclipse formatter has a nice option On/Off Tags:
  • @formatter:off
  • @formatter:on
But it's tedious and ugly to write these tags into the code. (Even Code templates does not simply usage of On/Off Tags very much). Much more simpler solution is to append the Java comment // ant the and of line, which you want to break. For example, I have configured the Eclipse formatter to have all method parameters on a single line. But when I write
this.someMethod(param1, //
    param2, //
    param3, //
    param4, //
    param5);
Then the CTRL+SHIFT+F reformatting let this piece of the code as is.

středa 20. ledna 2010

Eclipse: An error occurred while collecting items to be installed

I have tried to update my Eclipse 3.5 Galileo plugins, and all what I have seen was:
An error occurred while collecting items to be installed
No repository found containing: org.eclipse.net4j.jms.api/osgi.bundle/1.0.0.v200806180305
I could not find the solution for a couple of hours. Finally, BINGO!, reinstalling EclipseLink packages solved it.

Just go to Help -> Install New Software ->, choose Galile update site Galileo - http://download.eclipse.org/releases/galileo and search for all installed EclipseLink packages. (You must uncheck Hide items that are already installed also.) The installed packages have grey icon. Just check them, press Next, and then Finish. Restart the Eclipse and then try to update plugins again.

pátek 16. října 2009

Eclipse: Java Decompiler - Really Nice Plugin

Why the method throws an exception? What happens when I pass a null parameter? Hot the hell is the class designed? These question I have often asked when I had was working with a library without sources. But now I have found a really nice Eclipse plugin http://java.decompiler.free.fr/jd-eclipse/. The update site is http://java.decompiler.free.fr/jd-eclipse/update.

Now I may press F3 button and see the decompiled source immediately. I just miss a possibility to debug the code without source.

pátek 26. června 2009

Eclipse: WTP Plugin and Name of Deployment

I have a WTP project in Eclipse called in like myproject_war. When I have deployed it into the JBoss server, then the deployment name was myproject_war.war. I wanted to deploy it as myproject.war only. I could not find any property in the "Properties" dialogue to change the deploument name, so I have searched my filesystem for "myproject_war" string. So, I have discovered the file
.settings/org.eclipse.wst.common.component in the project directory. I have changed the attribute name of the wb-module module there, from
<wb-module name="myproject_war">
to
<wb-module name="myproject">
Now, the project is deployed as myproject.war.