IDE, OI: method propety editor: show inherited method without classname, treader does not support choosing the inherited

git-svn-id: branches/fixes_1_8@55203 -
This commit is contained in:
mattias 2017-06-04 07:11:00 +00:00
parent 6fb7b33f8e
commit c70e25128b

View File

@ -1860,8 +1860,8 @@ begin
LookupRoot:=GetLookupRootForComponent(TComponent(PropOwner)); LookupRoot:=GetLookupRootForComponent(TComponent(PropOwner));
if LookupRoot is TComponent then begin if LookupRoot is TComponent then begin
//DebugLn(['TMainIDE.OnPropHookGetMethodName ',Result,' GlobalDesignHook.LookupRoot=',dbgsName(GlobalDesignHook.LookupRoot),' JITMethod.TheClass=',dbgsName(JITMethod.TheClass),' PropOwner=',DbgSName(PropOwner),' PropOwner-LookupRoot=',DbgSName(LookupRoot)]); //DebugLn(['TMainIDE.OnPropHookGetMethodName ',Result,' GlobalDesignHook.LookupRoot=',dbgsName(GlobalDesignHook.LookupRoot),' JITMethod.TheClass=',dbgsName(JITMethod.TheClass),' PropOwner=',DbgSName(PropOwner),' PropOwner-LookupRoot=',DbgSName(LookupRoot)]);
if (LookupRoot.ClassType<>JITMethod.TheClass) if (LookupRoot<>OrigLookupRoot)
or (LookupRoot<>OrigLookupRoot) then or (not LookupRoot.InheritsFrom(JITMethod.TheClass)) then
Result:=JITMethod.TheClass.ClassName+'.'+Result; Result:=JITMethod.TheClass.ClassName+'.'+Result;
end; end;
end; end;
@ -1881,9 +1881,8 @@ begin
ActiveSrcEdit:=nil; ActiveSrcEdit:=nil;
if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[ctfSwitchToFormSource]) if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[ctfSwitchToFormSource])
then exit; then exit;
{$IFDEF IDE_DEBUG} {$IFDEF VerboseMethodPropEdit}
DebugLn(''); debugln(['TMainIDE.PropHookGetMethods ',ExtractFilename(ActiveUnitInfo.Filename),' Component=',ActiveUnitInfo.Component.ClassName]);
DebugLn('[TMainIDE.OnPropHookGetMethods] ************');
{$ENDIF} {$ENDIF}
if not CodeToolBoss.GetCompatiblePublishedMethods(ActiveUnitInfo.Source, if not CodeToolBoss.GetCompatiblePublishedMethods(ActiveUnitInfo.Source,
ActiveUnitInfo.Component.ClassName,TypeData,Proc) then ActiveUnitInfo.Component.ClassName,TypeData,Proc) then
@ -1902,9 +1901,8 @@ begin
ActiveSrcEdit:=nil; ActiveSrcEdit:=nil;
if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[ctfSwitchToFormSource]) if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[ctfSwitchToFormSource])
then exit; then exit;
{$IFDEF IDE_DEBUG} {$IFDEF VerboseMethodPropEdit}
DebugLn(''); debugln(['TMainIDE.PropHookGetCompatibleMethods ',ExtractFilename(ActiveUnitInfo.Filename),' Component=',ActiveUnitInfo.Component.ClassName,' InstProp=',DbgSName(InstProp^.Instance),'.',InstProp^.PropInfo^.Name]);
DebugLn('[TMainIDE.OnPropHookGetCompatibleMethods] ************');
{$ENDIF} {$ENDIF}
if FormEditor1.ComponentUsesRTTIForMethods(ActiveUnitInfo.Component) then begin if FormEditor1.ComponentUsesRTTIForMethods(ActiveUnitInfo.Component) then begin
CTResult:=CodeToolBoss.GetCompatiblePublishedMethods(ActiveUnitInfo.Source, CTResult:=CodeToolBoss.GetCompatiblePublishedMethods(ActiveUnitInfo.Source,
@ -1929,9 +1927,8 @@ begin
ActiveSrcEdit:=nil; ActiveSrcEdit:=nil;
if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[ctfSwitchToFormSource]) then if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[ctfSwitchToFormSource]) then
Exit(False); Exit(False);
{$IFDEF IDE_DEBUG} {$IFDEF VerboseMethodPropEdit}
debugln(''); debugln(['TMainIDE.PropHookGetCompatibleMethods ',ExtractFilename(ActiveUnitInfo.Filename),' Component=',ActiveUnitInfo.Component.ClassName,' MethodName="',AMethodName,'" InstProp=',DbgSName(InstProp^.Instance),'.',InstProp^.PropInfo^.Name]);
debugln('[TMainIDE.OnPropHookCompatibleMethodExists] ************ ',AMethodName);
{$ENDIF} {$ENDIF}
if FormEditor1.ComponentUsesRTTIForMethods(ActiveUnitInfo.Component) then begin if FormEditor1.ComponentUsesRTTIForMethods(ActiveUnitInfo.Component) then begin
Result := CodeToolBoss.PublishedMethodExists(ActiveUnitInfo.Source, Result := CodeToolBoss.PublishedMethodExists(ActiveUnitInfo.Source,
@ -12475,9 +12472,8 @@ begin
ActiveSrcEdit:=nil; ActiveSrcEdit:=nil;
if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[ctfSwitchToFormSource]) then if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[ctfSwitchToFormSource]) then
Exit(False); Exit(False);
{$IFDEF IDE_DEBUG} {$IFDEF VerboseMethodPropEdit}
debugln(''); debugln(['TMainIDE.PropHookGetCompatibleMethods ',ExtractFilename(ActiveUnitInfo.Filename),' Component=',ActiveUnitInfo.Component.ClassName,' MethodName="',AMethodName,'"']);
debugln('[TMainIDE.OnPropHookMethodExists] ************ ',AMethodName);
{$ENDIF} {$ENDIF}
Result := CodeToolBoss.PublishedMethodExists(ActiveUnitInfo.Source, Result := CodeToolBoss.PublishedMethodExists(ActiveUnitInfo.Source,
ActiveUnitInfo.Component.ClassName, AMethodName, TypeData, ActiveUnitInfo.Component.ClassName, AMethodName, TypeData,
@ -12499,7 +12495,11 @@ function TMainIDE.PropHookCreateMethod(const AMethodName: ShortString;
APropertyPath = Form1.Button1.OnClick APropertyPath = Form1.Button1.OnClick
ATypeInfo = the typeinfo of the event property ATypeInfo = the typeinfo of the event property
} }
{$IFDEF VerboseMethodPropEdit}
{$DEFINE VerboseOnPropHookCreateMethod} {$DEFINE VerboseOnPropHookCreateMethod}
{$ELSE}
{ $DEFINE VerboseOnPropHookCreateMethod}
{$ENDIF}
var var
ActiveSrcEdit: TSourceEditor; ActiveSrcEdit: TSourceEditor;
ActiveUnitInfo: TUnitInfo; ActiveUnitInfo: TUnitInfo;
@ -12659,6 +12659,9 @@ var
AClassName, AnInheritedClassName: string; AClassName, AnInheritedClassName: string;
CurMethodName, AInheritedMethodName: string; CurMethodName, AInheritedMethodName: string;
begin begin
{$IFDEF VerboseMethodPropEdit}
debugln(['TMainIDE.PropHookShowMethod AMethodName="',AMethodName,'"']);
{$ENDIF}
if IsValidIdentPair(AMethodName, AnInheritedClassName, AInheritedMethodName) then if IsValidIdentPair(AMethodName, AnInheritedClassName, AInheritedMethodName) then
begin begin
ActiveSrcEdit:=nil; ActiveSrcEdit:=nil;
@ -12679,8 +12682,10 @@ begin
AClassName:=ActiveUnitInfo.Component.ClassName; AClassName:=ActiveUnitInfo.Component.ClassName;
CurMethodName:=AMethodName; CurMethodName:=AMethodName;
end; end;
//DebugLn('[TMainIDE.OnPropHookShowMethod] MethodName=',AMethodName,', ClassName=',AClassName, {$IFDEF VerboseMethodPropEdit}
// ', CurMethodName=',CurMethodName,', ActiveUnit=',ActiveUnitInfo.Filename); DebugLn('[TMainIDE.OnPropHookShowMethod] MethodName=',AMethodName,', ClassName=',AClassName,
', CurMethodName=',CurMethodName,', ActiveUnit=',ExtractFilename(ActiveUnitInfo.Filename));
{$ENDIF}
if CodeToolBoss.JumpToPublishedMethodBody(ActiveUnitInfo.Source, if CodeToolBoss.JumpToPublishedMethodBody(ActiveUnitInfo.Source,
AClassName, CurMethodName, NewSource, NewX, NewY, NewTopLine) then AClassName, CurMethodName, NewSource, NewX, NewY, NewTopLine) then
begin begin
@ -12705,9 +12710,8 @@ begin
ActiveSrcEdit:=nil; ActiveSrcEdit:=nil;
if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[ctfSwitchToFormSource]) if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[ctfSwitchToFormSource])
then exit; then exit;
{$IFDEF IDE_DEBUG} {$IFDEF VerboseMethodPropEdit}
debugln(''); debugln(['TMainIDE.PropHookShowMethod CurName="',CurName,'" NewName="',NewName,'"']);
debugln('[TMainIDE.OnPropHookRenameMethod] ************');
{$ENDIF} {$ENDIF}
OldChange:=OpenEditorsOnCodeToolChange; OldChange:=OpenEditorsOnCodeToolChange;
OpenEditorsOnCodeToolChange:=true; OpenEditorsOnCodeToolChange:=true;
@ -12715,9 +12719,8 @@ begin
// rename/create published method // rename/create published method
BossResult:=CodeToolBoss.RenamePublishedMethod(ActiveUnitInfo.Source, BossResult:=CodeToolBoss.RenamePublishedMethod(ActiveUnitInfo.Source,
ActiveUnitInfo.Component.ClassName,CurName,NewName); ActiveUnitInfo.Component.ClassName,CurName,NewName);
{$IFDEF IDE_DEBUG} {$IFDEF VerboseMethodPropEdit}
debugln(''); debugln(['TMainIDE.PropHookShowMethod CurName="',CurName,'" NewName="',NewName,'" Result=',BossResult]);
debugln('[TMainIDE.OnPropHookRenameMethod] ************2 ');
{$ENDIF} {$ENDIF}
ApplyCodeToolChanges; ApplyCodeToolChanges;
if BossResult then begin if BossResult then begin