jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java
author ohair
Tue, 28 Dec 2010 15:53:50 -0800
changeset 7668 d4a77089c587
parent 5506 202f599c92aa
child 12559 9456ceada8b1
permissions -rw-r--r--
6962318: Update copyright year Reviewed-by: xdono
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
7668
d4a77089c587 6962318: Update copyright year
ohair
parents: 5506
diff changeset
     2
 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5448
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5448
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5448
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5448
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5448
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.awt.shell;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
3978
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
    28
import java.awt.*;
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
    29
import java.awt.image.BufferedImage;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.io.File;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.io.FileNotFoundException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.security.AccessController;
2489
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
    35
import java.security.PrivilegedAction;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.util.*;
3978
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
    37
import java.util.List;
2489
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
    38
import java.util.concurrent.*;
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
    39
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import sun.security.action.LoadLibraryAction;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import static sun.awt.shell.Win32ShellFolder2.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
import sun.awt.OSInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
// NOTE: This class supersedes Win32ShellFolderManager, which was removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
//       from distribution after version 1.4.2.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * @author Michael Martak
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * @author Leif Samuelsson
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * @author Kenneth Russell
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
public class Win32ShellFolderManager2 extends ShellFolderManager {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
        // Load library here
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
        AccessController.doPrivileged(new LoadLibraryAction("awt"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    public ShellFolder createShellFolder(File file) throws FileNotFoundException {
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
    63
        try {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
    64
            return createShellFolder(getDesktop(), file);
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
    65
        } catch (InterruptedException e) {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
    66
            throw new FileNotFoundException("Execution was interrupted");
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
    67
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
    70
    static Win32ShellFolder2 createShellFolder(Win32ShellFolder2 parent, File file)
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
    71
            throws FileNotFoundException, InterruptedException {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        long pIDL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
            pIDL = parent.parseDisplayName(file.getCanonicalPath());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        } catch (IOException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
            pIDL = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        if (pIDL == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
            // Shouldn't happen but watch for it anyway
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
            throw new FileNotFoundException("File " + file.getAbsolutePath() + " not found");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        }
4275
4c3444f1b9d8 6621569: Win32ShellFolder2 and Win32ShellFolderManager2 may leak native resources
rupashka
parents: 4271
diff changeset
    82
4c3444f1b9d8 6621569: Win32ShellFolder2 and Win32ShellFolderManager2 may leak native resources
rupashka
parents: 4271
diff changeset
    83
        try {
4c3444f1b9d8 6621569: Win32ShellFolder2 and Win32ShellFolderManager2 may leak native resources
rupashka
parents: 4271
diff changeset
    84
            return createShellFolderFromRelativePIDL(parent, pIDL);
4c3444f1b9d8 6621569: Win32ShellFolder2 and Win32ShellFolderManager2 may leak native resources
rupashka
parents: 4271
diff changeset
    85
        } finally {
4c3444f1b9d8 6621569: Win32ShellFolder2 and Win32ShellFolderManager2 may leak native resources
rupashka
parents: 4271
diff changeset
    86
            Win32ShellFolder2.releasePIDL(pIDL);
4c3444f1b9d8 6621569: Win32ShellFolder2 and Win32ShellFolderManager2 may leak native resources
rupashka
parents: 4271
diff changeset
    87
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
    90
    static Win32ShellFolder2 createShellFolderFromRelativePIDL(Win32ShellFolder2 parent, long pIDL)
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
    91
            throws InterruptedException {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        // Walk down this relative pIDL, creating new nodes for each of the entries
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        while (pIDL != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
            long curPIDL = Win32ShellFolder2.copyFirstPIDLEntry(pIDL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
            if (curPIDL != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
                parent = new Win32ShellFolder2(parent, curPIDL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
                pIDL = Win32ShellFolder2.getNextPIDLEntry(pIDL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
                // The list is empty if the parent is Desktop and pIDL is a shortcut to Desktop
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        return parent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
3978
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   106
    private static final int VIEW_LIST = 2;
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   107
    private static final int VIEW_DETAILS = 3;
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   108
    private static final int VIEW_PARENTFOLDER = 8;
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   109
    private static final int VIEW_NEWFOLDER = 11;
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   110
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   111
    private static final Image[] STANDARD_VIEW_BUTTONS = new Image[12];
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   112
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   113
    private static Image getStandardViewButton(int iconIndex) {
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   114
        Image result = STANDARD_VIEW_BUTTONS[iconIndex];
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   115
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   116
        if (result != null) {
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   117
            return result;
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   118
        }
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   119
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   120
        BufferedImage img = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   121
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   122
        img.setRGB(0, 0, 16, 16, Win32ShellFolder2.getStandardViewButton0(iconIndex), 0, 16);
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   123
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   124
        STANDARD_VIEW_BUTTONS[iconIndex] = img;
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   125
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   126
        return img;
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   127
    }
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   128
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    // Special folders
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    private static Win32ShellFolder2 desktop;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    private static Win32ShellFolder2 drives;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    private static Win32ShellFolder2 recent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    private static Win32ShellFolder2 network;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    private static Win32ShellFolder2 personal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    static Win32ShellFolder2 getDesktop() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        if (desktop == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                desktop = new Win32ShellFolder2(DESKTOP);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
            } catch (IOException e) {
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   141
                // Ignore error
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   142
            } catch (InterruptedException e) {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   143
                // Ignore error
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        return desktop;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    static Win32ShellFolder2 getDrives() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        if (drives == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
                drives = new Win32ShellFolder2(DRIVES);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            } catch (IOException e) {
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   154
                // Ignore error
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   155
            } catch (InterruptedException e) {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   156
                // Ignore error
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        return drives;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    static Win32ShellFolder2 getRecent() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        if (recent == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
                String path = Win32ShellFolder2.getFileSystemPath(RECENT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
                if (path != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
                    recent = createShellFolder(getDesktop(), new File(path));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
                }
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   169
            } catch (InterruptedException e) {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   170
                // Ignore error
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
            } catch (IOException e) {
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   172
                // Ignore error
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        return recent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    static Win32ShellFolder2 getNetwork() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        if (network == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                network = new Win32ShellFolder2(NETWORK);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
            } catch (IOException e) {
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   183
                // Ignore error
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   184
            } catch (InterruptedException e) {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   185
                // Ignore error
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        return network;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    static Win32ShellFolder2 getPersonal() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        if (personal == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
                String path = Win32ShellFolder2.getFileSystemPath(PERSONAL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
                if (path != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
                    Win32ShellFolder2 desktop = getDesktop();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
                    personal = desktop.getChildByPath(path);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
                    if (personal == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
                        personal = createShellFolder(getDesktop(), new File(path));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
                    if (personal != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
                        personal.setIsPersonal();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
                }
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   205
            } catch (InterruptedException e) {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   206
                // Ignore error
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
            } catch (IOException e) {
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   208
                // Ignore error
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        return personal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    private static File[] roots;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * @param key a <code>String</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     *  "fileChooserDefaultFolder":
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     *    Returns a <code>File</code> - the default shellfolder for a new filechooser
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     *  "roots":
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     *    Returns a <code>File[]</code> - containing the root(s) of the displayable hierarchy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     *  "fileChooserComboBoxFolders":
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     *    Returns a <code>File[]</code> - an array of shellfolders representing the list to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     *    show by default in the file chooser's combobox
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     *   "fileChooserShortcutPanelFolders":
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     *    Returns a <code>File[]</code> - an array of shellfolders representing well-known
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     *    folders, such as Desktop, Documents, History, Network, Home, etc.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     *    This is used in the shortcut panel of the filechooser on Windows 2000
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     *    and Windows Me.
3978
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   231
     *  "fileChooserIcon <icon>":
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   232
     *    Returns an <code>Image</code> - icon can be ListView, DetailsView, UpFolder, NewFolder or
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   233
     *    ViewMenu (Windows only).
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     *  "optionPaneIcon iconName":
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     *    Returns an <code>Image</code> - icon from the system icon list
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * @return An Object matching the key string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    public Object get(String key) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
        if (key.equals("fileChooserDefaultFolder")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
            File file = getPersonal();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
            if (file == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
                file = getDesktop();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
            return file;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
        } else if (key.equals("roots")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
            // Should be "History" and "Desktop" ?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
            if (roots == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
                File desktop = getDesktop();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
                if (desktop != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
                    roots = new File[] { desktop };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
                    roots = (File[])super.get(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
            return roots;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        } else if (key.equals("fileChooserComboBoxFolders")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
            Win32ShellFolder2 desktop = getDesktop();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
            if (desktop != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
                ArrayList<File> folders = new ArrayList<File>();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
                Win32ShellFolder2 drives = getDrives();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
                Win32ShellFolder2 recentFolder = getRecent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
                if (recentFolder != null && OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_2000) >= 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
                    folders.add(recentFolder);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
                folders.add(desktop);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
                // Add all second level folders
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
                File[] secondLevelFolders = desktop.listFiles();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
                Arrays.sort(secondLevelFolders);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
                for (File secondLevelFolder : secondLevelFolders) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
                    Win32ShellFolder2 folder = (Win32ShellFolder2) secondLevelFolder;
4271
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents: 3978
diff changeset
   275
                    if (!folder.isFileSystem() || (folder.isDirectory() && !folder.isLink())) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
                        folders.add(folder);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
                        // Add third level for "My Computer"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
                        if (folder.equals(drives)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
                            File[] thirdLevelFolders = folder.listFiles();
678
7d331a53a753 6571802: 'Shared Documents' listed in-between C,D drives in the JFileChooser, does not match with native
rupashka
parents: 454
diff changeset
   280
                            if (thirdLevelFolders != null && thirdLevelFolders.length > 0) {
7d331a53a753 6571802: 'Shared Documents' listed in-between C,D drives in the JFileChooser, does not match with native
rupashka
parents: 454
diff changeset
   281
                                List<File> thirdLevelFoldersList = Arrays.asList(thirdLevelFolders);
7d331a53a753 6571802: 'Shared Documents' listed in-between C,D drives in the JFileChooser, does not match with native
rupashka
parents: 454
diff changeset
   282
7d331a53a753 6571802: 'Shared Documents' listed in-between C,D drives in the JFileChooser, does not match with native
rupashka
parents: 454
diff changeset
   283
                                folder.sortChildren(thirdLevelFoldersList);
7d331a53a753 6571802: 'Shared Documents' listed in-between C,D drives in the JFileChooser, does not match with native
rupashka
parents: 454
diff changeset
   284
                                folders.addAll(thirdLevelFoldersList);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
                            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
                return folders.toArray(new File[folders.size()]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
                return super.get(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
        } else if (key.equals("fileChooserShortcutPanelFolders")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
            Toolkit toolkit = Toolkit.getDefaultToolkit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
            ArrayList<File> folders = new ArrayList<File>();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
            int i = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
            Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
            do {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
                value = toolkit.getDesktopProperty("win.comdlg.placesBarPlace" + i++);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
                    if (value instanceof Integer) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
                        // A CSIDL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
                        folders.add(new Win32ShellFolder2((Integer)value));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
                    } else if (value instanceof String) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
                        // A path
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
                        folders.add(createShellFolder(new File((String)value)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
                } catch (IOException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
                    // Skip this value
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   310
                } catch (InterruptedException e) {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   311
                    // Return empty result
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   312
                    return new File[0];
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
            } while (value != null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
            if (folders.size() == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
                // Use default list of places
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
                for (File f : new File[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
                    getRecent(), getDesktop(), getPersonal(), getDrives(), getNetwork()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
                }) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
                    if (f != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
                        folders.add(f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
            return folders.toArray(new File[folders.size()]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
        } else if (key.startsWith("fileChooserIcon ")) {
3978
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   328
            String name = key.substring(key.indexOf(" ") + 1);
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   329
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   330
            int iconIndex;
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   331
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   332
            if (name.equals("ListView") || name.equals("ViewMenu")) {
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   333
                iconIndex = VIEW_LIST;
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   334
            } else if (name.equals("DetailsView")) {
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   335
                iconIndex = VIEW_DETAILS;
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   336
            } else if (name.equals("UpFolder")) {
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   337
                iconIndex = VIEW_PARENTFOLDER;
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   338
            } else if (name.equals("NewFolder")) {
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   339
                iconIndex = VIEW_NEWFOLDER;
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   340
            } else {
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   341
                return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
            }
3978
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   343
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   344
            return getStandardViewButton(iconIndex);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
        } else if (key.startsWith("optionPaneIcon ")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
            Win32ShellFolder2.SystemIcon iconType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
            if (key == "optionPaneIcon Error") {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
                iconType = Win32ShellFolder2.SystemIcon.IDI_ERROR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
            } else if (key == "optionPaneIcon Information") {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
                iconType = Win32ShellFolder2.SystemIcon.IDI_INFORMATION;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
            } else if (key == "optionPaneIcon Question") {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
                iconType = Win32ShellFolder2.SystemIcon.IDI_QUESTION;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
            } else if (key == "optionPaneIcon Warning") {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
                iconType = Win32ShellFolder2.SystemIcon.IDI_EXCLAMATION;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
                return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
            return Win32ShellFolder2.getSystemIcon(iconType);
454
2f4f4fef8880 6210674: FileChooser fails to load custom harddrive icon and gets NullPointerException
rupashka
parents: 2
diff changeset
   359
        } else if (key.startsWith("shell32Icon ") || key.startsWith("shell32LargeIcon ")) {
2f4f4fef8880 6210674: FileChooser fails to load custom harddrive icon and gets NullPointerException
rupashka
parents: 2
diff changeset
   360
            String name = key.substring(key.indexOf(" ") + 1);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
            try {
454
2f4f4fef8880 6210674: FileChooser fails to load custom harddrive icon and gets NullPointerException
rupashka
parents: 2
diff changeset
   362
                int i = Integer.parseInt(name);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
                if (i >= 0) {
454
2f4f4fef8880 6210674: FileChooser fails to load custom harddrive icon and gets NullPointerException
rupashka
parents: 2
diff changeset
   364
                    return Win32ShellFolder2.getShell32Icon(i, key.startsWith("shell32LargeIcon "));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
            } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     * Does <code>dir</code> represent a "computer" such as a node on the network, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     * "My Computer" on the desktop.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     */
3507
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   376
    public boolean isComputerNode(final File dir) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
        if (dir != null && dir == getDrives()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
        } else {
3507
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   380
            String path = AccessController.doPrivileged(new PrivilegedAction<String>() {
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   381
                public String run() {
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   382
                    return dir.getAbsolutePath();
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   383
                }
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   384
            });
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   385
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
            return (path.startsWith("\\\\") && path.indexOf("\\", 2) < 0);      //Network path
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
    public boolean isFileSystemRoot(File dir) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
        //Note: Removable drives don't "exist" but are listed in "My Computer"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
        if (dir != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
            Win32ShellFolder2 drives = getDrives();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
            if (dir instanceof Win32ShellFolder2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
                Win32ShellFolder2 sf = (Win32ShellFolder2)dir;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
                if (sf.isFileSystem()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
                    if (sf.parent != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
                        return sf.parent.equals(drives);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
                    // else fall through ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
                    return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
            String path = dir.getPath();
5448
96e9d2b5c719 6945316: The Win32ShellFolderManager2.isFileSystemRoot can throw NPE
rupashka
parents: 4275
diff changeset
   406
96e9d2b5c719 6945316: The Win32ShellFolderManager2.isFileSystemRoot can throw NPE
rupashka
parents: 4275
diff changeset
   407
            if (path.length() != 3 || path.charAt(1) != ':') {
96e9d2b5c719 6945316: The Win32ShellFolderManager2.isFileSystemRoot can throw NPE
rupashka
parents: 4275
diff changeset
   408
                return false;
96e9d2b5c719 6945316: The Win32ShellFolderManager2.isFileSystemRoot can throw NPE
rupashka
parents: 4275
diff changeset
   409
            }
96e9d2b5c719 6945316: The Win32ShellFolderManager2.isFileSystemRoot can throw NPE
rupashka
parents: 4275
diff changeset
   410
96e9d2b5c719 6945316: The Win32ShellFolderManager2.isFileSystemRoot can throw NPE
rupashka
parents: 4275
diff changeset
   411
            File[] files = drives.listFiles();
96e9d2b5c719 6945316: The Win32ShellFolderManager2.isFileSystemRoot can throw NPE
rupashka
parents: 4275
diff changeset
   412
96e9d2b5c719 6945316: The Win32ShellFolderManager2.isFileSystemRoot can throw NPE
rupashka
parents: 4275
diff changeset
   413
            return files != null && Arrays.asList(files).contains(dir);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
        return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
    private static List topFolderList = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
    static int compareShellFolders(Win32ShellFolder2 sf1, Win32ShellFolder2 sf2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
        boolean special1 = sf1.isSpecial();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
        boolean special2 = sf2.isSpecial();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
        if (special1 || special2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
            if (topFolderList == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
                ArrayList tmpTopFolderList = new ArrayList();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
                tmpTopFolderList.add(Win32ShellFolderManager2.getPersonal());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
                tmpTopFolderList.add(Win32ShellFolderManager2.getDesktop());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
                tmpTopFolderList.add(Win32ShellFolderManager2.getDrives());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
                tmpTopFolderList.add(Win32ShellFolderManager2.getNetwork());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
                topFolderList = tmpTopFolderList;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
            int i1 = topFolderList.indexOf(sf1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
            int i2 = topFolderList.indexOf(sf2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
            if (i1 >= 0 && i2 >= 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
                return (i1 - i2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
            } else if (i1 >= 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
                return -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
            } else if (i2 >= 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
                return 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
        // Non-file shellfolders sort before files
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
        if (special1 && !special2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
            return -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
        } else if (special2 && !special1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
            return  1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
        return compareNames(sf1.getAbsolutePath(), sf2.getAbsolutePath());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
    static int compareNames(String name1, String name2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
        // First ignore case when comparing
678
7d331a53a753 6571802: 'Shared Documents' listed in-between C,D drives in the JFileChooser, does not match with native
rupashka
parents: 454
diff changeset
   455
        int diff = name1.compareToIgnoreCase(name2);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
        if (diff != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
            return diff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
            // May differ in case (e.g. "mail" vs. "Mail")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
            // We need this test for consistent sorting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
            return name1.compareTo(name2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
    }
2489
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   464
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   465
    @Override
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   466
    protected Invoker createInvoker() {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   467
        return new ComInvoker();
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   468
    }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   469
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   470
    private static class ComInvoker extends ThreadPoolExecutor implements ThreadFactory, ShellFolder.Invoker {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   471
        private static Thread comThread;
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   472
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   473
        private ComInvoker() {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   474
            super(1, 1, 0, TimeUnit.DAYS, new LinkedBlockingQueue<Runnable>());
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   475
            allowCoreThreadTimeOut(false);
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   476
            setThreadFactory(this);
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   477
            final Runnable shutdownHook = new Runnable() {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   478
                public void run() {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   479
                    AccessController.doPrivileged(new PrivilegedAction<Void>() {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   480
                        public Void run() {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   481
                            shutdownNow();
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   482
                            return null;
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   483
                        }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   484
                    });
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   485
                }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   486
            };
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   487
            AccessController.doPrivileged(new PrivilegedAction<Void>() {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   488
                public Void run() {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   489
                    Runtime.getRuntime().addShutdownHook(
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   490
                        new Thread(shutdownHook)
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   491
                    );
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   492
                    return null;
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   493
                }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   494
            });
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   495
        }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   496
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   497
        public synchronized Thread newThread(final Runnable task) {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   498
            final Runnable comRun = new Runnable() {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   499
                public void run() {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   500
                    try {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   501
                        initializeCom();
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   502
                        task.run();
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   503
                    } finally {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   504
                        uninitializeCom();
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   505
                    }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   506
                }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   507
            };
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   508
            comThread =
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   509
                AccessController.doPrivileged(
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   510
                    new PrivilegedAction<Thread>() {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   511
                        public Thread run() {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   512
                            /* The thread must be a member of a thread group
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   513
                             * which will not get GCed before VM exit.
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   514
                             * Make its parent the top-level thread group.
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   515
                             */
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   516
                            ThreadGroup tg = Thread.currentThread().getThreadGroup();
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   517
                            for (ThreadGroup tgn = tg;
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   518
                                 tgn != null;
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   519
                                 tg = tgn, tgn = tg.getParent());
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   520
                            Thread thread = new Thread(tg, comRun, "Swing-Shell");
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   521
                            thread.setDaemon(true);
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   522
                            return thread;
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   523
                        }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   524
                    }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   525
                );
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   526
            return comThread;
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   527
        }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   528
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   529
        public <T> T invoke(Callable<T> task) throws Exception {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   530
            if (Thread.currentThread() == comThread) {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   531
                // if it's already called from the COM
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   532
                // thread, we don't need to delegate the task
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   533
                return task.call();
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   534
            } else {
3507
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   535
                final Future<T> future;
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   536
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   537
                try {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   538
                    future = submit(task);
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   539
                } catch (RejectedExecutionException e) {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   540
                    throw new InterruptedException(e.getMessage());
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   541
                }
2817
f171f2417978 6713352: Deadlock in JFileChooser with synchronized custom FileSystemView
rupashka
parents: 2489
diff changeset
   542
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   543
                try {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   544
                    return future.get();
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   545
                } catch (InterruptedException e) {
3507
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   546
                    AccessController.doPrivileged(new PrivilegedAction<Void>() {
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   547
                        public Void run() {
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   548
                            future.cancel(true);
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   549
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   550
                            return null;
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   551
                        }
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   552
                    });
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   553
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   554
                    throw e;
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   555
                } catch (ExecutionException e) {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   556
                    Throwable cause = e.getCause();
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   557
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   558
                    if (cause instanceof Exception) {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   559
                        throw (Exception) cause;
2489
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   560
                    }
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   561
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   562
                    if (cause instanceof Error) {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   563
                        throw (Error) cause;
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   564
                    }
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   565
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   566
                    throw new RuntimeException("Unexpected error", cause);
2489
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   567
                }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   568
            }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   569
        }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   570
    }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   571
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   572
    static native void initializeCom();
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   573
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   574
    static native void uninitializeCom();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
}