codetools: reparsing source on searching for a published method body

git-svn-id: trunk@10295 -
This commit is contained in:
mattias 2006-12-04 17:08:44 +00:00
parent 421ec5b6aa
commit b8a4c2ed02
2 changed files with 28 additions and 22 deletions

View File

@ -540,26 +540,32 @@ var
SrcClassName: String;
begin
Result:=false;
ClassNode:=FindClassNodeInInterface(UpperClassName,true,false,true);
AFindContext:=FindPublishedMethodNodeInClass(ClassNode,UpperMethodName,true);
if AFindContext.Node=nil then begin
DebugLn(['TEventsCodeTool.JumpToPublishedMethodBody method not found: ',UpperClassName,'.',UpperMethodName]);
exit;
ActivateGlobalWriteLock;
try
BuildTree(false);
ClassNode:=FindClassNodeInInterface(UpperClassName,true,false,true);
AFindContext:=FindPublishedMethodNodeInClass(ClassNode,UpperMethodName,true);
if AFindContext.Node=nil then begin
DebugLn(['TEventsCodeTool.JumpToPublishedMethodBody method not found: ',UpperClassName,'.',UpperMethodName]);
exit;
end;
SrcTool:=TEventsCodeTool(AFindContext.Tool);
ClassNode:=AFindContext.Node.Parent.Parent;
if ClassNode.Desc<>ctnClass then begin
DebugLn(['TEventsCodeTool.JumpToPublishedMethodBody method found in non class',UpperClassName,'.',UpperMethodName,' in ',SrcTool.MainFilename,' Node=',ClassNode.DescAsString]);
exit;
end;
SrcClassName:=SrcTool.ExtractClassName(ClassNode,true);
ANode:=SrcTool.FindMethodNodeInImplementation(
SrcClassName,UpperMethodName,true);
if ANode=nil then begin
DebugLn(['TEventsCodeTool.JumpToPublishedMethodBody method not found ',SrcClassName,'.',UpperMethodName,' in ',SrcTool.MainFilename]);
exit;
end;
Result:=SrcTool.FindJumpPointInProcNode(ANode,NewPos,NewTopLine);
finally
DeactivateGlobalWriteLock;
end;
SrcTool:=TEventsCodeTool(AFindContext.Tool);
ClassNode:=AFindContext.Node.Parent.Parent;
if ClassNode.Desc<>ctnClass then begin
DebugLn(['TEventsCodeTool.JumpToPublishedMethodBody method found in non class',UpperClassName,'.',UpperMethodName,' in ',SrcTool.MainFilename,' Node=',ClassNode.DescAsString]);
exit;
end;
SrcClassName:=SrcTool.ExtractClassName(ClassNode,true);
ANode:=SrcTool.FindMethodNodeInImplementation(
SrcClassName,UpperMethodName,true);
if ANode=nil then begin
DebugLn(['TEventsCodeTool.JumpToPublishedMethodBody method not found ',SrcClassName,'.',UpperMethodName,' in ',SrcTool.MainFilename]);
exit;
end;
Result:=SrcTool.FindJumpPointInProcNode(ANode,NewPos,NewTopLine);
end;
function TEventsCodeTool.RenamePublishedMethod(const UpperClassName,

View File

@ -3742,10 +3742,10 @@ begin
raise EPropertyError.Create('Method name must be an identifier'{@SCannotCreateName});
exit;
end;
SetValue(FormMethodName);
SetValue(FormMethodName); // this will jump to the method
PropertyHook.RefreshPropertyValues;
end;
PropertyHook.ShowMethod(FormMethodName);
end else
PropertyHook.ShowMethod(FormMethodName);
end;
function TMethodPropertyEditor.GetAttributes: TPropertyAttributes;