Index: openide/src/org/openide/filesystems/FileUtil.java =================================================================== RCS file: /cvs/openide/src/org/openide/filesystems/FileUtil.java,v retrieving revision 1.70 diff -u -r1.70 FileUtil.java --- openide/src/org/openide/filesystems/FileUtil.java 12 Aug 2003 09:38:07 -0000 1.70 +++ openide/src/org/openide/filesystems/FileUtil.java 26 Nov 2003 17:57:47 -0000 @@ -18,6 +18,7 @@ import java.net.URLStreamHandler; import java.util.*; import java.util.jar.*; +import org.openide.util.NbBundle; import org.openide.util.Utilities; @@ -762,4 +763,29 @@ public static FileStatusListener weakFileStatusListener (FileStatusListener l, Object source) { return (FileStatusListener)org.openide.util.WeakListeners.create (FileStatusListener.class, l, source); } + + /** + * Get an appropriate display name for a file object. + * If the file corresponds to a path on disk, this will be the disk path. + * Otherwise the name will mention the filesystem and relative path. + * @param fo a file object + * @return a display name indicating where the file is + * @since XXX + */ + public static String getFileDisplayName(FileObject fo) { + File f = toFile(fo); + if (f != null) { + return f.getAbsolutePath(); + } else { + try { + FileSystem fs = fo.getFileSystem(); + return NbBundle.getMessage(FileUtil.class, "LBL_file_in_filesystem", + fo.getPath(), fs.getDisplayName()); + } catch (FileStateInvalidException e) { + // Not relevant now, just use the simple path. + return fo.getPath(); + } + } + } + } Index: openide/src/org/openide/filesystems/Bundle.properties =================================================================== RCS file: /cvs/openide/src/org/openide/filesystems/Bundle.properties,v retrieving revision 1.31 diff -u -r1.31 Bundle.properties --- openide/src/org/openide/filesystems/Bundle.properties 11 Jun 2003 17:11:23 -0000 1.31 +++ openide/src/org/openide/filesystems/Bundle.properties 26 Nov 2003 17:57:47 -0000 @@ -6,7 +6,7 @@ # http://www.sun.com/ # # The Original Code is NetBeans. The Initial Developer of the Original -# Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun +# Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun # Microsystems, Inc. All Rights Reserved. # Repository @@ -152,3 +152,8 @@ XML_InaccurateParam=Inaccurate number of parameters XML_UnknownElement=Unknown element. XML_DuplElement=Duplicated FileObject: + +# FileUtil +# {0} - relative file path +# {1} - filesystem display name +LBL_file_in_filesystem={0} in {1}