0N/A/*
2362N/A * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage sun.awt.shell;
0N/A
0N/Aimport java.io.File;
0N/Aimport java.security.AccessController;
0N/Aimport javax.swing.Icon;
0N/Aimport sun.security.action.GetPropertyAction;
0N/A
0N/A/**
0N/A * @author Michael Martak
0N/A * @since 1.4
0N/A */
0N/A
0N/Aclass DefaultShellFolder extends ShellFolder {
0N/A
0N/A /**
0N/A * Create a file system shell folder from a file
0N/A */
0N/A DefaultShellFolder(ShellFolder parent, File f) {
0N/A super(parent, f.getAbsolutePath());
0N/A }
0N/A
0N/A /**
0N/A * This method is implemented to make sure that no instances
0N/A * of <code>ShellFolder</code> are ever serialized. An instance of
0N/A * this default implementation can always be represented with a
0N/A * <code>java.io.File</code> object instead.
0N/A *
0N/A * @returns a <code>java.io.File</code> replacement object.
0N/A */
0N/A protected Object writeReplace() throws java.io.ObjectStreamException {
0N/A return new File(getPath());
0N/A }
0N/A
0N/A /**
0N/A * @return An array of shell folders that are children of this shell folder
0N/A * object, null if this shell folder is empty.
0N/A */
0N/A public File[] listFiles() {
0N/A File[] files = super.listFiles();
0N/A if (files != null) {
0N/A for (int i = 0; i < files.length; i++) {
0N/A files[i] = new DefaultShellFolder(this, files[i]);
0N/A }
0N/A }
0N/A return files;
0N/A }
0N/A
0N/A /**
0N/A * @return Whether this shell folder is a link
0N/A */
0N/A public boolean isLink() {
0N/A return false; // Not supported by default
0N/A }
0N/A
0N/A /**
0N/A * @return Whether this shell folder is marked as hidden
0N/A */
0N/A public boolean isHidden() {
0N/A String fileName = getName();
0N/A if (fileName.length() > 0) {
0N/A return (fileName.charAt(0) == '.');
0N/A }
0N/A return false;
0N/A }
0N/A
0N/A /**
0N/A * @return The shell folder linked to by this shell folder, or null
0N/A * if this shell folder is not a link
0N/A */
0N/A public ShellFolder getLinkLocation() {
0N/A return null; // Not supported by default
0N/A }
0N/A
0N/A /**
0N/A * @return The name used to display this shell folder
0N/A */
0N/A public String getDisplayName() {
0N/A return getName();
0N/A }
0N/A
0N/A /**
0N/A * @return The type of shell folder as a string
0N/A */
0N/A public String getFolderType() {
0N/A if (isDirectory()) {
0N/A return "File Folder"; // TODO : LOCALIZE THIS STRING!!!
0N/A } else {
0N/A return "File"; // TODO : LOCALIZE THIS STRING!!!
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * @return The executable type as a string
0N/A */
0N/A public String getExecutableType() {
0N/A return null; // Not supported by default
0N/A }
0N/A}