3 // Ben Motmans <ben.motmans@gmail.com>
5 // Copyright (c) 2007 Ben Motmans
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
29 using System
.Collections
.Generic
;
30 using MonoDevelop
.Core
;
31 using MonoDevelop
.Database
.Designer
;
32 using MonoDevelop
.Database
.Components
;
33
namespace MonoDevelop
.Database
.Sql
.Sqlite
35 public class SqliteGuiProvider
: IGuiProvider
37 // public bool ShowSelectDatabaseDialog (bool create, out string database)
39 // FileChooserDialog dlg = null;
41 // dlg = new FileChooserDialog (
42 // AddinCatalog.GetString ("Save Database"), null, FileChooserAction.Save,
43 // "gtk-cancel", ResponseType.Cancel,
44 // "gtk-save", ResponseType.Accept
47 // dlg = new FileChooserDialog (
48 // AddinCatalog.GetString ("Open Database"), null, FileChooserAction.Open,
49 // "gtk-cancel", ResponseType.Cancel,
50 // "gtk-open", ResponseType.Accept
53 // dlg.SelectMultiple = false;
54 // dlg.LocalOnly = true;
57 // FileFilter filter = new FileFilter ();
58 // filter.AddMimeType ("application/x-sqlite2");
59 // filter.AddMimeType ("application/x-sqlite3");
60 // filter.AddPattern ("*.db");
61 // filter.Name = AddinCatalog.GetString ("SQLite databases");
62 // FileFilter filterAll = new FileFilter ();
63 // filterAll.AddPattern ("*");
64 // filterAll.Name = AddinCatalog.GetString ("All files");
65 // dlg.AddFilter (filter);
66 // dlg.AddFilter (filterAll);
68 // if (dlg.Run () == (int)ResponseType.Accept) {
69 // database = dlg.Filename;
79 public bool ShowCreateDatabaseDialog (IDbFactory factory
)
81 return RunDialog (new SqliteCreateDatabaseDialog (factory
));
84 public bool ShowAddConnectionDialog (IDbFactory factory
)
86 return RunDialog (new SqliteDatabaseConnectionSettingsDialog (factory
));
89 public bool ShowEditConnectionDialog (IDbFactory factory
, DatabaseConnectionSettings settings
)
91 return RunDialog (new SqliteDatabaseConnectionSettingsDialog (factory
, settings
));
94 public bool ShowTableEditorDialog (IEditSchemaProvider schemaProvider
, TableSchema table
, bool create
)
96 TableEditorSettings settings
= new TableEditorSettings ();
97 TableEditorDialog dlg
= new TableEditorDialog (schemaProvider
, create
, settings
);
98 dlg
.Initialize (table
);
100 return RunDialog (dlg
);
103 public bool ShowViewEditorDialog (IEditSchemaProvider schemaProvider
, ViewSchema view
, bool create
)
105 ViewEditorSettings settings
= new ViewEditorSettings ();
106 ViewEditorDialog dlg
= new ViewEditorDialog (schemaProvider
, create
, settings
);
107 dlg
.Initialize (view
);
109 return RunDialog (dlg
);
112 public bool ShowProcedureEditorDialog (IEditSchemaProvider schemaProvider
, ProcedureSchema procedure
, bool create
)
114 ProcedureEditorSettings settings
= new ProcedureEditorSettings ();
115 ProcedureEditorDialog dlg
= new ProcedureEditorDialog (schemaProvider
, create
, settings
);
116 dlg
.Initialize (procedure
);
118 return RunDialog (dlg
);
121 public bool ShowUserEditorDialog (IEditSchemaProvider schemaProvider
, UserSchema user
, bool create
)
123 return false; //TODO: implement ShowUserEditorDialog
126 private bool RunDialog (Dialog dlg
)
130 if (dlg
.Run () == (int)ResponseType
.Ok
)