PageRenderTime 10ms CodeModel.GetById 6ms app.highlight 2ms RepoModel.GetById 1ms 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
 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 */
21package xml.hyperlinks;
22
23import org.gjt.sp.jedit.View;
24import org.gjt.sp.jedit.jEdit;
25
26import gatchan.jedit.hyperlinks.AbstractHyperlink;
27
28/**
29 * This hyperlink will open a file path in jEdit
30 * and move to given location
31 * @author Eric Le Lay
32 * @version $Id: jEditOpenFileAndGotoHyperlink.java 19677 2011-07-17 15:14:39Z kerik-sf $
33 */
34public class jEditOpenFileAndGotoHyperlink extends AbstractHyperlink
35{
36	private final String path;
37	private final int gotoLine;
38	private final int gotoCol;
39	
40	public jEditOpenFileAndGotoHyperlink(int start, int end, int line, String url, int gotoLine, int gotoColumn)
41	{
42		super(start, end, line, url);
43		path = url;
44		this.gotoLine = gotoLine;
45		this.gotoCol = gotoColumn;
46	}
47
48	public void click(View view)
49	{
50		xml.XmlInsert.openAndGo(view, view.getTextArea(),
51			path, gotoLine, gotoCol); 
52	}
53	
54	public String toString(){
55		return "jEditOpenFileAndGotoHyperlink["+path+":"+gotoLine+":"+gotoCol+"]";
56	}
57}