mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 19:19:19 +02:00
fixed exception handling
git-svn-id: trunk@8233 -
This commit is contained in:
parent
ba823195d4
commit
5a28a8fb1e
@ -26,8 +26,8 @@ unit CodeToolsExample1;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, MenuIntf, LazIDEIntf, SrcEditorIntf, CodeToolManager,
|
Classes, SysUtils, MenuIntf, LazIDEIntf, Controls, SrcEditorIntf,
|
||||||
CodeTree, CodeCache, CodeAtom, CustomCodeTool;
|
CodeToolManager, CodeTree, CodeCache, CodeAtom, CustomCodeTool;
|
||||||
|
|
||||||
procedure JumpIDEToImplementationKeyword(Sender: TObject);
|
procedure JumpIDEToImplementationKeyword(Sender: TObject);
|
||||||
|
|
||||||
@ -44,6 +44,7 @@ var
|
|||||||
Tool: TCodeTool;
|
Tool: TCodeTool;
|
||||||
NewCodePos: TCodeXYPosition;
|
NewCodePos: TCodeXYPosition;
|
||||||
NewTopLine: Integer;
|
NewTopLine: Integer;
|
||||||
|
Ok: Boolean;
|
||||||
begin
|
begin
|
||||||
if Sender=nil then ;
|
if Sender=nil then ;
|
||||||
// commit editor changes to codetools
|
// commit editor changes to codetools
|
||||||
@ -54,6 +55,7 @@ begin
|
|||||||
if SrcEditor=nil then exit;
|
if SrcEditor=nil then exit;
|
||||||
CodeBuffer:=SrcEditor.CodeToolsBuffer as TCodeBuffer;
|
CodeBuffer:=SrcEditor.CodeToolsBuffer as TCodeBuffer;
|
||||||
|
|
||||||
|
Ok:=false;
|
||||||
try
|
try
|
||||||
// init codetool for the source
|
// init codetool for the source
|
||||||
if CodeToolBoss.InitCurCodeTool(CodeBuffer) then begin
|
if CodeToolBoss.InitCurCodeTool(CodeBuffer) then begin
|
||||||
@ -70,16 +72,22 @@ begin
|
|||||||
NewCodePos,NewTopLine)
|
NewCodePos,NewTopLine)
|
||||||
then begin
|
then begin
|
||||||
// jump
|
// jump
|
||||||
LazarusIDE.DoOpenFileAndJumpToPos(NewCodePos.Code.Filename,
|
if LazarusIDE.DoOpenFileAndJumpToPos(NewCodePos.Code.Filename,
|
||||||
Point(NewCodePos.X,NewCodePos.Y),NewTopLine,-1,
|
Point(NewCodePos.X,NewCodePos.Y),NewTopLine,-1,
|
||||||
[ofRegularFile,ofUseCache]);
|
[ofRegularFile,ofUseCache])=mrOk
|
||||||
|
then
|
||||||
|
Ok:=true;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
except
|
except
|
||||||
LazarusIDE.DoJumpToCodeToolBossError;
|
on E: Exception do begin
|
||||||
|
CodeToolBoss.HandleException(E);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
if not Ok then
|
||||||
|
LazarusIDE.DoJumpToCodeToolBossError;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure Register;
|
procedure Register;
|
||||||
|
Loading…
Reference in New Issue
Block a user