예제 #1
0
        public override void ApplyChanges()
        {
            if (widget.IsChanged)
            {
                try {
                    //need to remove then add, in case we're replacing
                    RemoveUserSchemas();
                    AddUserSchemas();

                    // Update schema associations after we have added any new schemas to the schema manager.
                    foreach (string extension in widget.RemovedExtensions)
                    {
                        XmlEditorOptions.RemoveFileAssociation(extension);
                    }
                    foreach (var item in widget.GetChangedXmlFileAssociations())
                    {
                        XmlEditorOptions.SetFileAssociation(item);
                    }
                } catch (Exception ex) {
                    string msg = MonoDevelop.Core.GettextCatalog.GetString(
                        "Unhandled error saving schema changes.");
                    MonoDevelop.Core.LoggingService.LogError(msg, ex);
                    MonoDevelop.Ide.MessageService.ShowException(ex, msg);
                    return;
                }
            }
        }
 public void Init()
 {
     schemas = new XmlSchemaCompletionCollection();
     defaultXmlSchemaFileExtensions = CreateDefaultXmlSchemaFileExtensions();
     properties   = new Properties();
     associations = new XmlSchemaFileAssociations(properties, defaultXmlSchemaFileExtensions, schemas);
     options      = new XmlEditorOptions(properties);
 }
예제 #3
0
        public override Widget CreatePanelWidget()
        {
            widget = new XmlSchemasPanelWidget();
            widget.LoadUserSchemas(XmlSchemaManager.UserSchemas);

            var assocs = new List <XmlSchemaAssociation> ();

            foreach (string s in XmlFileExtensions.GetExtensions())
            {
                assocs.Add(XmlEditorOptions.GetSchemaAssociation(s));
            }
            widget.AddFileExtensions(assocs);

            return(widget);
        }