mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 18:03:47 +02:00
IDE: messages: show pattern in menu item
git-svn-id: trunk@45310 -
This commit is contained in:
parent
351c19894f
commit
74861f25d3
@ -259,7 +259,7 @@ type
|
||||
procedure ImproveMessages({%H-}aSynchronized: boolean); virtual; // (Synchronized=true->main, else worker thread) called after parsers added lines to Tool.WorkerMessages, Tool is in Critical section
|
||||
procedure ConsistencyCheck; virtual;
|
||||
class function IsSubTool(const SubTool: string): boolean; virtual;
|
||||
class function GetMsgExample({%H-}SubTool: string; {%H-}MsgID: integer): string; virtual;
|
||||
class function GetMsgPattern({%H-}SubTool: string; {%H-}MsgID: integer): string; virtual;
|
||||
class function GetMsgHint({%H-}SubTool: string; {%H-}MsgID: integer): string; virtual;
|
||||
class function GetMsgParser(Msg: TMessageLine; ParserClass: TClass): TExtToolParser;
|
||||
class function DefaultSubTool: string; virtual; abstract;
|
||||
@ -509,6 +509,7 @@ type
|
||||
function IndexOfParser(Parser: TExtToolParser): integer;
|
||||
procedure ClearParsers(Delete: boolean = true);
|
||||
function FindParser(aParserClass: TExtToolParserClass): TExtToolParser;
|
||||
function FindParser(const SubTool: string): TExtToolParser;
|
||||
|
||||
// viewers
|
||||
function ViewCount: integer;
|
||||
@ -574,7 +575,7 @@ type
|
||||
function FindParser(const SubTool: string): TExtToolParserClass; virtual; abstract; // (main thread)
|
||||
function ParserCount: integer; virtual; abstract; // (main thread)
|
||||
property Parsers[Index: integer]: TExtToolParserClass read GetParsers; // (main thread)
|
||||
function GetMsgExample(SubTool: string; MsgID: integer): string; virtual; // (main thread)
|
||||
function GetMsgPattern(SubTool: string; MsgID: integer): string; virtual; // (main thread)
|
||||
function GetMsgHint(SubTool: string; MsgID: integer): string; virtual; // (main thread)
|
||||
function GetMsgTool(Msg: TMessageLine): TAbstractExternalTool; virtual; abstract;
|
||||
end;
|
||||
@ -1261,6 +1262,21 @@ begin
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function TAbstractExternalTool.FindParser(const SubTool: string
|
||||
): TExtToolParser;
|
||||
var
|
||||
i: Integer;
|
||||
ParserClass: TExtToolParserClass;
|
||||
begin
|
||||
for i:=0 to ExternalToolList.ParserCount-1 do begin
|
||||
ParserClass:=ExternalToolList.Parsers[i];
|
||||
if not ParserClass.IsSubTool(SubTool) then continue;
|
||||
Result:=FindParser(ParserClass);
|
||||
if Result<>nil then exit;
|
||||
end;
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function TAbstractExternalTool.ViewCount: integer;
|
||||
begin
|
||||
Result:=FViews.Count;
|
||||
@ -1380,7 +1396,7 @@ begin
|
||||
Result:=CompareText(DefaultSubTool,SubTool)=0;
|
||||
end;
|
||||
|
||||
class function TExtToolParser.GetMsgExample(SubTool: string; MsgID: integer
|
||||
class function TExtToolParser.GetMsgPattern(SubTool: string; MsgID: integer
|
||||
): string;
|
||||
begin
|
||||
Result:='';
|
||||
@ -1445,7 +1461,7 @@ begin
|
||||
Items[i].ConsistencyCheck;
|
||||
end;
|
||||
|
||||
function TIDEExternalTools.GetMsgExample(SubTool: string; MsgID: integer
|
||||
function TIDEExternalTools.GetMsgPattern(SubTool: string; MsgID: integer
|
||||
): string;
|
||||
var
|
||||
Parser: TExtToolParserClass;
|
||||
@ -1454,7 +1470,7 @@ begin
|
||||
Result:='';
|
||||
for i:=0 to ParserCount-1 do begin
|
||||
Parser:=Parsers[i];
|
||||
Result:=Parser.GetMsgExample(SubTool,MsgID);
|
||||
Result:=Parser.GetMsgPattern(SubTool,MsgID);
|
||||
if Result<>'' then exit;
|
||||
end;
|
||||
end;
|
||||
|
@ -203,7 +203,7 @@ type
|
||||
var Item: TFPCMsgItem): boolean;
|
||||
class function IsSubTool(const SubTool: string): boolean; override;
|
||||
class function DefaultSubTool: string; override;
|
||||
class function GetMsgExample(SubTool: string; MsgID: integer): string;
|
||||
class function GetMsgPattern(SubTool: string; MsgID: integer): string;
|
||||
override;
|
||||
class function GetMsgHint(SubTool: string; MsgID: integer): string;
|
||||
override;
|
||||
@ -2390,7 +2390,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
class function TIDEFPCParser.GetMsgExample(SubTool: string; MsgID: integer
|
||||
class function TIDEFPCParser.GetMsgPattern(SubTool: string; MsgID: integer
|
||||
): string;
|
||||
var
|
||||
CurMsgFile: TFPCMsgFilePoolItem;
|
||||
|
@ -410,6 +410,7 @@ type
|
||||
procedure SaveClicked(OnlyShown: boolean);
|
||||
procedure CopyAllClicked(OnlyShown: boolean);
|
||||
procedure CopyMsgToClipboard(OnlyFilename: boolean);
|
||||
function GetMsgPattern(SubTool: string; MsgId: integer; MaxLen: integer): string;
|
||||
protected
|
||||
procedure Notification(AComponent: TComponent; Operation: TOperation);
|
||||
override;
|
||||
@ -2964,8 +2965,6 @@ procedure TMessagesFrame.MsgCtrlPopupMenuPopup(Sender: TObject);
|
||||
|
||||
procedure UpdateUnhideItems;
|
||||
var
|
||||
ExampleMsg: String;
|
||||
s: String;
|
||||
HideItem: TLMVFilterHideMsgType;
|
||||
i: Integer;
|
||||
Item: TIDEMenuCommand;
|
||||
@ -2982,13 +2981,7 @@ procedure TMessagesFrame.MsgCtrlPopupMenuPopup(Sender: TObject);
|
||||
end else
|
||||
Item:=MsgUnhideMsgOneTypeMenuSection.Items[i] as TIDEMenuCommand;
|
||||
HideItem:=MessagesCtrl.ActiveFilter.HideMsgTypes[i];
|
||||
s:=HideItem.SubTool;
|
||||
if HideItem.MsgID<>0 then
|
||||
s+='('+IntToStr(HideItem.MsgID)+')';
|
||||
ExampleMsg:=ExternalToolList.GetMsgExample(HideItem.SubTool,HideItem.MsgID);
|
||||
if ExampleMsg<>'' then
|
||||
s+=' '+ExampleMsg;
|
||||
Item.Caption:=s;
|
||||
Item.Caption:=GetMsgPattern(HideItem.SubTool,HideItem.MsgID,40);
|
||||
end;
|
||||
// delete old menu items
|
||||
while MsgUnhideMsgOneTypeMenuSection.Count>Cnt do
|
||||
@ -3080,7 +3073,7 @@ begin
|
||||
HasFilename:=Line.Filename<>'';
|
||||
HasText:=Line.Msg<>'';
|
||||
if (Line.SubTool<>'') and (Line.MsgID<>0) then begin
|
||||
MsgType:=Line.SubTool+' '+IntToStr(Line.MsgID);
|
||||
MsgType:=GetMsgPattern(Line.SubTool,Line.MsgID,40);
|
||||
CanHideMsgType:=ord(Line.Urgency)<ord(mluError);
|
||||
end;
|
||||
end;
|
||||
@ -3596,6 +3589,21 @@ begin
|
||||
Clipboard.AsText:=Txt;
|
||||
end;
|
||||
|
||||
function TMessagesFrame.GetMsgPattern(SubTool: string; MsgId: integer;
|
||||
MaxLen: integer): string;
|
||||
var
|
||||
Pattern: String;
|
||||
begin
|
||||
Result:=SubTool;
|
||||
if (MsgID<>0) then
|
||||
Result+='('+IntToStr(MsgID)+')';
|
||||
Pattern:=ExternalToolList.GetMsgPattern(SubTool,MsgID);
|
||||
if Pattern<>'' then
|
||||
Result+=' '+Pattern;
|
||||
if UTF8Length(Result)>MaxLen then
|
||||
Result:=UTF8Copy(Result,1,MaxLen)+'...';
|
||||
end;
|
||||
|
||||
procedure TMessagesFrame.Notification(AComponent: TComponent;
|
||||
Operation: TOperation);
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user