mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 16:59:20 +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';
|
lisSetValue = 'Set value';
|
||||||
lisCreateFunction = 'Create function';
|
lisCreateFunction = 'Create function';
|
||||||
lisResult2 = 'Result:';
|
lisResult2 = 'Result:';
|
||||||
|
lisTheIdentifierIsAUnitPleaseUseTheFileSaveAsFunction = 'The identifier is '
|
||||||
|
+'a unit. Please use the File - Save as function to rename a unit.';
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
@ -12545,6 +12545,7 @@ var
|
|||||||
Identifier: string;
|
Identifier: string;
|
||||||
PascalReferences: TAVLTree;
|
PascalReferences: TAVLTree;
|
||||||
ListOfLazFPDocNode: TFPList;
|
ListOfLazFPDocNode: TFPList;
|
||||||
|
CurUnitname: String;
|
||||||
begin
|
begin
|
||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
if not BeginCodeTool(TargetSrcEdit,TargetUnitInfo,[]) then exit;
|
if not BeginCodeTool(TargetSrcEdit,TargetUnitInfo,[]) then exit;
|
||||||
@ -12561,6 +12562,14 @@ begin
|
|||||||
DoJumpToCodePos(TargetSrcEdit, TargetUnitInfo,
|
DoJumpToCodePos(TargetSrcEdit, TargetUnitInfo,
|
||||||
NewSource, NewX, NewY, NewTopLine, true);
|
NewSource, NewX, NewY, NewTopLine, true);
|
||||||
CodeToolBoss.GetIdentifierAt(NewSource,NewX,NewY,Identifier);
|
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);
|
GetCurrentUnit(DeclarationSrcEdit,DeclarationUnitInfo);
|
||||||
DeclarationCaretXY:=DeclarationSrcEdit.EditorComponent.LogicalCaretXY;
|
DeclarationCaretXY:=DeclarationSrcEdit.EditorComponent.LogicalCaretXY;
|
||||||
|
Loading…
Reference in New Issue
Block a user