Browse Source

Use ToolStripManager.Renderer instead of MenuService.Renderer. Use ProfessionalRenderer+SystemColorTable instead of SystemRenderer.

The "CoreStartup" class now helps starting up the core and enables the core user to change the location of the properties file and some other core settings.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@799 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
aaeea686f3
  1. 7
      src/AddIns/Misc/HtmlHelp2/Project/src/BaseControls/DynamicHelpPad.cs
  2. 18
      src/AddIns/Misc/HtmlHelp2/Project/src/BaseControls/TocPad.cs
  3. 12
      src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs
  4. 1
      src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Gui/SearchAndReplaceDialog.cs
  5. 1
      src/Main/Core/Project/ICSharpCode.Core.csproj
  6. 9
      src/Main/Core/Project/Src/AddInTree/AddInTree.cs
  7. 106
      src/Main/Core/Project/Src/AddInTree/CoreStartup.cs
  8. 17
      src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs
  9. 13
      src/Main/Core/Project/Src/Services/MenuService/MenuService.cs
  10. 2
      src/Main/Core/Project/Src/Services/MessageService/MessageService.cs
  11. 36
      src/Main/Core/Project/Src/Services/PropertyService/PropertyService.cs
  12. 9
      src/Main/Core/Project/Src/Services/ResourceService/ResourceService.cs
  13. 2
      src/Main/Core/Project/Src/Services/StringParser/StringParser.cs
  14. 23
      src/Main/Core/Project/Src/Services/ToolBarService/ToolBarService.cs
  15. 42
      src/Main/StartUp/Project/SharpDevelopMain.cs

7
src/AddIns/Misc/HtmlHelp2/Project/src/BaseControls/DynamicHelpPad.cs

@ -368,7 +368,6 @@ namespace HtmlHelp2
dynamicHelpToolbar.Items.Add(button); dynamicHelpToolbar.Items.Add(button);
} }
this.RenderModeChanged(null, null);
dynamicHelpToolbar.ImageList = new ImageList(); dynamicHelpToolbar.ImageList = new ImageList();
dynamicHelpToolbar.ImageList.ColorDepth = ColorDepth.Depth32Bit; dynamicHelpToolbar.ImageList.ColorDepth = ColorDepth.Depth32Bit;
dynamicHelpToolbar.ImageList.Images.Add(ResourcesHelper.GetBitmap("HtmlHelp2.16x16.Toc.png")); dynamicHelpToolbar.ImageList.Images.Add(ResourcesHelper.GetBitmap("HtmlHelp2.16x16.Toc.png"));
@ -379,7 +378,6 @@ namespace HtmlHelp2
{ {
HtmlHelp2Environment.NamespaceReloaded += new EventHandler(this.NamespaceReloaded); HtmlHelp2Environment.NamespaceReloaded += new EventHandler(this.NamespaceReloaded);
} }
ToolbarService.RendererChanged += new EventHandler(this.RenderModeChanged);
} }
public void LoadDynamicHelpPage() public void LoadDynamicHelpPage()
@ -396,11 +394,6 @@ namespace HtmlHelp2
this.BuildANothing(); this.BuildANothing();
} }
private void RenderModeChanged(object sender, EventArgs e)
{
dynamicHelpToolbar.Renderer = ToolbarService.Renderer;
}
private void ToolStripButtonClicked(object sender, EventArgs e) private void ToolStripButtonClicked(object sender, EventArgs e)
{ {
ToolStripItem item = (ToolStripItem)sender; ToolStripItem item = (ToolStripItem)sender;

18
src/AddIns/Misc/HtmlHelp2/Project/src/BaseControls/TocPad.cs

@ -154,10 +154,6 @@ namespace HtmlHelp2
printTopic.Click += new EventHandler(this.PrintTopic); printTopic.Click += new EventHandler(this.PrintTopic);
printPopup.Items.Add(printChildTopics); printPopup.Items.Add(printChildTopics);
printChildTopics.Click += new EventHandler(this.PrintTopicAndSubtopics); printChildTopics.Click += new EventHandler(this.PrintTopicAndSubtopics);
RenderModeChanged(null, null);
ToolbarService.RendererChanged += new EventHandler(this.RenderModeChanged);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -206,20 +202,6 @@ namespace HtmlHelp2
Controls.Add(nohelpLabel); Controls.Add(nohelpLabel);
} }
private void RenderModeChanged(object sender, EventArgs e)
{
if (ToolbarService.Renderer is ToolStripProfessionalRenderer)
{
ProfessionalColorTable colorTable = new ProfessionalColorTable();
colorTable.UseSystemColors = true;
printPopup.Renderer = new ToolStripProfessionalRenderer(colorTable);
}
else
{
printPopup.Renderer = ToolbarService.Renderer;
}
}
public void LoadToc() public void LoadToc()
{ {
if (!this.controlIsEnabled) return; if (!this.controlIsEnabled) return;

12
src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs

@ -233,11 +233,12 @@ namespace ICSharpCode.SharpDevelop.Gui
public void UpdateRenderer() public void UpdateRenderer()
{ {
bool pro = PropertyService.Get("ICSharpCode.SharpDevelop.Gui.UseProfessionalRenderer", true); bool pro = PropertyService.Get("ICSharpCode.SharpDevelop.Gui.UseProfessionalRenderer", true);
ToolStripRenderer renderer = pro ? (ToolStripRenderer)new ToolStripProfessionalRenderer() : new ToolStripSystemRenderer(); if (pro) {
MenuService.Renderer = renderer; ToolStripManager.Renderer = new ToolStripProfessionalRenderer();
ToolbarService.Renderer = renderer; } else {
if (TopMenu != null) { ProfessionalColorTable colorTable = new ProfessionalColorTable();
TopMenu.Renderer = renderer; colorTable.UseSystemColors = true;
ToolStripManager.Renderer = new ToolStripProfessionalRenderer(colorTable);
} }
} }
@ -471,7 +472,6 @@ namespace ICSharpCode.SharpDevelop.Gui
void CreateMainMenu() void CreateMainMenu()
{ {
TopMenu = new MenuStrip(); TopMenu = new MenuStrip();
TopMenu.Renderer = MenuService.Renderer;
TopMenu.Items.Clear(); TopMenu.Items.Clear();
try { try {
ToolStripItem[] items = (ToolStripItem[])(AddInTree.GetTreeNode(mainMenuPath).BuildChildItems(this)).ToArray(typeof(ToolStripItem)); ToolStripItem[] items = (ToolStripItem[])(AddInTree.GetTreeNode(mainMenuPath).BuildChildItems(this)).ToArray(typeof(ToolStripItem));

1
src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Gui/SearchAndReplaceDialog.cs

@ -64,7 +64,6 @@ namespace SearchAndReplace
toolStrip.Dock = DockStyle.Top; toolStrip.Dock = DockStyle.Top;
toolStrip.Stretch = true; toolStrip.Stretch = true;
toolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; toolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
toolStrip.Renderer = MenuService.Renderer;
searchButton.Text = StringParser.Parse("${res:Dialog.NewProject.SearchReplace.FindDialogName}"); searchButton.Text = StringParser.Parse("${res:Dialog.NewProject.SearchReplace.FindDialogName}");
searchButton.Image = IconService.GetBitmap("Icons.16x16.FindIcon"); searchButton.Image = IconService.GetBitmap("Icons.16x16.FindIcon");

1
src/Main/Core/Project/ICSharpCode.Core.csproj

@ -139,6 +139,7 @@
<Compile Include="Src\Util\ClipboardWrapper.cs" /> <Compile Include="Src\Util\ClipboardWrapper.cs" />
<Compile Include="Src\AddInTree\AddIn\Manifest.cs" /> <Compile Include="Src\AddInTree\AddIn\Manifest.cs" />
<Compile Include="Src\AddInTree\AddIn\AddInReference.cs" /> <Compile Include="Src\AddInTree\AddIn\AddInReference.cs" />
<Compile Include="Src\AddInTree\CoreStartup.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Src\Services\LoggingService" /> <Folder Include="Src\Services\LoggingService" />

9
src/Main/Core/Project/Src/AddInTree/AddInTree.cs

@ -18,8 +18,6 @@ namespace ICSharpCode.Core
/// </summary> /// </summary>
public sealed class AddInTree public sealed class AddInTree
{ {
readonly static string defaultCoreDirectory;
static List<AddIn> addIns = new List<AddIn>(); static List<AddIn> addIns = new List<AddIn>();
static AddInTreeNode rootNode = new AddInTreeNode(); static AddInTreeNode rootNode = new AddInTreeNode();
@ -28,8 +26,6 @@ namespace ICSharpCode.Core
static AddInTree() static AddInTree()
{ {
defaultCoreDirectory = FileUtility.Combine(FileUtility.ApplicationRootPath, "AddIns");
doozers.Add("Class", new ClassDoozer()); doozers.Add("Class", new ClassDoozer());
doozers.Add("FileFilter", new FileFilterDoozer()); doozers.Add("FileFilter", new FileFilterDoozer());
doozers.Add("Icon", new IconDoozer()); doozers.Add("Icon", new IconDoozer());
@ -216,11 +212,6 @@ namespace ICSharpCode.Core
} }
} }
public static void Load()
{
Load(FileUtility.SearchDirectory(defaultCoreDirectory, "*.addin"));
}
public static void Load(List<string> addInFiles) public static void Load(List<string> addInFiles)
{ {
List<AddIn> list = new List<AddIn>(); List<AddIn> list = new List<AddIn>();

106
src/Main/Core/Project/Src/AddInTree/CoreStartup.cs

@ -0,0 +1,106 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 25.11.2005
* Time: 18:56
*/
using System;
using System.Collections.Generic;
using System.IO;
namespace ICSharpCode.Core
{
/// <summary>
/// Class that helps starting up ICSharpCode.Core.
/// </summary>
public class CoreStartup
{
List<string> addInFiles = new List<string>();
string propertiesName;
string configDirectory;
string dataDirectory;
string applicationName;
/// <summary>
/// Sets the name used for the properties (only name, without path or extension).
/// Must be set before StartCoreServices() is called.
/// </summary>
public string PropertiesName {
get {
return propertiesName;
}
set {
if (value == null || value.Length == 0)
throw new ArgumentNullException("value");
propertiesName = value;
}
}
/// <summary>
/// Sets the directory name used for the property service.
/// Must be set before StartCoreServices() is called.
/// Use null to use the default path "ApplicationData\ApplicationName".
/// </summary>
public string ConfigDirectory {
get {
return configDirectory;
}
set {
configDirectory = value;
}
}
/// <summary>
/// Sets the data directory used to load resources.
/// Must be set before StartCoreServices() is called.
/// Use null to use the default path "ApplicationRootPath\data".
/// </summary>
public string DataDirectory {
get {
return dataDirectory;
}
set {
dataDirectory = value;
}
}
public CoreStartup(string applicationName)
{
if (applicationName == null)
throw new ArgumentNullException("applicationName");
this.applicationName = applicationName;
propertiesName = applicationName + "Properties";
MessageService.DefaultMessageBoxTitle = applicationName;
}
public void AddAddInsFromDirectory(string addInDir)
{
addInFiles.AddRange(FileUtility.SearchDirectory(addInDir, "*.addin"));
}
public void RunInitialization()
{
LoggingService.Info("Loading AddInTree...");
AddInTree.Load(addInFiles);
// run workspace autostart commands
LoggingService.Info("Running autostart commands...");
foreach (ICommand command in AddInTree.BuildItems("/Workspace/Autostart", null, false)) {
command.Run();
}
}
public void StartCoreServices()
{
if (configDirectory == null)
configDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
applicationName);
PropertyService.InitializeService(configDirectory,
dataDirectory ?? Path.Combine(FileUtility.ApplicationRootPath, "data"),
propertiesName);
PropertyService.Load();
ResourceService.InitializeService(FileUtility.Combine(PropertyService.DataDirectory, "resources"));
}
}
}

17
src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs

@ -39,33 +39,24 @@ namespace ICSharpCode.Core
/// <summary> /// <summary>
/// A utility class related to file utilities. /// A utility class related to file utilities.
/// </summary> /// </summary>
public sealed class FileUtility public static class FileUtility
{ {
// TODO: GetFullPath is a **very** expensive method (performance-wise)! // TODO: GetFullPath is a **very** expensive method (performance-wise)!
// Call it only when necessary. (see IsEqualFile) // Call it only when necessary. (see IsEqualFile)
readonly static char[] separators = { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar, Path.VolumeSeparatorChar }; readonly static char[] separators = { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar, Path.VolumeSeparatorChar };
static string applicationRootPath; static string applicationRootPath = Environment.CurrentDirectory;
const string fileNameRegEx = @"^([a-zA-Z]:)?[^:]+$"; const string fileNameRegEx = @"^([a-zA-Z]:)?[^:]+$";
public static string ApplicationRootPath { public static string ApplicationRootPath {
get { get {
return applicationRootPath; return applicationRootPath;
} }
} set {
applicationRootPath = value;
static FileUtility()
{
Assembly entryAssembly = Assembly.GetEntryAssembly();
// entryAssembly == null might happen in unit test mode
if (entryAssembly != null) {
applicationRootPath = Path.Combine(Path.GetDirectoryName(entryAssembly.Location), "..");
} else {
applicationRootPath = Environment.CurrentDirectory;
} }
} }
public static string NETFrameworkInstallRoot { public static string NETFrameworkInstallRoot {
get { get {
using (RegistryKey installRootKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\.NETFramework")) { using (RegistryKey installRootKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\.NETFramework")) {

13
src/Main/Core/Project/Src/Services/MenuService/MenuService.cs

@ -20,17 +20,6 @@ namespace ICSharpCode.Core
{ {
public static class MenuService public static class MenuService
{ {
static ToolStripRenderer renderer;
public static ToolStripRenderer Renderer {
get {
return renderer;
}
set {
renderer = value;
}
}
public static void AddItemsToMenu(ToolStripItemCollection collection, object owner, string addInTreePath) public static void AddItemsToMenu(ToolStripItemCollection collection, object owner, string addInTreePath)
{ {
ArrayList buildItems = AddInTree.GetTreeNode(addInTreePath).BuildChildItems(owner); ArrayList buildItems = AddInTree.GetTreeNode(addInTreePath).BuildChildItems(owner);
@ -54,7 +43,6 @@ namespace ICSharpCode.Core
try { try {
ArrayList buildItems = AddInTree.GetTreeNode(addInTreePath).BuildChildItems(owner); ArrayList buildItems = AddInTree.GetTreeNode(addInTreePath).BuildChildItems(owner);
ContextMenuStrip contextMenu = new ContextMenuStrip(); ContextMenuStrip contextMenu = new ContextMenuStrip();
if (Renderer != null) contextMenu.Renderer = Renderer;
contextMenu.Items.Add(new ToolStripMenuItem("dummy")); contextMenu.Items.Add(new ToolStripMenuItem("dummy"));
contextMenu.Opening += delegate { contextMenu.Opening += delegate {
contextMenu.Items.Clear(); contextMenu.Items.Clear();
@ -135,7 +123,6 @@ namespace ICSharpCode.Core
public static void CreateQuickInsertMenu(TextBoxBase targetControl, Control popupControl, string[,] quickInsertMenuItems) public static void CreateQuickInsertMenu(TextBoxBase targetControl, Control popupControl, string[,] quickInsertMenuItems)
{ {
ContextMenuStrip contextMenu = new ContextMenuStrip(); ContextMenuStrip contextMenu = new ContextMenuStrip();
if (Renderer != null) contextMenu.Renderer = Renderer;
for (int i = 0; i < quickInsertMenuItems.GetLength(0); ++i) { for (int i = 0; i < quickInsertMenuItems.GetLength(0); ++i) {
if (quickInsertMenuItems[i, 0] == "-") { if (quickInsertMenuItems[i, 0] == "-") {
contextMenu.Items.Add(new MenuSeparator()); contextMenu.Items.Add(new MenuSeparator());

2
src/Main/Core/Project/Src/Services/MessageService/MessageService.cs

@ -149,7 +149,7 @@ namespace ICSharpCode.Core
} }
} }
static string defaultMessageBoxTitle = "SharpDevelop"; static string defaultMessageBoxTitle = "MessageBox";
public static string DefaultMessageBoxTitle { public static string DefaultMessageBoxTitle {
get { get {

36
src/Main/Core/Project/Src/Services/PropertyService/PropertyService.cs

@ -13,18 +13,27 @@ using System.Xml;
namespace ICSharpCode.Core namespace ICSharpCode.Core
{ {
public sealed class PropertyService public static class PropertyService
{ {
const string propertyFileName = "SharpDevelopProperties.xml"; static string propertyFileName;
const string propertyXmlRootNodeName = "SharpDevelopProperties"; static string propertyXmlRootNodeName;
static string configDirectory = FileUtility.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ".ICSharpCode", "SharpDevelop2") + Path.DirectorySeparatorChar; static string configDirectory;
static string dataDirectory = FileUtility.Combine(FileUtility.ApplicationRootPath, "data"); static string dataDirectory;
static Properties properties = new Properties(); static Properties properties;
static PropertyService() public static void InitializeService(string configDirectory, string dataDirectory, string propertiesName)
{ {
if (properties != null)
throw new InvalidOperationException("Service is already initialized.");
if (configDirectory == null || dataDirectory == null || propertiesName == null)
throw new ArgumentNullException();
properties = new Properties();
PropertyService.configDirectory = configDirectory;
PropertyService.dataDirectory = dataDirectory;
propertyXmlRootNodeName = propertiesName;
propertyFileName = propertiesName + ".xml";
properties.PropertyChanged += new PropertyChangedEventHandler(PropertiesPropertyChanged); properties.PropertyChanged += new PropertyChangedEventHandler(PropertiesPropertyChanged);
} }
@ -40,12 +49,12 @@ namespace ICSharpCode.Core
} }
} }
public static string Get(string property) public static string Get(string property)
{ {
return properties[property]; return properties[property];
} }
public static T Get<T>(string property, T defaultValue) public static T Get<T>(string property, T defaultValue)
{ {
return properties.Get(property, defaultValue); return properties.Get(property, defaultValue);
} }
@ -57,6 +66,8 @@ namespace ICSharpCode.Core
public static void Load() public static void Load()
{ {
if (properties == null)
throw new InvalidOperationException("Service is not initialized.");
if (!Directory.Exists(configDirectory)) { if (!Directory.Exists(configDirectory)) {
Directory.CreateDirectory(configDirectory); Directory.CreateDirectory(configDirectory);
} }
@ -76,10 +87,9 @@ namespace ICSharpCode.Core
using (XmlTextReader reader = new XmlTextReader(fileName)) { using (XmlTextReader reader = new XmlTextReader(fileName)) {
while (reader.Read()){ while (reader.Read()){
if (reader.IsStartElement()) { if (reader.IsStartElement()) {
switch (reader.LocalName) { if (reader.LocalName == propertyXmlRootNodeName) {
case propertyXmlRootNodeName: properties.ReadProperties(reader, propertyXmlRootNodeName);
properties.ReadProperties(reader, propertyXmlRootNodeName); return true;
return true;
} }
} }
} }

9
src/Main/Core/Project/Src/Services/ResourceService/ResourceService.cs

@ -33,11 +33,14 @@ namespace ICSharpCode.Core
static string resourceDirectory; static string resourceDirectory;
public static void InitializeService() public static void InitializeService(string resourceDirectory)
{ {
if (resourceDirectory != null) if (ResourceService.resourceDirectory != null)
throw new InvalidOperationException("Service is already initialized."); throw new InvalidOperationException("Service is already initialized.");
resourceDirectory = FileUtility.Combine(PropertyService.DataDirectory, "resources"); if (resourceDirectory == null)
throw new ArgumentNullException("resourceDirectory");
ResourceService.resourceDirectory = resourceDirectory;
PropertyService.PropertyChanged += new PropertyChangedEventHandler(OnPropertyChange); PropertyService.PropertyChanged += new PropertyChangedEventHandler(OnPropertyChange);
LoadLanguageResources(PropertyService.Get(uiLanguageProperty, Thread.CurrentThread.CurrentUICulture.Name)); LoadLanguageResources(PropertyService.Get(uiLanguageProperty, Thread.CurrentThread.CurrentUICulture.Name));

2
src/Main/Core/Project/Src/Services/StringParser/StringParser.cs

@ -193,7 +193,7 @@ namespace ICSharpCode.Core
if (k <= 0) if (k <= 0)
return null; return null;
string prefix = propertyName.Substring(0, k); string prefix = propertyName.Substring(0, k);
switch (prefix.ToUpper()) { switch (prefix.ToUpperInvariant()) {
case "ENV": case "ENV":
return Environment.GetEnvironmentVariable(propertyName.Substring(k + 1)); return Environment.GetEnvironmentVariable(propertyName.Substring(k + 1));
case "RES": case "RES":

23
src/Main/Core/Project/Src/Services/ToolBarService/ToolBarService.cs

@ -13,23 +13,6 @@ namespace ICSharpCode.Core
{ {
public static class ToolbarService public static class ToolbarService
{ {
static ToolStripRenderer renderer;
public static ToolStripRenderer Renderer {
get {
return renderer;
}
set {
if (renderer != value) {
renderer = value;
if (RendererChanged != null)
RendererChanged(null, EventArgs.Empty);
}
}
}
public static event EventHandler RendererChanged;
public static ToolStripItem[] CreateToolStripItems(object owner, AddInTreeNode treeNode) public static ToolStripItem[] CreateToolStripItems(object owner, AddInTreeNode treeNode)
{ {
return (ToolStripItem[])(treeNode.BuildChildItems(owner)).ToArray(typeof(ToolStripItem)); return (ToolStripItem[])(treeNode.BuildChildItems(owner)).ToArray(typeof(ToolStripItem));
@ -38,7 +21,6 @@ namespace ICSharpCode.Core
public static ToolStrip CreateToolStrip(object owner, AddInTreeNode treeNode) public static ToolStrip CreateToolStrip(object owner, AddInTreeNode treeNode)
{ {
ToolStrip toolStrip = new ToolStrip(); ToolStrip toolStrip = new ToolStrip();
if (Renderer != null) toolStrip.Renderer = Renderer;
toolStrip.Items.AddRange(CreateToolStripItems(owner, treeNode)); toolStrip.Items.AddRange(CreateToolStripItems(owner, treeNode));
UpdateToolbar(toolStrip); // setting Visible is only possible after the items have been added UpdateToolbar(toolStrip); // setting Visible is only possible after the items have been added
new LanguageChangeWatcher(toolStrip); new LanguageChangeWatcher(toolStrip);
@ -51,17 +33,12 @@ namespace ICSharpCode.Core
this.toolStrip = toolStrip; this.toolStrip = toolStrip;
toolStrip.Disposed += Disposed; toolStrip.Disposed += Disposed;
ResourceService.LanguageChanged += OnLanguageChanged; ResourceService.LanguageChanged += OnLanguageChanged;
RendererChanged += OnRendererChanged;
} }
void OnLanguageChanged(object sender, EventArgs e) { void OnLanguageChanged(object sender, EventArgs e) {
ToolbarService.UpdateToolbarText(toolStrip); ToolbarService.UpdateToolbarText(toolStrip);
} }
void OnRendererChanged(object sender, EventArgs e) {
toolStrip.Renderer = Renderer ?? new ToolStripProfessionalRenderer();
}
void Disposed(object sender, EventArgs e) { void Disposed(object sender, EventArgs e) {
ResourceService.LanguageChanged -= OnLanguageChanged; ResourceService.LanguageChanged -= OnLanguageChanged;
RendererChanged -= OnRendererChanged;
} }
} }

42
src/Main/StartUp/Project/SharpDevelopMain.cs

@ -162,17 +162,30 @@ namespace ICSharpCode.SharpDevelop
MessageService.CustomErrorReporter = ShowErrorBox; MessageService.CustomErrorReporter = ShowErrorBox;
#endif #endif
LoggingService.Info("Loading properties...");
PropertyService.Load();
ResourceService.InitializeService();
Assembly exe = typeof(SharpDevelopMain).Assembly; Assembly exe = typeof(SharpDevelopMain).Assembly;
FileUtility.ApplicationRootPath = Path.Combine(Path.GetDirectoryName(exe.Location), "..");
CoreStartup c = new CoreStartup("SharpDevelop");
c.ConfigDirectory = FileUtility.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ".ICSharpCode", "SharpDevelop2") + Path.DirectorySeparatorChar;
LoggingService.Info("Starting core services...");
c.StartCoreServices();
ResourceService.RegisterNeutralStrings(new ResourceManager("Resources.StringResources", exe)); ResourceService.RegisterNeutralStrings(new ResourceManager("Resources.StringResources", exe));
ResourceService.RegisterNeutralImages(new ResourceManager("Resources.BitmapResources", exe)); ResourceService.RegisterNeutralImages(new ResourceManager("Resources.BitmapResources", exe));
RegisterDoozers(); RegisterDoozers();
InitializeCore(); StringParser.RegisterStringTagProvider(new SharpDevelopStringTagProvider());
LoggingService.Info("Looking for AddIns...");
c.AddAddInsFromDirectory(FileUtility.Combine(FileUtility.ApplicationRootPath, "AddIns"));
c.RunInitialization();
LoggingService.Info("Initializing workbench...");
// .NET base autostarts
// taken out of the add-in tree for performance reasons (every tick in startup counts)
WorkbenchSingleton.InitializeWorkbench();
// initialize workbench-dependent services: // initialize workbench-dependent services:
ProjectService.InitializeService(); ProjectService.InitializeService();
@ -234,24 +247,5 @@ namespace ICSharpCode.SharpDevelop
MenuCommand.LinkCommandCreator = delegate(string link) { return new LinkCommand(link); }; MenuCommand.LinkCommandCreator = delegate(string link) { return new LinkCommand(link); };
} }
static void InitializeCore()
{
StringParser.RegisterStringTagProvider(new SharpDevelopStringTagProvider());
LoggingService.Info("Loading AddInTree...");
AddInTree.Load();
// run workspace autostart commands
LoggingService.Info("Running autostart commands...");
foreach (ICommand command in AddInTree.BuildItems("/Workspace/Autostart", null, false)) {
command.Run();
}
LoggingService.Info("Initializing workbench...");
// .NET base autostarts
// taken out of the add-in tree for performance reasons (every tick in startup counts)
WorkbenchSingleton.InitializeWorkbench();
}
} }
} }

Loading…
Cancel
Save