I'd like to automatically checkout a file when I start to edit it in Delphi 7 IDE.
ClearCase is my version control system and I really hate the need to checkout a file before starting to edit. It always breaks my thought flow: I'm trying to solve a problem, find where I need to change, try to edit it, fail because the file is read only, open clearcase, search the file, finally checkout, try to edit the file again, fail because the IDE still thinks it is readonly, tell the IDE that isn't readonly. When I finally go back to code, I forgot what I was trying do do.
I've found this nice and simple ClearCase IDE integration code. It works, but uses the deprecated ToolIntf unit. I've added a couple of shortcuts. Here is a simplified version of it (didn't try to compile):
unit clearcase;
interface
uses ToolsApi, ToolIntf;
implementation
uses
Windows, Dialogs, Classes, ExptIntf, Menus, ShellApi, SysUtils;
type
TDelphiClearcase = class
private
FClearcaseMenu,
FDoCheckOutPasDfm,
FDoCheckInPasDfm : TIMenuItemIntf;
procedure ExecCommand(const command: string; path: PChar = nil);
public
destructor Destroy;override;
procedure DoClick(Sender: TIMenuItemIntf);
property ClearcaseMenu: TIMenuItemIntf read FClearcaseMenu write FClearcaseMenu;
property DoCheckOutPasDfm:TIMenuItemIntf write FDoCheckOutPasDfm;
property DoCheckInPasDfm: TIMenuItemIntf write FDoCheckInPasDfm;
end;
var
dcc: TDelphiClearcase = nil;
{ TDelphiClearcase }
destructor TDelphiClearcase.Destroy;
procedure Remove(item: TIMenuItemIntf);
begin
if( item = nil )then
Exit;
item.DestroyMenuItem;
FreeAndNil(item);
end;
begin
Remove(FDoCheckOutPasDfm);
Remove(FDoCheckInPasDfm);
inherited;
end;
procedure TDelphiClearcase.DoClick(Sender: TIMenuItemIntf);
function GetPasDfm(const f: string): string;
var
aux: