Skip to content

Instantly share code, notes, and snippets.

@yveszoundi
Created June 30, 2016 12:37
Show Gist options
  • Save yveszoundi/a24a42c09dc180d246da1cc51fe748eb to your computer and use it in GitHub Desktop.
Save yveszoundi/a24a42c09dc180d246da1cc51fe748eb to your computer and use it in GitHub Desktop.
Eclim New Type
(defun ers/eclim-new-type (new_type_name new_type)
(interactive (list (read-string "Type name: ")
(completing-read "Type: " '("class"
"abstract"
"interface"
"enum"
"@interface"))))
(let* ((prj-dir (or (eclim-project-name) (eclim-project-name (dired-current-directory))))
(eclim-newtype-args (list "java_new"
"-p"
prj-dir
"-t"
new_type
"-n"
new_type_name))
(result (apply 'eclim--call-process eclim-newtype-args)))
(if (vectorp result)
(let* ((selected-dir (completing-read "Pick SRC: " (append result nil)))
(new-result (apply 'eclim--call-process
(nconc eclim-newtype-args
(list "-r" selected-dir)))))
(find-file new-result))
(find-file (result)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment