/jEdit/tags/jedit-4-2-pre14/macros/Files/Glob_Close.bsh
Unknown | 48 lines | 40 code | 8 blank | 0 comment | 0 complexity | df9e3769026b95162abb05e66c191b91 MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
- /*
- * Glob_Close.bsh - a BeanShell macro for jEdit that closes
- * all open buffers matching a given glob pattern.
- *
- * Copyright (C) 2003-2004 Ollie Rutherfurd <oliver@rutherfurd.net>
- *
- * $Id: Glob_Close.bsh 4995 2004-03-19 15:58:00Z spestov $
- */
- import gnu.regexp.*;
- void globClose(View view)
- {
- String glob = Macros.input(view, "Glob Pattern:");
- if(glob == null || glob.length() == 0)
- return;
- RE re = null;
- try
- {
- re = new RE(MiscUtilities.globToRE(glob));
- }
- catch(Exception e)
- {
- Macros.error(view,"Error in glob pattern: " + e.toString());
- return;
- }
- Buffer[] buffers = jEdit.getBuffers();
- for(int i=0; i < buffers.length; i++)
- {
- if(re.isMatch(buffers[i].getPath()))
- jEdit.closeBuffer(view,buffers[i]);
- }
- }
- globClose(view);
- /*
- <listitem>
- <para><filename>Glob_Close.bsh</filename></para>
- <abstract><para>
- Closes all open buffers matching a given glob pattern.
- </para></abstract>
- </listitem>
- */