/jEdit/tags/jedit-4-0-pre3/org/gjt/sp/jedit/io/FileRootsVFS.java
Java | 86 lines | 40 code | 11 blank | 35 comment | 3 complexity | 880084704d2b2a4032d700197385f731 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
- /*
- * FileRootsVFS.java - Local root filesystems VFS
- * :tabSize=8:indentSize=8:noTabs=false:
- * :folding=explicit:collapseFolds=1:
- *
- * Copyright (C) 2000, 2001 Slava Pestov
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
- package org.gjt.sp.jedit.io;
- //{{{ Imports
- import java.awt.Component;
- import java.io.File;
- import org.gjt.sp.util.Log;
- //}}}
- /**
- * A VFS that lists local root filesystems.
- * @author Slava Pestov
- * @version $Id: FileRootsVFS.java 3935 2001-12-11 06:32:54Z spestov $
- */
- public class FileRootsVFS extends VFS
- {
- public static final String PROTOCOL = "roots";
- //{{{ FileRootsVFS constructor
- public FileRootsVFS()
- {
- super("roots");
- } //}}}
- //{{{ getCapabilities() method
- public int getCapabilities()
- {
- // BROWSE_CAP not set because we don't want the VFS browser
- // to create the default 'favorites' item in the 'More' menu
- return 0 /* BROWSE_CAP | */;
- } //}}}
- //{{{ getParentOfPath() method
- public String getParentOfPath(String path)
- {
- return PROTOCOL + ":";
- } //}}}
- //{{{ _listDirectory() method
- public VFS.DirectoryEntry[] _listDirectory(Object session, String url,
- Component comp)
- {
- File[] roots = File.listRoots();
- if(roots == null)
- return null;
- VFS.DirectoryEntry[] rootDE = new VFS.DirectoryEntry[roots.length];
- for(int i = 0; i < roots.length; i++)
- {
- String name = roots[i].getPath();
- rootDE[i] = _getDirectoryEntry(session,name,comp);
- }
- return rootDE;
- } //}}}
- //{{{ _getDirectoryEntry() method
- public DirectoryEntry _getDirectoryEntry(Object session, String path,
- Component comp)
- {
- return new VFS.DirectoryEntry(path,path,path,VFS.DirectoryEntry
- .FILESYSTEM,0L,false);
- } //}}}
- }