IDE: fixed fake methods, bug #12248

git-svn-id: trunk@17214 -
This commit is contained in:
mattias 2008-11-04 10:42:43 +00:00
parent 560c617ebf
commit 710f2aa2d1
2 changed files with 13 additions and 21 deletions

View File

@ -392,7 +392,7 @@ type
procedure OIOnFindDeclarationOfProperty(Sender: TObject);
procedure OIOnUpdateRestricted(Sender: TObject);
function OnPropHookGetMethodName(const Method: TMethod;
CheckOwner: TObject): String;
PropOwner: TObject): String;
procedure OnPropHookGetMethods(TypeData: PTypeData; Proc:TGetStringProc);
function OnPropHookMethodExists(const AMethodName: String;
TypeData: PTypeData;
@ -1386,27 +1386,23 @@ begin
end;
function TMainIDE.OnPropHookGetMethodName(const Method: TMethod;
CheckOwner: TObject): String;
PropOwner: TObject): String;
var
JITMethod: TJITMethod;
LookupRoot: TPersistent;
begin
if Method.Code<>nil then begin
if Method.Data<>nil then begin
if (CheckOwner<>nil) and (TObject(Method.Data)<>CheckOwner) then
Result:=''
else begin
Result:=TObject(Method.Data).MethodName(Method.Code);
if Result='' then
Result:='<Unpublished>';
end;
Result:=TObject(Method.Data).MethodName(Method.Code);
if Result='' then
Result:='<Unpublished>';
end else
Result:='<No LookupRoot>';
end else if IsJITMethod(Method) then begin
JITMethod:=TJITMethod(Method.Data);
Result:=JITMethod.TheMethodName;
if CheckOwner is TComponent then begin
LookupRoot:=GetLookupRootForComponent(TComponent(CheckOwner));
if PropOwner is TComponent then begin
LookupRoot:=GetLookupRootForComponent(TComponent(PropOwner));
if LookupRoot is TComponent then begin
//DebugLn(['TMainIDE.OnPropHookGetMethodName ',dbgsName(GlobalDesignHook.LookupRoot),' ',dbgsName(JITMethod.TheClass)]);
if (LookupRoot.ClassType<>JITMethod.TheClass) then begin

View File

@ -1241,7 +1241,7 @@ type
function CreateMethod(const Name: ShortString; ATypeInfo:PTypeInfo;
APersistent: TPersistent;
const APropertyPath: string): TMethod;
function GetMethodName(const Method: TMethod; CheckOwner: TObject): String;
function GetMethodName(const Method: TMethod; PropOwner: TObject): String;
procedure GetMethods(TypeData: PTypeData; Proc: TGetStringProc);
function MethodExists(const Name: String; TypeData: PTypeData;
var MethodIsCompatible,MethodIsPublished,IdentIsMethod: boolean):boolean;
@ -5432,24 +5432,20 @@ begin
end;
function TPropertyEditorHook.GetMethodName(const Method: TMethod;
CheckOwner: TObject): String;
PropOwner: TObject): String;
var
i: Integer;
begin
i:=GetHandlerCount(htGetMethodName);
if GetNextHandlerIndex(htGetMethodName,i) then begin
Result:=TPropHookGetMethodName(FHandlers[htGetMethodName][i])(Method,CheckOwner);
Result:=TPropHookGetMethodName(FHandlers[htGetMethodName][i])(Method,PropOwner);
end else begin
// search the method name with the given code pointer
if Assigned(Method.Code) then begin
if Method.Data<>nil then begin
if (CheckOwner<>nil) and (TObject(Method.Data)<>CheckOwner) then
Result:=''
else begin
Result:=TObject(Method.Data).MethodName(Method.Code);
if Result='' then
Result:='<Unpublished>';
end;
Result:=TObject(Method.Data).MethodName(Method.Code);
if Result='' then
Result:='<Unpublished>';
end else
Result:='<No LookupRoot>';
end else