a patch for import feature
Paul Pogonyshev <[email protected]> Fri, 15 Sep 2006 14:58:00 +0300
| Newsgroups | gmane.emacs.jdee |
|---|---|
| Message-ID | <[email protected]> |
This simple patch allows automatic importing of classes
like `java.net.URL' and the like, i.e. which names are
all uppercase. It is a quick patch, so it might need
tweaking.
(I hereby put this patch in public domain, use as you
please.)
Hope this helps.
Paul
--- /home/paul/jde-2.3.5.1/lisp/jde-import.el 2006-02-19 16:22:36.000000000 +0200
+++ /usr/local/share/emacs/site-lisp/jde-2.3.5.1/lisp/jde-import.el 2006-09-15 14:51:32.910998096 +0300
@@ -72,6 +72,14 @@ the command prompts you to select only t
(function :tag "Test function"))
(boolean :tag "Exclude synonyms"))))
+(defcustom jde-import-include-class-names
+ '("URI" "URL" "UUID" "CSS" "HTML" "DTD")
+ "List of class names to try to import even if their name otherwise doesn't qualify for importing.
+Usually these are all-uppercase class names in order to override
+`at-least-one-lowercase-letter' rule."
+ :group 'jde-project
+ :type '(repeat string))
+
;; auto sorting of import statements
(defcustom jde-import-auto-sort nil
"*Automatically resort import statements after a `jde-import-import'.
@@ -923,8 +931,9 @@ are not the names of inner or outer clas
(let (case-fold-search
(name (buffer-substring-no-properties start end)))
(unless (or
- (string-match "^[a-z]" name)
- (not (string-match "[a-z]" name))
+ (and (or (string-match "^[a-z]" name)
+ (not (string-match "[a-z]" name)))
+ (not (member name jde-import-include-class-names)))
(member name declared-classes)
(member name imported-classes))
(add-to-list 'classes-to-import name t)))))))))