/* * List_Dirty_Buffers.bsh - Beanshell macro to provide a simple message box * telling you whether there are any dirty buffers. If all buffers are * saved, a message will appear telling you there are no dirty buffers, * otherwise a message will appear listing all the buffers that are dirty. This * is useful if you like all available screen space to develop (no toolbars, no * no docked plugins visable etc). * * Copyright (C) 2002 Lee Turner (lee@leeturner.org) * Version 1.0 * * :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: * * 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 2 * of the License, or 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, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ Buffer[] buffers = jEdit.getBuffers(); int dirtyBufferCount = 0; String dirtyBuffers = ""; for(int i = 0; i < buffers.length; i++) { if(buffers[i].isDirty()) { dirtyBufferCount++; dirtyBuffers = dirtyBuffers + buffers[i].toString() + System.getProperty("line.separator"); } } if(dirtyBufferCount == 0) { Macros.message(view, "No dirty buffers."); } else { Macros.message(view, dirtyBuffers); }