* Makefile.am:
[monodevelop.git] / extras / MonoDevelop.Database / MonoDevelop.Database.Sql.Npgsql / NpgsqlGuiProvider.cs
blob41a96fbc75a78698ce2f3873ba20b8e214e8cc72
1 //
2 // Authors:
3 // Ben Motmans <ben.motmans@gmail.com>
4 //
5 // Copyright (c) 2007 Ben Motmans
6 //
7 // Permission is hereby granted, free of charge, to any person obtaining a copy
8 // of this software and associated documentation files (the "Software"), to deal
9 // in the Software without restriction, including without limitation the rights
10 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 // copies of the Software, and to permit persons to whom the Software is
12 // furnished to do so, subject to the following conditions:
14 // The above copyright notice and this permission notice shall be included in
15 // all copies or substantial portions of the Software.
17 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 // THE SOFTWARE.
26 using Gtk;
27 using System;
28 using System.Data;
29 using System.Collections.Generic;
30 using MonoDevelop.Database.Designer;
31 using MonoDevelop.Database.Components;
32 namespace MonoDevelop.Database.Sql.Npgsql
34 public class NpgsqlGuiProvider : IGuiProvider
36 public bool ShowCreateDatabaseDialog (IDbFactory factory)
38 return false;
41 public bool ShowAddConnectionDialog (IDbFactory factory)
43 DatabaseConnectionSettingsDialog dlg = new DatabaseConnectionSettingsDialog (factory);
44 return RunDialog (dlg);
47 public bool ShowEditConnectionDialog (IDbFactory factory, DatabaseConnectionSettings settings)
49 DatabaseConnectionSettingsDialog dlg = new DatabaseConnectionSettingsDialog (factory, settings);
50 return RunDialog (dlg);
53 public bool ShowTableEditorDialog (IEditSchemaProvider schemaProvider, TableSchema table, bool create)
55 TableEditorSettings settings = new TableEditorSettings ();
56 TableEditorDialog dlg = new TableEditorDialog (schemaProvider, create, settings);
57 dlg.Initialize (table);
59 return RunDialog (dlg);
62 public bool ShowViewEditorDialog (IEditSchemaProvider schemaProvider, ViewSchema view, bool create)
64 ViewEditorSettings settings = new ViewEditorSettings ();
65 ViewEditorDialog dlg = new ViewEditorDialog (schemaProvider, create, settings);
66 dlg.Initialize (view);
68 return RunDialog (dlg);
71 public bool ShowProcedureEditorDialog (IEditSchemaProvider schemaProvider, ProcedureSchema procedure, bool create)
73 ProcedureEditorSettings settings = new ProcedureEditorSettings ();
74 ProcedureEditorDialog dlg = new ProcedureEditorDialog (schemaProvider, create, settings);
75 dlg.Initialize (procedure);
77 return RunDialog (dlg);
80 public bool ShowUserEditorDialog (IEditSchemaProvider schemaProvider, UserSchema user, bool create)
82 return false; //TODO: implement ShowUserEditorDialog
85 private bool RunDialog (Dialog dlg)
87 bool result = false;
88 try {
89 if (dlg.Run () == (int)ResponseType.Ok)
90 result = true;
91 } finally {
92 dlg.Destroy ();
94 return result;