You've already forked gnatstudio
mirror of
https://github.com/AdaCore/gnatstudio.git
synced 2026-02-12 12:42:33 -08:00
Open Analyzer report in browser after generating it
Also fix the action Display HTML. close eng/ide/gnatstudio#104
This commit is contained in:
committed by
Adrien Boulanger
parent
d8784e0d1b
commit
ef8431b7a9
@@ -304,31 +304,8 @@ package body CodePeer.Module.Actions is
|
||||
Context : Interactive_Command_Context) return Command_Return_Type
|
||||
is
|
||||
pragma Unreferenced (Self);
|
||||
|
||||
Kernel : constant Kernel_Handle := Get_Kernel (Context.Context);
|
||||
HTML_File : constant Virtual_File :=
|
||||
Get_Project (Kernel).Object_Dir.Create_From_Dir
|
||||
("gnathub/html-report/index.html");
|
||||
|
||||
begin
|
||||
if not HTML_File.Is_Regular_File then
|
||||
Kernel.Insert
|
||||
(Text => HTML_File.Display_Full_Name
|
||||
& (-" does not exist. Please perform a full analysis first"),
|
||||
Mode => GPS.Kernel.Error);
|
||||
|
||||
else
|
||||
-- ??? In the future, would be nice to provide a menu to launch
|
||||
-- the codepeer/gnathub web server and then a browser. This is
|
||||
-- more general than CodePeer since part of the gnathub integration
|
||||
-- so leave this aside for now.
|
||||
-- Html_Action_Hook.Run
|
||||
-- (Kernel, String (Full_Name (HTML_File).all));
|
||||
|
||||
Kernel.Insert
|
||||
(Text => -("Please launch the codepeer web server and connect to it"
|
||||
& " with your browser."));
|
||||
end if;
|
||||
Open_HTML_Report (Get_Kernel (Context.Context));
|
||||
|
||||
return Success;
|
||||
end Execute;
|
||||
@@ -409,7 +386,7 @@ package body CodePeer.Module.Actions is
|
||||
Free (Switches);
|
||||
end if;
|
||||
|
||||
Self.Module.Action := None;
|
||||
Self.Module.Action := Open_HTML;
|
||||
CodePeer.Shell_Commands.Build_Target_Execute
|
||||
(Kernel => Kernel_Handle (Self.Module.Kernel),
|
||||
Target_ID => CodePeer.Shell_Commands.Build_Target
|
||||
|
||||
@@ -1381,6 +1381,9 @@ package body CodePeer.Module is
|
||||
|
||||
Module.Load_CSV (Module.Inspection_File);
|
||||
|
||||
when Open_HTML =>
|
||||
Open_HTML_Report (Module.Kernel);
|
||||
|
||||
when None =>
|
||||
-- Should never get there
|
||||
pragma Assert (False);
|
||||
@@ -1779,6 +1782,27 @@ package body CodePeer.Module is
|
||||
end;
|
||||
end Annotate_Message;
|
||||
|
||||
----------------------
|
||||
-- Open_HTML_Report --
|
||||
----------------------
|
||||
|
||||
procedure Open_HTML_Report (Kernel : GPS.Kernel.Kernel_Handle)
|
||||
is
|
||||
HTML_File : constant Virtual_File :=
|
||||
Get_Project (Kernel).Object_Dir.Create_From_Dir
|
||||
("gnathub/html-report/index.html");
|
||||
begin
|
||||
if not HTML_File.Is_Regular_File then
|
||||
Kernel.Insert
|
||||
(Text => HTML_File.Display_Full_Name
|
||||
& (-" does not exist. Please perform a full analysis first"),
|
||||
Mode => GPS.Kernel.Error);
|
||||
else
|
||||
Html_Action_Hook.Run
|
||||
(Kernel, String (Full_Name (HTML_File).all));
|
||||
end if;
|
||||
end Open_HTML_Report;
|
||||
|
||||
--------------------------
|
||||
-- Update_Location_View --
|
||||
--------------------------
|
||||
|
||||
@@ -78,6 +78,9 @@ package CodePeer.Module is
|
||||
Message : CodePeer.Message_Access);
|
||||
-- Add 'pragma Annotate' for a message
|
||||
|
||||
procedure Open_HTML_Report (Kernel : GPS.Kernel.Kernel_Handle);
|
||||
-- Open analyzer html report in the browser if it exist
|
||||
|
||||
type Submenu_Factory_Record
|
||||
(Module : access Module_Id_Record'Class) is
|
||||
new GPS.Kernel.Modules.UI.Submenu_Factory_Record with null record;
|
||||
@@ -141,7 +144,8 @@ private
|
||||
of GPS.Kernel.Style_Manager.Style_Access;
|
||||
|
||||
type CodePeer_Action is
|
||||
(None, Report, Load_UI, Audit_Trail, Load_Bridge_Results, Load_CSV);
|
||||
(None, Report, Load_UI, Audit_Trail,
|
||||
Load_Bridge_Results, Load_CSV, Open_HTML);
|
||||
-- Actions related to codepeer handling:
|
||||
-- - None: no action registered
|
||||
-- - Report: generate report (for gnatsas only)
|
||||
@@ -149,6 +153,7 @@ private
|
||||
-- - Audit_Trail: load audit trail after gps_codepeer_bridge has run
|
||||
-- - Load_Bridge_Results: load codepeer messages after gps_codepeer_bridge
|
||||
-- - Load_CSV: load CSV file after codepeer run
|
||||
-- - Open_HTML: open index.html in the browser
|
||||
|
||||
package String_Sets is
|
||||
new Ada.Containers.Indefinite_Hashed_Sets (String, Ada.Strings.Hash, "=");
|
||||
|
||||
Reference in New Issue
Block a user