static void CreateDefaultProjectContentReferences() { IList <string> defaultReferences = AddInTree.BuildItems <string>("/SharpDevelop/Services/ParserService/SingleFileGacReferences", null, false); foreach (string defaultReference in defaultReferences) { ReferenceProjectItem item = new ReferenceProjectItem(null, defaultReference); defaultProjectContent.AddReferencedContent(ParserService.GetProjectContentForReference(item)); } if (WorkbenchSingleton.Workbench != null) { WorkbenchSingleton.Workbench.ActiveViewContentChanged += delegate { if (WorkbenchSingleton.Workbench.ActiveViewContent != null) { string file = WorkbenchSingleton.Workbench.ActiveViewContent.PrimaryFileName; if (file != null) { IParser parser = GetParser(file); if (parser != null && parser.Language != null) { defaultProjectContent.Language = parser.Language; defaultProjectContent.DefaultImports = parser.Language.CreateDefaultImports(defaultProjectContent); } } } }; } }
void AddReference(ReferenceProjectItem reference, bool updateInterDependencies) { try { AddReferencedContent(ParserService.GetProjectContentForReference(reference)); if (updateInterDependencies) { UpdateReferenceInterDependencies(); } OnReferencedContentsChanged(EventArgs.Empty); } catch (Exception e) { MessageService.ShowError(e); } }
void AddReference(ReferenceProjectItem reference, bool updateInterDependencies) { try { AddReferencedContent(ParserService.GetProjectContentForReference(reference)); if (updateInterDependencies) { UpdateReferenceInterDependencies(); } OnReferencedContentsChanged(EventArgs.Empty); // Refresh the reference if required. // If the user removes the reference and then re-adds it, there might be other references // in the project depending on it, so we do the refresh after the old reference was added. ParserService.RefreshProjectContentForReference(reference); } catch (Exception e) { MessageService.ShowError(e); } }