DevoxxGenieIDEAPlugin icon indicating copy to clipboard operation
DevoxxGenieIDEAPlugin copied to clipboard

[REFACTORING] Make sure to use project message bus instead of application message bus

Open stephanj opened this issue 1 year ago β€’ 3 comments

The MessageBus is used to fire events but these should be restricted to the current project not the full IDEA application.

project.getMessageBus();
The difference between `Application.getMessageBus()` and `Project.getMessageBus()` 
in IntelliJ IDEA lies in their scope and usage:

1. **Application.getMessageBus()**:
   - This message bus is associated with the entire IntelliJ IDEA application.
   - It is used for application-wide events and communication.
   - Services and components that need to communicate across the entire application should use this message bus.

2. **Project.getMessageBus()**:
   - This message bus is associated with a specific project within IntelliJ IDEA.
   - It is used for project-specific events and communication.
   - Services and components that need to communicate within the context of a single project should use this message bus.

In summary, `Application.getMessageBus()` is for global communication across the entire application, while `Project.getMessageBus()` is for communication within a specific project.

stephanj avatar Dec 17 '24 14:12 stephanj

To add my stone : there is a com.devoxx.genie.ui.util.NotificationUtil class so shouldn't we refactor all those calls in that Util class in some kind of connect() method?

samkerr4coding avatar Dec 23 '24 10:12 samkerr4coding

@stephanj i'm currently looking at this one i feel that panel/listener get connection and suscribing should implement a dispose method

I suggest to create a MessageBusUtil class with connect, suscribe and publish method at Project level (and not Application as initially posted), i'm looking at this

samkerr4coding avatar Dec 24 '24 10:12 samkerr4coding

Great, thanks and happy holidays! πŸŽ„πŸΎπŸ₯‚

stephanj avatar Dec 25 '24 10:12 stephanj