PageRenderTime 35ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/jEdit/tags/jedit-4-2-pre4/macros/Files/Open_Selection.bsh

#
Unknown | 54 lines | 46 code | 8 blank | 0 comment | 0 complexity | 149bea0dc7e61ffccc49addce4288e23 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
  1. /*
  2. * Open_Selection.bsh - a BeanShell macro script for the
  3. * jEdit text editor - opens file named by selected text
  4. * Copyright (C) 2001 Slava Pestov
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version 2
  9. * of the License, or any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with the jEdit program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19. *
  20. * $Id: Open_Selection.bsh 4826 2003-07-14 23:00:54Z spestov $
  21. *
  22. * Checked for jEdit 4.0 API
  23. *
  24. */
  25. void openSelection()
  26. {
  27. Selection[] selection = textArea.getSelection();
  28. if(selection == null)
  29. view.getToolkit().beep();
  30. else
  31. {
  32. for(i = 0; i < selection.length; i++)
  33. jEdit.openFile(view,textArea.getSelectedText(selection[i]));
  34. }
  35. }
  36. openSelection();
  37. /*
  38. Macro index data (in DocBook format)
  39. <listitem>
  40. <para><filename>Open_Selection.bsh</filename></para>
  41. <abstract><para>
  42. Opens the file named by the current buffer's selected text.
  43. </para></abstract>
  44. </listitem>
  45. */
  46. // end Open_Selection.bsh