jdk/test/javax/swing/JFileChooser/6550546/bug6550546.java
author rupashka
Thu, 22 Oct 2009 16:39:29 +0400
changeset 4271 35fc7add4925
child 5506 202f599c92aa
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:
4271
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
     1
/*
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
     2
 * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
     4
 *
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
     7
 * published by the Free Software Foundation.
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
     8
 *
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    13
 * accompanied this code).
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    14
 *
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    18
 *
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    21
 * have any questions.
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    22
 */
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    23
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    24
/* @test
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    25
   @bug 6550546
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    26
   @summary Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    27
   @author Pavel Porvatov
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    28
   @run main bug6550546
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    29
*/
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    30
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    31
import sun.awt.OSInfo;
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    32
import sun.awt.shell.ShellFolder;
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    33
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    34
import javax.swing.*;
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    35
import java.io.File;
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    36
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    37
public class bug6550546 {
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    38
    public static void main(String[] args) throws Exception {
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    39
        if (OSInfo.getOSType() != OSInfo.OSType.WINDOWS) {
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    40
            System.out.println("The test is suitable only for Windows, skipped.");
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    41
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    42
            return;
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    43
        }
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    44
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    45
        SwingUtilities.invokeAndWait(new Runnable() {
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    46
            public void run() {
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    47
                File[] files = (File[]) ShellFolder.get("fileChooserComboBoxFolders");
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    48
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    49
                for (File file : files) {
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    50
                    if (file instanceof ShellFolder && ((ShellFolder) file).isLink()) {
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    51
                        throw new RuntimeException("Link shouldn't be in FileChooser combobox, " + file.getPath());
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    52
                    }
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    53
                }
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    54
            }
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    55
        });
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    56
    }
35fc7add4925 6550546: Win LAF: JFileChooser -> Look in Drop down should not display any shortcuts created on desktop
rupashka
parents:
diff changeset
    57
}