Handle file opening

Hi! I am creating plugin for Intellij. Looking for help with handling File and Project opening events.

To clarify my question:
Case for file opening handle in editor: I want to add my custom InlayParameterHintsProvider above each method on file opening. 
Case for project: I want to do some calculus on project opening.

Hope for a quick response, thank you!

0
3 comments

File opened listener:

MessageBus bus = project.getMessageBus();
bus.connect().subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerListener() {
@Override
public void fileOpened(@NotNull FileEditorManager source, @NotNull VirtualFile file) {
//your code
}
});
0

Thank you, Brian!
And how can I do something like this on Project opening event?

0

Create a new class that implements ProjectComponent, register it in the plugin.xml, then put the code you want to run in the constructor.

0

Please sign in to leave a comment.