public CombineOptionsDialog(Gtk.Window parentWindow, Combine combine, IAddInTreeNode node, IAddInTreeNode configurationNode)
            : base(parentWindow, null, null)
        {
            this.combine = combine;
            this.configurationNode = configurationNode;
            this.Title = GettextCatalog.GetString ("Combine Options");

            configData = ConfigurationData.Build (combine);
            configData.ConfigurationsChanged += new EventHandler (OnConfigChanged);

            properties = new DefaultProperties();
            properties.SetProperty ("Combine", combine);
            properties.SetProperty ("CombineConfigData", configData);

            AddNodes (properties, Gtk.TreeIter.Zero, node.BuildChildItems (this));

            SelectFirstNode ();
        }
        public UnitTestOptionsDialog(Gtk.Window parent, UnitTest test)
            : base(parent, null, null)
        {
            IAddInTreeNode node = AddInTreeSingleton.AddInTree.GetTreeNode("/SharpDevelop/Workbench/UnitTestOptions/GeneralOptions");
            configurationNode = AddInTreeSingleton.AddInTree.GetTreeNode("/SharpDevelop/Workbench/UnitTestOptions/ConfigurationProperties");

            this.test = test;
            this.Title = GettextCatalog.GetString ("Unit Test Options");

            properties = new DefaultProperties();
            properties.SetProperty ("UnitTest", test);
            AddNodes (properties, Gtk.TreeIter.Zero, node.BuildChildItems (this));
            SelectFirstNode ();
        }
        Gtk.CellRendererText textRenderer; // used to set an editable node

        #endregion Fields

        #region Constructors

        public ProjectOptionsDialog(Gtk.Window parentWindow, Project project, IAddInTreeNode node, IAddInTreeNode configurationNode)
            : base(parentWindow, null, null)
        {
            this.project = project;
            this.configurationNode = configurationNode;
            this.Title = GettextCatalog.GetString ("Project Options");

            properties = new DefaultProperties();
            properties.SetProperty("Project", project);

            AddNodes(properties, Gtk.TreeIter.Zero, node.BuildChildItems(this));

            //
            // This code has to add treeview node items to the treeview. under a configuration node
            //
            AddConfigurationNodes();

            //TreeView.ButtonReleaseEvent += new EventHandler (OnButtonRelease);

            SelectFirstNode ();
        }
        void SaveCombinePreferences(Combine combine)
        {
            string combinefilename = combine.FileName;
            string directory = Runtime.Properties.ConfigDirectory + "CombinePreferences";

            if (!Directory.Exists(directory)) {
                Runtime.FileService.CreateDirectory(directory);
            }
            string combinepath = Path.GetDirectoryName(combinefilename);
            XmlDocument doc = new XmlDocument();
            doc.LoadXml("<?xml version=\"1.0\"?>\n<UserCombinePreferences/>");

            XmlAttribute fileNameAttribute = doc.CreateAttribute("filename");
            fileNameAttribute.InnerText = combinefilename;
            doc.DocumentElement.Attributes.Append(fileNameAttribute);

            XmlElement filesnode = doc.CreateElement("Files");
            doc.DocumentElement.AppendChild(filesnode);

            foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection) {
                if (content.ContentName != null) {
                    XmlElement el = doc.CreateElement("File");

                    XmlAttribute attr = doc.CreateAttribute("filename");
                    attr.InnerText = fileUtilityService.AbsoluteToRelativePath(combinepath, content.ContentName);
                    el.Attributes.Append(attr);

                    filesnode.AppendChild(el);
                }
            }

            XmlElement viewsnode = doc.CreateElement("Views");
            doc.DocumentElement.AppendChild(viewsnode);

            foreach (IPadContent view in WorkbenchSingleton.Workbench.PadContentCollection) {
                if (view is IMementoCapable) {
                    XmlElement el = doc.CreateElement("ViewMemento");
                    el.SetAttribute ("Id", view.Id);
                    el.AppendChild(((IMementoCapable)view).CreateMemento().ToXmlElement(doc));
                    viewsnode.AppendChild(el);
                }
            }

            IProperties properties = new DefaultProperties();
            string name = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow == null ? String.Empty : WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName;
            properties.SetProperty("ActiveWindow", name == null ? String.Empty : name);
            properties.SetProperty("ActiveConfiguration", combine.ActiveConfiguration == null ? String.Empty : combine.ActiveConfiguration.Name);

            XmlElement propertynode = doc.CreateElement("Properties");
            doc.DocumentElement.AppendChild(propertynode);

            propertynode.AppendChild(properties.ToXmlElement(doc));

            fileUtilityService.ObservedSave(new NamedFileOperationDelegate(doc.Save), directory + Path.DirectorySeparatorChar + combine.Name + ".xml", FileErrorPolicy.ProvideAlternative);
        }
        void AddConfigurationNodes()
        {
            configurationTreeNode = treeStore.AppendValues (GettextCatalog.GetString ("Configurations"), null);

            foreach (IConfiguration config in project.Configurations) {
                Gtk.TreeIter newNode ;

                if (config == project.ActiveConfiguration) {
                    newNode = treeStore.AppendValues (configurationTreeNode, config.Name + " " + GettextCatalog.GetString ("(Active)"), config);
                    //newNode.NodeFont = boldFont;
                } else {
                    newNode = treeStore.AppendValues (configurationTreeNode, config.Name, config);
                    //newNode.NodeFont = plainFont;
                }

                DefaultProperties configNodeProperties = new DefaultProperties();
                configNodeProperties.SetProperty("Project", project);
                configNodeProperties.SetProperty("Config", config);
                AddNodes(configNodeProperties, newNode, configurationNode.BuildChildItems(this));
            }
        }
        void FillConfigurations(Gtk.TreeIter configIter)
        {
            foreach (string name in test.GetConfigurations ()) {
                DefaultProperties configNodeProperties = new DefaultProperties();
                configNodeProperties.SetProperty("UnitTest", test);
                configNodeProperties.SetProperty("Config", name);

                ArrayList list = configurationNode.BuildChildItems (this);
                if (list.Count > 1) {
                    Gtk.TreeIter newNode = AddPath (name, configIter);
                    AddNodes (configNodeProperties, newNode, list);
                } else {
                    AddNode (name, configNodeProperties, configIter, (IDialogPanelDescriptor) list [0]);
                }
            }
        }
        void FillConfigurations()
        {
            foreach (IConfiguration config in configData.Configurations) {
                DefaultProperties configNodeProperties = new DefaultProperties();
                configNodeProperties.SetProperty("Combine", combine);
                configNodeProperties.SetProperty("Config", config);

                ArrayList list = configurationNode.BuildChildItems (this);
                if (list.Count > 1) {
                    Gtk.TreeIter newNode = AddPath (config.Name, configIter);
                    AddNodes (configNodeProperties, newNode, list);
                } else {
                    AddNode (config.Name, configNodeProperties, configIter, (IDialogPanelDescriptor) list [0]);
                }
            }
        }
        public string CreateProject(ProjectCreateInformation projectCreateInformation)
        {
            this.projectCreateInformation = projectCreateInformation;

            if (wizardpath != null) {
            //              TODO: WIZARD
                IProperties customizer = new DefaultProperties();
                customizer.SetProperty("ProjectCreateInformation", projectCreateInformation);
                customizer.SetProperty("ProjectTemplate", this);
                //WizardDialog wizard = new WizardDialog("Project Wizard", customizer, wizardpath);
                //if (wizard.ShowDialog() == DialogResult.OK) {
                //	lastCombine = combineDescriptor.CreateCombine(projectCreateInformation, this.languagename);
                //} else {
                //	return null;
                //}
            } else {
                lastCombine = combineDescriptor.CreateEntry (projectCreateInformation, this.languagename);
            }

            return lastCombine;
        }