From: Amedeo F. <afa...@li...> - 2003-03-25 10:38:55
|
Marcelo Vanzin wrote: > Currently not, since no events are being fired after I got no feedback > (and I currently don't need them in PV). Well, maybe they are not required by PV itself, but I think they are essential if PV is to be used by other plugins. > Is there any way to accomplish what you want other than a file > added/removed event? I believe not. Or better, probably yes, but in this case I would not use PV at all. I'm using PV as a mean for the user to specify which files my plugin has to take into account. So I obviously need to know when a file is added to or removed from the group. I think PV should be perfect for this. > The biggest problem I see is how to "subscribe" to the event > dispatching; it would be cumbersome to register the listener in each > project; using the EditBus is one idea, but it could really cause a lot > of messages when doing an import; and then, there are the current > listeners for the ProjectViewer, which could be extended to add file > add/remove events. I don't see why the "Listener" pattern would not fit. You already use it to inform about project creation, destruction and loading. I think you could simply add a similar mechanism to VPTProject (not to ProjectViewer, PV listeners and Project listeners should be distinct). Using the EditBus is a bad idea. I think the EditBus should be used essentially for jEdit-related topics, not as a general purpose inter-plugin communication mechanism. Why should all other EditBus listeners know about PV activities? Besides, I should connect my PV-listener to the bus, thus receiving a number of messages I don't care. You don't have to send one message for each imported file, just send one event telling what happened, the listeners will then possibly request the new file list to the project. Of course, single add/remove operations need instead to specify which file is affected. > Also, would you need directory added/removed? (Those are a little more > complicated to generate...) No, I just need know about files. Amedeo |