with Gtk.Menu_Item; use Gtk.Menu_Item; with Gtk; use Gtk; with Gtk.Main; use Gtk.Main; with Glib.Error; use Glib.Error; with Gtk.Widget; use Gtk.Widget; with Gtk.Dialog; use Gtk.Dialog; with Gtk.Button; use Gtk.Button; with Gtk.About_Dialog; use Gtk.About_Dialog; with Gtk.Label; use Gtk.Label; with Ada.Text_IO; use Ada.Text_IO; with Ada.IO_Exceptions; use Ada.IO_Exceptions; with GNAT.Current_Exception; use GNAT.Current_Exception; with Gtk.File_Chooser; use Gtk.File_Chooser; with Gtk.File_Chooser_Dialog; use Gtk.File_Chooser_Dialog; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Translate; use Translate; with Framework_Config; use Framework_Config; with Project; use Project; with AADL_Parsers; use AADL_Parsers; --with Xml_generic_Parsers; use Xml_generic_Parsers; --with Xml_generic_Parsers.architecture; use Xml_generic_Parsers.architecture; with graphical_editor.user_message; use graphical_editor.user_message; with Glib; use Glib; with Glib.Object; use Glib.Object; package body graphical_editor.import_aadls_callbacks is procedure import_aadl_file (Object : access Gtkada_Builder_Record'Class) is pragma Unreferenced (Object); Open_File_Chooser : GObject; File : Unbounded_String; Temp : constant unbounded_string_ptr := new Unbounded_String; begin --Do_Open; Do_Aadl_Import; Open_File_Chooser :=Get_Object(Object, "filechooserdialog1"); --Xml_Project_File_Name := File := To_Unbounded_String (Get_Filename (+(Gtk_File_Chooser_Dialog(Open_File_Chooser)))); --File := To_Unbounded_String (Get_Filename (import_aadl_selection)); Temp.all := File; begin add (Aadl_Project_File_Name, Temp); Systems.Read_From_Aadl_File (Sys, Project_File_Dir_List, Aadl_Project_File_Name); Is_Saved := True; -- Rebuild_Canvas (Graph_Window); exception when AADL_Read_Error => Show_Message_Box (Lb_Can_Not_Read_File (Current_Language) & To_Unbounded_String (" ; AADL parsing Error ; ") & Exception_Message); when Ada.IO_Exceptions.Name_Error => Show_Message_Box (Lb_Can_Not_Open_File (Current_Language) & To_Unbounded_String (", Name_Error")); when Ada.IO_Exceptions.Status_Error => Show_Message_Box (Lb_Can_Not_Open_File (Current_Language) & To_Unbounded_String (", Status_Error")); when Ada.IO_Exceptions.Mode_Error => Show_Message_Box (Lb_Can_Not_Open_File (Current_Language) & To_Unbounded_String (", Mode_Error")); when Ada.IO_Exceptions.Use_Error => Show_Message_Box (Lb_Can_Not_Open_File (Current_Language) & To_Unbounded_String (", Use_Error")); when Ada.IO_Exceptions.Device_Error => Show_Message_Box (Lb_Can_Not_Open_File (Current_Language) & To_Unbounded_String (", Device_Error")); when Ada.IO_Exceptions.End_Error => Show_Message_Box (Lb_Can_Not_Open_File (Current_Language) & To_Unbounded_String (", End_Error")); when Ada.IO_Exceptions.Data_Error => Show_Message_Box (Lb_Can_Not_Open_File (Current_Language) & To_Unbounded_String (", Data_Error")); when Ada.IO_Exceptions.Layout_Error => Show_Message_Box (Lb_Can_Not_Open_File (Current_Language) & To_Unbounded_String (", Layout_Error")); when others => Show_Message_Box (Lb_Can_Not_Read_File (Current_Language) & " ; " & Exception_Name & " ; " & Exception_Message); end; Unref(Open_File_Chooser); Hide(Gtk_Widget(Open_File_Chooser)); end import_aadl_file; procedure cancel (Object : access Gtkada_Builder_Record'Class) is pragma Unreferenced (Object); Open_File_Chooser : GObject; begin Open_File_Chooser :=Get_Object(Object, "filechooserdialog1"); Unref(Open_File_Chooser); Hide(Gtk_Widget(Open_File_Chooser)); end cancel; end graphical_editor.import_aadls_callbacks;