IDE: A minor optimization for getting ecFindDeclaration command. Formatting.

git-svn-id: trunk@56365 -
This commit is contained in:
juha 2017-11-11 16:06:27 +00:00
parent b0701b8534
commit 24ea33059c

View File

@ -3635,6 +3635,7 @@ var
IdentFound, StringFound: Boolean; IdentFound, StringFound: Boolean;
ActiveDesigner: TComponentEditorDesigner; ActiveDesigner: TComponentEditorDesigner;
CurWordAtCursor: string; CurWordAtCursor: string;
FindDeclarationCmd: TIDECommand;
begin begin
GetCurrentUnit(ASrcEdit, AnUnitInfo); GetCurrentUnit(ASrcEdit, AnUnitInfo);
ActiveDesigner := GetActiveDesignerSkipMainBar; ActiveDesigner := GetActiveDesignerSkipMainBar;
@ -3731,13 +3732,12 @@ begin
IDECommandList.FindIDECommand(ecShowAbstractMethods).Enabled := Editable; IDECommandList.FindIDECommand(ecShowAbstractMethods).Enabled := Editable;
IDECommandList.FindIDECommand(ecRemoveEmptyMethods).Enabled := Editable; IDECommandList.FindIDECommand(ecRemoveEmptyMethods).Enabled := Editable;
IDECommandList.FindIDECommand(ecFindDeclaration).Enabled := CurWordAtCursor<>''; FindDeclarationCmd := IDECommandList.FindIDECommand(ecFindDeclaration);
FindDeclarationCmd.Enabled := CurWordAtCursor<>'';
if CurWordAtCursor<>'' then if CurWordAtCursor<>'' then
IDECommandList.FindIDECommand(ecFindDeclaration).Caption := FindDeclarationCmd.Caption := Format(lisFindDeclarationOf, [CurWordAtCursor])
Format(lisFindDeclarationOf, [CurWordAtCursor])
else else
IDECommandList.FindIDECommand(ecFindDeclaration).Caption := FindDeclarationCmd.Caption := uemFindDeclaration;
uemFindDeclaration;
end; end;
procedure TMainIDE.UpdateEditorTabCommands(Sender: TObject); procedure TMainIDE.UpdateEditorTabCommands(Sender: TObject);
@ -9895,12 +9895,14 @@ begin
NewX,NewY,BodySource,BodyX,BodyY,BodyTopLine,BlockTopLine,BlockBottomLine,RevertableJump)) NewX,NewY,BodySource,BodyX,BodyY,BodyTopLine,BlockTopLine,BlockBottomLine,RevertableJump))
then then
JumpToBodySuccess := DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo, JumpToBodySuccess := DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo,
BodySource, BodyX, BodyY, BodyTopLine, BlockTopLine, BlockBottomLine, [jfAddJumpPoint, jfFocusEditor]) = mrOK; BodySource, BodyX, BodyY, BodyTopLine, BlockTopLine, BlockBottomLine,
[jfAddJumpPoint, jfFocusEditor]) = mrOK;
end; end;
end; end;
if not JumpToBodySuccess then if not JumpToBodySuccess then
DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo, DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo,
NewSource, NewX, NewY, NewTopLine, BlockTopLine, BlockBottomLine, [jfAddJumpPoint, jfFocusEditor]); NewSource, NewX, NewY, NewTopLine, BlockTopLine, BlockBottomLine,
[jfAddJumpPoint, jfFocusEditor]);
end else begin end else begin
DoJumpToCodeToolBossError; DoJumpToCodeToolBossError;
end; end;