/** * Creates a new ProxyFile using the given file to delegate AbstractFile method calls to. * * @param file the file to be proxied */ public ProxyFile(AbstractFile file) { super(file.getURL()); this.file = file; }
@Override public FileURL getURL() { return file.getURL(); }
@Override public void start() { // Notify listeners that location is changing locationManager.fireLocationChanging(folder==null?folderURL:folder.getURL()); super.start(); }
/** * Returns <code>true</code> if this file is a root folder. * <p> * This default implementation returns <code>true</code> if this file's URL path is <code>/</code>. * </p> * * @return <code>true</code> if this file is a root folder */ public boolean isRoot() { return getURL().getPath().equals("/"); }
/** * Returns the hashCode of this file's {@link #getURL() URL}. * * @return the hashCode of this file's {@link #getURL() URL}. */ public int hashCode() { return getURL().hashCode(); }
public boolean accept(AbstractFile file) { return file.getURL().getScheme().equals(FileProtocols.S3); } });
public ChangeFolderThread(AbstractFile folder, boolean findWorkableFolder, boolean changeLockedTab) { // Ensure that we work on a raw file instance and not a cached one this.folder = (folder instanceof CachedFile)?((CachedFile)folder).getProxiedFile():folder; this.folderURL = folder.getURL(); this.findWorkableFolder = findWorkableFolder; this.changeLockedTab = changeLockedTab; setPriority(Thread.MAX_PRIORITY); }
private FileURL restoreFileURL(String url) { try { return FileURL.getFileURL(url); } catch (MalformedURLException e) { return getHomeFolder().getURL(); } } }
/********************************** * LocationListener Implementation **********************************/ public void locationChanged(LocationEvent locationEvent) { updateTabLocation(folderPanel.getCurrentFolder().getURL()); }
/******************** * MuActions support ********************/ public void add(AbstractFile file) { addTab(defaultTabsFactory.createTab(file.getURL())); }
public void locationCancelled(LocationEvent locationEvent) { updateTabLocation(folderPanel.getCurrentFolder().getURL()); }
public void locationFailed(LocationEvent locationEvent) { updateTabLocation(folderPanel.getCurrentFolder().getURL()); }
@Override public boolean isHidden() { if(!isHiddenSet && getFileAttributesAvailable && FileProtocols.FILE.equals(file.getURL().getScheme())) getFileAttributes(file); // Note: getFileAttributes() might fail to retrieve file attributes, so we need to test isDirectorySet again if(!isHiddenSet) { isHidden = file.isHidden(); isHiddenSet = true; } return isHidden; }
@Override public boolean exists() { if(!existsSet && getFileAttributesAvailable && FileProtocols.FILE.equals(file.getURL().getScheme())) getFileAttributes(file); // Note: getFileAttributes() might fail to retrieve file attributes, so we need to test isDirectorySet again if(!existsSet) { exists = file.exists(); existsSet = true; } return exists; }
@Override public boolean isDirectory() { if(!isDirectorySet && getFileAttributesAvailable && FileProtocols.FILE.equals(file.getURL().getScheme())) getFileAttributes(file); // Note: getFileAttributes() might fail to retrieve file attributes, so we need to test isDirectorySet again if(!isDirectorySet) { isDirectory = file.isDirectory(); isDirectorySet = true; } return isDirectory; }
@Override public RecentLocation[] getData() { List<RecentLocation> list = new LinkedList<RecentLocation>(); for (FileURL url : GlobalLocationHistory.Instance().getHistory()) { // Don't include the currently presented location in the list if (!url.equals(folderPanel.getCurrentFolder().getURL())) list.add(0, new RecentLocation(url)); } return list.toArray(new RecentLocation[0]); }
public Icon lookupCache(AbstractFile file, Dimension preferredResolution) { // Under Mac OS X, return the icon of /Network for the root of remote (non-local) locations. if(OsFamily.MAC_OS_X.isCurrent() && !FileProtocols.FILE.equals(file.getURL().getScheme()) && file.isRoot()) return getSwingIcon(new java.io.File("/Network")); // Look for an existing icon instance for the file's extension return (file.isDirectory()? directoryIconCache : fileIconCache).get(getCheckedExtension(file)); }
@Override protected void toggleEnabledState() { AbstractFile currentFolder = mainFrame.getActivePanel().getCurrentFolder(); setEnabled(currentFolder.getURL().getScheme().equals(FileProtocols.FILE) && !currentFolder.isArchive() && !currentFolder.hasAncestor(AbstractArchiveEntryFile.class) ); }
@Override protected void acceptListItem(AbstractFile item) { MainFrame mainFrame = WindowManager.getCurrentMainFrame(); if(item.getURL().getScheme().equals(FileProtocols.FILE) && (item.hasAncestor(LocalFile.class))) { try { DesktopManager.open(item); } catch(IOException e) {} } // Copies non-local file in a temporary local file and opens them using their native association. else { ProgressDialog progressDialog = new ProgressDialog(mainFrame, Translator.get("copy_dialog.copying")); TempExecJob job = new TempExecJob(progressDialog, mainFrame, item); progressDialog.start(job); } }
/** * Copy constructor */ public MainFrame(MainFrame mainFrame) { FolderPanel leftFolderPanel = mainFrame.getLeftPanel(); FolderPanel rightFolderPanel = mainFrame.getRightPanel(); FileTable leftFileTable = leftFolderPanel.getFileTable(); FileTable rightFileTable = rightFolderPanel.getFileTable(); init(new FolderPanel(this, new ConfFileTableTab[] {new ConfFileTableTab(leftFolderPanel.getCurrentFolder().getURL())}, 0, leftFileTable.getConfiguration()), new FolderPanel(this, new ConfFileTableTab[] {new ConfFileTableTab(rightFolderPanel.getCurrentFolder().getURL())}, 0, rightFileTable.getConfiguration())); // TODO: Sorting should be part of the FileTable configuration this.leftTable.sortBy(leftFileTable.getSortInfo()); this.rightTable.sortBy(rightFileTable.getSortInfo()); }