How to update a custom ToolWindow with content from a Listener class?

已回答

This is my requirement:

Based on updates to a file, I want to update the content of a custom tool window with specific information (e.g., the name of the file, path, etc.).

To do this, I have implemented the following:

  1. Created a listener class that inherits from BulkFileListener and overrides the after method. Using breakpoints, I have determined that this class works as expected (i.e., the after method is called when I update a file)
  2. Created a GUI Form class that uses the GridLayoutManager. As for now, this control contains only a label
  3. Created a tool window factory class that implements ToolWindowFactory. This class creates an instance of the GUI Form.

For #2 and #3, I followed the IntelliJ sample code. When I run the plugin, this tool window shows up in the IDE.

Help needed:

I need help with integrating the listener and the tool window. So when the user updates an open file, I want to pass certain information to the tool window, which it should automatically show.

0

What does "updates an open file" mean? Does it imply, changes in your toolwindow should only reflect currently opened file in editor?

Then com.intellij.openapi.vfs.newvfs.BulkFileListener is probably not the correct choice.

0

请先登录再写评论。