src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java

Print this page




  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.awt.shell;
  27 
  28 import java.awt.*;
  29 import java.awt.image.BufferedImage;
  30 
  31 import java.io.File;
  32 import java.io.FileNotFoundException;
  33 import java.io.IOException;
  34 import java.security.AccessController;
  35 import java.security.PrivilegedAction;
  36 import java.util.*;
  37 import java.util.List;
  38 import java.util.concurrent.*;
  39 
  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 {
  63         try {
  64             return createShellFolder(getDesktop(), file);
  65         } catch (InterruptedException e) {
  66             throw new FileNotFoundException("Execution was interrupted");
  67         }
  68     }
  69 
  70     static Win32ShellFolder2 createShellFolder(Win32ShellFolder2 parent, File file)
  71             throws FileNotFoundException, InterruptedException {
  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");




  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.awt.shell;
  27 
  28 import java.awt.*;
  29 import java.awt.image.BufferedImage;
  30 
  31 import java.io.File;
  32 import java.io.FileNotFoundException;
  33 import java.io.IOException;
  34 import java.security.AccessController;
  35 import java.security.PrivilegedAction;
  36 import java.util.*;
  37 import java.util.List;
  38 import java.util.concurrent.*;
  39 


  40 import static sun.awt.shell.Win32ShellFolder2.*;
  41 import sun.awt.OSInfo;
  42 
  43 // NOTE: This class supersedes Win32ShellFolderManager, which was removed
  44 //       from distribution after version 1.4.2.
  45 
  46 /**
  47  * @author Michael Martak
  48  * @author Leif Samuelsson
  49  * @author Kenneth Russell
  50  * @since 1.4
  51  */
  52 
  53 public class Win32ShellFolderManager2 extends ShellFolderManager {
  54 
  55     static {
  56         // Load library here
  57         AccessController.doPrivileged(
  58             new java.security.PrivilegedAction<Void>() {
  59                 public Void run() {
  60                     System.loadLibrary("awt");
  61                     return null;
  62                 }
  63             });
  64     }
  65 
  66     public ShellFolder createShellFolder(File file) throws FileNotFoundException {
  67         try {
  68             return createShellFolder(getDesktop(), file);
  69         } catch (InterruptedException e) {
  70             throw new FileNotFoundException("Execution was interrupted");
  71         }
  72     }
  73 
  74     static Win32ShellFolder2 createShellFolder(Win32ShellFolder2 parent, File file)
  75             throws FileNotFoundException, InterruptedException {
  76         long pIDL;
  77         try {
  78             pIDL = parent.parseDisplayName(file.getCanonicalPath());
  79         } catch (IOException ex) {
  80             pIDL = 0;
  81         }
  82         if (pIDL == 0) {
  83             // Shouldn't happen but watch for it anyway
  84             throw new FileNotFoundException("File " + file.getAbsolutePath() + " not found");