mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 22:49:30 +02:00
IDE: rename identifier: check if renaming a unit
git-svn-id: trunk@19207 -
This commit is contained in:
parent
0a2aa05286
commit
f940e202a0
@ -4074,6 +4074,8 @@ resourcestring
|
||||
lisSetValue = 'Set value';
|
||||
lisCreateFunction = 'Create function';
|
||||
lisResult2 = 'Result:';
|
||||
lisTheIdentifierIsAUnitPleaseUseTheFileSaveAsFunction = 'The identifier is '
|
||||
+'a unit. Please use the File - Save as function to rename a unit.';
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -12545,6 +12545,7 @@ var
|
||||
Identifier: string;
|
||||
PascalReferences: TAVLTree;
|
||||
ListOfLazFPDocNode: TFPList;
|
||||
CurUnitname: String;
|
||||
begin
|
||||
Result:=mrCancel;
|
||||
if not BeginCodeTool(TargetSrcEdit,TargetUnitInfo,[]) then exit;
|
||||
@ -12561,6 +12562,14 @@ begin
|
||||
DoJumpToCodePos(TargetSrcEdit, TargetUnitInfo,
|
||||
NewSource, NewX, NewY, NewTopLine, true);
|
||||
CodeToolBoss.GetIdentifierAt(NewSource,NewX,NewY,Identifier);
|
||||
CurUnitname:=ExtractFileNameOnly(NewSource.Filename);
|
||||
if CompareIdentifiers(PChar(Identifier),PChar(CurUnitName))=0 then
|
||||
begin
|
||||
IDEMessageDialog(srkmecRenameIdentifier,
|
||||
lisTheIdentifierIsAUnitPleaseUseTheFileSaveAsFunction,
|
||||
mtInformation,[mbCancel],'');
|
||||
exit(mrCancel);
|
||||
end;
|
||||
|
||||
GetCurrentUnit(DeclarationSrcEdit,DeclarationUnitInfo);
|
||||
DeclarationCaretXY:=DeclarationSrcEdit.EditorComponent.LogicalCaretXY;
|
||||
|
Loading…
Reference in New Issue
Block a user