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

/jEdit/tags/jedit-4-0-pre5/macros/Java/Get_Class_Name.bsh

#
Unknown | 53 lines | 44 code | 9 blank | 0 comment | 0 complexity | 933adb938fe57a17f85888b47756dc1c 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. * Get_Class_Name.bsh - a BeanShell macro script for the
  3. * jEdit text editor - gets class name from buffer name
  4. * Copyright (C) 2001 John Gellene
  5. * jgellene@nyc.rr.com
  6. * http://community.jedit.org
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version 2
  11. * of the License, or any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with the jEdit program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. *
  22. * $Id: Get_Class_Name.bsh 3872 2001-11-06 17:28:22Z jgellene $
  23. *
  24. * Checked for jEdit 4.0 API
  25. *
  26. */
  27. void getClassName()
  28. {
  29. name = buffer.getName();
  30. index = name.lastIndexOf('.');
  31. textArea.setSelectedText( index != -1 ?
  32. name.substring(0, index) : name);
  33. }
  34. getClassName();
  35. /*
  36. Macro index data (in DocBook format)
  37. <listitem>
  38. <para><filename>Get_Class_Name.bsh</filename></para>
  39. <abstract><para>
  40. Inserts a Java class name based upon the buffer's file name.
  41. </para></abstract>
  42. </listitem>
  43. */
  44. // end Get_Class_Name.bsh