Triggering AnAction on editor file change

Hello,

I'm wiring a navigation plugin, and I want to trigger AnAction whenever a new file is displayed in an editor window. (ex. clicking a file in the Project window).  How can I do this?

0
5 comments
Avatar
Permanently deleted user

Sub-class and register an EditorTrackerListener with the EditorTracker.  Inside of that listener, trigger the action or schedule a Runnable to run your code without having to use the action mechanism.

1

I’m having trouble understanding how to get a handle to the proper EditorTracker.

0
Avatar
Permanently deleted user

Look at Project.getComponent(EditorTracker.class).  That will get the editor tracker for a specific project.

0

Just getting back to this project.

Appreciate the info, but EditorTracker's addEditorTrackerListener() seems to be a private function.

0

Please sign in to leave a comment.