codetools: TSourceChangeCache.Begin/EndUpdate comments and clean up

git-svn-id: trunk@41626 -
This commit is contained in:
mattias 2013-06-09 11:25:13 +00:00
parent c6f791deab
commit 945a988824
3 changed files with 8 additions and 8 deletions

View File

@ -292,7 +292,7 @@ type
// source changing
procedure BeginUpdate;
procedure EndUpdate;
function EndUpdate: boolean;
function GatherExternalChanges: boolean;
property OnGatherExternalChanges: TOnGatherExternalChanges
read FOnGatherExternalChanges write FOnGatherExternalChanges;
@ -1123,9 +1123,9 @@ begin
SourceChangeCache.BeginUpdate;
end;
procedure TCodeToolManager.EndUpdate;
function TCodeToolManager.EndUpdate: boolean;
begin
SourceChangeCache.EndUpdate;
Result:=SourceChangeCache.EndUpdate;
end;
function TCodeToolManager.GatherExternalChanges: boolean;

View File

@ -251,8 +251,8 @@ type
procedure RaiseException(const AMessage: string);
public
BeautifyCodeOptions: TBeautifyCodeOptions;
procedure BeginUpdate;
function EndUpdate: boolean;
procedure BeginUpdate; // use this to delay Apply, must be balanced with EndUpdate
function EndUpdate: boolean; // calls Apply
property MainScanner: TLinkScanner read FMainScanner write SetMainScanner;
property MainScannerNeeded: boolean read FMainScannerNeeded;
function Replace(FrontGap, AfterGap: TGapTyp; FromPos, ToPos: integer;
@ -1166,7 +1166,7 @@ begin
Result:=true;
if FUpdateLock<=0 then exit;
dec(FUpdateLock);
if FUpdateLock<=0 then
if (FUpdateLock<=0) then
Result:=Apply;
end;

View File

@ -1020,13 +1020,13 @@ begin
NewUsesTerm:=NewUsesTerm+';';
if not SourceChangeCache.Replace(gtEmptyLine,gtEmptyLine,InsertPos,InsertPos,
NewUsesTerm) then exit;
//if not SourceChangeCache.Apply then exit; <- has no effect when FUpdateLock>0
end;
Result:=true;
finally
if not Result then
SourceChangeCache.Clear;
SourceChangeCache.EndUpdate;
if not SourceChangeCache.EndUpdate then
Result:=false;
end;
end;