如何访问 subclipse 在运行时使用的 SVNClientAdapter?
我正在使用 Subclipse API,我想实现 ISVNNotifyListener,以便我可以了解运行时发生的 subclipse 事件。我相信我需要将我的通知侦听器实例添加(订阅)到客户端适配器将通知的侦听器集,但我不知道如何访问 Subclipse 在运行时使用的客户端适配器。有没有办法访问它以便我可以将侦听器添加到集合中?
I am using the Subclipse API and I would like to implement the ISVNNotifyListener so that I can find out about the subclipse events as they happen during runtime. I believe I need to add (subscribe) my instance of the notify listener to the set of listeners that the Client Adapter will notify, but I am at a loss for how to get access to the Client Adapter that is being used by Subclipse at runtime. Is there a way to access it so that I can add my listener to the set?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
抱歉,不幸的是 Subclipse 尚未以这种方式进行编码以提供对内部的访问。 Subclipse 为需要在 Subversion 中进行的每个 API 调用构造一个新的 ISVNClientAdapter 对象,并根据需要动态地将其 ISVNNotifyListener 添加到该对象。所以你没有办法插入你自己的听众。
也许您可以编写一个实现 IConsoleListener 的类,并让它充当 Subclipse 类的代理。然后,您可以调用 SVNProviderPlugin.getConsoleListener 来获取当前控制台侦听器并将其引用存储在您的类中。然后调用 SVNProviderPlugin.setConsoleListener 将 Subclipse 中保存的类替换为您的类。当事件在您的类中触发时,您可以将它们转发到 Subclipse 类,并对代码中的事件执行任何您想要的操作。像这样的东西:
Sorry, but unfortunately Subclipse has not been coded in such a way to provide access to the internals. Subclipse constructs a new ISVNClientAdapter object for each API call it needs to make into Subversion and it adds its ISVNNotifyListener to this object on the fly as needed. So there is no way for you to interject your own listener.
Perhaps you could write a class that implements IConsoleListener and have it act as a proxy for the Subclipse class. You could then call SVNProviderPlugin.getConsoleListener to get the current console listener and store a reference to it in your class. Then call SVNProviderPlugin.setConsoleListener to replace the class held in Subclipse with your class. As the events are fired in your class, you could just forward them on to the Subclipse class and do whatever you want with the events in your code. Something like this: