codetools: ctnClassInterface: do not add visibility nodes

git-svn-id: trunk@29355 -
This commit is contained in:
mattias 2011-02-03 18:06:02 +00:00
parent 4e5d44a9de
commit 9d8f487e25
4 changed files with 28 additions and 16 deletions

View File

@ -241,6 +241,7 @@ type
function HasAsRoot(RootNode: TCodeTreeNode): boolean; function HasAsRoot(RootNode: TCodeTreeNode): boolean;
function GetNodeOfType(ADesc: TCodeTreeNodeDesc): TCodeTreeNode; function GetNodeOfType(ADesc: TCodeTreeNodeDesc): TCodeTreeNode;
function GetNodeOfTypes(Descriptors: array of TCodeTreeNodeDesc): TCodeTreeNode; function GetNodeOfTypes(Descriptors: array of TCodeTreeNodeDesc): TCodeTreeNode;
function GetTopMostNodeOfType(ADesc: TCodeTreeNodeDesc): TCodeTreeNode;
function GetFindContextParent: TCodeTreeNode; function GetFindContextParent: TCodeTreeNode;
function GetLevel: integer; function GetLevel: integer;
function DescAsString: string; function DescAsString: string;
@ -744,6 +745,20 @@ begin
end; end;
end; end;
function TCodeTreeNode.GetTopMostNodeOfType(ADesc: TCodeTreeNodeDesc
): TCodeTreeNode;
var
Node: TCodeTreeNode;
begin
Result:=nil;
Node:=Self;
while Node<>nil do begin
if Node.Desc=ADesc then
Result:=Node;
Node:=Node.Parent;
end;
end;
function TCodeTreeNode.GetFindContextParent: TCodeTreeNode; function TCodeTreeNode.GetFindContextParent: TCodeTreeNode;
begin begin
Result:=Parent; Result:=Parent;

View File

@ -349,11 +349,14 @@ begin
DebugLn('TMethodJumpingCodeTool.FindJumpPoint C ',NodeDescriptionAsString(CursorNode.Desc)); DebugLn('TMethodJumpingCodeTool.FindJumpPoint C ',NodeDescriptionAsString(CursorNode.Desc));
{$ENDIF} {$ENDIF}
// first test if in a class // first test if in a class
ClassNode:=CursorNode.GetNodeOfTypes([ctnClass,ctnObject, ClassNode:=CursorNode.GetNodeOfTypes([ctnClass,ctnClassInterface,
ctnObjCClass,ctnObjCCategory,ctnCPPClass]); ctnDispinterface,ctnObject,ctnObjCClass,ctnObjCCategory,ctnObjCProtocol,
ctnCPPClass]);
if ClassNode<>nil then begin if ClassNode<>nil then begin
// cursor is in class/object definition // cursor is in class/object/interface definition
// search in all implemented class procedures for the body // Interfaces have no method bodies, but if the class was refactored it has
// and then jumping is a nide feature
// => search in all implemented class procedures for the body
{$IFDEF CTDEBUG} {$IFDEF CTDEBUG}
DebugLn('TMethodJumpingCodeTool.FindJumpPoint D ',NodeDescriptionAsString(ClassNode.Desc)); DebugLn('TMethodJumpingCodeTool.FindJumpPoint D ',NodeDescriptionAsString(ClassNode.Desc));
{$ENDIF} {$ENDIF}
@ -362,7 +365,7 @@ begin
{$IFDEF CTDEBUG} {$IFDEF CTDEBUG}
DebugLn('TMethodJumpingCodeTool.FindJumpPoint E ',dbgs(CleanCursorPos),', |',copy(Src,CleanCursorPos,8)); DebugLn('TMethodJumpingCodeTool.FindJumpPoint E ',dbgs(CleanCursorPos),', |',copy(Src,CleanCursorPos,8));
{$ENDIF} {$ENDIF}
TypeSectionNode:=ClassNode.GetNodeOfType(ctnTypeSection); TypeSectionNode:=ClassNode.GetTopMostNodeOfType(ctnTypeSection);
// search the method node under the cursor // search the method node under the cursor
CursorNode:=FindDeepestNodeAtPos(CleanCursorPos,true). CursorNode:=FindDeepestNodeAtPos(CleanCursorPos,true).
GetNodeOfType(ctnProcedure); GetNodeOfType(ctnProcedure);

View File

@ -3797,10 +3797,6 @@ begin
ReadClassInheritance(true); ReadClassInheritance(true);
end else end else
UndoReadNextAtom; UndoReadNextAtom;
// start the first class section (always published)
CreateChildNode;
CurNode.Desc:=ctnClassPublished;
CurNode.StartPos:=CurPos.EndPos; // behind 'class' including the space
ReadNextAtom; ReadNextAtom;
if CurPos.Flag=cafEdgedBracketOpen then if CurPos.Flag=cafEdgedBracketOpen then
ReadGUID; ReadGUID;
@ -3814,9 +3810,6 @@ begin
end; end;
ReadNextAtom; ReadNextAtom;
until false; until false;
// end last class section (public, private, ...)
CurNode.EndPos:=CurPos.StartPos;
EndChildNode;
end else begin end else begin
// forward definition // forward definition
CurNode.SubDesc:=CurNode.SubDesc+ctnsForwardDeclaration; CurNode.SubDesc:=CurNode.SubDesc+ctnsForwardDeclaration;

View File

@ -970,7 +970,7 @@ type
deprecated {$IFDEF VER2_5}'use method with EditorObject'{$ENDIF}; // deprecated in 0.9.29 March 2010 deprecated {$IFDEF VER2_5}'use method with EditorObject'{$ENDIF}; // deprecated in 0.9.29 March 2010
function SaveSourceEditorChangesToCodeCache(AEditor: TSourceEditorInterface): boolean; override; function SaveSourceEditorChangesToCodeCache(AEditor: TSourceEditorInterface): boolean; override;
procedure ApplyCodeToolChanges; procedure ApplyCodeToolChanges;
procedure DoJumpToProcedureSection; procedure DoJumpToOtherProcedureSection;
procedure DoFindDeclarationAtCursor; procedure DoFindDeclarationAtCursor;
procedure DoFindDeclarationAtCaret(const LogCaretXY: TPoint); procedure DoFindDeclarationAtCaret(const LogCaretXY: TPoint);
function DoFindRenameIdentifier(Rename: boolean): TModalResult; function DoFindRenameIdentifier(Rename: boolean): TModalResult;
@ -3104,7 +3104,7 @@ begin
ecFindProcedureDefinition, ecFindProcedureDefinition,
ecFindProcedureMethod: ecFindProcedureMethod:
DoJumpToProcedureSection; DoJumpToOtherProcedureSection;
ecFindDeclaration: ecFindDeclaration:
DoFindDeclarationAtCursor; DoFindDeclarationAtCursor;
@ -14522,7 +14522,7 @@ begin
CodeToolBoss.SourceCache.ClearAllSourceLogEntries; CodeToolBoss.SourceCache.ClearAllSourceLogEntries;
end; end;
procedure TMainIDE.DoJumpToProcedureSection; procedure TMainIDE.DoJumpToOtherProcedureSection;
var ActiveSrcEdit: TSourceEditor; var ActiveSrcEdit: TSourceEditor;
ActiveUnitInfo: TUnitInfo; ActiveUnitInfo: TUnitInfo;
NewSource: TCodeBuffer; NewSource: TCodeBuffer;
@ -14542,8 +14542,9 @@ begin
begin begin
DoJumpToCodePos(ActiveSrcEdit, ActiveUnitInfo, DoJumpToCodePos(ActiveSrcEdit, ActiveUnitInfo,
NewSource, NewX, NewY, NewTopLine, not RevertableJump); NewSource, NewX, NewY, NewTopLine, not RevertableJump);
end else end else begin
DoJumpToCodeToolBossError; DoJumpToCodeToolBossError;
end;
end; end;
procedure TMainIDE.DoJumpToCodeToolBossError; procedure TMainIDE.DoJumpToCodeToolBossError;