author | rupashka |
Thu, 22 Oct 2009 16:39:29 +0400 | |
changeset 4271 | 35fc7add4925 |
parent 3978 | b024e01b947a |
child 4275 | 4c3444f1b9d8 |
permissions | -rw-r--r-- |
2 | 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 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Sun designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Sun in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
22 |
* CA 95054 USA or visit www.sun.com if you need additional information or |
|
23 |
* have any questions. |
|
24 |
*/ |
|
25 |
||
26 |
package sun.awt.shell; |
|
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 | 30 |
|
31 |
import java.io.File; |
|
32 |
import java.io.FileNotFoundException; |
|
33 |
import java.io.IOException; |
|
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 | 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 | 40 |
import sun.security.action.LoadLibraryAction; |
41 |
||
42 |
import static sun.awt.shell.Win32ShellFolder2.*; |
|
43 |
import sun.awt.OSInfo; |
|
44 |
||
45 |
// NOTE: This class supersedes Win32ShellFolderManager, which was removed |
|
46 |
// from distribution after version 1.4.2. |
|
47 |
||
48 |
/** |
|
49 |
* @author Michael Martak |
|
50 |
* @author Leif Samuelsson |
|
51 |
* @author Kenneth Russell |
|
52 |
* @since 1.4 |
|
53 |
*/ |
|
54 |
||
55 |
public class Win32ShellFolderManager2 extends ShellFolderManager { |
|
56 |
||
57 |
static { |
|
58 |
// Load library here |
|
59 |
AccessController.doPrivileged(new LoadLibraryAction("awt")); |
|
60 |
} |
|
61 |
||
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 | 68 |
} |
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 | 72 |
long pIDL; |
73 |
try { |
|
74 |
pIDL = parent.parseDisplayName(file.getCanonicalPath()); |
|
75 |
} catch (IOException ex) { |
|
76 |
pIDL = 0; |
|
77 |
} |
|
78 |
if (pIDL == 0) { |
|
79 |
// Shouldn't happen but watch for it anyway |
|
80 |
throw new FileNotFoundException("File " + file.getAbsolutePath() + " not found"); |
|
81 |
} |
|
82 |
Win32ShellFolder2 folder = createShellFolderFromRelativePIDL(parent, pIDL); |
|
83 |
Win32ShellFolder2.releasePIDL(pIDL); |
|
84 |
return folder; |
|
85 |
} |
|
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 | 89 |
// Walk down this relative pIDL, creating new nodes for each of the entries |
90 |
while (pIDL != 0) { |
|
91 |
long curPIDL = Win32ShellFolder2.copyFirstPIDLEntry(pIDL); |
|
92 |
if (curPIDL != 0) { |
|
93 |
parent = new Win32ShellFolder2(parent, curPIDL); |
|
94 |
pIDL = Win32ShellFolder2.getNextPIDLEntry(pIDL); |
|
95 |
} else { |
|
96 |
// The list is empty if the parent is Desktop and pIDL is a shortcut to Desktop |
|
97 |
break; |
|
98 |
} |
|
99 |
} |
|
100 |
return parent; |
|
101 |
} |
|
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 | 126 |
// Special folders |
127 |
private static Win32ShellFolder2 desktop; |
|
128 |
private static Win32ShellFolder2 drives; |
|
129 |
private static Win32ShellFolder2 recent; |
|
130 |
private static Win32ShellFolder2 network; |
|
131 |
private static Win32ShellFolder2 personal; |
|
132 |
||
133 |
static Win32ShellFolder2 getDesktop() { |
|
134 |
if (desktop == null) { |
|
135 |
try { |
|
136 |
desktop = new Win32ShellFolder2(DESKTOP); |
|
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 | 141 |
} |
142 |
} |
|
143 |
return desktop; |
|
144 |
} |
|
145 |
||
146 |
static Win32ShellFolder2 getDrives() { |
|
147 |
if (drives == null) { |
|
148 |
try { |
|
149 |
drives = new Win32ShellFolder2(DRIVES); |
|
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 | 154 |
} |
155 |
} |
|
156 |
return drives; |
|
157 |
} |
|
158 |
||
159 |
static Win32ShellFolder2 getRecent() { |
|
160 |
if (recent == null) { |
|
161 |
try { |
|
162 |
String path = Win32ShellFolder2.getFileSystemPath(RECENT); |
|
163 |
if (path != null) { |
|
164 |
recent = createShellFolder(getDesktop(), new File(path)); |
|
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 | 168 |
} catch (IOException e) { |
3346
1c65be97eaa2
6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents:
2817
diff
changeset
|
169 |
// Ignore error |
2 | 170 |
} |
171 |
} |
|
172 |
return recent; |
|
173 |
} |
|
174 |
||
175 |
static Win32ShellFolder2 getNetwork() { |
|
176 |
if (network == null) { |
|
177 |
try { |
|
178 |
network = new Win32ShellFolder2(NETWORK); |
|
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 | 183 |
} |
184 |
} |
|
185 |
return network; |
|
186 |
} |
|
187 |
||
188 |
static Win32ShellFolder2 getPersonal() { |
|
189 |
if (personal == null) { |
|
190 |
try { |
|
191 |
String path = Win32ShellFolder2.getFileSystemPath(PERSONAL); |
|
192 |
if (path != null) { |
|
193 |
Win32ShellFolder2 desktop = getDesktop(); |
|
194 |
personal = desktop.getChildByPath(path); |
|
195 |
if (personal == null) { |
|
196 |
personal = createShellFolder(getDesktop(), new File(path)); |
|
197 |
} |
|
198 |
if (personal != null) { |
|
199 |
personal.setIsPersonal(); |
|
200 |
} |
|
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 | 204 |
} catch (IOException e) { |
3346
1c65be97eaa2
6460525: javax/swing/JFileChooser/6396844/TwentyThousandTest.java times out
rupashka
parents:
2817
diff
changeset
|
205 |
// Ignore error |
2 | 206 |
} |
207 |
} |
|
208 |
return personal; |
|
209 |
} |
|
210 |
||
211 |
||
212 |
private static File[] roots; |
|
213 |
||
214 |
/** |
|
215 |
* @param key a <code>String</code> |
|
216 |
* "fileChooserDefaultFolder": |
|
217 |
* Returns a <code>File</code> - the default shellfolder for a new filechooser |
|
218 |
* "roots": |
|
219 |
* Returns a <code>File[]</code> - containing the root(s) of the displayable hierarchy |
|
220 |
* "fileChooserComboBoxFolders": |
|
221 |
* Returns a <code>File[]</code> - an array of shellfolders representing the list to |
|
222 |
* show by default in the file chooser's combobox |
|
223 |
* "fileChooserShortcutPanelFolders": |
|
224 |
* Returns a <code>File[]</code> - an array of shellfolders representing well-known |
|
225 |
* folders, such as Desktop, Documents, History, Network, Home, etc. |
|
226 |
* This is used in the shortcut panel of the filechooser on Windows 2000 |
|
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 | 231 |
* "optionPaneIcon iconName": |
232 |
* Returns an <code>Image</code> - icon from the system icon list |
|
233 |
* |
|
234 |
* @return An Object matching the key string. |
|
235 |
*/ |
|
236 |
public Object get(String key) { |
|
237 |
if (key.equals("fileChooserDefaultFolder")) { |
|
238 |
File file = getPersonal(); |
|
239 |
if (file == null) { |
|
240 |
file = getDesktop(); |
|
241 |
} |
|
242 |
return file; |
|
243 |
} else if (key.equals("roots")) { |
|
244 |
// Should be "History" and "Desktop" ? |
|
245 |
if (roots == null) { |
|
246 |
File desktop = getDesktop(); |
|
247 |
if (desktop != null) { |
|
248 |
roots = new File[] { desktop }; |
|
249 |
} else { |
|
250 |
roots = (File[])super.get(key); |
|
251 |
} |
|
252 |
} |
|
253 |
return roots; |
|
254 |
} else if (key.equals("fileChooserComboBoxFolders")) { |
|
255 |
Win32ShellFolder2 desktop = getDesktop(); |
|
256 |
||
257 |
if (desktop != null) { |
|
258 |
ArrayList<File> folders = new ArrayList<File>(); |
|
259 |
Win32ShellFolder2 drives = getDrives(); |
|
260 |
||
261 |
Win32ShellFolder2 recentFolder = getRecent(); |
|
262 |
if (recentFolder != null && OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_2000) >= 0) { |
|
263 |
folders.add(recentFolder); |
|
264 |
} |
|
265 |
||
266 |
folders.add(desktop); |
|
267 |
// Add all second level folders |
|
268 |
File[] secondLevelFolders = desktop.listFiles(); |
|
269 |
Arrays.sort(secondLevelFolders); |
|
270 |
for (File secondLevelFolder : secondLevelFolders) { |
|
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 | 273 |
folders.add(folder); |
274 |
// Add third level for "My Computer" |
|
275 |
if (folder.equals(drives)) { |
|
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 | 282 |
} |
283 |
} |
|
284 |
} |
|
285 |
} |
|
286 |
return folders.toArray(new File[folders.size()]); |
|
287 |
} else { |
|
288 |
return super.get(key); |
|
289 |
} |
|
290 |
} else if (key.equals("fileChooserShortcutPanelFolders")) { |
|
291 |
Toolkit toolkit = Toolkit.getDefaultToolkit(); |
|
292 |
ArrayList<File> folders = new ArrayList<File>(); |
|
293 |
int i = 0; |
|
294 |
Object value; |
|
295 |
do { |
|
296 |
value = toolkit.getDesktopProperty("win.comdlg.placesBarPlace" + i++); |
|
297 |
try { |
|
298 |
if (value instanceof Integer) { |
|
299 |
// A CSIDL |
|
300 |
folders.add(new Win32ShellFolder2((Integer)value)); |
|
301 |
} else if (value instanceof String) { |
|
302 |
// A path |
|
303 |
folders.add(createShellFolder(new File((String)value))); |
|
304 |
} |
|
305 |
} catch (IOException e) { |
|
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 | 310 |
} |
311 |
} while (value != null); |
|
312 |
||
313 |
if (folders.size() == 0) { |
|
314 |
// Use default list of places |
|
315 |
for (File f : new File[] { |
|
316 |
getRecent(), getDesktop(), getPersonal(), getDrives(), getNetwork() |
|
317 |
}) { |
|
318 |
if (f != null) { |
|
319 |
folders.add(f); |
|
320 |
} |
|
321 |
} |
|
322 |
} |
|
323 |
return folders.toArray(new File[folders.size()]); |
|
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 | 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 | 342 |
} else if (key.startsWith("optionPaneIcon ")) { |
343 |
Win32ShellFolder2.SystemIcon iconType; |
|
344 |
if (key == "optionPaneIcon Error") { |
|
345 |
iconType = Win32ShellFolder2.SystemIcon.IDI_ERROR; |
|
346 |
} else if (key == "optionPaneIcon Information") { |
|
347 |
iconType = Win32ShellFolder2.SystemIcon.IDI_INFORMATION; |
|
348 |
} else if (key == "optionPaneIcon Question") { |
|
349 |
iconType = Win32ShellFolder2.SystemIcon.IDI_QUESTION; |
|
350 |
} else if (key == "optionPaneIcon Warning") { |
|
351 |
iconType = Win32ShellFolder2.SystemIcon.IDI_EXCLAMATION; |
|
352 |
} else { |
|
353 |
return null; |
|
354 |
} |
|
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 | 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 | 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 | 362 |
} |
363 |
} catch (NumberFormatException ex) { |
|
364 |
} |
|
365 |
} |
|
366 |
return null; |
|
367 |
} |
|
368 |
||
369 |
/** |
|
370 |
* Does <code>dir</code> represent a "computer" such as a node on the network, or |
|
371 |
* "My Computer" on the desktop. |
|
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 | 374 |
if (dir != null && dir == getDrives()) { |
375 |
return true; |
|
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 | 383 |
return (path.startsWith("\\\\") && path.indexOf("\\", 2) < 0); //Network path |
384 |
} |
|
385 |
} |
|
386 |
||
387 |
public boolean isFileSystemRoot(File dir) { |
|
388 |
//Note: Removable drives don't "exist" but are listed in "My Computer" |
|
389 |
if (dir != null) { |
|
390 |
Win32ShellFolder2 drives = getDrives(); |
|
391 |
if (dir instanceof Win32ShellFolder2) { |
|
392 |
Win32ShellFolder2 sf = (Win32ShellFolder2)dir; |
|
393 |
if (sf.isFileSystem()) { |
|
394 |
if (sf.parent != null) { |
|
395 |
return sf.parent.equals(drives); |
|
396 |
} |
|
397 |
// else fall through ... |
|
398 |
} else { |
|
399 |
return false; |
|
400 |
} |
|
401 |
} |
|
402 |
String path = dir.getPath(); |
|
403 |
return (path.length() == 3 |
|
404 |
&& path.charAt(1) == ':' |
|
405 |
&& Arrays.asList(drives.listFiles()).contains(dir)); |
|
406 |
} |
|
407 |
return false; |
|
408 |
} |
|
409 |
||
410 |
private static List topFolderList = null; |
|
411 |
static int compareShellFolders(Win32ShellFolder2 sf1, Win32ShellFolder2 sf2) { |
|
412 |
boolean special1 = sf1.isSpecial(); |
|
413 |
boolean special2 = sf2.isSpecial(); |
|
414 |
||
415 |
if (special1 || special2) { |
|
416 |
if (topFolderList == null) { |
|
417 |
ArrayList tmpTopFolderList = new ArrayList(); |
|
418 |
tmpTopFolderList.add(Win32ShellFolderManager2.getPersonal()); |
|
419 |
tmpTopFolderList.add(Win32ShellFolderManager2.getDesktop()); |
|
420 |
tmpTopFolderList.add(Win32ShellFolderManager2.getDrives()); |
|
421 |
tmpTopFolderList.add(Win32ShellFolderManager2.getNetwork()); |
|
422 |
topFolderList = tmpTopFolderList; |
|
423 |
} |
|
424 |
int i1 = topFolderList.indexOf(sf1); |
|
425 |
int i2 = topFolderList.indexOf(sf2); |
|
426 |
if (i1 >= 0 && i2 >= 0) { |
|
427 |
return (i1 - i2); |
|
428 |
} else if (i1 >= 0) { |
|
429 |
return -1; |
|
430 |
} else if (i2 >= 0) { |
|
431 |
return 1; |
|
432 |
} |
|
433 |
} |
|
434 |
||
435 |
// Non-file shellfolders sort before files |
|
436 |
if (special1 && !special2) { |
|
437 |
return -1; |
|
438 |
} else if (special2 && !special1) { |
|
439 |
return 1; |
|
440 |
} |
|
441 |
||
442 |
return compareNames(sf1.getAbsolutePath(), sf2.getAbsolutePath()); |
|
443 |
} |
|
444 |
||
445 |
static int compareNames(String name1, String name2) { |
|
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 | 448 |
if (diff != 0) { |
449 |
return diff; |
|
450 |
} else { |
|
451 |
// May differ in case (e.g. "mail" vs. "Mail") |
|
452 |
// We need this test for consistent sorting |
|
453 |
return name1.compareTo(name2); |
|
454 |
} |
|
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 | 567 |
} |