Nick,

> There is also a utility function `jde-compile-finish-update-imports' that
is
> suitable for inclusion in `jde-compile-finish-hook' so that imports are
> updated automatically.

The compile finish hook idea is fantastic. However it should not update the
file if the new import list matches the one in the file. Otherwise
the .java file becomes out-of-date with respect to .class immediately
and programs like make or ant will compile it again.

Also setting the jde-import-package-begin-format to -
"
//**/ import %s.*; /*
"

and

jde-import-package-end-format to
"//*/

"

works beutifully.

What you get is something like this -

//**/ import java.awt.*; /*
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Window;
//*/

Now say you start using bunch of other classes from java.awt you simply
delete the first / to transform the import list to -

/**/ import java.awt.*; /*
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Window;
//*/

Then you compile, the program compiles succesfully, the compile finish hook
runs and transformas the list to -

//**/ import java.awt.*; /*
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.List;
import java.awt.ScrollPane;
import java.awt.Toolkit;
import java.awt.Window;
file://*/

[NOTE: Notice the comment switching]

Cool for lazy programmers huh !
Programmer friendly...maintainence friendly.....
No more import-on-demand...No more unused imports...

Thanks for taking the effort to develope this.

regards,
-sandip

Reply via email to