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?
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!
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.
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.
I must be possible somehow: we use SourceConexion (http://www.epocalipse.com/scx.htm) here, which auto checks-out the file before you edit the source or change the form.
JVCS has IDE integration support, it is open source, maybe they have implemented this too: http://jedivcs.sourceforge.net/
来源:https://stackoverflow.com/questions/908942/how-to-detect-if-file-in-ide-is-being-edited-using-open-tools-api