George Flaherty wrote:
> Is there a way I can eliminate any import which might include "*". I

Hi George,

this is not possible with the existing set of functions.
I've written a function which does this job.
It calls jde-import-all after removing all package-imports.
Note that this function works with the CVS version of jde-import.el.
In order to use it with a prior version, replace the last line by
         (jde-import-all))))

(defun jde-import-expand-imports (&optional no-exclude)
"Delete all package imports and replace them by their respective class imports.
The replacement is done by `jde-import-all'. `jde-import-auto-collapse-imports'
is temporarily disabled during the execution of `jde-import-all'.
The optional prefix argumet NO-EXCLUDE is used by `jde-import-all'.
This function is roughly the opposite of `jde-import-collapse-imports'."
(interactive "P")
(let* ((tags (semantic-fetch-tags))
(imports (semantic-brute-find-tag-by-class 'include tags))
import-all
package-import-start
package-import-end
jde-import-auto-collapse-imports) ; disable auto collapse
(dolist (import imports)
(when package-import-start
;; kill from start of package-import to beginning of following import
(kill-region package-import-start (semantic-tag-start import))
(setq import-all t)
(setq package-import-start nil))
(when (string-match "\\.\\*" (semantic-tag-name import)) ; package-import?
(setq package-import-start (semantic-tag-start import))
(setq package-import-end (semantic-tag-end import))))
;; kill last import?
(when package-import-start
;; kill from start of package-import to end of line
(kill-region package-import-start
(save-excursion
(goto-char package-import-end)
(end-of-line)
(or (eobp) (forward-char))
(point)))
(setq import-all t))
(if import-all
(jde-import-all no-exclude))))



Regards,

Martin

George Flaherty wrote:
Is there a way I can eliminate any import which might include "*". I
would like to be able to do the following

import foo.foobar.*;

and convert it into

import foo.foobar.ClassOne;
import foo.foobar.ClassTwo;

I have tried with jde-import-all-unique and
jde-import-kill-extra-imports, but what happens is I will will end up
with the following:

import foo.foobar.*;
import foo.foobar.ClassOne;
import foo.foobar.ClassTwo;

thanks.
-george




Reply via email to