Hi, I implemented a jde-wiz-log-method function.
As I copied and modified code from jde-javadoc-autodoc-at-line function,
it has dependency on jde-javadoc.el.
it works like this;
public Node getNodeByPath(String absPath) {
// HERE run jde-wiz-log-method
}
then the code becomes,
public Node getNodeByPath(String absPath) {
if (logger.isLoggable(Level.FINEST)) {
logger.finest("getNodeByPath(absPath - " + absPath + ")");
}
}
The function code are :
(defun jde-wiz-log-method()
"insert logger statement of a method or constructor"
(interactive)
(if (not (eq major-mode 'jde-mode))
(error "Major mode must be 'jde-mode'"))
(let ((found (jde-javadoc-nonterminal-at-line)))
(if (not found)
(error "No tag found at point")
(let* ((modifiers (semantic-tag-modifiers found))
(type (semantic-tag-type found))
(name (semantic-tag-name found))
(arguments (semantic-tag-function-arguments found))
(throws (semantic-tag-function-throws found))
(string
(concat
"if (logger.isLoggable(Level.FINEST))"
(if jde-gen-k&r " {\n" "\n{\n")
"logger.finest(\""
name
"(")))
(while arguments
(let* ((arg (car arguments))
(name (semantic-tag-name arg)) ;;argument name
(type (semantic-tag-type arg)) ;;argument type i.e. boolean
)
(if (> (length arguments) 1)
(setq string (concat string name " - \" + " name " + \", "))
(setq string
(concat string name " - \" + " name " + \")\");\n}\n\n")))
(setq arguments (cdr arguments))))
(if (eq (length arguments) 0)
(setq string
(concat string ")\");\n}\n\n")))
(insert string)
))
(jde-wiz-indent (point))
))
--
--------------------
Java Architect yoonforh at tmax dot co dot kr (ICQ #21382429)
Building on One Span Ahead Technology
Process Engineer From Software Development To Business Modeling
PGP http://www.javadom.com/personal/yoonforhatyahoodotcom.asc