config/.vim/eclim/autoload/eclim/java/constructor.vim

60 lines
1.9 KiB
VimL

" Author: Eric Van Dewoestine
"
" Description: {{{
" see http://eclim.org/vim/java/constructor.html
"
" License:
"
" Copyright (C) 2005 - 2010 Eric Van Dewoestine
"
" This program is free software: you can redistribute it and/or modify
" it under the terms of the GNU General Public License as published by
" the Free Software Foundation, either version 3 of the License, or
" (at your option) any later version.
"
" This program is distributed in the hope that it will be useful,
" but WITHOUT ANY WARRANTY; without even the implied warranty of
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" GNU General Public License for more details.
"
" You should have received a copy of the GNU General Public License
" along with this program. If not, see <http://www.gnu.org/licenses/>.
"
" }}}
" Script Variables {{{
let s:command_properties =
\ '-command java_constructor -p "<project>" -f "<file>" -o <offset> -e <encoding>'
" }}}
" Constructor(first, last) {{{
function! eclim#java#constructor#Constructor(first, last)
if !eclim#project#util#IsCurrentFileInProject()
return
endif
call eclim#java#util#SilentUpdate()
let properties = a:last == 1 ? [] :
\ eclim#java#util#GetSelectedFields(a:first, a:last)
let project = eclim#project#util#GetCurrentProjectName()
let file = eclim#project#util#GetProjectRelativeFilePath()
let command = s:command_properties
let command = substitute(command, '<project>', project, '')
let command = substitute(command, '<file>', file, '')
let command = substitute(command, '<offset>', eclim#util#GetOffset(), '')
let command = substitute(command, '<encoding>', eclim#util#GetEncoding(), '')
if len(properties) > 0
let command = command . ' -r ' . join(properties, ',')
endif
let result = eclim#ExecuteEclim(command)
if result != "0"
call eclim#util#RefreshFile()
silent retab
endif
endfunction " }}}
" vim:ft=vim:fdm=marker