summaryrefslogtreecommitdiff
path: root/javax/swing/filechooser/FileSystemView.java
diff options
context:
space:
mode:
authorRoman Kennke <roman@kennke.org>2006-08-02 11:31:42 +0000
committerRoman Kennke <roman@kennke.org>2006-08-02 11:31:42 +0000
commit96e691c80b4df8929bf41dded5119b067ab7524c (patch)
tree74bc82045bb91a31e52af6a2cc52f7fa822a9d13 /javax/swing/filechooser/FileSystemView.java
parent376fefd18a289818077838e682923fc3930bc969 (diff)
downloadclasspath-96e691c80b4df8929bf41dded5119b067ab7524c.tar.gz
2006-08-02 Roman Kennke <kennke@aicas.com>
PR 27604 * javax/swing/plaf/basic/BasicChooserUI.java (BasicFileView.getName): Fetch the real name from the file chooser's FileSystemView. * javax/swing/plaf/metal/MetalChooserUI.java (DirectoryComboBoxRenderer.getListCellRendererComponent): Set the text fetched from the JFileChooser.getName(). * javax/swing/FileSystemView.java (createFileObject): When file is a filesystem root, create a filesystem root object first. (getSystemDisplayName): Return the filename. Added specnote about ShellFolder class that is mentioned in the spec. * javax/swing/UnixFileSystemView.java (getSystemDisplayName): Implemented to return the real name of a file, special handling files like '.' or '..'.
Diffstat (limited to 'javax/swing/filechooser/FileSystemView.java')
-rw-r--r--javax/swing/filechooser/FileSystemView.java21
1 files changed, 16 insertions, 5 deletions
diff --git a/javax/swing/filechooser/FileSystemView.java b/javax/swing/filechooser/FileSystemView.java
index f51b745c8..84b80dd40 100644
--- a/javax/swing/filechooser/FileSystemView.java
+++ b/javax/swing/filechooser/FileSystemView.java
@@ -76,7 +76,10 @@ public abstract class FileSystemView
*/
public File createFileObject(String path)
{
- return new File(path);
+ File f = new File(path);
+ if (isFileSystemRoot(f))
+ f = this.createFileSystemRoot(f);
+ return f;
}
/**
@@ -223,16 +226,24 @@ public abstract class FileSystemView
/**
* Returns the name of a file as it would be displayed by the underlying
- * system. This implementation returns <code>null</code>, subclasses must
- * override.
+ * system.
*
* @param f the file.
*
- * @return <code>null</code>.
+ * @return the name of a file as it would be displayed by the underlying
+ * system
+ *
+ * @specnote The specification suggests that the information here is
+ * fetched from a ShellFolder class. This seems to be a non public
+ * private file handling class. We simply return File.getName()
+ * here and leave special handling to subclasses.
*/
public String getSystemDisplayName(File f)
{
- return null;
+ String name = null;
+ if (f != null)
+ name = f.getName();
+ return name;
}
/**