1 /*
   2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
   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.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25   @test
  26   @bug 8075516
  27   @requires os.family=="windows"
  28   @summary Deleting a file from either the open or save java.awt.FileDialog
  29            hangs.
  30   @run main/manual DeleteInsideFileDialogTest
  31 */
  32 
  33 import java.awt.*;
  34 
  35 public class DeleteInsideFileDialogTest {
  36 
  37     public static void main(String[] args) {
  38 
  39         String instructions =
  40                 "1) Create a file using any file manager\n" +
  41                 "2) Delete it in the opened File Dialog window using the " +
  42                    "right click popup menu\n" +
  43                 "3) Select any file in the File Dialog and press OK (If this " +
  44                    "is not possible the test fails)\n";
  45 
  46         Frame f = new Frame("Instructions");
  47         f.setLayout(new BorderLayout());
  48         f.add(new TextArea(instructions), BorderLayout.CENTER);
  49         f.pack();
  50         f.setLocation(100, 500);
  51         f.setVisible(true);
  52 
  53         FileDialog fd = new FileDialog (new Frame());
  54         fd.setVisible(true);
  55         if (fd.getFile() == null) {
  56             fd.dispose();
  57             throw  new RuntimeException("Failed");
  58         }
  59         fd.dispose();
  60     }
  61 }