Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez <lluis@novell.com>2010-03-17 15:36:38 +0300
committerLluis Sanchez <lluis@novell.com>2010-03-17 15:36:38 +0300
commit26cd98aac012ec3d1a5db043464d8be9575eaff9 (patch)
tree3f8035c5a1f675529494bec84e22483ab51df1dc /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels
parent26073c35357e7c57940985325dc1d9479225476a (diff)
parent585086f0ea0a49166046bb8f48d2def87907d0e0 (diff)
Merged MD.Projects into MD.Core, and MD.Projects.Gui, MD.Core.Gui and MD.Components into MD.Ide.
svn path=/trunk/monodevelop/; revision=153733
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/BaseDirectoryPanel.cs75
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/BaseDirectoryPanelWidget.cs52
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CodeFormattingPanel.cs363
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineBuildOptions.cs63
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineConfigurationPanel.cs149
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineInformationPanel.cs75
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CommonAssemblySigningPreferences.cs142
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CustomCommandPanel.cs56
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CustomCommandPanelWidget.cs94
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CustomCommandWidget.cs240
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/GeneralProjectOptions.cs141
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/NamespaceSynchronisationPanel.cs257
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/OutputOptionsPanel.cs173
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/RunOptionsPanel.cs118
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/RuntimeOptionsPanel.cs105
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/SolutionItemConfigurationsPanel.cs184
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/StartupOptionsPanel.cs205
17 files changed, 2492 insertions, 0 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/BaseDirectoryPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/BaseDirectoryPanel.cs
new file mode 100644
index 0000000000..09d95ab8a5
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/BaseDirectoryPanel.cs
@@ -0,0 +1,75 @@
+// BaseDirectoryPanel.cs
+//
+// Author:
+// Lluis Sanchez Gual <lluis@novell.com>
+//
+// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+using System;
+using MonoDevelop.Core;
+using MonoDevelop.Ide.Gui.Dialogs;
+using MonoDevelop.Projects;
+
+namespace MonoDevelop.Ide.Projects.OptionPanels
+{
+ public class BaseDirectoryPanel: IOptionsPanel
+ {
+ BaseDirectoryPanelWidget widget;
+ IWorkspaceObject obj;
+
+ public BaseDirectoryPanel()
+ {
+ }
+
+ public void Initialize (OptionsDialog dialog, object dataObject)
+ {
+ obj = dataObject as IWorkspaceObject;
+ }
+
+ public Gtk.Widget CreatePanelWidget ()
+ {
+ widget = new BaseDirectoryPanelWidget ();
+ widget.BaseDirectory = System.IO.Path.GetFullPath (obj.BaseDirectory);
+ return widget;
+ }
+
+ public bool IsVisible ()
+ {
+ return obj != null;
+ }
+
+ public bool ValidateChanges ()
+ {
+ if (widget.BaseDirectory.Length > 0 && !System.IO.Directory.Exists (widget.BaseDirectory)) {
+ MessageService.ShowError (GettextCatalog.GetString ("Directory not found: {0}", widget.BaseDirectory));
+ return false;
+ }
+ return true;
+ }
+
+ public void ApplyChanges ()
+ {
+ obj.BaseDirectory = widget.BaseDirectory;
+ }
+ }
+}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/BaseDirectoryPanelWidget.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/BaseDirectoryPanelWidget.cs
new file mode 100644
index 0000000000..e0d65e589f
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/BaseDirectoryPanelWidget.cs
@@ -0,0 +1,52 @@
+// BaseDirectoryPanel.cs
+//
+// Author:
+// Lluis Sanchez Gual <lluis@novell.com>
+//
+// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+using System;
+
+namespace MonoDevelop.Ide.Projects.OptionPanels
+{
+
+
+ [System.ComponentModel.Category("MonoDevelop.Projects.Gui")]
+ [System.ComponentModel.ToolboxItem(true)]
+ public partial class BaseDirectoryPanelWidget : Gtk.Bin
+ {
+ public BaseDirectoryPanelWidget()
+ {
+ this.Build();
+ }
+
+ public string BaseDirectory {
+ get {
+ return folderentry.Path;
+ }
+ set {
+ folderentry.Path = value;
+ }
+ }
+ }
+}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CodeFormattingPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CodeFormattingPanel.cs
new file mode 100644
index 0000000000..efa9e7f29b
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CodeFormattingPanel.cs
@@ -0,0 +1,363 @@
+//
+// CodeFormattingPanelWidget.cs
+//
+// Author:
+// Lluis Sanchez Gual <lluis@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using Mono.Addins;
+using MonoDevelop.Ide.Gui.Dialogs;
+using MonoDevelop.Ide.Extensions;
+using MonoDevelop.Projects;
+using MonoDevelop.Core;
+using MonoDevelop.Projects.Gui.Extensions;
+using MonoDevelop.Projects.Policies;
+using MonoDevelop.Components;
+
+namespace MonoDevelop.Ide.Projects.OptionPanels
+{
+ class CodeFormattingPanel: OptionsPanel
+ {
+ PolicyContainer policyContainer;
+ Dictionary<string,MimeTypePanelData> typeSections = new Dictionary<string, MimeTypePanelData> ();
+ List<string> globalMimeTypes;
+
+ public override void Initialize (MonoDevelop.Ide.Gui.Dialogs.OptionsDialog dialog, object dataObject)
+ {
+ base.Initialize (dialog, dataObject);
+
+ if (dataObject is SolutionItem) {
+ policyContainer = ((SolutionItem)dataObject).Policies;
+ } else if (dataObject is Solution) {
+ policyContainer = ((Solution)dataObject).Policies;
+ } else if (dataObject is PolicySet) {
+ policyContainer = ((PolicySet)dataObject);
+ globalMimeTypes = new List<string> ();
+ string userTypes = PropertyService.Get<string> ("MonoDevelop.Projects.GlobalPolicyMimeTypes", "");
+ globalMimeTypes.AddRange (userTypes.Split (new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries));
+ }
+
+ foreach (string mt in GetItemMimeTypes ())
+ AddPanel (mt);
+ }
+
+ MimeTypePanelData AddPanel (string mt)
+ {
+ MimeTypePanelData data = new MimeTypePanelData ();
+ OptionsDialogSection sec = new OptionsDialogSection (typeof(MimeTypePolicyOptionsSection));
+ sec.Fill = true;
+ Gdk.Pixbuf icon = DesktopService.GetPixbufForType (mt, Gtk.IconSize.Menu);
+ sec.Icon = ImageService.GetStockId (icon, Gtk.IconSize.Menu);
+ data.Section = sec;
+ data.MimeType = mt;
+ data.TypeDescription = DesktopService.GetMimeTypeDescription (mt);
+ if (string.IsNullOrEmpty (data.TypeDescription))
+ data.TypeDescription = mt;
+ data.DataObject = DataObject;
+ data.PolicyContainer = policyContainer;
+ sec.Label = data.TypeDescription;
+ LoadPolicyTypeData (data, mt);
+ typeSections [mt] = data;
+ ParentDialog.AddChildSection (this, sec, data);
+ return data;
+ }
+
+ void RemovePanel (string mt)
+ {
+ MimeTypePanelData data = typeSections [mt];
+ typeSections.Remove (mt);
+ ParentDialog.RemoveSection (data.Section);
+ }
+
+ internal MimeTypePanelData AddGlobalMimeType (string mt)
+ {
+ if (!globalMimeTypes.Contains (mt)) {
+ globalMimeTypes.Add (mt);
+ return AddPanel (mt);
+ }
+ return null;
+ }
+
+ internal void RemoveGlobalMimeType (string mt)
+ {
+ if (globalMimeTypes.Remove (mt))
+ RemovePanel (mt);
+ }
+
+ public IEnumerable<MimeTypePanelData> GetMimeTypeData ()
+ {
+ return typeSections.Values;
+ }
+
+ public PolicyContainer PolicyContainer {
+ get { return policyContainer; }
+ }
+
+ void LoadPolicyTypeData (MimeTypePanelData data, string mimeType)
+ {
+ List<string> types = new List<string> ();
+ types.AddRange (DesktopService.GetMimeTypeInheritanceChain (mimeType));
+ List<IMimeTypePolicyOptionsPanel> panels = new List<IMimeTypePolicyOptionsPanel> ();
+
+ bool useParentPolicy = false;
+ foreach (MimeTypeOptionsPanelNode node in AddinManager.GetExtensionNodes ("/MonoDevelop/ProjectModel/Gui/MimeTypePolicyPanels")) {
+ if (!types.Contains (node.MimeType))
+ continue;
+
+ IMimeTypePolicyOptionsPanel panel = (IMimeTypePolicyOptionsPanel) node.CreateInstance (typeof(IMimeTypePolicyOptionsPanel));
+ panel.Initialize (ParentDialog, DataObject);
+ panel.InitializePolicy (policyContainer, mimeType, mimeType == node.MimeType);
+ panel.Label = GettextCatalog.GetString (node.Label);
+ if (!panel.IsVisible ())
+ continue;
+
+ if (!panel.HasCustomPolicy)
+ useParentPolicy = true;
+
+ panels.Add (panel);
+ }
+ data.Panels = panels;
+ if (!policyContainer.IsRoot)
+ data.UseParentPolicy = useParentPolicy;
+ }
+
+ public override Gtk.Widget CreatePanelWidget ()
+ {
+ return new CodeFormattingPanelWidget (this, ParentDialog);
+ }
+
+ public override void ApplyChanges ()
+ {
+ if (globalMimeTypes != null) {
+ string types = string.Join (";", globalMimeTypes.ToArray ());
+ PropertyService.Set ("MonoDevelop.Projects.GlobalPolicyMimeTypes", types);
+ }
+ // If a section is already loaded, changes will be committed in the panel
+ foreach (MimeTypePanelData pd in typeSections.Values) {
+ if (!pd.SectionLoaded)
+ pd.ApplyChanges ();
+ }
+ }
+
+ public IEnumerable<string> GetItemMimeTypes ()
+ {
+ HashSet<string> types = new HashSet<string> ();
+ if (DataObject is Solution)
+ GetItemMimeTypes (types, ((Solution)DataObject).RootFolder);
+ else if (DataObject is SolutionItem)
+ GetItemMimeTypes (types, (SolutionItem)DataObject);
+ else {
+ types.Add ("application/xml");
+ foreach (MimeTypeOptionsPanelNode node in AddinManager.GetExtensionNodes ("/MonoDevelop/ProjectModel/Gui/MimeTypePolicyPanels")) {
+ types.Add (node.MimeType);
+ globalMimeTypes.Remove (node.MimeType);
+ }
+ types.UnionWith (globalMimeTypes);
+ }
+ return types;
+ }
+
+ public bool IsUserMimeType (string type)
+ {
+ return globalMimeTypes != null && globalMimeTypes.Contains (type);
+ }
+
+ void GetItemMimeTypes (HashSet<string> types, SolutionItem item)
+ {
+ if (item is SolutionFolder) {
+ foreach (SolutionItem it in ((SolutionFolder)item).Items)
+ GetItemMimeTypes (types, it);
+ }
+ else if (item is Project) {
+ foreach (ProjectFile pf in ((Project)item).Files) {
+ string mt = DesktopService.GetMimeTypeForUri (pf.FilePath);
+ foreach (string mth in DesktopService.GetMimeTypeInheritanceChain (mt))
+ types.Add (mth);
+ }
+ }
+ }
+ }
+
+ [System.ComponentModel.ToolboxItem(true)]
+ partial class CodeFormattingPanelWidget : Gtk.Bin
+ {
+ CodeFormattingPanel panel;
+ Gtk.ListStore store;
+ OptionsDialog dialog;
+
+ public CodeFormattingPanelWidget (CodeFormattingPanel panel, OptionsDialog dialog)
+ {
+ this.Build();
+ this.panel = panel;
+ this.dialog = dialog;
+
+ store = new Gtk.ListStore (typeof(MimeTypePanelData), typeof(Gdk.Pixbuf), typeof(string));
+ tree.Model = store;
+
+ boxButtons.Visible = panel.DataObject is PolicySet;
+ Gtk.CellRendererText crt = new Gtk.CellRendererText ();
+ Gtk.CellRendererPixbuf crp = new Gtk.CellRendererPixbuf ();
+
+ Gtk.TreeViewColumn col = new Gtk.TreeViewColumn ();
+ col.Title = GettextCatalog.GetString ("File Type");
+ col.PackStart (crp, false);
+ col.PackStart (crt, true);
+ col.AddAttribute (crp, "pixbuf", 1);
+ col.AddAttribute (crt, "text", 2);
+ tree.AppendColumn (col);
+ store.SetSortColumnId (2, Gtk.SortType.Ascending);
+
+ CellRendererComboBox comboCell = new CellRendererComboBox ();
+ comboCell.Changed += OnPolicySelectionChanged;
+ Gtk.TreeViewColumn polCol = tree.AppendColumn (GettextCatalog.GetString ("Policy"), comboCell, new Gtk.TreeCellDataFunc (OnSetPolicyData));
+
+ tree.Selection.Changed += delegate {
+ Gtk.TreeIter it;
+ tree.Selection.GetSelected (out it);
+ Gtk.TreeViewColumn ccol;
+ Gtk.TreePath path;
+ tree.GetCursor (out path, out ccol);
+ if (ccol == polCol)
+ tree.SetCursor (path, ccol, true);
+ };
+
+ Fill ();
+ UpdateButtons ();
+
+ tree.Selection.Changed += delegate {
+ UpdateButtons ();
+ };
+ }
+
+ static readonly string parentPolicyText = GettextCatalog.GetString ("(Inherited Policy)");
+ static readonly string customPolicyText = GettextCatalog.GetString ("(Custom)");
+
+ void OnSetPolicyData (Gtk.TreeViewColumn treeColumn, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
+ {
+ MimeTypePanelData mt = (MimeTypePanelData) store.GetValue (iter, 0);
+
+ string selection;
+ if (mt.UseParentPolicy)
+ selection = parentPolicyText;
+ else {
+ PolicySet matchingSet = mt.GetMatchingSet ();
+ if (matchingSet != null)
+ selection = matchingSet.Name;
+ else
+ selection = customPolicyText;
+ }
+
+ CellRendererComboBox comboCell = (CellRendererComboBox) cell;
+ comboCell.Values = GetComboOptions (mt);
+ comboCell.Text = selection;
+ }
+
+ string[] GetComboOptions (MimeTypePanelData mt)
+ {
+ List<string> values = new List<string> ();
+
+ if (!this.panel.PolicyContainer.IsRoot)
+ values.Add (parentPolicyText);
+
+ foreach (PolicySet set in mt.GetSupportedPolicySets ())
+ values.Add (set.Name);
+
+ values.Add (customPolicyText);
+ return values.ToArray ();
+ }
+
+ void OnPolicySelectionChanged (object s, ComboSelectionChangedArgs args)
+ {
+ Gtk.TreeIter iter;
+ if (store.GetIter (out iter, new Gtk.TreePath (args.Path))) {
+ MimeTypePanelData mt = (MimeTypePanelData) store.GetValue (iter, 0);
+ if (args.Active != -1) {
+ string sel = args.ActiveText;
+ if (sel == parentPolicyText)
+ mt.UseParentPolicy = true;
+ else if (sel != customPolicyText) {
+ PolicySet pset = PolicyService.GetPolicySet (sel);
+ mt.AssignPolicies (pset);
+ }
+ }
+ }
+ }
+
+ void Fill ()
+ {
+ foreach (MimeTypePanelData mt in panel.GetMimeTypeData ()) {
+ store.AppendValues (mt, DesktopService.GetPixbufForType (mt.MimeType, Gtk.IconSize.Menu), mt.TypeDescription);
+ }
+ }
+
+ protected void OnButtonEditClicked (object sender, System.EventArgs e)
+ {
+ Gtk.TreeIter iter;
+ if (tree.Selection.GetSelected (out iter)) {
+ MimeTypePanelData mt = (MimeTypePanelData) store.GetValue (iter, 0);
+ dialog.ShowPage (mt.Section);
+ }
+ }
+
+ protected virtual void OnButtonAddClicked (object sender, System.EventArgs e)
+ {
+ AddMimeTypeDialog dlg = new AddMimeTypeDialog (panel.GetItemMimeTypes ());
+ try {
+ dlg.TransientFor = this.Toplevel as Gtk.Window;
+ if (dlg.Run () == (int) Gtk.ResponseType.Ok) {
+ MimeTypePanelData mt = panel.AddGlobalMimeType (dlg.MimeType);
+ store.AppendValues (mt, DesktopService.GetPixbufForType (mt.MimeType, Gtk.IconSize.Menu), mt.TypeDescription);
+ }
+ } finally {
+ dlg.Destroy ();
+ }
+ }
+
+ protected virtual void OnButtonRemoveClicked (object sender, System.EventArgs e)
+ {
+ Gtk.TreeIter iter;
+ if (tree.Selection.GetSelected (out iter)) {
+ MimeTypePanelData mt = (MimeTypePanelData) store.GetValue (iter, 0);
+ if (MessageService.Confirm (GettextCatalog.GetString ("Are you sure you want to remove the formatting policy for the type '{0}'?", mt.TypeDescription), AlertButton.Delete)) {
+ panel.RemoveGlobalMimeType (mt.MimeType);
+ store.Remove (ref iter);
+ }
+ }
+ }
+
+ void UpdateButtons ()
+ {
+ Gtk.TreeIter iter;
+ if (tree.Selection.GetSelected (out iter)) {
+ MimeTypePanelData mt = (MimeTypePanelData) store.GetValue (iter, 0);
+ if (panel.IsUserMimeType (mt.MimeType)) {
+ buttonRemove.Sensitive = buttonEdit.Sensitive = true;
+ return;
+ }
+ }
+ buttonRemove.Sensitive = buttonEdit.Sensitive = false;
+ }
+ }
+}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineBuildOptions.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineBuildOptions.cs
new file mode 100644
index 0000000000..448575687e
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineBuildOptions.cs
@@ -0,0 +1,63 @@
+// CombineBuildOptions.cs
+//
+// Author:
+// Mike Krüger <mkrueger@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using MonoDevelop.Ide.Gui.Dialogs;
+using MonoDevelop.Projects;
+
+namespace MonoDevelop.Ide.Projects.OptionPanels
+{
+ class CombineBuildOptions : ItemOptionsPanel
+ {
+ CombineBuildOptionsWidget widget;
+
+ public override Gtk.Widget CreatePanelWidget()
+ {
+ return widget = new CombineBuildOptionsWidget (ConfiguredSolution);
+ }
+
+ public override void ApplyChanges ()
+ {
+ widget.Store ();
+ }
+ }
+
+ partial class CombineBuildOptionsWidget : Gtk.Bin
+ {
+ Solution solution;
+
+ public CombineBuildOptionsWidget (Solution solution)
+ {
+ Build ();
+ this.solution = solution;
+ folderEntry.Path = solution.OutputDirectory;
+ }
+
+ public void Store()
+ {
+ solution.OutputDirectory = folderEntry.Path;
+ }
+ }
+}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineConfigurationPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineConfigurationPanel.cs
new file mode 100644
index 0000000000..4a1ea2eb9d
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineConfigurationPanel.cs
@@ -0,0 +1,149 @@
+// CombineConfigurationPanel.cs
+//
+// Author:
+// Todd Berman <tberman@off.net>
+//
+// Copyright (c) 2004 Todd Berman
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+
+using System;
+using System.Collections;
+
+using MonoDevelop.Projects;
+using MonoDevelop.Core;
+using MonoDevelop.Ide.Gui.Dialogs;
+using MonoDevelop.Components;
+using Gtk;
+
+namespace MonoDevelop.Ide.Projects.OptionPanels
+{
+ internal class CombineConfigurationPanel : MultiConfigItemOptionsPanel
+ {
+ CombineConfigurationPanelWidget widget;
+
+ public override Widget CreatePanelWidget()
+ {
+ return widget = new CombineConfigurationPanelWidget ((MultiConfigItemOptionsDialog) ParentDialog);
+ }
+
+ public override void LoadConfigData ()
+ {
+ widget.Load ((SolutionConfiguration) CurrentConfiguration);
+ }
+
+ public override void ApplyChanges ()
+ {
+ widget.Store ();
+ }
+ }
+
+ partial class CombineConfigurationPanelWidget : Gtk.Bin
+ {
+ TreeStore store;
+ SolutionConfiguration configuration;
+ MultiConfigItemOptionsDialog parentDialog;
+
+ public CombineConfigurationPanelWidget (MultiConfigItemOptionsDialog parentDialog)
+ {
+ Build ();
+
+ this.parentDialog = parentDialog;
+ store = new TreeStore (typeof(object), typeof(string), typeof(bool));
+ configsList.Model = store;
+ configsList.HeadersVisible = true;
+
+ TreeViewColumn col = new TreeViewColumn ();
+ CellRendererText sr = new CellRendererText ();
+ col.PackStart (sr, true);
+ col.Expand = true;
+ col.AddAttribute (sr, "text", 1);
+ col.Title = GettextCatalog.GetString ("Solution Item");
+ configsList.AppendColumn (col);
+
+ CellRendererToggle tt = new CellRendererToggle ();
+ tt.Activatable = true;
+ tt.Toggled += new ToggledHandler (OnBuildToggled);
+ configsList.AppendColumn (GettextCatalog.GetString ("Build"), tt, "active", 2);
+
+ CellRendererComboBox comboCell = new CellRendererComboBox ();
+ comboCell.Changed += new ComboSelectionChangedHandler (OnConfigSelectionChanged);
+ configsList.AppendColumn (GettextCatalog.GetString ("Configuration"), comboCell, new TreeCellDataFunc (OnSetConfigurationsData));
+ }
+
+ public void Load (SolutionConfiguration config)
+ {
+ configuration = config;
+
+ store.Clear ();
+ foreach (SolutionConfigurationEntry ce in configuration.Configurations) {
+ if (ce.Item != null)
+ store.AppendValues (ce, ce.Item.Name, ce.Build);
+ }
+ }
+
+ void OnSetConfigurationsData (Gtk.TreeViewColumn treeColumn, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
+ {
+ SolutionConfigurationEntry entry = (SolutionConfigurationEntry) store.GetValue (iter, 0);
+
+ ConfigurationData data = parentDialog.ConfigurationData.FindConfigurationData (entry.Item);
+
+ string[] values = new string [data.Configurations.Count];
+ for (int n=0; n<values.Length; n++)
+ values [n] = data.Configurations [n].Id;
+ CellRendererComboBox comboCell = (CellRendererComboBox) cell;
+ comboCell.Values = values;
+ comboCell.Text = entry.ItemConfiguration;
+ }
+
+ void OnBuildToggled (object sender, ToggledArgs args)
+ {
+ TreeIter iter;
+ if (store.GetIter (out iter, new TreePath (args.Path))) {
+ SolutionConfigurationEntry entry = (SolutionConfigurationEntry) store.GetValue (iter, 0);
+ entry.Build = !entry.Build;
+ store.SetValue (iter, 2, entry.Build);
+ }
+ }
+
+ void OnConfigSelectionChanged (object s, ComboSelectionChangedArgs args)
+ {
+ TreeIter iter;
+ if (store.GetIter (out iter, new TreePath (args.Path))) {
+ SolutionConfigurationEntry entry = (SolutionConfigurationEntry) store.GetValue (iter, 0);
+ if (args.Active != -1) {
+ ConfigurationData data = parentDialog.ConfigurationData.FindConfigurationData (entry.Item);
+ entry.ItemConfiguration = data.Configurations [args.Active].Id;
+ }
+ else
+ entry.ItemConfiguration = null;
+ }
+ }
+
+ public void Store ()
+ {
+ // Data stored at dialog level
+ }
+ }
+
+}
+
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineInformationPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineInformationPanel.cs
new file mode 100644
index 0000000000..190e1740f2
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CombineInformationPanel.cs
@@ -0,0 +1,75 @@
+/*
+Copyright (c) 2006 Scott Ellington
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+using System;
+using System.IO;
+using System.Collections;
+using System.ComponentModel;
+
+using MonoDevelop.Projects;
+using MonoDevelop.Core;
+
+using MonoDevelop.Ide.Gui.Dialogs;
+using Gtk;
+using MonoDevelop.Components;
+
+namespace MonoDevelop.Ide.Projects.OptionPanels
+{
+ internal class CombineInformationPanel : ItemOptionsPanel
+ {
+ CombineInformationWidget widget;
+
+ public override Widget CreatePanelWidget()
+ {
+ return widget = new CombineInformationWidget (ConfiguredSolution);
+ }
+
+ public override void ApplyChanges()
+ {
+ widget.Store (ConfiguredSolution);
+ }
+ }
+
+ partial class CombineInformationWidget : Gtk.Bin
+ {
+ public CombineInformationWidget (Solution solution)
+ {
+ Build ();
+
+ versLabel.UseUnderline = true;
+ descLabel.UseUnderline = true;
+
+ versEntry.Text = solution.Version;
+ descView.Buffer.Text = solution.Description;
+ }
+
+ public void Store (Solution solution)
+ {
+ solution.Version = versEntry.Text;
+ solution.Description = descView.Buffer.Text;
+ }
+ }
+}
+
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CommonAssemblySigningPreferences.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CommonAssemblySigningPreferences.cs
new file mode 100644
index 0000000000..8b1e01415c
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CommonAssemblySigningPreferences.cs
@@ -0,0 +1,142 @@
+//
+// CommonAssemblySigningPreferences.cs
+//
+// Author:
+// Mike Krüger <mkrueger@novell.com>
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using MonoDevelop.Ide.Gui.Dialogs;
+using MonoDevelop.Projects;
+using MonoDevelop.Core;
+
+namespace MonoDevelop.Ide.Projects.OptionPanels
+{
+ internal partial class CommonAssemblySigningPreferences : Gtk.Bin
+ {
+ ItemConfiguration[] configurations;
+ string keyFile;
+
+ public CommonAssemblySigningPreferences ()
+ {
+ this.Build();
+ }
+
+ public void LoadPanelContents (Project project, ItemConfiguration[] configurations)
+ {
+ this.configurations = configurations;
+
+ int signAsm = -1;
+
+ keyFile = null;
+ foreach (DotNetProjectConfiguration c in configurations) {
+ int r = c.SignAssembly ? 1 : 0;
+ if (signAsm == -1)
+ signAsm = r;
+ else if (signAsm != r)
+ signAsm = 2;
+ if (keyFile == null)
+ keyFile = c.AssemblyKeyFile;
+ else if (keyFile != c.AssemblyKeyFile)
+ keyFile = "?";
+ }
+
+ if (signAsm == 2)
+ signAssemblyCheckbutton.Inconsistent = true;
+ else {
+ signAssemblyCheckbutton.Inconsistent = false;
+ signAssemblyCheckbutton.Active = signAsm == 1;
+ }
+
+ if (keyFile == null || keyFile == "?")
+ this.strongNameFileEntry.Path = string.Empty;
+ else
+ this.strongNameFileEntry.Path = keyFile;
+
+ this.strongNameFileEntry.DefaultPath = project.BaseDirectory;
+ this.strongNameFileLabel.Sensitive = this.strongNameFileEntry.Sensitive = signAsm != 0;
+ this.signAssemblyCheckbutton.Toggled += new EventHandler (SignAssemblyCheckbuttonActivated);
+ }
+
+ void SignAssemblyCheckbuttonActivated (object sender, EventArgs e)
+ {
+ signAssemblyCheckbutton.Inconsistent = false;
+ this.strongNameFileLabel.Sensitive = this.strongNameFileEntry.Sensitive = this.signAssemblyCheckbutton.Active;
+ }
+
+ public void StorePanelContents ()
+ {
+ foreach (DotNetProjectConfiguration c in configurations) {
+ if (!signAssemblyCheckbutton.Inconsistent)
+ c.SignAssembly = this.signAssemblyCheckbutton.Active;
+ if (strongNameFileEntry.Path.Length > 0 || keyFile != "?")
+ c.AssemblyKeyFile = this.strongNameFileEntry.Path;
+ }
+ }
+ }
+
+ class CommonAssemblySigningPreferencesPanel: MultiConfigItemOptionsPanel
+ {
+ CommonAssemblySigningPreferences widget;
+
+ public override bool IsVisible ()
+ {
+ return ConfiguredProject is DotNetProject;
+ }
+
+
+ public override Gtk.Widget CreatePanelWidget ()
+ {
+ AllowMixedConfigurations = true;
+ return (widget = new CommonAssemblySigningPreferences ());
+ }
+
+ protected override bool ConfigurationsAreEqual (IEnumerable<ItemConfiguration> configs)
+ {
+ DotNetProjectConfiguration cref = null;
+ foreach (DotNetProjectConfiguration c in configs) {
+ if (cref == null)
+ cref = c;
+ else {
+ if (c.SignAssembly != cref.SignAssembly)
+ return false;
+ if (c.AssemblyKeyFile != cref.AssemblyKeyFile)
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public override void LoadConfigData ()
+ {
+ widget.LoadPanelContents (ConfiguredProject, CurrentConfigurations);
+ }
+
+ public override void ApplyChanges ()
+ {
+ widget.StorePanelContents ();
+ }
+ }
+}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CustomCommandPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CustomCommandPanel.cs
new file mode 100644
index 0000000000..e12eaac575
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CustomCommandPanel.cs
@@ -0,0 +1,56 @@
+// CustomCommandPanel.cs
+//
+// Author:
+// Lluis Sanchez Gual <lluis@novell.com>
+//
+// Copyright (c) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+
+using System;
+using System.Collections.Generic;
+using MonoDevelop.Ide.Gui.Dialogs;
+using MonoDevelop.Projects;
+using MonoDevelop.Core;
+
+namespace MonoDevelop.Ide.Projects.OptionPanels
+{
+ internal class CustomCommandPanel: MultiConfigItemOptionsPanel
+ {
+ CustomCommandPanelWidget widget;
+
+ public override Gtk.Widget CreatePanelWidget ()
+ {
+ return (widget = new CustomCommandPanelWidget ());
+ }
+
+ public override void LoadConfigData ()
+ {
+ widget.Load (ConfiguredSolutionItem, CurrentConfiguration.CustomCommands);
+ }
+
+ public override void ApplyChanges ()
+ {
+ // Do nothing. Changes to cloned configurations are automatically applied.
+ }
+ }
+}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CustomCommandPanelWidget.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CustomCommandPanelWidget.cs
new file mode 100644
index 0000000000..90f29579b7
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CustomCommandPanelWidget.cs
@@ -0,0 +1,94 @@
+// CustomCommandPanelWidget.cs
+//
+// Author:
+// Lluis Sanchez Gual <lluis@novell.com>
+//
+// Copyright (c) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+
+using System;
+using MonoDevelop.Projects;
+
+namespace MonoDevelop.Ide.Projects.OptionPanels
+{
+ [System.ComponentModel.Category("widget")]
+ [System.ComponentModel.ToolboxItem(true)]
+ internal partial class CustomCommandPanelWidget : Gtk.Bin
+ {
+ CustomCommandCollection commands;
+ CustomCommandWidget lastSlot;
+ SolutionEntityItem entry;
+
+ public CustomCommandPanelWidget ()
+ {
+ this.Build();
+ }
+
+ public void Load (SolutionEntityItem entry, CustomCommandCollection commands)
+ {
+ this.entry = entry;
+ this.commands = commands;
+
+ // Clean the list
+ foreach (CustomCommandWidget ccw in vboxCommands.Children) {
+ ccw.CommandCreated -= OnCommandCreated;
+ ccw.CommandRemoved -= OnCommandRemoved;
+ vboxCommands.Remove (ccw);
+ ccw.Destroy ();
+ }
+
+ foreach (CustomCommand cmd in commands) {
+ AddCommandSlot (cmd);
+ }
+ // Add an empty slot to allow adding more commands.
+ AddCommandSlot (null);
+ }
+
+ void AddCommandSlot (CustomCommand cmd)
+ {
+ CustomCommandWidget widget = new CustomCommandWidget (entry, cmd);
+ vboxCommands.PackStart (widget, false, false, 0);
+ widget.CommandCreated += OnCommandCreated;
+ widget.CommandRemoved += OnCommandRemoved;
+ widget.Show ();
+ lastSlot = widget;
+ }
+
+ void OnCommandCreated (object s, EventArgs args)
+ {
+ CustomCommandWidget widget = (CustomCommandWidget) s;
+ commands.Add (widget.CustomCommand);
+
+ // Add an empty slot to allow adding more commands.
+ AddCommandSlot (null);
+ }
+
+ void OnCommandRemoved (object s, EventArgs args)
+ {
+ CustomCommandWidget widget = (CustomCommandWidget) s;
+ commands.Remove (widget.CustomCommand);
+ if (lastSlot != widget)
+ vboxCommands.Remove (widget);
+ }
+ }
+}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CustomCommandWidget.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CustomCommandWidget.cs
new file mode 100644
index 0000000000..a0974f89f9
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CustomCommandWidget.cs
@@ -0,0 +1,240 @@
+// CustomCommandWidget.cs
+//
+// Author:
+// Lluis Sanchez Gual <lluis@novell.com>
+//
+// Copyright (c) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+
+using System;
+using MonoDevelop.Core;
+using MonoDevelop.Projects;
+using MonoDevelop.Components;
+
+namespace MonoDevelop.Ide.Projects.OptionPanels
+{
+ [System.ComponentModel.Category("widget")]
+ [System.ComponentModel.ToolboxItem(true)]
+ internal partial class CustomCommandWidget : Gtk.Bin
+ {
+ CustomCommand cmd;
+ IWorkspaceObject entry;
+ bool updating;
+
+ // snatched from MonoDevelop.Ide.Gui.OptionPanels/ExternalToolPanel.cs
+ // a lot of these probably don't apply to custom build commands (e.g. ItemPath -- path of current open doc)
+// static string[,] argumentQuickInsertMenu = new string[,] {
+// {GettextCatalog.GetString ("Item Path"), "${ItemPath}"},
+// {GettextCatalog.GetString ("_Item Directory"), "${ItemDir}"},
+// {GettextCatalog.GetString ("Item file name"), "${ItemFileName}"},
+// {GettextCatalog.GetString ("Item extension"), "${ItemExt}"},
+// {"-", ""},
+// {GettextCatalog.GetString ("Current line"), "${CurLine}"},
+// {GettextCatalog.GetString ("Current column"), "${CurCol}"},
+// {GettextCatalog.GetString ("Current text"), "${CurText}"},
+// {"-", ""},
+// {GettextCatalog.GetString ("Target Path"), "${TargetPath}"},
+// {GettextCatalog.GetString ("_Target Directory"), "${TargetDir}"},
+// {GettextCatalog.GetString ("Target Name"), "${TargetName}"},
+// {GettextCatalog.GetString ("Target Extension"), "${TargetExt}"},
+// {"-", ""},
+// {GettextCatalog.GetString ("_Project Directory"), "${ProjectDir}"},
+// {GettextCatalog.GetString ("Project file name"), "${ProjectFileName}"},
+// {"-", ""},
+// {GettextCatalog.GetString ("_Solution Directory"), "${CombineDir}"},
+// {GettextCatalog.GetString ("Solution File Name"), "${CombineFileName}"},
+// {"-", ""},
+// {GettextCatalog.GetString ("MonoDevelop Startup Directory"), "${StartupPath}"},
+// };
+
+ static string[,] projectWorkingDirInsertMenu = new string[,] {
+ // Keep in sync with CustomCommand.cs
+ {GettextCatalog.GetString ("_Target Directory"), "${TargetDir}"},
+ {GettextCatalog.GetString ("Target _Name"), "${TargetName}"},
+ {"-", ""},
+ {GettextCatalog.GetString ("_Project Directory"), "${ProjectDir}"},
+ {GettextCatalog.GetString ("P_roject Name"), "${ProjectName}"},
+ {GettextCatalog.GetString ("Project _File"), "${ProjectFile}"},
+ {"-", ""},
+ {GettextCatalog.GetString ("_Solution Directory"), "${SolutionDir}"},
+ {GettextCatalog.GetString ("So_lution Name"), "${SolutionName}"},
+ {GettextCatalog.GetString ("Solution F_ile"), "${SolutionFile}"},
+ };
+
+ static string[,] entryWorkingDirInsertMenu = new string[,] {
+ // Keep in sync with CustomCommand.cs
+ {GettextCatalog.GetString ("Solution _Item Directory"), "${ItemDir}"},
+ {GettextCatalog.GetString ("Solution Item _Name"), "${ItemName}"},
+ {GettextCatalog.GetString ("Solution Item _File"), "${ItemFile}"},
+ {"-", ""},
+ {GettextCatalog.GetString ("_Solution Directory"), "${SolutionDir}"},
+ {GettextCatalog.GetString ("So_lution Name"), "${SolutionName}"},
+ {GettextCatalog.GetString ("Solution F_ile"), "${SolutionFile}"},
+ };
+
+ static string[,] solutionWorkingDirInsertMenu = new string[,] {
+ // Keep in sync with CustomCommand.cs
+ {GettextCatalog.GetString ("_Solution Directory"), "${SolutionDir}"},
+ {GettextCatalog.GetString ("So_lution Name"), "${SolutionName}"},
+ };
+
+ public CustomCommandWidget (IWorkspaceObject entry, CustomCommand cmd)
+ {
+ this.Build();
+ this.cmd = cmd;
+ if (cmd != null) {
+ updating = true;
+ comboType.RemoveText (0);
+ updating = false;
+ }
+
+ this.entry = entry;
+ UpdateControls ();
+ this.WidgetFlags |= Gtk.WidgetFlags.NoShowAll;
+
+ string[,] workingDirInsertMenu;
+ if (entry is Project)
+ workingDirInsertMenu = projectWorkingDirInsertMenu;
+ else if (entry is SolutionEntityItem)
+ workingDirInsertMenu = entryWorkingDirInsertMenu;
+ else
+ workingDirInsertMenu = solutionWorkingDirInsertMenu;
+
+ new MenuButtonEntry (workingdirEntry, workingdirQuickInsertButton, workingDirInsertMenu);
+ }
+
+ public CustomCommand CustomCommand {
+ get { return cmd; }
+ }
+
+ void UpdateControls ()
+ {
+ updating = true;
+
+ boxData.Visible = tableData.Visible = buttonRemove.Visible = (cmd != null);
+
+ if (cmd == null) {
+ comboType.Active = 0;
+ }
+ else {
+ Array array = Enum.GetValues (typeof (CustomCommandType));
+ comboType.Active = Array.IndexOf (array, cmd.Type);
+ labelName.Visible = entryName.Visible = (cmd.Type == CustomCommandType.Custom);
+ entryName.Text = cmd.Name;
+ entryCommand.Text = cmd.Command;
+ checkExternalCons.Active = cmd.ExternalConsole;
+ checkPauseCons.Active = cmd.PauseExternalConsole;
+ checkPauseCons.Sensitive = cmd.ExternalConsole;
+ workingdirEntry.Text = cmd.WorkingDir;
+ }
+ updating = false;
+ }
+
+ protected virtual void OnButtonBrowseClicked(object sender, System.EventArgs e)
+ {
+ FileSelector fdiag = new FileSelector (GettextCatalog.GetString ("Select File"));
+ try {
+ fdiag.SetCurrentFolder (entry.BaseDirectory);
+ fdiag.SelectMultiple = false;
+ fdiag.TransientFor = this.Toplevel as Gtk.Window;
+ if (fdiag.Run () == (int) Gtk.ResponseType.Ok) {
+ if (System.IO.Path.IsPathRooted (fdiag.Filename))
+ entryCommand.Text = FileService.AbsoluteToRelativePath (entry.BaseDirectory, fdiag.Filename);
+ else
+ entryCommand.Text = fdiag.Filename;
+ }
+ fdiag.Hide ();
+ } finally {
+ fdiag.Destroy ();
+ }
+ }
+
+ protected virtual void OnEntryCommandChanged(object sender, System.EventArgs e)
+ {
+ if (!updating)
+ cmd.Command = entryCommand.Text;
+ }
+
+ protected virtual void OnEntryNameChanged(object sender, System.EventArgs e)
+ {
+ if (!updating)
+ cmd.Name = entryName.Text;
+ }
+
+ protected virtual void OnComboTypeChanged(object sender, System.EventArgs e)
+ {
+ if (!updating) {
+ if (cmd == null) {
+ if (comboType.Active != 0) {
+ // Selected a command type. Create the command now
+ cmd = new CustomCommand ();
+ cmd.Type = (CustomCommandType) (comboType.Active - 1);
+ updating = true;
+ comboType.RemoveText (0);
+ updating = false;
+ if (CommandCreated != null)
+ CommandCreated (this, EventArgs.Empty);
+ }
+ } else
+ cmd.Type = (CustomCommandType) (comboType.Active);
+ UpdateControls ();
+ if (cmd.Type == CustomCommandType.Custom)
+ entryName.GrabFocus ();
+ else
+ entryCommand.GrabFocus ();
+ }
+ }
+
+ protected virtual void OnCheckPauseConsClicked(object sender, System.EventArgs e)
+ {
+ if (!updating)
+ cmd.PauseExternalConsole = checkPauseCons.Active;
+ }
+
+ protected virtual void OnCheckExternalConsClicked(object sender, System.EventArgs e)
+ {
+ if (!updating) {
+ cmd.ExternalConsole = checkExternalCons.Active;
+ UpdateControls ();
+ }
+ }
+
+ protected virtual void OnButtonRemoveClicked(object sender, System.EventArgs e)
+ {
+ if (CommandRemoved != null)
+ CommandRemoved (this, EventArgs.Empty);
+ }
+
+ protected virtual void OnWorkingdirEntryChanged (object sender, System.EventArgs e)
+ {
+ if (!updating) {
+ cmd.WorkingDir = workingdirEntry.Text;
+ UpdateControls ();
+ workingdirEntry.GrabFocus ();
+ }
+ }
+
+ public event EventHandler CommandCreated;
+ public event EventHandler CommandRemoved;
+ }
+}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/GeneralProjectOptions.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/GeneralProjectOptions.cs
new file mode 100644
index 0000000000..5789914e6c
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/GeneralProjectOptions.cs
@@ -0,0 +1,141 @@
+// GeneralProjectOptions.cs
+//
+// Author:
+// Mike Krüger <mkrueger@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using MonoDevelop.Ide.Gui.Dialogs;
+
+using Gtk;
+using MonoDevelop.Projects;
+
+namespace MonoDevelop.Ide.Projects.OptionPanels
+{
+ internal class GeneralProjectOptions : ItemOptionsPanel
+ {
+ GeneralProjectOptionsWidget widget;
+
+ public override Widget CreatePanelWidget()
+ {
+ return widget = new GeneralProjectOptionsWidget (ConfiguredProject, ParentDialog);
+ }
+
+ public override void ApplyChanges()
+ {
+ widget.Store ();
+ }
+ }
+
+ partial class GeneralProjectOptionsWidget : Gtk.Bin
+ {
+ Project project;
+ OptionsDialog dialog;
+
+ public GeneralProjectOptionsWidget (Project project, OptionsDialog dialog)
+ {
+ Build ();
+
+ this.project = project;
+ this.dialog = dialog;
+
+ nameLabel.UseUnderline = true;
+
+ descriptionLabel.UseUnderline = true;
+
+ projectNameEntry.Text = project.Name;
+ projectDescriptionTextView.Buffer.Text = project.Description;
+
+ // TODO msbuild Move to build panel?
+ if (project is DotNetProject) {
+ projectDefaultNamespaceEntry.Text = ((DotNetProject)project).DefaultNamespace;
+ } else {
+ defaultNamespaceLabel.Visible = false;
+ projectDefaultNamespaceEntry.Visible = false;
+ }
+
+ switch (project.NewFileSearch)
+ {
+ case NewFileSearch.None:
+ newFilesOnLoadCheckButton.Active = false;
+ autoInsertNewFilesCheckButton.Active = false;
+ break;
+ case NewFileSearch.OnLoad:
+ newFilesOnLoadCheckButton.Active = true;
+ autoInsertNewFilesCheckButton.Active = false;
+ break;
+ default:
+ newFilesOnLoadCheckButton.Active = true;
+ autoInsertNewFilesCheckButton.Active = true;
+ break;
+ }
+
+ entryVersion.Text = project.Version;
+ checkSolutionVersion.Active = project.SyncVersionWithSolution;
+ entryVersion.Sensitive = !project.SyncVersionWithSolution;
+
+ newFilesOnLoadCheckButton.Clicked += new EventHandler(AutoLoadCheckBoxCheckedChangeEvent);
+ AutoLoadCheckBoxCheckedChangeEvent(null, null);
+ }
+
+ void AutoLoadCheckBoxCheckedChangeEvent(object sender, EventArgs e)
+ {
+ autoInsertNewFilesCheckButton.Sensitive = newFilesOnLoadCheckButton.Active;
+ if (newFilesOnLoadCheckButton.Active == false)
+ autoInsertNewFilesCheckButton.Active = false;
+ }
+
+ public void Store ()
+ {
+ if (projectNameEntry.Text != project.Name) {
+ ProjectOptionsDialog.RenameItem (project, projectNameEntry.Text);
+ if (project.ParentSolution != null)
+ dialog.ModifiedObjects.Add (project.ParentSolution);
+ }
+
+ project.Description = projectDescriptionTextView.Buffer.Text;
+ if (project is DotNetProject)
+ ((DotNetProject)project).DefaultNamespace = projectDefaultNamespaceEntry.Text;
+
+ if (newFilesOnLoadCheckButton.Active) {
+ project.NewFileSearch = autoInsertNewFilesCheckButton.Active ? NewFileSearch.OnLoadAutoInsert : NewFileSearch.OnLoad;
+ } else {
+ project.NewFileSearch = NewFileSearch.None;
+ }
+ if (checkSolutionVersion.Active)
+ project.SyncVersionWithSolution = true;
+ else {
+ project.SyncVersionWithSolution = false;
+ project.Version = entryVersion.Text;
+ }
+ }
+
+ protected virtual void OnCheckSolutionVersionClicked (object sender, System.EventArgs e)
+ {
+ entryVersion.Sensitive = !checkSolutionVersion.Active;
+ if (!entryVersion.Sensitive)
+ entryVersion.Text = project.ParentSolution.Version;
+ }
+ }
+
+}
+
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/NamespaceSynchronisationPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/NamespaceSynchronisationPanel.cs
new file mode 100644
index 0000000000..c41957a92f
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/NamespaceSynchronisationPanel.cs
@@ -0,0 +1,257 @@
+//
+// NamespaceOptionsPanel.cs
+//
+// Author:
+// Michael Hutchinson <mhutchinson@novell.com>
+//
+// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Gtk;
+using MonoDevelop.Core;
+using MonoDevelop.Projects;
+using MonoDevelop.Projects.Policies;
+using MonoDevelop.Ide.Gui.Dialogs;
+
+namespace MonoDevelop.Ide.Projects.OptionPanels
+{
+ class NamespaceSynchronisationPanel : PolicyOptionsPanel<DotNetNamingPolicy>
+ {
+ NamespaceSynchronisationPanelWidget widget;
+ bool migrateIds;
+
+ public override Widget CreatePanelWidget ()
+ {
+ widget = new NamespaceSynchronisationPanelWidget (this);
+ widget.Show ();
+ return widget;
+ }
+
+ protected override string PolicyTitleWithMnemonic {
+ get { return GettextCatalog.GetString ("_Policy"); }
+ }
+
+ protected override void LoadFrom (DotNetNamingPolicy policy)
+ {
+ widget.LoadFrom (policy);
+ }
+
+ protected override DotNetNamingPolicy GetPolicy ()
+ {
+ return widget.GetPolicy ();
+ }
+
+ public override bool ValidateChanges ()
+ {
+ if (ConfiguredSolution != null && widget.ResourceNamingChanged) {
+ string msg = GettextCatalog.GetString ("The resource naming policy has changed");
+ string detail = "Changing the resource naming policy may cause run-time errors if the code using resources is not properly updated. There are two options:\n\n";
+ detail += GettextCatalog.GetString ("Update all resource identifiers to match the new policy. This will require changes in the source code that references resources using the old policy. Identifiers explicitly set using the file properties pad won't be changed.\n\n");
+ detail += "Keep curent resource identifiers. It doesn't require source code changes. Resources added from now on will use the new policy)";
+ AlertButton update = new AlertButton ("Update Identifiers");
+ AlertButton keep = new AlertButton ("Keep Current Identifiers");
+ AlertButton res = MessageService.AskQuestion (msg, detail, AlertButton.Cancel, update, keep);
+ if (res == AlertButton.Cancel)
+ return false;
+ migrateIds = res == keep;
+ }
+ return base.ValidateChanges ();
+ }
+
+ public override void ApplyChanges ()
+ {
+ base.ApplyChanges ();
+
+ if (widget.ResourceNamingChanged) {
+ if (ConfiguredProject is DotNetProject) {
+ ((DotNetProject)ConfiguredProject).UpdateResourceHandler (migrateIds);
+ } else if (DataObject is SolutionFolder) {
+ foreach (DotNetProject prj in ((SolutionFolder)DataObject).GetAllItems<DotNetProject> ())
+ prj.UpdateResourceHandler (migrateIds);
+ } else if (ConfiguredSolution != null) {
+ foreach (DotNetProject prj in ConfiguredSolution.GetAllSolutionItems<DotNetProject> ())
+ prj.UpdateResourceHandler (migrateIds);
+ }
+ }
+ }
+
+ }
+
+ partial class NamespaceSynchronisationPanelWidget : Gtk.Bin
+ {
+ NamespaceSynchronisationPanel panel;
+ TreeStore previewStore;
+ TreeView previewTree;
+ ResourceNamePolicy initialResourceNaming;
+ bool firstLoad = true;
+
+ public bool ResourceNamingChanged {
+ get { return ActiveResourceNamePolicy != initialResourceNaming; }
+ }
+
+ public NamespaceSynchronisationPanelWidget (NamespaceSynchronisationPanel panel)
+ {
+ this.panel = panel;
+
+ this.Build ();
+
+ checkAssociateNamespacesDirectories.Toggled += UpdateNamespaceSensitivity;
+ UpdateNamespaceSensitivity (null, EventArgs.Empty);
+
+ checkDefaultAsRoot.Toggled += UpdatePreview;
+ radioFlat.Toggled += UpdatePreview;
+ radioHierarch.Toggled += UpdatePreview;
+
+ previewStore = new TreeStore (typeof (Gdk.Pixbuf), typeof (String), typeof (String));
+ previewTree = new TreeView (previewStore);
+
+ //Cosmetic, not available in GTK+ 2.8
+ //previewTree.ShowExpanders = false;
+ //previewTree.LevelIndentation = 24;
+
+ previewTree.CanFocus = false;
+ previewFrame.CanFocus = false;
+ namespaceAssociationBox.FocusChain = new Widget[] { checkDefaultAsRoot, hbox1 };
+ hbox1.FocusChain = new Widget[] { radioFlat, radioHierarch };
+ previewTree.ButtonPressEvent += SuppressClick;
+
+ TreeViewColumn dirCol = new TreeViewColumn ();
+ dirCol.Title = GettextCatalog.GetString ("Directory");
+ var iconRenderer = new CellRendererPixbuf ();
+ CellRendererText textRenderer = new CellRendererText ();
+ dirCol.PackStart (iconRenderer, false);
+ dirCol.PackStart (textRenderer, false);
+ dirCol.AddAttribute (iconRenderer, "pixbuf", 0);
+ dirCol.AddAttribute (textRenderer, "text", 1);
+ previewTree.AppendColumn (dirCol);
+
+ previewTree.AppendColumn (GettextCatalog.GetString ("Namespace"), textRenderer, "text", 2);
+
+ previewFrame.Add (previewTree);
+ previewFrame.ShowAll ();
+
+ UpdatePreview (null, EventArgs.Empty);
+ }
+
+ public void LoadFrom (DotNetNamingPolicy policy)
+ {
+ checkAssociateNamespacesDirectories.Active = (policy.DirectoryNamespaceAssociation != DirectoryNamespaceAssociation.None);
+ checkDefaultAsRoot.Active = policy.DirectoryNamespaceAssociation == DirectoryNamespaceAssociation.PrefixedFlat
+ || policy.DirectoryNamespaceAssociation == DirectoryNamespaceAssociation.PrefixedHierarchical;
+ radioHierarch.Active = policy.DirectoryNamespaceAssociation == DirectoryNamespaceAssociation.Hierarchical
+ || policy.DirectoryNamespaceAssociation == DirectoryNamespaceAssociation.PrefixedHierarchical;
+
+ if (policy.ResourceNamePolicy == ResourceNamePolicy.FileFormatDefault) {
+ checkVSStyleResourceNames.Inconsistent = true;
+ } else {
+ checkVSStyleResourceNames.Active = policy.ResourceNamePolicy == ResourceNamePolicy.MSBuild;
+ checkVSStyleResourceNames.Inconsistent = false;
+ }
+
+ if (firstLoad) {
+ initialResourceNaming = policy.ResourceNamePolicy;
+ firstLoad = false;
+ }
+ }
+
+ public DotNetNamingPolicy GetPolicy ()
+ {
+ DirectoryNamespaceAssociation assoc;
+ if (!checkAssociateNamespacesDirectories.Active) {
+ assoc = DirectoryNamespaceAssociation.None;
+ } else {
+ if (radioHierarch.Active) {
+ if (checkDefaultAsRoot.Active)
+ assoc = DirectoryNamespaceAssociation.PrefixedHierarchical;
+ else
+ assoc = DirectoryNamespaceAssociation.Hierarchical;
+ } else {
+ if (checkDefaultAsRoot.Active)
+ assoc = DirectoryNamespaceAssociation.PrefixedFlat;
+ else
+ assoc = DirectoryNamespaceAssociation.Flat;
+ }
+
+ }
+
+ return new DotNetNamingPolicy (assoc, ActiveResourceNamePolicy);
+ }
+
+ [GLib.ConnectBefore]
+ void SuppressClick (object o, ButtonPressEventArgs args)
+ {
+ args.RetVal = true;
+ }
+
+ ResourceNamePolicy ActiveResourceNamePolicy {
+ get {
+ return checkVSStyleResourceNames.Inconsistent
+ ? ResourceNamePolicy.FileFormatDefault
+ : (checkVSStyleResourceNames.Active
+ ? ResourceNamePolicy.MSBuild
+ : ResourceNamePolicy.FileName);
+ }
+ }
+
+ void UpdateNamespaceSensitivity (object sender, EventArgs args)
+ {
+ namespaceAssociationBox.Sensitive = checkAssociateNamespacesDirectories.Active;
+ UpdatePolicyNameList (null, null);
+ }
+
+ void UpdatePreview (object sender, EventArgs args)
+ {
+ previewStore.Clear ();
+ TreeIter iter;
+
+ string rootNamespace = checkDefaultAsRoot.Active? GettextCatalog.GetString ("Default.Namespace") : "";
+
+ Gdk.Pixbuf folderIcon = ImageService.GetPixbuf ("md-open-folder", IconSize.Menu);
+ Gdk.Pixbuf projectIcon = ImageService.GetPixbuf ("md-project", IconSize.Menu);
+ iter = previewStore.AppendValues (projectIcon, GettextCatalog.GetString ("Project"), rootNamespace);
+
+ if (rootNamespace.Length > 0)
+ rootNamespace += ".";
+
+ if (radioFlat.Active) {
+ previewStore.AppendValues (iter, folderIcon, "A", rootNamespace + "A");
+ previewStore.AppendValues (iter, folderIcon, "A.B", rootNamespace + "A.B");
+ } else {
+ iter = previewStore.AppendValues (iter, folderIcon, "A", rootNamespace + "A");
+ previewStore.AppendValues (iter, folderIcon, "B", rootNamespace + "A.B");
+ }
+
+ previewTree.ExpandAll ();
+
+ UpdatePolicyNameList (null, null);
+ }
+
+ protected void UpdatePolicyNameList (object sender, System.EventArgs e)
+ {
+ if (sender == checkVSStyleResourceNames)
+ checkVSStyleResourceNames.Inconsistent = false;
+
+ panel.UpdateSelectedNamedPolicy ();
+ }
+ }
+}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/OutputOptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/OutputOptionsPanel.cs
new file mode 100644
index 0000000000..826e4b70c6
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/OutputOptionsPanel.cs
@@ -0,0 +1,173 @@
+// OutputOptionsPanel.cs
+//
+// Author:
+// Mike Krüger <mkrueger@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using Gtk;
+using MonoDevelop.Core;
+using MonoDevelop.Ide.Gui.Dialogs;
+using MonoDevelop.Projects;
+
+namespace MonoDevelop.Ide.Projects.OptionPanels
+{
+ internal class OutputOptionsPanel : MultiConfigItemOptionsPanel
+ {
+ OutputOptionsPanelWidget widget;
+
+ public OutputOptionsPanel ()
+ {
+ AllowMixedConfigurations = true;
+ }
+
+ public override bool IsVisible ()
+ {
+ return ConfiguredProject is DotNetProject;
+ }
+
+ public override Widget CreatePanelWidget()
+ {
+ return (widget = new OutputOptionsPanelWidget ());
+ }
+
+ public override bool ValidateChanges ()
+ {
+ return widget.ValidateChanges ();
+ }
+
+ public override void LoadConfigData ()
+ {
+ widget.Load (ConfiguredProject, CurrentConfigurations);
+ }
+
+ protected override bool ConfigurationsAreEqual (IEnumerable<ItemConfiguration> configs)
+ {
+ string outAsm = null;
+ string outDir = null;
+ string outDirTemplate = null;
+ OutputOptionsPanelWidget.GetCommonData (configs, out outAsm, out outDir, out outDirTemplate);
+ return outAsm.Length != 0 && (outDir.Length != 0 || outDirTemplate.Length != 0);
+ }
+
+
+ public override void ApplyChanges()
+ {
+ widget.Store ();
+ }
+ }
+
+
+ partial class OutputOptionsPanelWidget : Gtk.Bin
+ {
+ ItemConfiguration[] configurations;
+
+ public OutputOptionsPanelWidget ()
+ {
+ Build ();
+ }
+
+ public void Load (Project project, ItemConfiguration[] configs)
+ {
+ this.configurations = configs;
+ string outAsm = null;
+ string outDir = null;
+ string outDirTemplate = null;
+
+ GetCommonData (configs, out outAsm, out outDir, out outDirTemplate);
+
+ assemblyNameEntry.Text = outAsm;
+
+ outputPathEntry.DefaultPath = project.BaseDirectory;
+ outputPathEntry.Path = !string.IsNullOrEmpty (outDir) ? outDir : outDirTemplate;
+ }
+
+ internal static void GetCommonData (IEnumerable<ItemConfiguration> configs, out string outAsm, out string outDir, out string outDirTemplate)
+ {
+ outAsm = null;
+ outDir = null;
+ outDirTemplate = null;
+
+ foreach (DotNetProjectConfiguration conf in configs) {
+ if (outAsm == null)
+ outAsm = conf.OutputAssembly;
+ else if (outAsm != conf.OutputAssembly)
+ outAsm = "";
+
+ string dirTemplate = conf.OutputDirectory.ToString ().Replace (conf.Name, "$(Configuration)");
+ if (conf.Platform.Length > 0)
+ dirTemplate = dirTemplate.Replace (conf.Platform, "$(Platform)");
+
+ if (outDir == null) {
+ outDir = conf.OutputDirectory;
+ outDirTemplate = dirTemplate;
+ }
+ else {
+ if (outDir != conf.OutputDirectory)
+ outDir = "";
+ if (outDirTemplate != dirTemplate)
+ outDirTemplate = "";
+ }
+ }
+ }
+
+ public bool ValidateChanges ()
+ {
+ if (configurations == null)
+ return true;
+
+ foreach (DotNetProjectConfiguration conf in configurations) {
+ if (assemblyNameEntry.Text.Length == 0 && conf.OutputAssembly.Length == 0) {
+ MessageService.ShowError (GettextCatalog.GetString ("Invalid assembly name specified"));
+ return false;
+ }
+ string dir = outputPathEntry.Path;
+ dir = dir.Replace ("$(Configuration)", conf.Name);
+ dir = dir.Replace ("$(Platform)", conf.Platform);
+ if (!FileService.IsValidPath (dir)) {
+ MessageService.ShowError (GettextCatalog.GetString ("Invalid output directory: {0}", dir));
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public void Store ()
+ {
+ if (configurations == null)
+ return;
+
+ foreach (DotNetProjectConfiguration conf in configurations) {
+ if (assemblyNameEntry.Text.Length > 0)
+ conf.OutputAssembly = assemblyNameEntry.Text;
+ string dir = outputPathEntry.Path;
+ dir = dir.Replace ("$(Configuration)", conf.Name);
+ dir = dir.Replace ("$(Platform)", conf.Platform);
+ conf.OutputDirectory = dir;
+ }
+ }
+ }
+}
+
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/RunOptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/RunOptionsPanel.cs
new file mode 100644
index 0000000000..67a285815a
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/RunOptionsPanel.cs
@@ -0,0 +1,118 @@
+// RunOptionsPanel.cs
+//
+// Author:
+// Lluis Sanchez Gual <lluis@novell.com>
+//
+// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+using System;
+using System.IO;
+
+using MonoDevelop.Projects;
+using MonoDevelop.Ide.Gui.Dialogs;
+using MonoDevelop.Components;
+using MonoDevelop.Core;
+
+using Gtk;
+
+
+namespace MonoDevelop.Ide.Projects.OptionPanels
+{
+ internal class RunOptionsPanel : MultiConfigItemOptionsPanel
+ {
+ RunOptionsPanelWidget widget;
+
+ public override Widget CreatePanelWidget()
+ {
+ return (widget = new RunOptionsPanelWidget ());
+ }
+
+ public override bool ValidateChanges ()
+ {
+ return widget.ValidateChanges ();
+ }
+
+ public override void LoadConfigData ()
+ {
+ widget.Load (ConfiguredProject, (ProjectConfiguration) CurrentConfiguration);
+ }
+
+
+ public override void ApplyChanges()
+ {
+ widget.Store ();
+ }
+ }
+
+ public partial class RunOptionsPanelWidget : Gtk.Bin
+ {
+ ProjectConfiguration configuration;
+
+ public RunOptionsPanelWidget()
+ {
+ this.Build();
+ externalConsoleCheckButton.Toggled += new EventHandler (ExternalConsoleToggle);
+ }
+
+ public void Load (Project project, ProjectConfiguration config)
+ {
+ this.configuration = config;
+
+ parametersEntry.Text = configuration.CommandLineParameters;
+ externalConsoleCheckButton.Active = configuration.ExternalConsole;
+ pauseConsoleOutputCheckButton.Active = configuration.PauseConsoleOutput;
+ pauseConsoleOutputCheckButton.Sensitive = externalConsoleCheckButton.Active;
+
+ envVarList.LoadValues (configuration.EnvironmentVariables);
+ }
+
+ public bool ValidateChanges ()
+ {
+ return true;
+ }
+
+ public void Store ()
+ {
+ if (configuration == null)
+ return;
+
+ configuration.CommandLineParameters = parametersEntry.Text;
+ configuration.ExternalConsole = externalConsoleCheckButton.Active;
+ configuration.PauseConsoleOutput = pauseConsoleOutputCheckButton.Active;
+
+ configuration.EnvironmentVariables.Clear ();
+ envVarList.StoreValues (configuration.EnvironmentVariables);
+ }
+
+ void ExternalConsoleToggle (object sender, EventArgs e)
+ {
+ if (externalConsoleCheckButton.Active) {
+ pauseConsoleOutputCheckButton.Sensitive = true;
+ pauseConsoleOutputCheckButton.Active = true;
+ } else {
+ pauseConsoleOutputCheckButton.Sensitive = false;
+ pauseConsoleOutputCheckButton.Active = false;
+ }
+ }
+ }
+}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/RuntimeOptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/RuntimeOptionsPanel.cs
new file mode 100644
index 0000000000..c6656bf413
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/RuntimeOptionsPanel.cs
@@ -0,0 +1,105 @@
+//
+// RuntimeOptionsPanel.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+
+using MonoDevelop.Projects;
+using MonoDevelop.Ide.Projects;
+using MonoDevelop.Components;
+using MonoDevelop.Core;
+using MonoDevelop.Core.Assemblies;
+
+using Gtk;
+using MonoDevelop.Ide.Gui.Dialogs;
+
+namespace MonoDevelop.Ide.Projects.OptionPanels
+{
+ internal class RuntimeOptionsPanel : ItemOptionsPanel
+ {
+ RuntimeOptionsPanelWidget widget;
+
+ public override bool IsVisible ()
+ {
+ return ConfiguredProject is DotNetProject;
+ }
+
+ public override Widget CreatePanelWidget()
+ {
+ return (widget = new RuntimeOptionsPanelWidget ((DotNetProject)ConfiguredProject, ItemConfigurations));
+ }
+
+ public override void ApplyChanges()
+ {
+ widget.Store ();
+ }
+ }
+
+ partial class RuntimeOptionsPanelWidget : Gtk.Bin
+ {
+ DotNetProject project;
+ ArrayList supportedVersions = new ArrayList ();
+
+ public RuntimeOptionsPanelWidget (DotNetProject project, IEnumerable<ItemConfiguration> configurations)
+ {
+ Build ();
+
+ this.project = project;
+ if (project != null) {
+ // Get the list of available versions, and add only those supported by the target language.
+ foreach (TargetFramework fx in Runtime.SystemAssemblyService.GetTargetFrameworks ()) {
+ if (fx != project.TargetFramework) {
+ if (!project.TargetRuntime.IsInstalled (fx))
+ continue;
+ if (!project.SupportsFramework (fx))
+ continue;
+ }
+ runtimeVersionCombo.AppendText (fx.Name);
+ if (project.TargetFramework == fx)
+ runtimeVersionCombo.Active = supportedVersions.Count;
+ supportedVersions.Add (fx);
+ }
+ if (supportedVersions.Count <= 1)
+ Sensitive = false;
+ }
+ else
+ Sensitive = false;
+ }
+
+ public void Store ()
+ {
+ if (project == null || runtimeVersionCombo.Active == -1)
+ return;
+ TargetFramework fx = (TargetFramework) supportedVersions [runtimeVersionCombo.Active];
+ if (project.TargetFramework != fx)
+ project.TargetFramework = fx;
+ }
+ }
+}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/SolutionItemConfigurationsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/SolutionItemConfigurationsPanel.cs
new file mode 100644
index 0000000000..54ea0daa89
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/SolutionItemConfigurationsPanel.cs
@@ -0,0 +1,184 @@
+//
+// SolutionItemConfigurationsPanel.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Reflection;
+
+using MonoDevelop.Projects;
+using MonoDevelop.Core;
+using MonoDevelop.Components;
+using MonoDevelop.Ide.Gui.Dialogs;
+using Gtk;
+
+namespace MonoDevelop.Ide.Projects.OptionPanels
+{
+ internal class SolutionItemConfigurationsPanel : ItemOptionsPanel
+ {
+ CombineEntryConfigurationsPanelWidget widget;
+
+ public override Widget CreatePanelWidget ()
+ {
+ MultiConfigItemOptionsDialog dlg = (MultiConfigItemOptionsDialog) ParentDialog;
+ return (widget = new CombineEntryConfigurationsPanelWidget (dlg));
+ }
+
+ public override void ApplyChanges()
+ {
+ widget.Store ();
+ }
+ }
+
+ partial class CombineEntryConfigurationsPanelWidget : Gtk.Bin
+ {
+ TreeStore store;
+ ConfigurationData configData;
+
+ public CombineEntryConfigurationsPanelWidget (MultiConfigItemOptionsDialog dlg)
+ {
+ Build ();
+
+ configData = dlg.ConfigurationData;
+
+ store = new TreeStore (typeof(object), typeof(string));
+ configsList.Model = store;
+ configsList.HeadersVisible = true;
+
+ TreeViewColumn col = new TreeViewColumn ();
+ CellRendererText sr = new CellRendererText ();
+ col.PackStart (sr, true);
+ col.AddAttribute (sr, "text", 1);
+ col.Title = GettextCatalog.GetString ("Configuration");
+ configsList.AppendColumn (col);
+
+ foreach (ItemConfiguration cc in configData.Configurations)
+ store.AppendValues (cc, cc.Id);
+
+ addButton.Clicked += new EventHandler (OnAddConfiguration);
+ removeButton.Clicked += new EventHandler (OnRemoveConfiguration);
+ renameButton.Clicked += new EventHandler (OnRenameConfiguration);
+ copyButton.Clicked += new EventHandler (OnCopyConfiguration);
+ }
+
+ void OnAddConfiguration (object sender, EventArgs args)
+ {
+ AddConfiguration (null);
+ }
+
+ void OnCopyConfiguration (object sender, EventArgs args)
+ {
+ Gtk.TreeModel foo;
+ Gtk.TreeIter iter;
+ if (!configsList.Selection.GetSelected (out foo, out iter))
+ return;
+
+ ItemConfiguration cc = (ItemConfiguration) store.GetValue (iter, 0);
+ AddConfiguration (cc.Id);
+ }
+
+ void AddConfiguration (string copyFrom)
+ {
+ NewConfigurationDialog dlg = new NewConfigurationDialog (configData.Configurations);
+ try {
+ bool done = false;
+ do {
+ dlg.TransientFor = this.Toplevel as Gtk.Window;
+ if (dlg.Run () == (int) Gtk.ResponseType.Ok) {
+ ItemConfiguration cc = configData.AddConfiguration (dlg.ConfigName, copyFrom, dlg.CreateChildren);
+ store.AppendValues (cc, cc.Id);
+ done = true;
+ } else
+ done = true;
+ } while (!done);
+ } finally {
+ dlg.Destroy ();
+ }
+ }
+
+ void OnRemoveConfiguration (object sender, EventArgs args)
+ {
+ Gtk.TreeModel foo;
+ Gtk.TreeIter iter;
+ if (!configsList.Selection.GetSelected (out foo, out iter))
+ return;
+
+ if (configData.Configurations.Count == 1) {
+ MessageService.ShowWarning (GettextCatalog.GetString ("There must be at least one configuration."));
+ return;
+ }
+
+ ItemConfiguration cc = (ItemConfiguration) store.GetValue (iter, 0);
+ DeleteConfigDialog dlg = new DeleteConfigDialog ();
+
+ try {
+ dlg.TransientFor = this.Toplevel as Gtk.Window;
+ if (dlg.Run () == (int) Gtk.ResponseType.Yes) {
+ configData.RemoveConfiguration (cc.Id, dlg.DeleteChildren);
+ store.Remove (ref iter);
+ }
+ } finally {
+ dlg.Destroy ();
+ }
+ }
+
+ void OnRenameConfiguration (object sender, EventArgs args)
+ {
+ Gtk.TreeModel foo;
+ Gtk.TreeIter iter;
+ if (!configsList.Selection.GetSelected (out foo, out iter))
+ return;
+
+ ItemConfiguration cc = (ItemConfiguration) store.GetValue (iter, 0);
+ RenameConfigDialog dlg = new RenameConfigDialog (configData.Configurations);
+ dlg.ConfigName = cc.Id;
+
+ try {
+ bool done = false;
+ do {
+ dlg.TransientFor = this.Toplevel as Gtk.Window;
+ if (dlg.Run () == (int) Gtk.ResponseType.Ok) {
+ configData.RenameConfiguration (cc.Id, dlg.ConfigName, dlg.RenameChildren);
+ store.SetValue (iter, 1, cc.Id);
+ done = true;
+ } else
+ done = true;
+ } while (!done);
+ } finally {
+ dlg.Destroy ();
+ }
+ }
+
+ public bool Store()
+ {
+ // Data stored at dialog level
+ return true;
+ }
+ }
+}
+
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/StartupOptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/StartupOptionsPanel.cs
new file mode 100644
index 0000000000..f59a5dcce6
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/StartupOptionsPanel.cs
@@ -0,0 +1,205 @@
+// StartupOptionsPanel.cs
+//
+// Author:
+// Lluis Sanchez Gual <lluis@novell.com>
+//
+// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+using System;
+using System.Collections.Generic;
+using Gtk;
+using MonoDevelop.Projects;
+using MonoDevelop.Core;
+using MonoDevelop.Core.Execution;
+using MonoDevelop.Ide.Gui.Dialogs;
+
+namespace MonoDevelop.Ide.Projects.OptionPanels
+{
+ [System.ComponentModel.Category("MonoDevelop.Projects.Gui")]
+ [System.ComponentModel.ToolboxItem(true)]
+ partial class StartupOptionsPanelWidget : Gtk.Bin
+ {
+ Solution sol;
+ ListStore listStore;
+ List<SolutionEntityItem> startupItems;
+
+ public StartupOptionsPanelWidget (Solution sol)
+ {
+ this.Build();
+ this.sol = sol;
+
+ startupItems = new List<SolutionEntityItem> ();
+ foreach (SolutionEntityItem it in sol.GetAllSolutionItems<SolutionEntityItem> ()) {
+ // Include in the list if it can run in any of the existing execution modes and configurations
+ foreach (IExecutionModeSet mset in Runtime.ProcessService.GetExecutionModes ()) {
+ bool matched = false;
+ foreach (IExecutionMode mode in mset.ExecutionModes) {
+ foreach (SolutionConfiguration sc in sol.Configurations) {
+ if (it.CanExecute (new ExecutionContext (mode, null), sc.Selector)) {
+ startupItems.Add (it);
+ matched = true;
+ break;
+ }
+ }
+ if (matched)
+ break;
+ }
+ if (matched)
+ break;
+ }
+ }
+
+ listStore = new ListStore (typeof(SolutionItem), typeof(bool), typeof(string));
+ treeItems.Model = listStore;
+
+ CellRendererToggle crt = new CellRendererToggle ();
+ treeItems.AppendColumn ("", crt, "active", 1);
+ treeItems.AppendColumn (GettextCatalog.GetString ("Project"), new CellRendererText (), "text", 2);
+
+ if (startupItems.Count > 0) {
+ for (int n=0; n<startupItems.Count; n++) {
+ SolutionEntityItem it = startupItems [n];
+ comboItems.AppendText (it.Name);
+ listStore.AppendValues (it, sol.MultiStartupItems.Contains (it), it.Name);
+ if (sol.StartupItem == it)
+ comboItems.Active = n;
+ }
+ }
+ else {
+ comboItems.AppendText (GettextCatalog.GetString ("The solution does not contain any executable project"));
+ comboItems.Active = 0;
+ comboItems.Sensitive = false;
+ radioMulti.Sensitive = false;
+ radioSingle.Sensitive = false;
+ }
+
+ radioSingle.Active = sol.SingleStartup;
+ radioMulti.Active = !sol.SingleStartup;
+ UpdateButtons ();
+
+ crt.Toggled += OnItemToggled;
+ treeItems.Selection.Changed += OnSelectionChanged;
+ }
+
+ void UpdateButtons ()
+ {
+ TreeIter iter;
+ if (radioSingle.Active || !treeItems.Selection.GetSelected (out iter)) {
+ buttonUp.Sensitive = false;
+ buttonDown.Sensitive = false;
+ }
+ else {
+ TreeIter first;
+ listStore.GetIterFirst (out first);
+ buttonUp.Sensitive = !listStore.GetPath (iter).Equals (listStore.GetPath (first));
+ buttonDown.Sensitive = listStore.IterNext (ref iter);
+ }
+
+ treeItems.Sensitive = !radioSingle.Active;
+ comboItems.Sensitive = radioSingle.Active;
+ }
+
+ void OnItemToggled (object s, ToggledArgs args)
+ {
+ Gtk.TreeIter it;
+ listStore.GetIterFromString (out it, args.Path);
+ bool run = (bool) listStore.GetValue (it, 1);
+ listStore.SetValue (it, 1, !run);
+ }
+
+ protected virtual void OnButtonUpClicked (object sender, System.EventArgs e)
+ {
+ TreeIter iter;
+ if (!treeItems.Selection.GetSelected (out iter))
+ return;
+
+ TreePath tp = listStore.GetPath (iter);
+ Gtk.TreeIter pi;
+ if (tp.Prev () && listStore.GetIter (out pi, tp)) {
+ listStore.Swap (pi, iter);
+ treeItems.ScrollToCell (listStore.GetPath (iter), treeItems.Columns[0], false, 0, 0);
+ UpdateButtons ();
+ }
+ }
+
+ protected virtual void OnButtonDownClicked (object sender, System.EventArgs e)
+ {
+ TreeIter iter;
+ if (!treeItems.Selection.GetSelected (out iter))
+ return;
+
+ TreeIter pit = iter;
+ listStore.IterNext (ref iter);
+ listStore.Swap (pit, iter);
+ treeItems.ScrollToCell (listStore.GetPath (pit), treeItems.Columns[0], false, 0, 0);
+ UpdateButtons ();
+ }
+
+ void OnSelectionChanged (object s, EventArgs args)
+ {
+ UpdateButtons ();
+ }
+
+ public void ApplyChanges ()
+ {
+ sol.SingleStartup = radioSingle.Active;
+ sol.MultiStartupItems.Clear ();
+
+ if (sol.SingleStartup) {
+ if (comboItems.Active != -1 && startupItems.Count > 0)
+ sol.StartupItem = startupItems [comboItems.Active];
+ else
+ sol.StartupItem = null;
+ } else {
+ TreeIter it;
+ if (listStore.GetIterFirst (out it)) {
+ do {
+ if ((bool) listStore.GetValue (it, 1))
+ sol.MultiStartupItems.Add ((SolutionEntityItem) listStore.GetValue (it, 0));
+ } while (listStore.IterNext (ref it));
+ }
+ sol.StartupItem = null;
+ }
+ }
+
+ protected virtual void OnRadioSingleToggled (object sender, System.EventArgs e)
+ {
+ UpdateButtons ();
+ }
+ }
+
+ class StartupOptionsPanel: ItemOptionsPanel
+ {
+ StartupOptionsPanelWidget widget;
+
+ public override Widget CreatePanelWidget ()
+ {
+ return widget = new StartupOptionsPanelWidget (ConfiguredSolution);
+ }
+
+ public override void ApplyChanges ()
+ {
+ widget.ApplyChanges ();
+ }
+ }
+}