6

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!

stukelly
  • 4,257
  • 3
  • 37
  • 44
  • Did you solve your problem? I'd love to see your code. I've just asked a similar question: http://stackoverflow.com/questions/6670621/how-to-hook-a-method-to-the-edit-event-in-delphi-7-ide – neves Jul 28 '11 at 21:18
  • @neves: You'd better focus on [TOndrej](http://stackoverflow.com/users/11480/tondrej)'s [answser](http://stackoverflow.com/a/909485/744588) below. Presumably, `user112365` is no more alive and kicking on SO. – menjaraz Jan 07 '12 at 10:18

2 Answers2

8

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.

Ondrej Kelle
  • 36,941
  • 2
  • 65
  • 128
  • Thanks a lot. Sounds like this should work. I'll give it a try and let you know later, most likely on Friday. –  May 27 '09 at 05:49
  • @user112365 Did you ever figure this out? I tried this but the problem is that Read-Only files cannot be modified. So the IOTAEditor.Modified is never fired. – santiagoIT Aug 11 '16 at 20:18
  • @santiagoIT I think you can remove the read-only flag from the edit buffer even if the file itself is read-only. – Ondrej Kelle Aug 11 '16 at 22:27
1

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/

André
  • 8,920
  • 1
  • 24
  • 24