FileEditorManagerListener.fileClosed() never called

I registered a FileEditorManagerListener in my plugin like so:


The plugin will log events for files being opened, but not when they are closed. The exception to this is when I close the project, I will get an event per file that is open in the editor.

I'm using build 3542 under windows.

Michael

2 comments

The TabSwitch suffers from this problem too. Did you submit a bug report
about this?

Bas

michael beauregard wrote:

I registered a FileEditorManagerListener in my plugin like so:

 public class MyPlugin implements ProjectComponent {
>     private Logger log = Logger.getInstance(getClass().getName());
> 
>     public void projectOpened() {
> 
>         FileEditorManager editor = FileEditorManager.getInstance(project);
>         editor.addFileEditorManagerListener(new FileEditorManagerAdapter() {
>             public void fileOpened(FileEditorManager fileEditorManager, VirtualFile virtualFile) {
>                 log.debug("file opened " + virtualFile.getName());
>             }
> 
>             public void fileClosed(FileEditorManager fileEditorManager, VirtualFile virtualFile) {
>                 log.debug("file closed " + virtualFile.getName());
>             }
>         });
>     }
> }
> ]]>


The plugin will log events for files being opened, but not when they are closed. The exception to this is when I close the project, I will get an event per file that is open in the editor.

I'm using build 3542 under windows.

Michael

0

I submitted a bug report myself:
http://www.jetbrains.net/jira/browse/IDEA-5875

Bas

Bas Leijdekkers wrote:

The TabSwitch suffers from this problem too. Did you submit a bug report
about this?

Bas

michael beauregard wrote:

>> I registered a FileEditorManagerListener in my plugin like so:
>>
>>

> public class MyPlugin implements ProjectComponent {
>>     private Logger log = Logger.getInstance(getClass().getName());
>> 
>>     public void projectOpened() {
>> 
>>         FileEditorManager editor = FileEditorManager.getInstance(project);
>>         editor.addFileEditorManagerListener(new FileEditorManagerAdapter() {
>>             public void fileOpened(FileEditorManager fileEditorManager, VirtualFile virtualFile) {
>>                 log.debug("file opened " + virtualFile.getName());
>>             }
>> 
>>             public void fileClosed(FileEditorManager fileEditorManager, VirtualFile virtualFile) {
>>                 log.debug("file closed " + virtualFile.getName());
>>             }
>>         });
>>     }
>> }
>> ]]>

>>
>> The plugin will log events for files being opened, but not when they are closed. The exception to this is when I close the project, I will get an event per file that is open in the editor.
>>
>> I'm using build 3542 under windows.
>>
>> Michael

0

Please sign in to leave a comment.