/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @author Michael Martak
* @since 1.4
*/
/**
* Create a file system shell folder from a file
*/
}
/**
* @return Whether this is a file system shell folder
*/
public boolean isFileSystem() {
}
/**
* This method must be implemented to make sure that no instances
* of <code>ShellFolder</code> are ever serialized. If <code>isFileSystem()</code> returns
* <code>true</code>, then the object should be representable with an instance of
* <code>java.io.File</code> instead. If not, then the object is most likely
* depending on some internal (native) state and cannot be serialized.
*
* @returns a <code>java.io.File</code> replacement object, or <code>null</code>
* if no suitable replacement can be found.
*/
/**
* Returns the path for this object's parent,
* or <code>null</code> if this object does not name a parent
* folder.
*
* @return the path as a String for this object's parent,
* or <code>null</code> if this object does not name a parent
* folder
*
* @see java.io.File#getParent()
* @since 1.4
*/
return super.getParent();
}
} else {
return null;
}
}
/**
* Returns a File object representing this object's parent,
* or <code>null</code> if this object does not name a parent
* folder.
*
* @return a File object representing this object's parent,
* or <code>null</code> if this object does not name a parent
* folder
*
* @see java.io.File#getParentFile()
* @since 1.4
*/
return parent;
} else if (isFileSystem()) {
return super.getParentFile();
} else {
return null;
}
}
return listFiles(true);
}
if (!includeHiddenFiles) {
for (int i = 0; i < nameCount; i++) {
v.addElement(files[i]);
}
}
}
return files;
}
/**
* @return Whether this shell folder is a link
*/
public abstract boolean isLink();
/**
* @return The shell folder linked to by this shell folder, or null
* if this shell folder is not a link
*/
/**
* @return The name used to display this shell folder
*/
/**
* @return The type of shell folder as a string
*/
/**
* @return The executable type as a string
*/
/**
* Compares this ShellFolder with the specified ShellFolder for order.
*
* @see #compareTo(Object)
*/
if (isFileSystem()) {
} else {
return -1;
}
} else {
if (isFileSystem()) {
return 1;
} else {
}
}
}
/**
* @param getLargeIcon whether to return large icon (ignored in base implementation)
* @return The icon used to display this shell folder
*/
return null;
}
// Static
static {
getDesktopProperty("Shell.shellFolderManager");
try {
// swallow the exceptions below and use default shell folder
} catch(ClassNotFoundException e) {
} catch(NullPointerException e) {
}
if (managerClass == null) {
managerClass = ShellFolderManager.class;
}
try {
} catch (InstantiationException e) {
throw new Error("Could not instantiate Shell Folder Manager: "
+ managerClass.getName());
} catch (IllegalAccessException e) {
throw new Error ("Could not access Shell Folder Manager: "
+ managerClass.getName());
}
}
/**
* Return a shell folder from a file object
* @exception FileNotFoundException if file does not exist
*/
if (file instanceof ShellFolder) {
return (ShellFolder)file;
}
throw new FileNotFoundException();
}
}
/**
* @param key a <code>String</code>
* @return An Object matching the string <code>key</code>.
* @see ShellFolderManager#get(String)
*/
}
/**
* Does <code>dir</code> represent a "computer" such as a node on the network, or
* "My Computer" on the desktop.
*/
}
/**
* @return Whether this is a file system root directory
*/
}
/**
* Canonicalizes files that don't have symbolic links in their path.
* Normalizes files that do, preserving symbolic links from being resolved.
*/
// path of f doesn't contain symbolic links
return canonical;
}
// preserve symbolic links from being resolved
}
// Override File methods
return;
}
// To avoid loads of synchronizations with Invoker and improve performance we
// synchronize the whole code of the sort method once
// Check that we can use the ShellFolder.sortChildren() method:
// 1. All files have the same non-null parent
// 2. All files is ShellFolders
commonParent = null;
break;
}
if (commonParent == null) {
} else {
commonParent = null;
break;
}
}
}
if (commonParent instanceof ShellFolder) {
} else {
}
return null;
}
});
}
// To avoid loads of synchronizations with Invoker and improve performance we
// synchronize the whole code of the sort method once
return null;
}
});
}
public boolean isAbsolute() {
return (!isFileSystem() || super.isAbsolute());
}
return (isFileSystem() ? super.getAbsoluteFile() : this);
}
public boolean canRead() {
}
/**
* Returns true if folder allows creation of children.
* True for the "Desktop" folder, but false for the "My Computer"
* folder.
*/
public boolean canWrite() {
}
public boolean exists() {
// Assume top-level drives exist, because state is uncertain for
// removable drives.
}
public boolean isDirectory() {
}
public boolean isFile() {
}
public long lastModified() {
}
public long length() {
}
return (isFileSystem() ? super.createNewFile() : false);
}
public boolean delete() {
}
public void deleteOnExit() {
if (isFileSystem()) {
super.deleteOnExit();
} else {
// Do nothing // ((Fix?))
}
}
public boolean mkdir() {
return (isFileSystem() ? super.mkdir() : false);
}
public boolean mkdirs() {
return (isFileSystem() ? super.mkdirs() : false);
}
}
}
public boolean setReadOnly() {
}
}
if (dir instanceof ShellFolder) {
}
columns = new ShellFolderColumnInfo[]{
DEFAULT_COMPARATOR, true),
DEFAULT_COMPARATOR, true)
};
}
return columns;
}
return null;
}
if (file instanceof ShellFolder) {
return value;
}
}
return null;
}
switch (column) {
case 0:
// By default, file name will be rendered using getSystemDisplayName()
return file;
case 1: // size
case 2: // date
if (isFileSystemRoot(file)) {
return null;
}
default:
return null;
}
}
return null;
}
/**
* Invokes the {@code task} which doesn't throw checked exceptions
* from its {@code call} method. If invokation is interrupted then Thread.currentThread().isInterrupted() will
* be set and result will be {@code null}
*/
try {
} catch (InterruptedException e) {
return null;
}
}
/**
* Invokes the {@code task} which throws checked exceptions from its {@code call} method.
* If invokation is interrupted then Thread.currentThread().isInterrupted() will
* be set and InterruptedException will be thrown as well.
*/
throws InterruptedException, E {
try {
} catch (Exception e) {
if (e instanceof RuntimeException) {
// Rethrow unchecked exceptions
throw (RuntimeException) e;
}
if (e instanceof InterruptedException) {
// Set isInterrupted flag for current thread
// Rethrow InterruptedException
throw (InterruptedException) e;
}
if (exceptionClass.isInstance(e)) {
throw exceptionClass.cast(e);
}
throw new RuntimeException("Unexpected error", e);
}
}
/**
* Interface allowing to invoke tasks in different environments on different platforms.
*/
public static interface Invoker {
/**
* Invokes a callable task.
*
* @param task a task to invoke
* @throws Exception {@code InterruptedException} or an exception that was thrown from the {@code task}
* @return the result of {@code task}'s invokation
*/
}
/**
* Provides a default comparator for the default column set
*/
int gt;
gt = 0;
gt = 1;
gt = -1;
} else if (o1 instanceof Comparable) {
} else {
gt = 0;
}
return gt;
}
};
if (f1 instanceof ShellFolder) {
if (sf1.isFileSystem()) {
}
}
if (f2 instanceof ShellFolder) {
if (sf2.isFileSystem()) {
}
}
// Non-file shellfolders sort before files
return -1;
return 1;
} else {
// First ignore case when comparing
if (diff != 0) {
return diff;
} else {
// May differ in case (e.g. "mail" vs. "Mail")
// We need this test for consistent sorting
}
}
}
};
}