}
VimPlugin plugin = VimPlugin.getDefault();
alreadyClosed = true;
VimServer server = plugin.getVimserver(serverID);
if (server != null){
server.getEditors().remove(this);
if (save && dirty) {
server.getVc().command(bufferID, "save", "");
dirty = false;
firePropertyChange(PROP_DIRTY);
}
if (server.getEditors().size() > 0) {
server.getVc().command(bufferID, "close", "");
String gvim = VimPlugin.getDefault().getPreferenceStore().getString(
PreferenceConstants.P_GVIM);
String[] args = new String[5];
args[0] = gvim;
args[1] = "--servername";
args[2] = String.valueOf(server.getID());
args[3] = "--remote-send";
args[4] = "<esc>:redraw!<cr>";
try{
CommandExecutor.execute(args, 1000);
}catch(Exception e){
logger.error("Error redrawing vim after file close.", e);
}
} else {
try {
VimConnection vc = server.getVc();
if (vc != null){
server.getVc().function(bufferID, "saveAndExit", "");
}
plugin.stopVimServer(serverID);
} catch (IOException e) {
message(plugin.getMessage("server.stop.failed"), e);
}