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

Print this page

        

*** 1097,1107 **** ? SwingConstants.RIGHT : column.getAlignment() == LVCFMT_CENTER ? SwingConstants.CENTER : SwingConstants.LEADING); ! column.setComparator(new ColumnComparator(getIShellFolder(), i)); notNullColumns.add(column); } } columns = new ShellFolderColumnInfo[notNullColumns.size()]; --- 1097,1107 ---- ? SwingConstants.RIGHT : column.getAlignment() == LVCFMT_CENTER ? SwingConstants.CENTER : SwingConstants.LEADING); ! column.setComparator(new ColumnComparator(Win32ShellFolder2.this, i)); notNullColumns.add(column); } } columns = new ShellFolderColumnInfo[notNullColumns.size()];
*** 1133,1167 **** public void sortChildren(final List<? extends File> files) { // To avoid loads of synchronizations with Invoker and improve performance we // synchronize the whole code of the sort method once invoke(new Callable<Void>() { public Void call() { ! Collections.sort(files, new ColumnComparator(getIShellFolder(), 0)); return null; } }); } private static class ColumnComparator implements Comparator<File> { ! private final long parentIShellFolder; private final int columnIdx; ! public ColumnComparator(long parentIShellFolder, int columnIdx) { ! this.parentIShellFolder = parentIShellFolder; this.columnIdx = columnIdx; } // compares 2 objects within this folder by the specified column public int compare(final File o, final File o1) { Integer result = invoke(new Callable<Integer>() { public Integer call() { if (o instanceof Win32ShellFolder2 && o1 instanceof Win32ShellFolder2) { // delegates comparison to native method ! return compareIDsByColumn(parentIShellFolder, ((Win32ShellFolder2) o).getRelativePIDL(), ((Win32ShellFolder2) o1).getRelativePIDL(), columnIdx); } return 0; --- 1133,1167 ---- public void sortChildren(final List<? extends File> files) { // To avoid loads of synchronizations with Invoker and improve performance we // synchronize the whole code of the sort method once invoke(new Callable<Void>() { public Void call() { ! Collections.sort(files, new ColumnComparator(Win32ShellFolder2.this, 0)); return null; } }); } private static class ColumnComparator implements Comparator<File> { ! private final Win32ShellFolder2 shellFolder; private final int columnIdx; ! public ColumnComparator(Win32ShellFolder2 shellFolder, int columnIdx) { ! this.shellFolder = shellFolder; this.columnIdx = columnIdx; } // compares 2 objects within this folder by the specified column public int compare(final File o, final File o1) { Integer result = invoke(new Callable<Integer>() { public Integer call() { if (o instanceof Win32ShellFolder2 && o1 instanceof Win32ShellFolder2) { // delegates comparison to native method ! return compareIDsByColumn(shellFolder.getIShellFolder(), ((Win32ShellFolder2) o).getRelativePIDL(), ((Win32ShellFolder2) o1).getRelativePIDL(), columnIdx); } return 0;