PageRenderTime 70ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-3-pre5/jars/MacOS/macos/script/AppleScriptHandler.java

#
Java | 73 lines | 34 code | 8 blank | 31 comment | 3 complexity | f6276fecd9a92f341a3fb8a4382ab3b2 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. * :tabSize=8:indentSize=8:noTabs=false:
  3. * :folding=explicit:collapseFolds=1:
  4. *
  5. * AppleScriptHandler.java
  6. * Copyright (C) 2002 Kris Kopicki
  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 this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. */
  22. package macos.script;
  23. //{{{ Imports
  24. import java.io.*;
  25. import org.gjt.sp.jedit.*;
  26. import macos.*;
  27. //}}}
  28. public class AppleScriptHandler extends Macros.Handler
  29. {
  30. //{{{ accept() method
  31. public boolean accept(String path)
  32. {
  33. return ffilter.accept(new File(path));
  34. } //}}}
  35. //{{{ createMacro() method
  36. public Macros.Macro createMacro(String macroName, String path)
  37. {
  38. if (macroName.toLowerCase().endsWith(".scpt"))
  39. macroName = macroName.substring(0, macroName.length() - 5);
  40. else if (macroName.toLowerCase().endsWith(".applescript"))
  41. macroName = macroName.substring(0, macroName.length() - 12);
  42. return new Macros.Macro(this,macroName,
  43. Macros.Macro.macroNameToLabel(macroName),path);
  44. } //}}}
  45. //{{{ runMacro() method
  46. public void runMacro(View view, Macros.Macro macro)
  47. {
  48. MacOSActions.runScript(macro.getPath());
  49. }
  50. //}}}
  51. //{{{ runMacro() method
  52. public void runMacro(View view, Macros.Macro macro, boolean ownNamespace)
  53. {
  54. runMacro(view,macro);
  55. } //}}}
  56. //{{{ Handler constructor
  57. public AppleScriptHandler()
  58. {
  59. super("applescript");
  60. ffilter = new ScriptFilter();
  61. } //}}}
  62. //{{{ Private members
  63. private FileFilter ffilter;
  64. //}}}
  65. }