From: <kp...@us...> - 2012-01-10 09:22:01
|
Revision: 20740 http://jedit.svn.sourceforge.net/jedit/?rev=20740&view=rev Author: kpouer Date: 2012-01-10 09:21:50 +0000 (Tue, 10 Jan 2012) Log Message: ----------- moved private methods to the end of the file added explicit folds fixed the case where the session is null Modified Paths: -------------- jEdit/trunk/org/gjt/sp/jedit/browser/VFSBrowser.java Modified: jEdit/trunk/org/gjt/sp/jedit/browser/VFSBrowser.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/browser/VFSBrowser.java 2012-01-10 08:10:09 UTC (rev 20739) +++ jEdit/trunk/org/gjt/sp/jedit/browser/VFSBrowser.java 2012-01-10 09:21:50 UTC (rev 20740) @@ -1026,6 +1026,13 @@ } } //}}} + //{{{ paste() method + /** + * Paste the file contained in the clipboard. + * If the clipboard do not contains files, nothing happens. + * @param file the target, it can be a file, in that case it will be pasted to + * the parent directory, or a directory. + */ public void paste(VFSFile file) throws IOException, UnsupportedFlavorException { if (file == null) @@ -1047,7 +1054,11 @@ try { vfsSession = vfs.createVFSSession(targetPath, this); - + if (vfsSession == null) + { + Log.log(Log.ERROR, this, "Unable to create session for " + targetPath); + return; + } Transferable transferable = Registers.getRegister('$').getTransferable(); if (transferable.isDataFlavorSupported(ListVFSFileTransferable.jEditFileList)) { @@ -1080,22 +1091,8 @@ { vfs._endVFSSession(vfsSession, this); } - } + } //}}} - private void _copy(Object vfsSession, VFS vfs, String sourcePath, String sourceName, String targetPath) - throws IOException - { - String name = createUniqueFilename(vfsSession, vfs, targetPath, sourceName); - if (name == null) - { - Log.log(Log.WARNING, this, "Unable to create unique name for file " + - targetPath + '/' + sourceName); - } - String targetName = MiscUtilities.constructPath(targetPath, name); - ThreadUtilities - .runInBackground(new CopyFileWorker(view, sourcePath, targetName)); - } - //{{{ locateFile() method /** * Goes to the given file's directory and selects the file in the list. @@ -1531,6 +1528,21 @@ "vfs.browser.toolbar-dialog"); } //}}} + //{{{ _copy() method + private void _copy(Object vfsSession, VFS vfs, String sourcePath, String sourceName, String targetPath) + throws IOException + { + String name = createUniqueFilename(vfsSession, vfs, targetPath, sourceName); + if (name == null) + { + Log.log(Log.WARNING, this, "Unable to create unique name for file " + + targetPath + '/' + sourceName); + } + String targetName = MiscUtilities.constructPath(targetPath, name); + ThreadUtilities + .runInBackground(new CopyFileWorker(view, sourcePath, targetName)); + } //}}} + //{{{ propertiesChanged() method private void propertiesChanged() { @@ -1574,13 +1586,15 @@ reloadDirectory(); } //}}} + //{{{ createUniqueFilename() method /** * Create a unique filename * @param session the session for the vfs * @param vfs the vfs * @param path the parent directory * @param baseName the filename - * @return baseName if it doesn't already exists, or baseName-copy-i with i as an integer < 1000. Null if unable + * @return baseName if it doesn't already exists, or baseName-copy-i + * with i as an integer < 1000. Null if unable * to find a unique filename * @throws IOException */ @@ -1604,8 +1618,9 @@ return name; } return null; - } + } //}}} + /* We do this stuff because the browser is not able to handle * more than one request yet */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |