本文介绍了如何检测IDE中的文件是否使用Open Tools API进行编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用访问ClearCase的Open Tools API制作了一个小型IDE插件。它具有菜单项签入,检出等。它可以正常工作,但是如果我开始在IDE编辑器中键入,或者我尝试保存文件,我希望它自动检出一个只读文件。你认为这是可能的吗?

I made a small IDE plug-in using Open Tools API that accesses ClearCase. It has menu items "Check In", "Check Out", etc. It works OK but I want it to check out a read-only file automatically if I start typing in IDE editor or if I attempt to save the file. Do you think this is possible?

我尝试了一些东西,但最终放弃了。 IOTAEditorServices.KeyboardServices有AddKeyboardBinding方法,看起来很有前途。使用它,我添加了一个通配符绑定类型btPartial(和以后尝试btComplete),插件开始检测一些快捷键,但不是所有的键盘事件,远离它...任何想法将不胜感激!

I tried a few things but gave up eventually. IOTAEditorServices.KeyboardServices has AddKeyboardBinding method which looked promising. Using it I added a notifier with binding type btPartial (and later tried btComplete) and the plug-in started detecting some shortcut key presses but not all keyboard events, far from it... Any ideas would be much appreciated!

推荐答案

我认为更清洁的方式是将每个编辑器的$ code> IOTAEditorNotifier 并且只要编辑器的内容被修改,无论是通过键盘,鼠标还是从另一个插件以编程方式,都可以使用IDE调用的 IOTAEditor.Modified 方法。

I think a "cleaner" way is to hook up a IOTAEditorNotifier to each editor and have your IOTAEditor.Modified method called by the IDE whenever the contents of the editor is modified, whether by keyboard, mouse or programmatically from another plugin.

是一个注册一个 IOTAIDENotifier 被通知在IDE中打开的文件,以便它可以注册其 IOTAEditorNotifier 实例。

Here's an example which registers an IOTAIDENotifier to be notified of files being opened in the IDE so it can register its IOTAEditorNotifier instances.

这篇关于如何检测IDE中的文件是否使用Open Tools API进行编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 00:24