procedure TDMSParserWizMainForm.ShowUnitSource(
const FileName:
string);
begin
(BorlandIDEServices
as IOTAActionServices).OpenFile(FileName);
end;
procedure ShowMessageView;
var
h: HWND;
c: TComponent;
begin
// The GetFocus/SetFocus is necessary in my case the IDE is popped up some
// other message ("the contents of a.txt have changed: reload?") -- without
// doing SetFocus, the technique would result in the messageview being in the
// foreground, but the messagebox still waiting for an answer.
h := Windows.GetFocus;
try
c := Application.FindComponent('
EditorActionLists');
if c =
nil then
Exit;
c := c.FindComponent('
ecMessageView');
if (c =
nil)
or not (c
is TAction)
then
Exit;
TAction(c).Execute;
finally
Windows.SetFocus(h);
end;
end;
procedure TDMSParserWizMainForm.ShowInMessageView(
const FileName, MessageStr:
string;
LineNumber, ColumnNumber: Integer);
var
MessageServices: IOTAMessageServices40;
begin
MessageServices := BorlandIDEServices
as IOTAMessageServices40;
MessageServices.ClearCompilerMessages;
MessageServices.ClearToolMessages;
MessageServices.AddToolMessage(FileName, MessageStr, '
DMS-Parser', LineNumber, ColumnNumber);
ShowMessageView;
end;
procedure TDMSParserWizMainForm.ShowParseError(e: EParseError);
var
EditorServices: IOTAEditorServices;
TopView: IOTAEditView;
EditActions: IOTAEditActions;
begin
ShowInMessageView(CurrUnit, e.
Message, e.LineNo, e.ColumnNo);
EditorServices := BorlandIDEServices
as IOTAEditorServices;
TopView := EditorServices.TopView;
if TopView =
nil then
begin
ShowUnitSource(CurrUnit);
TopView := EditorServices.TopView;
end;
if TopView <>
nil then
begin
EditActions := TopView
as IOTAEditActions;
EditActions.NextError;
end;
Close;
Beep;
end;