implemented FindDeclarationOfOIProperty path for child components

git-svn-id: trunk@8936 -
This commit is contained in:
mattias 2006-03-13 22:35:50 +00:00
parent 60115fa7ed
commit c4aef17fa9
2 changed files with 17 additions and 5 deletions

View File

@ -1387,7 +1387,7 @@ var
Context: TFindContext; Context: TFindContext;
begin begin
Result:=false; Result:=false;
//DebugLn('TFindDeclarationTool.FindDeclarationOfPropertyPath PropertyPath="',PropertyPath,'"'); DebugLn('TFindDeclarationTool.FindDeclarationOfPropertyPath PropertyPath="',PropertyPath,'"');
if PropertyPath='' then exit; if PropertyPath='' then exit;
BuildTree(false); BuildTree(false);
@ -1404,13 +1404,13 @@ begin
try try
// then search the properties // then search the properties
repeat repeat
//DebugLn('TFindDeclarationTool.FindDeclarationOfPropertyPath ',Context.Node.DescAsString); DebugLn('TFindDeclarationTool.FindDeclarationOfPropertyPath ',Context.Node.DescAsString);
if (not (Context.Node.Desc in [ctnClass,ctnClassInterface,ctnRecordType])) if (not (Context.Node.Desc in [ctnClass,ctnClassInterface,ctnRecordType]))
then then
exit; exit;
Params.Flags:=[fdfExceptionOnNotFound,fdfSearchInAncestors]; Params.Flags:=[fdfExceptionOnNotFound,fdfSearchInAncestors];
Identifier:=GetNextIdentifier; Identifier:=GetNextIdentifier;
//DebugLn('TFindDeclarationTool.FindDeclarationOfPropertyPath Identifier="',identifier,'"'); DebugLn('TFindDeclarationTool.FindDeclarationOfPropertyPath Identifier="',identifier,'"');
if Identifier='' then exit; if Identifier='' then exit;
Params.SetIdentifier(Self,PChar(Identifier),nil); Params.SetIdentifier(Self,PChar(Identifier),nil);
Params.ContextNode:=Context.Node; Params.ContextNode:=Context.Node;

View File

@ -199,6 +199,7 @@ var
AFile: TLazProjectFile; AFile: TLazProjectFile;
NewCode: TCodeBuffer; NewCode: TCodeBuffer;
NewX, NewY: integer; NewX, NewY: integer;
APersistent: TPersistent;
begin begin
Result:=false; Result:=false;
Code:=nil; Code:=nil;
@ -236,9 +237,20 @@ begin
if LoadCodeBuffer(Code,AFile.Filename,[])<>mrOk then begin if LoadCodeBuffer(Code,AFile.Filename,[])<>mrOk then begin
exit; exit;
end; end;
if Row.Editor=nil then begin
DebugLn('FindDeclarationOfOIProperty Row.Editor=nil');
exit;
end;
// create the property search path // create the property search path
PropPath:=LookupRoot.ClassName+'.'+ APersistent:=Row.Editor.GetComponent(0);
AnInspector.GetActivePropertyGrid.PropertyPath(Row); if APersistent=nil then begin
DebugLn('FindDeclarationOfOIProperty APersistent=nil');
exit;
end;
PropPath:=AnInspector.GetActivePropertyGrid.PropertyPath(Row);
if APersistent is TComponent then
PropPath:=TComponent(APersistent).Name+'.'+PropPath;
PropPath:=LookupRoot.ClassName+'.'+PropPath;
// find the property declaration // find the property declaration
if not CodeToolBoss.FindDeclarationOfPropertyPath(Code,PropPath,NewCode, if not CodeToolBoss.FindDeclarationOfPropertyPath(Code,PropPath,NewCode,
NewX,NewY,NewTopLine) then NewX,NewY,NewTopLine) then