public GenerateDataClassesDialog ()
		{
			this.Build();
			
			notebook.ChangeCurrentPage += ChangeCurrentNotebookPage;
			
			comboLocation = new ProjectDirectoryComboBox ();
			comboDatabase = new DatabaseConnectionContextComboBox ();
			
			tableGeneral.Attach (comboLocation, 1, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0);
			tableGeneral.Attach (comboDatabase, 1, 2, 1, 2, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0);
			
			columnMapping = new ColumnMappingWidget (true);
			//tableMapping = new TableMappingWidget ();
			
			tableTables.Attach (columnMapping, 0, 1, 1, 2, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill | AttachOptions.Expand, 0, 0);
			//tableTables.Attach (tableMapping, 1, 2, 1, 2, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill | AttachOptions.Expand, 0, 0);
			
			ShowAll ();
		}
		public SqlQueryView ()
		{
			stoppedQueries = new List<object> ();
			MonoDevelop.SourceEditor.Extension.TemplateExtensionNodeLoader.Init ();
			this.UntitledName = string.Concat (AddinCatalog.GetString ("Untitled Sql Script"), ".sql");
			
			vbox = new VBox (false, 6);
			vbox.BorderWidth = 6;
			
			Toolbar toolbar = new Toolbar ();
			toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
			
			buttonExecute = new ToolButton (ImageService.GetImage ("md-db-execute", IconSize.SmallToolbar),
			                                AddinCatalog.GetString ("_Execute"));
			buttonExecute.Label = AddinCatalog.GetString ("Execute");
			buttonExecute.Sensitive = false;
			buttonExecute.TooltipMarkup = AddinCatalog.GetString ("Execute Query");
			buttonExecute.IsImportant = true;
			buttonExecute.Clicked += new EventHandler (ExecuteClicked);

			buttonStop = new ToolButton ("gtk-stop");
			buttonStop.TooltipText = AddinCatalog.GetString ("Stop Query Execution");
			buttonStop.Sensitive = false;
			buttonStop.Clicked += new EventHandler (StopClicked);
			
			buttonClear = new ToolButton (ImageService.GetImage ("gtk-clear", IconSize.Button), 
			                              AddinCatalog.GetString ("Clear Results"));
			buttonClear.TooltipText = AddinCatalog.GetString ("Clear Results");
			buttonClear.Clicked += new EventHandler (ClearClicked);
			
			comboConnections = new DatabaseConnectionContextComboBox ();
			selectedConnection = comboConnections.DatabaseConnection;
			comboConnections.Changed += new EventHandler (ConnectionChanged);
			ToolItem comboItem = new ToolItem ();
			comboItem.Child = comboConnections;
			
			toolbar.Add (buttonExecute);
			toolbar.Add (buttonStop);
			toolbar.Add (buttonClear);
			toolbar.Add (new SeparatorToolItem ());
			toolbar.Add (comboItem);
			
			pane = new VPaned ();

			// Sql History Window
			ScrolledWindow windowHistory = new ScrolledWindow ();
			history = new SqlEditorWidget ();
			history.Editable = false;
			windowHistory.AddWithViewport (history);
			
			// Status of the Last Query
			ScrolledWindow windowStatus = new ScrolledWindow ();
			status = new TextView ();
			windowStatus.Add (status);
			
			notebook = new Notebook ();
			notebook.AppendPage (windowStatus, new Label (AddinCatalog.GetString ("Status")));
			notebook.AppendPage (windowHistory, new Label (AddinCatalog.GetString ("Query History")));
			
			pane.Pack2 (notebook, true, true);
			vbox.PackStart (toolbar, false, true, 0);
			vbox.PackStart (pane, true, true, 0);
			this.Document.TextReplaced += SqlChanged;
			vbox.ShowAll ();
			Document.DocumentUpdated += delegate (object sender, EventArgs args) {
				// Default mime type or a provider defined.
				if (selectedConnection == null)
					Document.MimeType = "text/x-sql";
				else 
					Document.MimeType = GetMimeType ();
				
			};
			notebook.Hide ();
		}
        public ModelerCanvasWidget(ModelerCanvas owner, modelController controller)
        {
            this.Build ();
            _owner = owner;
            _controller = controller;
            VBox mainVbox = new VBox (false, 6);
            mainVbox.BorderWidth = 6;
            this.Add(mainVbox);

            //Create Toolbar
            Toolbar toolbar = new Toolbar ();
            toolbar.Name = "toolbar";
            toolbar.ShowArrow = true;
            toolbar.IconSize = Gtk.IconSize.LargeToolbar;
            toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
            toolbar.Sensitive=true;
            toolbar.Activate();
            mainVbox.Add(toolbar);
            Gtk.Box.BoxChild w1 = ((Gtk.Box.BoxChild)(mainVbox[toolbar]));
            w1.Position = 0;
            w1.Expand = false;
            w1.Fill = true;

            //Create SCrollWindow
            mainScrolledWindow = new ScrolledWindow();
            mainScrolledWindow.Activate();
            mainScrolledWindow.SetPolicy( Gtk.PolicyType.Always,Gtk.PolicyType.Always);
            mainScrolledWindow.CanFocus = true;
            mainScrolledWindow.Name = "mainScrolledWindow";
            mainScrolledWindow.ShadowType = ((Gtk.ShadowType)(1));
            mainVbox.Add(mainScrolledWindow);
            Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(mainVbox[mainScrolledWindow]));
             			w2.Position = 1;
            w2.Fill=true;
            w2.Expand=true;

            //Create Toolbar Buttons

            //Add New Table
            buttonNew = new ToolButton(new Gtk.Image (Gtk.Stock.New, IconSize.Button),"Add Table");
            buttonNew.Sensitive = true;
            buttonNew.TooltipMarkup = "Add a new empty table";
            buttonNew.IsImportant = true;
            buttonNew.Clicked += new EventHandler (OnbuttonNewActionActivated);
            buttonNew.Activate();
            buttonNew.Show();
            toolbar.Add (buttonNew);
            //Create a Relationship between two tables
            buttonRelationship = new ToolButton(new Gtk.Image (Gtk.Stock.New, IconSize.Button),"Relationship");
            buttonRelationship.Sensitive = true;
            buttonRelationship.TooltipMarkup = "Add a new relationship between tables";
            buttonRelationship.IsImportant = true;
            buttonRelationship.Clicked += new EventHandler (OnbuttonRelationshipActivated);
            buttonRelationship.Activate();
            buttonRelationship.Show();
            toolbar.Add (buttonRelationship);
            //Delete Selected Figure(s)
            buttonDelete = new ToolButton(new Gtk.Image (Gtk.Stock.New, IconSize.Button),"Remove");
            buttonDelete.Sensitive = true;
                buttonDelete.TooltipMarkup = "Remove selected figure(s) from diagram (table or relationship)";
            buttonDelete.IsImportant = true;
            buttonDelete.Clicked += new EventHandler (buttonDeleteRelationshipActivated);
            buttonDelete.Activate();
            buttonDelete.Show();
            toolbar.Add (buttonDelete);
            //Select Active Database
            comboConnections = new DatabaseConnectionContextComboBox ();
            selectedConnection = comboConnections.DatabaseConnection;
            comboConnections.Changed += new EventHandler (ConnectionChanged);
            ToolItem comboItem = new ToolItem ();
            comboItem.Child = comboConnections;
            comboItem.Show();
            toolbar.Add (new SeparatorToolItem ());
            toolbar.Add (comboItem);
            //Show all items
            mainVbox.ShowAll ();
        }
		public SqlQueryView ()
		{
			stoppedQueries = new List<object> ();
			
			vbox = new VBox (false, 6);
			vbox.BorderWidth = 6;

			sqlEditor = new SqlEditorWidget ();
			sqlEditor.TextChanged += new EventHandler (SqlChanged);
			
			Toolbar toolbar = new Toolbar ();
			toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
			
			buttonExecute = new ToolButton (
				Services.Resources.GetImage ("md-db-execute", IconSize.SmallToolbar),
				GettextCatalog.GetString ("Execute")
			);
			buttonStop = new ToolButton ("gtk-stop");
			buttonClear = new ToolButton (Services.Resources.GetImage ("gtk-clear", IconSize.Button), GettextCatalog.GetString ("Clear Results"));
			buttonStop.Sensitive = false;
			buttonExecute.Sensitive = false;
			
			buttonExecute.Clicked += new EventHandler (ExecuteClicked);
			buttonStop.Clicked += new EventHandler (StopClicked);
			buttonClear.Clicked += new EventHandler (ClearClicked);
			
			comboConnections = new DatabaseConnectionContextComboBox ();
			selectedConnection = comboConnections.DatabaseConnection;
			comboConnections.Changed += new EventHandler (ConnectionChanged);

			buttonExecute.IsImportant = true;
			
			ToolItem comboItem = new ToolItem ();
			comboItem.Child = comboConnections;
			
			toolbar.Add (buttonExecute);
			toolbar.Add (buttonStop);
			toolbar.Add (buttonClear);
			toolbar.Add (new SeparatorToolItem ());
			toolbar.Add (comboItem);
			
			pane = new VPaned ();

			ScrolledWindow windowStatus = new ScrolledWindow ();
			status = new TextView ();
			windowStatus.Add (status);
			
			notebook = new Notebook ();
			notebook.AppendPage (windowStatus, new Label (GettextCatalog.GetString ("Status")));
			
			pane.Pack1 (sqlEditor, true, true);
			pane.Pack2 (notebook, true, true);
			
			vbox.PackStart (toolbar, false, true, 0);
			vbox.PackStart (pane, true, true, 0);
			
			vbox.ShowAll ();
			notebook.Hide ();
		}