< prev index next >
src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java
Print this page
@@ -27,10 +27,11 @@
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.*;
import javax.swing.SwingConstants;
@@ -1127,10 +1128,12 @@
private static final int LVCFMT_LEFT = 0;
private static final int LVCFMT_RIGHT = 1;
private static final int LVCFMT_CENTER = 2;
public ShellFolderColumnInfo[] getFolderColumns() {
+ ShellFolder library = resolveLibrary(this);
+ if (library != null) return library.getFolderColumns();
return invoke(new Callable<ShellFolderColumnInfo[]>() {
public ShellFolderColumnInfo[] call() {
ShellFolderColumnInfo[] columns = doGetColumnInfo(getIShellFolder());
if (columns != null) {
@@ -1157,17 +1160,36 @@
}
});
}
public Object getFolderColumnValue(final int column) {
+ if(isFileSystem()) {
+ ShellFolder library = resolveLibrary(this);
+ if (library != null) return library.getFolderColumnValue(column);
+ }
return invoke(new Callable<Object>() {
public Object call() {
return doGetColumnValue(getParentIShellFolder(), getRelativePIDL(), column);
}
});
}
+ private static ShellFolder resolveLibrary(ShellFolder folder) {
+ for (ShellFolder f = folder; f != null; f = f.parent) {
+ if (!f.isFileSystem()) {
+ if(f.getPath() != null && "Library".equals(f.getFolderType())) {
+ try {
+ return getShellFolder(new File(folder.getPath()));
+ } catch (FileNotFoundException e) {
+ }
+ }
+ break;
+ }
+ }
+ return null;
+ }
+
// NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details
private native ShellFolderColumnInfo[] doGetColumnInfo(long iShellFolder2);
// NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details
private native Object doGetColumnValue(long parentIShellFolder2, long childPIDL, int columnIdx);
< prev index next >