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 GetNodeOfType(ADesc: TCodeTreeNodeDesc): TCodeTreeNode;
function GetNodeOfTypes(Descriptors: array of TCodeTreeNodeDesc): TCodeTreeNode;
function GetTopMostNodeOfType(ADesc: TCodeTreeNodeDesc): TCodeTreeNode;
function GetFindContextParent: TCodeTreeNode;
function GetLevel: integer;
function DescAsString: string;
@ -744,6 +745,20 @@ begin
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;
begin
Result:=Parent;

View File

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

View File

@ -3797,10 +3797,6 @@ begin
ReadClassInheritance(true);
end else
UndoReadNextAtom;
// start the first class section (always published)
CreateChildNode;
CurNode.Desc:=ctnClassPublished;
CurNode.StartPos:=CurPos.EndPos; // behind 'class' including the space
ReadNextAtom;
if CurPos.Flag=cafEdgedBracketOpen then
ReadGUID;
@ -3814,9 +3810,6 @@ begin
end;
ReadNextAtom;
until false;
// end last class section (public, private, ...)
CurNode.EndPos:=CurPos.StartPos;
EndChildNode;
end else begin
// forward definition
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
function SaveSourceEditorChangesToCodeCache(AEditor: TSourceEditorInterface): boolean; override;
procedure ApplyCodeToolChanges;
procedure DoJumpToProcedureSection;
procedure DoJumpToOtherProcedureSection;
procedure DoFindDeclarationAtCursor;
procedure DoFindDeclarationAtCaret(const LogCaretXY: TPoint);
function DoFindRenameIdentifier(Rename: boolean): TModalResult;
@ -3104,7 +3104,7 @@ begin
ecFindProcedureDefinition,
ecFindProcedureMethod:
DoJumpToProcedureSection;
DoJumpToOtherProcedureSection;
ecFindDeclaration:
DoFindDeclarationAtCursor;
@ -14522,7 +14522,7 @@ begin
CodeToolBoss.SourceCache.ClearAllSourceLogEntries;
end;
procedure TMainIDE.DoJumpToProcedureSection;
procedure TMainIDE.DoJumpToOtherProcedureSection;
var ActiveSrcEdit: TSourceEditor;
ActiveUnitInfo: TUnitInfo;
NewSource: TCodeBuffer;
@ -14542,8 +14542,9 @@ begin
begin
DoJumpToCodePos(ActiveSrcEdit, ActiveUnitInfo,
NewSource, NewX, NewY, NewTopLine, not RevertableJump);
end else
end else begin
DoJumpToCodeToolBossError;
end;
end;
procedure TMainIDE.DoJumpToCodeToolBossError;