Open folder dialog style change to Macish
authorRoman Chernyatchik <roman.chernyatchik@jetbrains.com>
Tue, 11 Jan 2011 18:04:41 +0000 (21:04 +0300)
committerRoman Chernyatchik <roman.chernyatchik@jetbrains.com>
Tue, 11 Jan 2011 18:09:58 +0000 (21:09 +0300)
plugins/github/src/org/jetbrains/plugins/github/ui/GithubCloneProjectPane.java

index 8d4f3a799380216da885ddbc5d2595a7ae61c58e..57115ed22e5f408235509e5e50a0779142d929f8 100644 (file)
@@ -1,11 +1,12 @@
 package org.jetbrains.plugins.github.ui;
 
 import com.intellij.ide.ui.ListCellRendererWrapper;
+import com.intellij.openapi.fileChooser.FileChooser;
 import com.intellij.openapi.fileChooser.FileChooserDescriptor;
-import com.intellij.openapi.fileChooser.FileChooserDialog;
-import com.intellij.openapi.fileChooser.FileChooserFactory;
 import com.intellij.openapi.ui.TextFieldWithBrowseButton;
+import com.intellij.openapi.vfs.LocalFileSystem;
 import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.util.Consumer;
 import org.jetbrains.annotations.Nullable;
 import org.jetbrains.plugins.github.RepositoryInfo;
 
@@ -101,11 +102,19 @@ public class GithubCloneProjectPane {
           }
         };
         fileChooserDescriptor.setTitle("Select project destination folder");
-        final FileChooserDialog fileChooser = FileChooserFactory.getInstance().createFileChooser(fileChooserDescriptor, myPanel);
-        final VirtualFile[] files = fileChooser.choose(null, null);
-        if (files.length > 0) {
-          myTextFieldWithBrowseButton.setText(files[0].getPath());
-        }
+
+        final String preselectedFolderPath = myTextFieldWithBrowseButton.getText();
+        final VirtualFile preselectedFolder = LocalFileSystem.getInstance().findFileByPath(preselectedFolderPath);
+
+        FileChooser.chooseFilesWithSlideEffect(fileChooserDescriptor, null, preselectedFolder,
+                                               new Consumer<VirtualFile[]>() {
+                                                 @Override
+                                                 public void consume(VirtualFile[] files) {
+                                                   if (files.length > 0) {
+                                                     myTextFieldWithBrowseButton.setText(files[0].getPath());
+                                                   }
+                                                 }
+                                               });
       }
     });
   }