# FileChooser and Slow Operation in EDT

**URL:** <https://platform.jetbrains.com/t/filechooser-and-slow-operation-in-edt/724>\
**Category:** IntelliJ Platform\
**Created:** [February 27, 2025, 4:30pm UTC](https://platform.jetbrains.com/t/filechooser-and-slow-operation-in-edt/724 "2025-02-27T16:30:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonathanlermitage.1](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@jonathanlermitage.1](https://platform.jetbrains.com/u/jonathanlermitage.1)\
**Post date:** [February 27, 2025, 4:30pm UTC](https://platform.jetbrains.com/t/filechooser-and-slow-operation-in-edt/724/1 "2025-02-27T16:30:11Z")

</div>

Hi, I have a `JButton` that triggers a file selection by invoking a `com.intellij.openapi.fileChooser.FileChooser`.  
Basically, it looks like

```auto
myButton.addActionListener(al -> {
    FileChooserDescriptor fileChooserDescriptor = new FileChooserDescriptor(...);
    VirtualFile virtualFile = FileChooser.chooseFile(fileChooserDescriptor, null, null); // <- error here
    ...
});

```

This triggers a `Slow operations are prohibited on EDT` exception.

If I move `FileChooser.chooseFile` outside from the EDT, it says I need to run in EDT…

A workaround is to replace `com.intellij.openapi.fileChooser.FileChooser` by a good old `javax.swing.JFileChooser`, but its UI is ugly.

Do you know how to integrate a `FileChooser`? Thanks.

---

<div class="post-metadata">

**Author:** ![marcin.xvsg](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/marcin.xvsg/32/311_2.png) [@marcin.xvsg](https://platform.jetbrains.com/u/marcin.xvsg)\
**Post date:** [June 5, 2025, 11:03am UTC](https://platform.jetbrains.com/t/filechooser-and-slow-operation-in-edt/724/2 "2025-06-05T11:03:16Z")

</div>

@jonathanlermitage.1 have you succeeded on that one?

---

<div class="post-metadata">

**Author:** ![jonathanlermitage.1](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@jonathanlermitage.1](https://platform.jetbrains.com/u/jonathanlermitage.1)\
**Post date:** [June 5, 2025, 5:10pm UTC](https://platform.jetbrains.com/t/filechooser-and-slow-operation-in-edt/724/3 "2025-06-05T17:10:15Z")

</div>

Unfortunately, no 😞.  
BTW, users may see these warnings when the Internal mode is activated. If so, they can hide them by setting `ide.slow.operations.assertion=false` in IDE’s properties.

---

<div class="post-metadata">

**Author:** ![yuriy.artamonov](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/yuriy.artamonov/32/48_2.png) [@yuriy.artamonov](https://platform.jetbrains.com/u/yuriy.artamonov)\
**Post date:** [June 6, 2025, 8:19pm UTC](https://platform.jetbrains.com/t/filechooser-and-slow-operation-in-edt/724/4 "2025-06-06T20:19:14Z")

</div>

Sorry folks, there is no solution unfortunately yet. But this diagnostic is not shown to users in releases, please do not worry, only during development and internal mode.

---

<div class="post-metadata">

**Author:** ![dgizer](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/dgizer/32/2390_2.png) [@dgizer](https://platform.jetbrains.com/u/dgizer)\
**Post date:** [December 23, 2025, 4:18pm UTC](https://platform.jetbrains.com/t/filechooser-and-slow-operation-in-edt/724/5 "2025-12-23T16:18:29Z")

</div>

It looks so the slow operations may be bypassed if the not null initial value for `FileChoser` is provided. For me the following approach works

```auto
VirtualFile initLocation = defaultLocation; // should not be null
VirtualFile virtualFile = FileChooser.chooseFile(fileChooserDescriptor, null, defaultLocation);

```
