jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java
author rupashka
Thu, 22 Oct 2009 16:39:29 +0400
changeset 4271 35fc7add4925
parent 3978 b024e01b947a
child 4275 4c3444f1b9d8
permissions -rw-r--r--
6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop Reviewed-by: peterz
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
     2
 * Copyright 2003-2009 Sun Microsystems, Inc.  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
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
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
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
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
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        Win32ShellFolder2 folder = createShellFolderFromRelativePIDL(parent, pIDL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        Win32ShellFolder2.releasePIDL(pIDL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        return folder;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
    87
    static Win32ShellFolder2 createShellFolderFromRelativePIDL(Win32ShellFolder2 parent, long pIDL)
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
    88
            throws InterruptedException {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        // Walk down this relative pIDL, creating new nodes for each of the entries
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        while (pIDL != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
            long curPIDL = Win32ShellFolder2.copyFirstPIDLEntry(pIDL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
            if (curPIDL != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
                parent = new Win32ShellFolder2(parent, curPIDL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
                pIDL = Win32ShellFolder2.getNextPIDLEntry(pIDL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
                // The list is empty if the parent is Desktop and pIDL is a shortcut to Desktop
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        return parent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
3978
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   103
    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
   104
    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
   105
    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
   106
    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
   107
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   108
    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
   109
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   110
    private static Image getStandardViewButton(int iconIndex) {
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   111
        Image result = STANDARD_VIEW_BUTTONS[iconIndex];
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
        if (result != null) {
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   114
            return result;
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
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   117
        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
   118
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   119
        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
   120
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   121
        STANDARD_VIEW_BUTTONS[iconIndex] = img;
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   122
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   123
        return img;
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   124
    }
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   125
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    // Special folders
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    private static Win32ShellFolder2 desktop;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    private static Win32ShellFolder2 drives;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    private static Win32ShellFolder2 recent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    private static Win32ShellFolder2 network;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    private static Win32ShellFolder2 personal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    static Win32ShellFolder2 getDesktop() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        if (desktop == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
                desktop = new Win32ShellFolder2(DESKTOP);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
            } catch (IOException e) {
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   138
                // Ignore error
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   139
            } catch (InterruptedException e) {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   140
                // Ignore error
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        return desktop;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    static Win32ShellFolder2 getDrives() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        if (drives == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
                drives = new Win32ShellFolder2(DRIVES);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
            } catch (IOException e) {
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   151
                // Ignore error
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   152
            } catch (InterruptedException e) {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   153
                // Ignore error
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        return drives;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    static Win32ShellFolder2 getRecent() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        if (recent == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
                String path = Win32ShellFolder2.getFileSystemPath(RECENT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
                if (path != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                    recent = createShellFolder(getDesktop(), new File(path));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
                }
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   166
            } catch (InterruptedException e) {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   167
                // Ignore error
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
            } catch (IOException e) {
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   169
                // Ignore error
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        return recent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    static Win32ShellFolder2 getNetwork() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        if (network == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                network = new Win32ShellFolder2(NETWORK);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
            } catch (IOException e) {
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   180
                // Ignore error
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   181
            } catch (InterruptedException e) {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   182
                // Ignore error
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        return network;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    static Win32ShellFolder2 getPersonal() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        if (personal == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
                String path = Win32ShellFolder2.getFileSystemPath(PERSONAL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
                if (path != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
                    Win32ShellFolder2 desktop = getDesktop();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
                    personal = desktop.getChildByPath(path);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
                    if (personal == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
                        personal = createShellFolder(getDesktop(), new File(path));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
                    if (personal != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
                        personal.setIsPersonal();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
                }
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   202
            } catch (InterruptedException e) {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   203
                // Ignore error
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
            } catch (IOException e) {
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   205
                // Ignore error
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        return personal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    private static File[] roots;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * @param key a <code>String</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     *  "fileChooserDefaultFolder":
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     *    Returns a <code>File</code> - the default shellfolder for a new filechooser
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     *  "roots":
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     *    Returns a <code>File[]</code> - containing the root(s) of the displayable hierarchy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     *  "fileChooserComboBoxFolders":
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     *    Returns a <code>File[]</code> - an array of shellfolders representing the list to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     *    show by default in the file chooser's combobox
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     *   "fileChooserShortcutPanelFolders":
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     *    Returns a <code>File[]</code> - an array of shellfolders representing well-known
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     *    folders, such as Desktop, Documents, History, Network, Home, etc.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     *    This is used in the shortcut panel of the filechooser on Windows 2000
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     *    and Windows Me.
3978
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   228
     *  "fileChooserIcon <icon>":
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   229
     *    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
   230
     *    ViewMenu (Windows only).
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     *  "optionPaneIcon iconName":
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     *    Returns an <code>Image</code> - icon from the system icon list
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * @return An Object matching the key string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    public Object get(String key) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        if (key.equals("fileChooserDefaultFolder")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
            File file = getPersonal();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
            if (file == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
                file = getDesktop();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
            return file;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
        } else if (key.equals("roots")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
            // Should be "History" and "Desktop" ?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
            if (roots == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
                File desktop = getDesktop();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
                if (desktop != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
                    roots = new File[] { desktop };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
                    roots = (File[])super.get(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
            return roots;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        } else if (key.equals("fileChooserComboBoxFolders")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
            Win32ShellFolder2 desktop = getDesktop();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
            if (desktop != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
                ArrayList<File> folders = new ArrayList<File>();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
                Win32ShellFolder2 drives = getDrives();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
                Win32ShellFolder2 recentFolder = getRecent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
                if (recentFolder != null && OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_2000) >= 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
                    folders.add(recentFolder);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
                folders.add(desktop);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
                // Add all second level folders
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
                File[] secondLevelFolders = desktop.listFiles();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
                Arrays.sort(secondLevelFolders);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
                for (File secondLevelFolder : secondLevelFolders) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
                    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
   272
                    if (!folder.isFileSystem() || (folder.isDirectory() && !folder.isLink())) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
                        folders.add(folder);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
                        // Add third level for "My Computer"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
                        if (folder.equals(drives)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
                            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
   277
                            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
   278
                                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
   279
7d331a53a753 6571802: 'Shared Documents' listed in-between C,D drives in the JFileChooser, does not match with native
rupashka
parents: 454
diff changeset
   280
                                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
   281
                                folders.addAll(thirdLevelFoldersList);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
                            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
                return folders.toArray(new File[folders.size()]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
                return super.get(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
        } else if (key.equals("fileChooserShortcutPanelFolders")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
            Toolkit toolkit = Toolkit.getDefaultToolkit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
            ArrayList<File> folders = new ArrayList<File>();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
            int i = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
            Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
            do {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
                value = toolkit.getDesktopProperty("win.comdlg.placesBarPlace" + i++);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
                    if (value instanceof Integer) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
                        // A CSIDL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
                        folders.add(new Win32ShellFolder2((Integer)value));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
                    } else if (value instanceof String) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
                        // A path
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
                        folders.add(createShellFolder(new File((String)value)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
                } catch (IOException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
                    // Skip this value
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   307
                } catch (InterruptedException e) {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   308
                    // Return empty result
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   309
                    return new File[0];
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
            } while (value != null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
            if (folders.size() == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
                // Use default list of places
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
                for (File f : new File[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
                    getRecent(), getDesktop(), getPersonal(), getDrives(), getNetwork()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
                }) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
                    if (f != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
                        folders.add(f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
            return folders.toArray(new File[folders.size()]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
        } else if (key.startsWith("fileChooserIcon ")) {
3978
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   325
            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
   326
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   327
            int iconIndex;
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   328
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   329
            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
   330
                iconIndex = VIEW_LIST;
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   331
            } else if (name.equals("DetailsView")) {
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   332
                iconIndex = VIEW_DETAILS;
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   333
            } else if (name.equals("UpFolder")) {
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   334
                iconIndex = VIEW_PARENTFOLDER;
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   335
            } else if (name.equals("NewFolder")) {
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   336
                iconIndex = VIEW_NEWFOLDER;
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   337
            } else {
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   338
                return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
            }
3978
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   340
b024e01b947a 6840086: JFileChooser lacks icons on top right when running on Windows 7
rupashka
parents: 3507
diff changeset
   341
            return getStandardViewButton(iconIndex);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
        } else if (key.startsWith("optionPaneIcon ")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
            Win32ShellFolder2.SystemIcon iconType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
            if (key == "optionPaneIcon Error") {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
                iconType = Win32ShellFolder2.SystemIcon.IDI_ERROR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
            } else if (key == "optionPaneIcon Information") {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
                iconType = Win32ShellFolder2.SystemIcon.IDI_INFORMATION;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
            } else if (key == "optionPaneIcon Question") {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
                iconType = Win32ShellFolder2.SystemIcon.IDI_QUESTION;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
            } else if (key == "optionPaneIcon Warning") {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
                iconType = Win32ShellFolder2.SystemIcon.IDI_EXCLAMATION;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
                return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
            return Win32ShellFolder2.getSystemIcon(iconType);
454
2f4f4fef8880 6210674: FileChooser fails to load custom harddrive icon and gets NullPointerException
rupashka
parents: 2
diff changeset
   356
        } 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
   357
            String name = key.substring(key.indexOf(" ") + 1);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
            try {
454
2f4f4fef8880 6210674: FileChooser fails to load custom harddrive icon and gets NullPointerException
rupashka
parents: 2
diff changeset
   359
                int i = Integer.parseInt(name);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
                if (i >= 0) {
454
2f4f4fef8880 6210674: FileChooser fails to load custom harddrive icon and gets NullPointerException
rupashka
parents: 2
diff changeset
   361
                    return Win32ShellFolder2.getShell32Icon(i, key.startsWith("shell32LargeIcon "));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
            } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     * Does <code>dir</code> represent a "computer" such as a node on the network, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     * "My Computer" on the desktop.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
     */
3507
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   373
    public boolean isComputerNode(final File dir) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
        if (dir != null && dir == getDrives()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
        } else {
3507
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   377
            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
   378
                public String run() {
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   379
                    return dir.getAbsolutePath();
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   380
                }
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   381
            });
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   382
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
            return (path.startsWith("\\\\") && path.indexOf("\\", 2) < 0);      //Network path
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
    public boolean isFileSystemRoot(File dir) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
        //Note: Removable drives don't "exist" but are listed in "My Computer"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
        if (dir != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
            Win32ShellFolder2 drives = getDrives();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
            if (dir instanceof Win32ShellFolder2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
                Win32ShellFolder2 sf = (Win32ShellFolder2)dir;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
                if (sf.isFileSystem()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
                    if (sf.parent != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
                        return sf.parent.equals(drives);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
                    // else fall through ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
                    return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
            String path = dir.getPath();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
            return (path.length() == 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
                    && path.charAt(1) == ':'
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
                    && Arrays.asList(drives.listFiles()).contains(dir));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
        return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
    private static List topFolderList = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
    static int compareShellFolders(Win32ShellFolder2 sf1, Win32ShellFolder2 sf2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
        boolean special1 = sf1.isSpecial();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
        boolean special2 = sf2.isSpecial();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
        if (special1 || special2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
            if (topFolderList == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
                ArrayList tmpTopFolderList = new ArrayList();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
                tmpTopFolderList.add(Win32ShellFolderManager2.getPersonal());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
                tmpTopFolderList.add(Win32ShellFolderManager2.getDesktop());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
                tmpTopFolderList.add(Win32ShellFolderManager2.getDrives());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
                tmpTopFolderList.add(Win32ShellFolderManager2.getNetwork());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
                topFolderList = tmpTopFolderList;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
            int i1 = topFolderList.indexOf(sf1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
            int i2 = topFolderList.indexOf(sf2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
            if (i1 >= 0 && i2 >= 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
                return (i1 - i2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
            } else if (i1 >= 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
                return -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
            } else if (i2 >= 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
                return 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
        // Non-file shellfolders sort before files
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
        if (special1 && !special2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
            return -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
        } else if (special2 && !special1) {
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
        return compareNames(sf1.getAbsolutePath(), sf2.getAbsolutePath());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
    static int compareNames(String name1, String name2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
        // 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
   447
        int diff = name1.compareToIgnoreCase(name2);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
        if (diff != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
            return diff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
            // May differ in case (e.g. "mail" vs. "Mail")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
            // We need this test for consistent sorting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
            return name1.compareTo(name2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
    }
2489
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   456
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   457
    @Override
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   458
    protected Invoker createInvoker() {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   459
        return new ComInvoker();
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   460
    }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   461
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   462
    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
   463
        private static Thread comThread;
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
        private ComInvoker() {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   466
            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
   467
            allowCoreThreadTimeOut(false);
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   468
            setThreadFactory(this);
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   469
            final Runnable shutdownHook = new Runnable() {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   470
                public void run() {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   471
                    AccessController.doPrivileged(new PrivilegedAction<Void>() {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   472
                        public Void run() {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   473
                            shutdownNow();
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   474
                            return null;
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   475
                        }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   476
                    });
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   477
                }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   478
            };
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
                    Runtime.getRuntime().addShutdownHook(
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   482
                        new Thread(shutdownHook)
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
                    return null;
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
        }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   488
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   489
        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
   490
            final Runnable comRun = new Runnable() {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   491
                public void run() {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   492
                    try {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   493
                        initializeCom();
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   494
                        task.run();
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   495
                    } finally {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   496
                        uninitializeCom();
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   497
                    }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   498
                }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   499
            };
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   500
            comThread =
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   501
                AccessController.doPrivileged(
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   502
                    new PrivilegedAction<Thread>() {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   503
                        public Thread run() {
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   504
                            /* 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
   505
                             * 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
   506
                             * 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
   507
                             */
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   508
                            ThreadGroup tg = Thread.currentThread().getThreadGroup();
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   509
                            for (ThreadGroup tgn = tg;
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   510
                                 tgn != null;
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   511
                                 tg = tgn, tgn = tg.getParent());
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   512
                            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
   513
                            thread.setDaemon(true);
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   514
                            return thread;
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
                    }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   517
                );
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   518
            return comThread;
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   519
        }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   520
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   521
        public <T> T invoke(Callable<T> task) throws Exception {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   522
            if (Thread.currentThread() == comThread) {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   523
                // if it's already called from the COM
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   524
                // thread, we don't need to delegate the task
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   525
                return task.call();
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   526
            } else {
3507
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   527
                final Future<T> future;
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   528
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   529
                try {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   530
                    future = submit(task);
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   531
                } catch (RejectedExecutionException e) {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   532
                    throw new InterruptedException(e.getMessage());
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   533
                }
2817
f171f2417978 6713352: Deadlock in JFileChooser with synchronized custom FileSystemView
rupashka
parents: 2489
diff changeset
   534
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   535
                try {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   536
                    return future.get();
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   537
                } catch (InterruptedException e) {
3507
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   538
                    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
   539
                        public Void run() {
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   540
                            future.cancel(true);
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   541
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   542
                            return null;
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   543
                        }
1610d6f5a0e3 6461173: One JCK test([NewFolderAction0001]) failed on Windows due to lack of PropertyPermission(s)
rupashka
parents: 3346
diff changeset
   544
                    });
3346
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   545
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   546
                    throw e;
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   547
                } catch (ExecutionException e) {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   548
                    Throwable cause = e.getCause();
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   549
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   550
                    if (cause instanceof Exception) {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   551
                        throw (Exception) cause;
2489
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
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
                    if (cause instanceof Error) {
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   555
                        throw (Error) cause;
1c65be97eaa2 6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents: 2817
diff changeset
   556
                    }
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
                    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
   559
                }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   560
            }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   561
        }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   562
    }
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   563
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   564
    static native void initializeCom();
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   565
5052722686e2 6491795: COM should be initialized for Shell API calls in ShellFolder2.cpp
rupashka
parents: 715
diff changeset
   566
    static native void uninitializeCom();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
}