mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 19:39:17 +02:00
IDE: Move some code from TProjectUnitFileSelector to TRemoveFilesSelector.
This commit is contained in:
parent
0b023f20d7
commit
baa04bf91a
@ -194,7 +194,6 @@ type
|
|||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function SelectAndRun: TModalResult;
|
function SelectAndRun: TModalResult;
|
||||||
function RunOneUnit(AnUnitInfo: TUnitInfo): TModalResult;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TRemoveFilesSelector }
|
{ TRemoveFilesSelector }
|
||||||
@ -204,6 +203,7 @@ type
|
|||||||
function ActionForFiles: TModalResult; override;
|
function ActionForFiles: TModalResult; override;
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
|
function RunOneUnit(AnUnitInfo: TUnitInfo): TModalResult;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TRenameFilesSelector }
|
{ TRenameFilesSelector }
|
||||||
@ -1798,43 +1798,15 @@ end;
|
|||||||
|
|
||||||
function TProjectUnitFileSelector.SelectAndRun: TModalResult;
|
function TProjectUnitFileSelector.SelectAndRun: TModalResult;
|
||||||
begin
|
begin
|
||||||
Result:=Select;
|
Result:=Select; // Let the user select files in a dialog.
|
||||||
if Result<>mrOK then Exit;
|
if Result<>mrOK then Exit;
|
||||||
if Assigned(fUnitInfos) and (fUnitInfos.Count>0) then begin
|
if Assigned(fUnitInfos) and (fUnitInfos.Count>0) then begin
|
||||||
// check ToolStatus
|
// check ToolStatus
|
||||||
if (MainIDE.ToolStatus in [itCodeTools,itCodeToolAborting]) then begin
|
if (MainIDE.ToolStatus in [itCodeTools,itCodeToolAborting]) then begin
|
||||||
debugln('RemoveUnitsFromProject wrong ToolStatus ',dbgs(ord(MainIDE.ToolStatus)));
|
debugln('RemoveUnitsFromProject wrong ToolStatus ',dbgs(ord(MainIDE.ToolStatus)));
|
||||||
exit(mrOK);
|
exit;
|
||||||
end;
|
end;
|
||||||
// commit changes from source editor to codetools
|
|
||||||
//SaveEditorChangesToCodeCache(nil);
|
|
||||||
//Project1.BeginUpdate(true);
|
|
||||||
try
|
|
||||||
Result:=ActionForFiles;
|
Result:=ActionForFiles;
|
||||||
finally
|
|
||||||
// all changes were handled automatically by events, just clear the logs
|
|
||||||
//CodeToolBoss.SourceCache.ClearAllSourceLogEntries;
|
|
||||||
//Project1.EndUpdate;
|
|
||||||
end;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Result:=mrOk;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TProjectUnitFileSelector.RunOneUnit(AnUnitInfo: TUnitInfo): TModalResult;
|
|
||||||
begin
|
|
||||||
Assert(AnUnitInfo.IsPartOfProject, 'TProjectUnitFileSelector.RunOneUnit: '
|
|
||||||
+ AnUnitInfo.Unit_Name + ' is not part of project');
|
|
||||||
fUnitInfos:=TFPList.Create;
|
|
||||||
fUnitInfos.Add(AnUnitInfo);
|
|
||||||
// commit changes from source editor to codetools
|
|
||||||
SaveEditorChangesToCodeCache(nil);
|
|
||||||
Project1.BeginUpdate(true);
|
|
||||||
try
|
|
||||||
Result:=ActionForFiles;
|
|
||||||
finally
|
|
||||||
CodeToolBoss.SourceCache.ClearAllSourceLogEntries;
|
|
||||||
Project1.EndUpdate;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1857,6 +1829,10 @@ begin
|
|||||||
ObsoleteUnitPaths:='';
|
ObsoleteUnitPaths:='';
|
||||||
ObsoleteIncPaths:='';
|
ObsoleteIncPaths:='';
|
||||||
Assert(fUnitInfos.Count > 0, 'TRemoveFilesSelector.ActionForFiles: No files');
|
Assert(fUnitInfos.Count > 0, 'TRemoveFilesSelector.ActionForFiles: No files');
|
||||||
|
// commit changes from source editor to codetools
|
||||||
|
SaveEditorChangesToCodeCache(nil);
|
||||||
|
Project1.BeginUpdate(true);
|
||||||
|
try
|
||||||
for i:=0 to fUnitInfos.Count-1 do
|
for i:=0 to fUnitInfos.Count-1 do
|
||||||
begin
|
begin
|
||||||
AnUnitInfo:=TUnitInfo(fUnitInfos[i]);
|
AnUnitInfo:=TUnitInfo(fUnitInfos[i]);
|
||||||
@ -1915,6 +1891,28 @@ begin
|
|||||||
// or paths of ObsoleteIncPaths
|
// or paths of ObsoleteIncPaths
|
||||||
if ObsoleteIncPaths<>'' then
|
if ObsoleteIncPaths<>'' then
|
||||||
RemovePathFromBuildModes(ObsoleteIncPaths, pcosIncludePath);
|
RemovePathFromBuildModes(ObsoleteIncPaths, pcosIncludePath);
|
||||||
|
finally
|
||||||
|
// all changes were handled automatically by events, just clear the logs
|
||||||
|
CodeToolBoss.SourceCache.ClearAllSourceLogEntries;
|
||||||
|
Project1.EndUpdate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TRemoveFilesSelector.RunOneUnit(AnUnitInfo: TUnitInfo): TModalResult;
|
||||||
|
begin
|
||||||
|
Assert(AnUnitInfo.IsPartOfProject, 'TRemoveFilesSelector.RunOneUnit: '
|
||||||
|
+ AnUnitInfo.Unit_Name + ' is not part of project');
|
||||||
|
fUnitInfos:=TFPList.Create;
|
||||||
|
fUnitInfos.Add(AnUnitInfo);
|
||||||
|
// commit changes from source editor to codetools
|
||||||
|
SaveEditorChangesToCodeCache(nil);
|
||||||
|
Project1.BeginUpdate(true);
|
||||||
|
try
|
||||||
|
Result:=ActionForFiles;
|
||||||
|
finally
|
||||||
|
CodeToolBoss.SourceCache.ClearAllSourceLogEntries;
|
||||||
|
Project1.EndUpdate;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TRenameFilesSelector }
|
{ TRenameFilesSelector }
|
||||||
|
Loading…
Reference in New Issue
Block a user