Ejemplo n.º 1
0
 public CodeDocumentStorage(CodeDocument owner)
     : base(owner)
 {
     if (owner == null)
     {
         throw new ArgumentNullException("owner");
     }
     this._language = (CodeDocumentLanguage) owner.Language;
 }
Ejemplo n.º 2
0
 public CodeDocumentStorage(CodeDocumentLanguage language)
     : base(null)
 {
     if (language == null)
     {
         throw new ArgumentNullException("language");
     }
     this._language = language;
 }
Ejemplo n.º 3
0
 public CodeDocument(DocumentProjectItem projectItem, CodeDocumentLanguage language)
     : base(projectItem)
 {
     if (language == null)
     {
         throw new ArgumentNullException("language");
     }
     this._language = language;
 }
Ejemplo n.º 4
0
 public DocumentInstanceArguments(string fileName, CodeDocumentLanguage codeLanguage, string namespaceName, string className)
 {
     if ((fileName == null) || (fileName.Length == 0))
     {
         throw new ArgumentNullException("fileName");
     }
     if (codeLanguage == null)
     {
         throw new ArgumentNullException("codeLanguage");
     }
     this._fileName = fileName;
     this._codeLanguage = codeLanguage;
     this._namespaceName = namespaceName;
     this._className = className;
 }
Ejemplo n.º 5
0
 void IDisposable.Dispose()
 {
     if (this._languages != null)
     {
         foreach (DocumentLanguage language in this._languages.Values)
         {
             ((IDisposable) language).Dispose();
         }
         this._languages = null;
     }
     if (this._codeLanguage != null)
     {
         IPreferencesService service = (IPreferencesService) this._serviceProvider.GetService(typeof(IPreferencesService));
         if (service != null)
         {
             service.GetPreferencesStore(typeof(LanguageManager)).SetValue("CodeLanguage", this._codeLanguage.Name, string.Empty);
         }
         this._codeLanguage = null;
     }
     this._serviceProvider = null;
 }
Ejemplo n.º 6
0
 public AddFileDialog(Project project, string location, bool fixedLocation)
     : base(project)
 {
     if (project == null)
     {
         throw new ArgumentNullException("project");
     }
     this.InitializeComponent();
     Bitmap bitmap = new Bitmap(typeof(AddFileDialog), "IconView.bmp");
     bitmap.MakeTransparent(Color.Fuchsia);
     this._iconViewButton.EnabledImage = bitmap;
     bitmap = new Bitmap(typeof(AddFileDialog), "ListView.bmp");
     bitmap.MakeTransparent(Color.Fuchsia);
     this._listViewButton.EnabledImage = bitmap;
     this._project = project;
     if (location != null)
     {
         if (fixedLocation)
         {
             this._location = location;
             this._locationText.ReadOnly = true;
         }
         this._locationText.Text = location;
     }
     this._codeLanguages = new ArrayList();
     ILanguageManager manager = (ILanguageManager) this.GetService(typeof(ILanguageManager));
     if (manager != null)
     {
         foreach (DocumentLanguage language in manager.DocumentLanguages)
         {
             CodeDocumentLanguage language2 = language as CodeDocumentLanguage;
             if (language2 != null)
             {
                 this._codeLanguages.Add(language2);
             }
         }
         this._defaultLanguage = (CodeDocumentLanguage) manager.DefaultCodeLanguage;
     }
     IPreferencesService service = (IPreferencesService) this.GetService(typeof(IPreferencesService));
     if (service != null)
     {
         PreferencesStore preferencesStore = service.GetPreferencesStore(typeof(AddFileDialog));
         if ((preferencesStore != null) && (preferencesStore.GetValue("View", 0) != 0))
         {
             this._listViewButton.Checked = true;
             this._iconViewButton.Checked = false;
             this._templateListView.View = View.List;
         }
     }
 }
Ejemplo n.º 7
0
 protected virtual string GetTemplateFilePath(CodeDocumentLanguage codeLanguage)
 {
     StringBuilder builder = new StringBuilder(0x100);
     string templateFileExtension = this.GetTemplateFileExtension(codeLanguage);
     builder.Append(Path.Combine(this.TemplatesPath, templateFileExtension));
     builder.Append('\\');
     builder.Append(codeLanguage.Name);
     builder.Append('\\');
     builder.Append("NewFile");
     builder.Append('.');
     builder.Append(templateFileExtension);
     return builder.ToString();
 }
Ejemplo n.º 8
0
 protected string GetTemplateFileExtension(CodeDocumentLanguage codeLanguage)
 {
     if ((this.TemplateFlags & Microsoft.Matrix.Core.Documents.TemplateFlags.IsCode) != Microsoft.Matrix.Core.Documents.TemplateFlags.None)
     {
         CodeDomProvider codeDomProvider = codeLanguage.CodeDomProvider;
         if (codeDomProvider != null)
         {
             string fileExtension = codeDomProvider.FileExtension;
             if (fileExtension.StartsWith("."))
             {
                 fileExtension = fileExtension.Substring(1);
             }
             return fileExtension;
         }
     }
     return this.Extension;
 }
Ejemplo n.º 9
0
 public void LoadDocumentLanguages()
 {
     CodeDocumentLanguage language = null;
     PreferencesStore store;
     ICollection config = (ICollection) ConfigurationSettings.GetConfig("microsoft.matrix/documentLanguages");
     if (config != null)
     {
         foreach (string str in config)
         {
             try
             {
                 DocumentLanguage language2 = (DocumentLanguage) Activator.CreateInstance(Type.GetType(str, true));
                 language2.Initialize(this._serviceProvider);
                 this._languages.Add(language2.Name, language2);
                 if (language == null)
                 {
                     language = language2 as CodeDocumentLanguage;
                 }
                 continue;
             }
             catch (Exception)
             {
                 continue;
             }
         }
     }
     IPreferencesService service = (IPreferencesService) this._serviceProvider.GetService(typeof(IPreferencesService));
     if ((service != null) && service.GetPreferencesStore(typeof(LanguageManager), out store))
     {
         string str2 = store.GetValue("CodeLanguage", string.Empty);
         if (str2.Length != 0)
         {
             this._codeLanguage = this._languages[str2] as CodeDocumentLanguage;
         }
     }
     if (this._codeLanguage == null)
     {
         this._codeLanguage = language;
     }
 }
Ejemplo n.º 10
0
 public void SetCurrentCodeLanguage(CodeDocumentLanguage codeLanguage)
 {
     this._codeLanguage = codeLanguage;
 }