PageRenderTime 42ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/jEdit/tags/jedit-4-5-pre1/org/gjt/sp/jedit/browser/MkDirBrowserTask.java

#
Java | 97 lines | 54 code | 8 blank | 35 comment | 1 complexity | 7f9f2ad2ac71446c2147ccbfdb049596 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. * jEdit - Programmer's Text Editor
  3. * :tabSize=8:indentSize=8:noTabs=false:
  4. * :folding=explicit:collapseFolds=1:
  5. *
  6. * Copyright Š 2011 Matthieu Casanova
  7. * Portions Copyright (C) 2000, 2003 Slava Pestov
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2
  12. * of the License, or any later version.
  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 org.gjt.sp.jedit.browser;
  23. //{{{ Imports
  24. import org.gjt.sp.jedit.io.VFS;
  25. import org.gjt.sp.jedit.io.VFSManager;
  26. import org.gjt.sp.jedit.jEdit;
  27. import org.gjt.sp.util.Log;
  28. import java.io.IOException;
  29. //}}}
  30. /**
  31. * @author Matthieu CAsanova
  32. * @version $Id: BrowserIORequest.java 12504 2008-04-22 23:12:43Z ezust $
  33. */
  34. class MkDirBrowserTask extends AbstractBrowserTask
  35. {
  36. //{{{ MkDirBrowserTask constructor
  37. /**
  38. * Creates a new browser I/O request.
  39. * @param browser The VFS browser instance
  40. * @param path The first path name to operate on
  41. */
  42. MkDirBrowserTask(VFSBrowser browser,
  43. Object session, VFS vfs, String path,
  44. Runnable awtRunnable)
  45. {
  46. super(browser, session, vfs, path, awtRunnable);
  47. } //}}}
  48. //{{{ run() method
  49. @Override
  50. public void _run()
  51. {
  52. String[] args = {path};
  53. try
  54. {
  55. setCancellable(true);
  56. setStatus(jEdit.getProperty("vfs.status.mkdir",args));
  57. path = vfs._canonPath(session, path,browser);
  58. if(!vfs._mkdir(session, path,browser))
  59. VFSManager.error(browser, path,"ioerror.mkdir-error",null);
  60. }
  61. catch(IOException io)
  62. {
  63. setCancellable(false);
  64. Log.log(Log.ERROR,this,io);
  65. args[0] = io.toString();
  66. VFSManager.error(browser, path,"ioerror",args);
  67. }
  68. finally
  69. {
  70. try
  71. {
  72. vfs._endVFSSession(session,browser);
  73. }
  74. catch(IOException io)
  75. {
  76. setCancellable(false);
  77. Log.log(Log.ERROR,this,io);
  78. args[0] = io.toString();
  79. VFSManager.error(browser, path,"ioerror",args);
  80. }
  81. }
  82. } //}}}
  83. //{{{ toString() method
  84. public String toString()
  85. {
  86. return getClass().getName() + "[type=MKDIR"
  87. + ",vfs=" + vfs + ",path=" + path + ']';
  88. } //}}}
  89. }