< prev index next >

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

Print this page
rev 13901 : Fixes for 8151385. Contains additional fix for 8149453 (upFolder, newFolder, etc. icons)
rev 13629 : 8138838: docs cleanup for java.desktop
Summary: docs cleanup for java.desktop
Reviewed-by: serb
rev 12334 : 8080405: Exception in thread "AWT-EventQueue-1" java.security.AccessControlException
Reviewed-by: prr, chegar, art
rev 12260 : 8017487: filechooser in Windows-Libraries folder: columns are mixed up
Reviewed-by: serb, ant
rev 11779 : 8027771: Enhance thread contexts
Reviewed-by: anthony, serb
rev 11290 : 8062561: Test bug8055304 fails if file system default directory has read access
Reviewed-by: serb
rev 11280 : 8055304: More boxing for DirectoryComboBoxModel
Reviewed-by: serb, prr, skoivu
rev 10444 : 8054834: Modular Source Code
Reviewed-by: alanb, chegar, ihse, mduigou
Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, chris.hegarty@oracle.com, erik.joelsson@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, magnus.ihse.bursie@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, paul.sandoz@oracle.com


  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 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 import java.util.stream.Stream;
  40 
  41 import static sun.awt.shell.Win32ShellFolder2.*;
  42 import sun.awt.OSInfo;
  43 import sun.awt.util.ThreadGroupUtils;
  44 import sun.misc.ManagedLocalsThread;
  45 // NOTE: This class supersedes Win32ShellFolderManager, which was removed
  46 //       from distribution after version 1.4.2.
  47 
  48 /**
  49  * @author Michael Martak


  95             if (curPIDL != 0) {
  96                 parent = Win32ShellFolder2.createShellFolder(parent, curPIDL);
  97                 pIDL = Win32ShellFolder2.getNextPIDLEntry(pIDL);
  98             } else {
  99                 // The list is empty if the parent is Desktop and pIDL is a shortcut to Desktop
 100                 break;
 101             }
 102         }
 103         return parent;
 104     }
 105 
 106     private static final int VIEW_LIST = 2;
 107     private static final int VIEW_DETAILS = 3;
 108     private static final int VIEW_PARENTFOLDER = 8;
 109     private static final int VIEW_NEWFOLDER = 11;
 110 
 111     private static final Image[] STANDARD_VIEW_BUTTONS = new Image[12];
 112 
 113     private static Image getStandardViewButton(int iconIndex) {
 114         Image result = STANDARD_VIEW_BUTTONS[iconIndex];
 115 
 116         if (result != null) {
 117             return result;
 118         }
 119 
 120         BufferedImage img = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);

 121 
 122         img.setRGB(0, 0, 16, 16, Win32ShellFolder2.getStandardViewButton0(iconIndex), 0, 16);

 123 
 124         STANDARD_VIEW_BUTTONS[iconIndex] = img;
 125 

 126         return img;
 127     }
 128 
 129     // Special folders
 130     private static Win32ShellFolder2 desktop;
 131     private static Win32ShellFolder2 drives;
 132     private static Win32ShellFolder2 recent;
 133     private static Win32ShellFolder2 network;
 134     private static Win32ShellFolder2 personal;
 135 
 136     static Win32ShellFolder2 getDesktop() {
 137         if (desktop == null) {
 138             try {
 139                 desktop = new Win32ShellFolder2(DESKTOP);
 140             } catch (SecurityException e) {
 141                 // Ignore error
 142             } catch (IOException e) {
 143                 // Ignore error
 144             } catch (InterruptedException e) {
 145                 // Ignore error




  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 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 import java.awt.image.BaseMultiResolutionImage;
  31 
  32 import java.io.File;
  33 import java.io.FileNotFoundException;
  34 import java.io.IOException;
  35 import java.security.AccessController;
  36 import java.security.PrivilegedAction;
  37 import java.util.*;
  38 import java.util.List;
  39 import java.util.concurrent.*;
  40 import java.util.stream.Stream;
  41 
  42 import static sun.awt.shell.Win32ShellFolder2.*;
  43 import sun.awt.OSInfo;
  44 import sun.awt.util.ThreadGroupUtils;
  45 import sun.misc.ManagedLocalsThread;
  46 // NOTE: This class supersedes Win32ShellFolderManager, which was removed
  47 //       from distribution after version 1.4.2.
  48 
  49 /**
  50  * @author Michael Martak


  96             if (curPIDL != 0) {
  97                 parent = Win32ShellFolder2.createShellFolder(parent, curPIDL);
  98                 pIDL = Win32ShellFolder2.getNextPIDLEntry(pIDL);
  99             } else {
 100                 // The list is empty if the parent is Desktop and pIDL is a shortcut to Desktop
 101                 break;
 102             }
 103         }
 104         return parent;
 105     }
 106 
 107     private static final int VIEW_LIST = 2;
 108     private static final int VIEW_DETAILS = 3;
 109     private static final int VIEW_PARENTFOLDER = 8;
 110     private static final int VIEW_NEWFOLDER = 11;
 111 
 112     private static final Image[] STANDARD_VIEW_BUTTONS = new Image[12];
 113 
 114     private static Image getStandardViewButton(int iconIndex) {
 115         Image result = STANDARD_VIEW_BUTTONS[iconIndex];

 116         if (result != null) {
 117             return result;
 118         }
 119 
 120         BufferedImage imgSmall = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
 121         imgSmall.setRGB(0, 0, 16, 16, Win32ShellFolder2.getStandardViewButton0(iconIndex, true), 0, 16);
 122 
 123         BufferedImage imgLarge = new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB);
 124         imgLarge.setRGB(0, 0, 32, 32, Win32ShellFolder2.getStandardViewButton0(iconIndex, false), 0, 32);
 125 
 126         Image img = new BaseMultiResolutionImage(imgSmall, imgLarge);
 127 
 128         STANDARD_VIEW_BUTTONS[iconIndex] = img;
 129         return img;
 130     }
 131 
 132     // Special folders
 133     private static Win32ShellFolder2 desktop;
 134     private static Win32ShellFolder2 drives;
 135     private static Win32ShellFolder2 recent;
 136     private static Win32ShellFolder2 network;
 137     private static Win32ShellFolder2 personal;
 138 
 139     static Win32ShellFolder2 getDesktop() {
 140         if (desktop == null) {
 141             try {
 142                 desktop = new Win32ShellFolder2(DESKTOP);
 143             } catch (SecurityException e) {
 144                 // Ignore error
 145             } catch (IOException e) {
 146                 // Ignore error
 147             } catch (InterruptedException e) {
 148                 // Ignore error


< prev index next >