h2pas wizard: now jumping to error for tools

git-svn-id: trunk@12410 -
This commit is contained in:
mattias 2007-10-10 20:47:39 +00:00
parent 0b9b60dd65
commit a1bc835c26
3 changed files with 34 additions and 16 deletions

View File

@ -3198,7 +3198,8 @@ function TCodeCompletionCodeTool.GatherUnitDefinitions(out
procedure RaiseRedefinition(Node1, Node2: TCodeTreeNode);
begin
raise Exception.Create('redefinition found: '+GetRedefinitionNodeText(Node1)
MoveCursorToNodeStart(Node1);
RaiseException('redefinition found: '+GetRedefinitionNodeText(Node1)
+' at '+CleanPosToStr(Node1.StartPos)
+' and at '+CleanPosToStr(Node2.StartPos));
end;

View File

@ -1859,27 +1859,44 @@ var
ErrorComponent: TComponent;
ErrorTool: TCustomTextConverterTool;
ErrMsg: String;
Line: Integer;
Col: Integer;
Filename: String;
BaseDir: String;
begin
Result:=TextConverter.Execute(List,ErrorComponent);
if Result=mrOk then exit;
Line:=0;
Col:=0;
Filename:='';
if ErrorComponent is TCustomTextConverterTool then begin
ErrorTool:=TCustomTextConverterTool(ErrorComponent);
ErrMsg:=ErrorTool.ErrorFilename;
if ErrMsg='' then
ErrMsg:=DefaultFilename;
if ErrorTool.ErrorLine>0 then begin
ErrMsg:=ErrMsg+'('+IntToStr(ErrorTool.ErrorLine)+',';
if ErrorTool.ErrorColumn>0 then
ErrMsg:=ErrMsg+IntToStr(ErrorTool.ErrorColumn)
else
ErrMsg:=ErrMsg+'1';
ErrMsg:=ErrMsg+')';
end;
ErrMsg:=ErrMsg+' Error: '+ErrorTool.ErrorMsg+' ('+ErrorTool.Caption+')';
end else begin
ErrMsg:=DefaultFilename;
Line:=ErrorTool.ErrorLine;
Col:=ErrorTool.ErrorColumn;
Filename:=ErrorTool.ErrorFilename;
end;
if Filename='' then
Filename:=DefaultFilename;
// create error message
ErrMsg:=Filename;
BaseDir:=ExtractFilePath(Project.BaseDir);
Filename:=CreateRelativePath(Filename,BaseDir);
if ErrMsg='' then
ErrMsg:=DefaultFilename;
if Line>0 then begin
ErrMsg:=ErrMsg+'('+IntToStr(Line)+',';
if Col>0 then
ErrMsg:=ErrMsg+IntToStr(Col)
else
ErrMsg:=ErrMsg+'1';
ErrMsg:=ErrMsg+')';
end;
ErrMsg:=ErrMsg+' Error: '+ErrorTool.ErrorMsg+' ('+ErrorTool.Caption+')';
DebugLn(['TH2PasConverter.ConvertFile Failed: ',ErrMsg]);
IDEMessagesWindow.AddMsg(ErrMsg,BaseDir,-1);
LazarusIDE.DoJumpToCompilerMessage(IDEMessagesWindow.LinesCount-1,true);
Result:=mrAbort;
end;
var

View File

@ -202,7 +202,7 @@ type
function ShowProgress(const SomeText: string;
Step, MaxStep: integer): boolean; virtual; abstract; // False if canceled by user
function DoJumpToCompilerMessage(Index:integer;
FocusEditor: boolean): boolean; virtual; abstract;
FocusEditor: boolean): boolean; virtual; abstract;
procedure DoJumpToNextError(DirectionDown: boolean); virtual; abstract;
procedure DoShowMessagesView; virtual; abstract;
function DoCheckFilesOnDisk(Instantaneous: boolean = false): TModalResult; virtual; abstract;