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

/bundles/plugins-trunk/Ancestor/src/gatchan/jedit/ancestor/Ancestor.java

#
Java | 71 lines | 32 code | 9 blank | 30 comment | 2 complexity | fd4042a9660911edea178a3f77cae923 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. * Ancestor.java - An Ancestor
  3. * :tabSize=8:indentSize=8:noTabs=false:
  4. * :folding=explicit:collapseFolds=1:
  5. *
  6. * Copyright (C) 2007, 2011 Matthieu Casanova
  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. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20. */
  21. package gatchan.jedit.ancestor;
  22. import org.gjt.sp.jedit.Buffer;
  23. import org.gjt.sp.jedit.View;
  24. import org.gjt.sp.jedit.browser.VFSBrowser;
  25. import org.gjt.sp.jedit.jEdit;
  26. /**
  27. * An Ancestor. It represents a parent path for a file.
  28. *
  29. * @author Matthieu Casanova
  30. * @version $Id: Server.java,v 1.33 2007/01/05 15:15:17 matthieu Exp $
  31. */
  32. public class Ancestor
  33. {
  34. private final View view;
  35. private final String path;
  36. private final String name;
  37. //{{{ Ancestor constructor
  38. public Ancestor(View view, String path, String name)
  39. {
  40. this.view = view;
  41. this.path = path;
  42. this.name = name;
  43. } //}}}
  44. //{{{ getName() method
  45. public String getName()
  46. {
  47. return name;
  48. } //}}}
  49. //{{{ doAction() method
  50. public void doAction()
  51. {
  52. VFSBrowser.browseDirectory(view, path);
  53. } //}}}
  54. //{{{ closeFiles() method
  55. public void closeContainedFiles()
  56. {
  57. Buffer[] b = jEdit.getBuffers();
  58. for(int i=0; i<b.length; i++)
  59. if(b[i].getDirectory().startsWith(path))
  60. jEdit.closeBuffer(view,b[i]);
  61. } //}}}
  62. }