发现与颠覆性 API 的冲突
我正在编写一个 Eclipse 插件来更新我的工作区中的一些项目。更新后可能会出现冲突。如果更新的项目中存在一些冲突,我想向用户显示一个对话框。
为了更新,我使用 UpdateOperation
,然后对更新后的项目执行 IResource.refreshLocal()。为了查找冲突,我使用 FileUtility.checkForResourcesPresenceRecursive(resources, IStateFilter.SF_CONFLICTING)
。还尝试了 IStateFilter.SF_CONTENT_CONFLICTING
和 IStateFilter.SF_TREE_CONFLICTING
。通常它们返回false
。
当我在调试模式下运行时,前两个返回 true
。这让我想到刷新后会触发一些事件,并且随着调试模式下时间的损失,Subversive 会了解它。我说得对吗?这是什么活动?它不是IResourceChangeEvent
。尝试监听 POST_CHANGED
但没有成功。
你有什么提示吗?谢谢。
I am writing an eclipse plug-in to update some projects in my workspace. After the update, there may be conflicts. I want to show a dialog to the user if there are some conflicts in the updated project(s).
To update, I use the UpdateOperation
, then I do a IResource.refreshLocal() on the updated project. To look for conflicts I use FileUtility.checkForResourcesPresenceRecursive(resources, IStateFilter.SF_CONFLICTING)
. Also tryed with IStateFilter.SF_CONTENT_CONFLICTING
and IStateFilter.SF_TREE_CONFLICTING
. Normally they return false
.
When I run in debug mode, the first two return true
. That brings me to think that there is some event that gets fired after the refresh and with the loss of time in debug mode, Subversive gets to know about it. Am I right ? What event is this ? It is not IResourceChangeEvent
. Tryed to listen for POST_CHANGED
with no luck.
Do you have a hint for me ? Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这比我预想的要容易。
UpdateOperation
(以及CommitOperation
和MergeOperation
)类扩展了AbstractConflictDetectionOperation
,提供了hasUnresolvedConflicts( )
方法。这就是窍门;)It was easier than I expected. The
UpdateOperation
(and also theCommitOperation
and theMergeOperation
) class extendsAbstractConflictDetectionOperation
that offers thehasUnresolvedConflicts()
method. That does the trick ;)