PageRenderTime 146ms CodeModel.GetById 143ms app.highlight 1ms 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
 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 */
21package gatchan.jedit.ancestor;
22
23import org.gjt.sp.jedit.Buffer;
24import org.gjt.sp.jedit.View;
25import org.gjt.sp.jedit.browser.VFSBrowser;
26import org.gjt.sp.jedit.jEdit;
27
28/**
29 * An Ancestor. It represents a parent path for a file.
30 *
31 * @author Matthieu Casanova
32 * @version $Id: Server.java,v 1.33 2007/01/05 15:15:17 matthieu Exp $
33 */
34public class Ancestor
35{
36	private final View view;
37
38	private final String path;
39	private final String name;
40	
41	//{{{ Ancestor constructor
42	public Ancestor(View view, String path, String name)
43	{
44		this.view = view;
45		this.path = path;
46		this.name = name;
47	} //}}}
48
49	//{{{ getName() method 
50	public String getName()
51	{
52		return name;
53	} //}}}
54
55	//{{{ doAction() method
56	public void doAction()
57	{
58		VFSBrowser.browseDirectory(view, path);
59	} //}}}
60	
61	//{{{ closeFiles() method
62	public void closeContainedFiles()
63	{
64		Buffer[] b = jEdit.getBuffers();
65		
66		for(int i=0; i<b.length; i++)
67			if(b[i].getDirectory().startsWith(path))
68				jEdit.closeBuffer(view,b[i]);
69	} //}}}
70
71}