PageRenderTime 33ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/bundles/plugins-trunk/XML/xml/hyperlinks/jEditOpenFileAndGotoHyperlink.java

#
Java | 57 lines | 25 code | 6 blank | 26 comment | 0 complexity | 4dd933aa9ce74b3d594576e059c9ffe2 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. * jEditOpenFileAndGotoHyperlink.java - open file in jEdit and move to a given location
  3. * :tabSize=8:indentSize=8:noTabs=false:
  4. * :folding=explicit:collapseFolds=1:
  5. *
  6. * Copyright (C) 2011 Eric Le Lay
  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 xml.hyperlinks;
  22. import org.gjt.sp.jedit.View;
  23. import org.gjt.sp.jedit.jEdit;
  24. import gatchan.jedit.hyperlinks.AbstractHyperlink;
  25. /**
  26. * This hyperlink will open a file path in jEdit
  27. * and move to given location
  28. * @author Eric Le Lay
  29. * @version $Id: jEditOpenFileAndGotoHyperlink.java 19677 2011-07-17 15:14:39Z kerik-sf $
  30. */
  31. public class jEditOpenFileAndGotoHyperlink extends AbstractHyperlink
  32. {
  33. private final String path;
  34. private final int gotoLine;
  35. private final int gotoCol;
  36. public jEditOpenFileAndGotoHyperlink(int start, int end, int line, String url, int gotoLine, int gotoColumn)
  37. {
  38. super(start, end, line, url);
  39. path = url;
  40. this.gotoLine = gotoLine;
  41. this.gotoCol = gotoColumn;
  42. }
  43. public void click(View view)
  44. {
  45. xml.XmlInsert.openAndGo(view, view.getTextArea(),
  46. path, gotoLine, gotoCol);
  47. }
  48. public String toString(){
  49. return "jEditOpenFileAndGotoHyperlink["+path+":"+gotoLine+":"+gotoCol+"]";
  50. }
  51. }