static void InitializeWorkbench(Workbench workbench, IWorkbenchLayout layout) { SD.Services.AddService(typeof(IWorkbench), workbench); SD.Services.AddService(typeof(IWinFormsService), new WinFormsService()); SD.Services.AddService(typeof(IWinFormsToolbarService), new WinFormsToolbarService()); SD.Services.AddService(typeof(IWinFormsMenuService), new WinFormsMenuService()); SD.Services.AddService(typeof(IProjectService), new SDProjectService()); SD.Services.AddService(typeof(IBuildService), new BuildService()); SD.Services.AddService(typeof(IParserService), new ParserService()); SD.Services.AddService(typeof(IFileService), new FileService()); SD.Services.AddService(typeof(IStatusBarService), new StatusBarService()); SD.Services.AddService(typeof(IMSBuildEngine), new MSBuildEngine()); SD.Services.AddService(typeof(IDisplayBindingService), new DisplayBindingService()); SD.Services.AddService(typeof(IBookmarkManager), new BookmarkManager()); LanguageService.ValidateLanguage(); TaskService.Initialize(); CustomToolsService.Initialize(); workbench.Initialize(); workbench.SetMemento(PropertyService.NestedProperties(workbenchMemento)); workbench.WorkbenchLayout = layout; var applicationStateInfoService = SD.GetService <ApplicationStateInfoService>(); if (applicationStateInfoService != null) { applicationStateInfoService.RegisterStateGetter(activeContentState, delegate { return(SD.Workbench.ActiveContent); }); } WorkbenchSingleton.OnWorkbenchCreated(); // initialize workbench-dependent services: NavigationService.InitializeService(); workbench.ActiveContentChanged += delegate { //Debug.WriteLine("ActiveContentChanged to " + workbench.ActiveContent); LoggingService.Debug("ActiveContentChanged to " + workbench.ActiveContent); }; workbench.ActiveViewContentChanged += delegate { //Debug.WriteLine("ActiveViewContentChanged to " + workbench.ActiveViewContent); LoggingService.Debug("ActiveViewContentChanged to " + workbench.ActiveViewContent); }; workbench.ActiveWorkbenchWindowChanged += delegate { //Debug.WriteLine("ActiveWorkbenchWindowChanged to " + workbench.ActiveWorkbenchWindow); LoggingService.Debug("ActiveWorkbenchWindowChanged to " + workbench.ActiveWorkbenchWindow); }; }
public static void Initialize (IProgressMonitor monitor) { Counters.Initialization.Trace ("Creating Workbench"); workbench = new Workbench (); Counters.Initialization.Trace ("Creating Root Workspace"); workspace = new RootWorkspace (); Counters.Initialization.Trace ("Creating Services"); projectOperations = new ProjectOperations (); helpOperations = new HelpOperations (); commandService = new CommandManager (); ideServices = new IdeServices (); CustomToolService.Init (); AutoTestService.Start (commandService, Preferences.EnableAutomatedTesting); commandService.CommandTargetScanStarted += CommandServiceCommandTargetScanStarted; commandService.CommandTargetScanFinished += CommandServiceCommandTargetScanFinished; KeyBindingService.LoadBindingsFromExtensionPath ("/MonoDevelop/Ide/KeyBindingSchemes"); KeyBindingService.LoadCurrentBindings ("MD2"); commandService.CommandError += delegate (object sender, CommandErrorArgs args) { MessageService.ShowException (args.Exception, args.ErrorMessage); }; FileService.ErrorHandler = FileServiceErrorHandler; monitor.BeginTask (GettextCatalog.GetString("Loading Workbench"), 5); Counters.Initialization.Trace ("Loading Commands"); commandService.LoadCommands ("/MonoDevelop/Ide/Commands"); monitor.Step (1); Counters.Initialization.Trace ("Initializing Workbench"); workbench.Initialize (monitor); monitor.Step (1); InternalLog.EnableErrorNotification (); monitor.Step (1); Counters.Initialization.Trace ("Restoring Workbench State"); workbench.Show ("SharpDevelop.Workbench.WorkbenchMemento"); monitor.Step (1); Counters.Initialization.Trace ("Flushing GUI events"); DispatchService.RunPendingEvents (); Counters.Initialization.Trace ("Flushed GUI events"); MessageService.RootWindow = workbench.RootWindow; commandService.EnableIdleUpdate = true; // Default file format MonoDevelop.Projects.Services.ProjectServiceLoaded += delegate(object sender, EventArgs e) { ((ProjectService)sender).DefaultFileFormatId = IdeApp.Preferences.DefaultProjectFileFormat; }; IdeApp.Preferences.DefaultProjectFileFormatChanged += delegate { IdeApp.Services.ProjectService.DefaultFileFormatId = IdeApp.Preferences.DefaultProjectFileFormat; }; // Perser service initialization MonoDevelop.Projects.Dom.Parser.ProjectDomService.TrackFileChanges = true; MonoDevelop.Projects.Dom.Parser.ProjectDomService.ParseProgressMonitorFactory = new ParseProgressMonitorFactory (); // Startup commands Counters.Initialization.Trace ("Running Startup Commands"); AddinManager.AddExtensionNodeHandler ("/MonoDevelop/Ide/StartupHandlers", OnExtensionChanged); monitor.EndTask (); // Set initial run flags Counters.Initialization.Trace ("Upgrading Settings"); if (PropertyService.Get("MonoDevelop.Core.FirstRun", false)) { isInitialRun = true; PropertyService.Set ("MonoDevelop.Core.FirstRun", false); PropertyService.Set ("MonoDevelop.Core.LastRunVersion", BuildVariables.PackageVersion); PropertyService.Set ("MonoDevelop.Core.LastRunVersion", CurrentRevision); PropertyService.SaveProperties (); } string lastVersion = PropertyService.Get ("MonoDevelop.Core.LastRunVersion", "1.9.1"); int lastRevision = PropertyService.Get ("MonoDevelop.Core.LastRunRevision", 0); if (lastRevision != CurrentRevision && !isInitialRun) { isInitialRunAfterUpgrade = true; if (lastRevision == 0) { switch (lastVersion) { case "1.0": lastRevision = 1; break; case "2.0": lastRevision = 2; break; case "2.2": lastRevision = 3; break; case "2.2.1": lastRevision = 4; break; } } upgradedFromRevision = lastRevision; PropertyService.Set ("MonoDevelop.Core.LastRunVersion", BuildVariables.PackageVersion); PropertyService.Set ("MonoDevelop.Core.LastRunRevision", CurrentRevision); PropertyService.SaveProperties (); } // The ide is now initialized isInitialized = true; if (isInitialRun) { try { OnInitialRun (); } catch (Exception e) { LoggingService.LogError ("Error found while initializing the IDE", e); } } if (isInitialRunAfterUpgrade) { try { OnUpgraded (upgradedFromRevision); } catch (Exception e) { LoggingService.LogError ("Error found while initializing the IDE", e); } } if (initializedEvent != null) initializedEvent (null, EventArgs.Empty); // load previous combine if ((bool)PropertyService.Get("SharpDevelop.LoadPrevProjectOnStartup", false)) { RecentOpen recentOpen = Workbench.RecentOpen; if (recentOpen.RecentProjectsCount > 0) { IdeApp.Workspace.OpenWorkspaceItem(recentOpen.RecentProjects.First ().ToString()).WaitForCompleted (); } } commandService.CommandSelected += OnCommandSelected; commandService.CommandDeselected += OnCommandDeselected; //FIXME: we should really make this on-demand. consumers can display a "loading help cache" message like VS MonoDevelop.Projects.HelpService.AsyncInitialize (); UpdateInstrumentationIcon (); IdeApp.Preferences.EnableInstrumentationChanged += delegate { UpdateInstrumentationIcon (); }; AutoTestService.NotifyEvent ("MonoDevelop.Ide.IdeStart"); }
public static void Initialize(IProgressMonitor monitor) { Counters.Initialization.Trace("Creating Workbench"); workbench = new Workbench(); Counters.Initialization.Trace("Creating Root Workspace"); workspace = new RootWorkspace(); Counters.Initialization.Trace("Creating Services"); projectOperations = new ProjectOperations(); helpOperations = new HelpOperations(); commandService = new CommandManager(); ideServices = new IdeServices(); CustomToolService.Init(); AutoTestService.Start(commandService, Preferences.EnableAutomatedTesting); commandService.CommandTargetScanStarted += CommandServiceCommandTargetScanStarted; commandService.CommandTargetScanFinished += CommandServiceCommandTargetScanFinished; commandService.KeyBindingFailed += KeyBindingFailed; KeyBindingService.LoadBindingsFromExtensionPath("/MonoDevelop/Ide/KeyBindingSchemes"); KeyBindingService.LoadCurrentBindings("MD2"); commandService.CommandError += delegate(object sender, CommandErrorArgs args) { LoggingService.LogInternalError(args.ErrorMessage, args.Exception); }; FileService.ErrorHandler = FileServiceErrorHandler; monitor.BeginTask(GettextCatalog.GetString("Loading Workbench"), 5); Counters.Initialization.Trace("Loading Commands"); commandService.LoadCommands("/MonoDevelop/Ide/Commands"); monitor.Step(1); Counters.Initialization.Trace("Initializing Workbench"); workbench.Initialize(monitor); monitor.Step(1); InternalLog.EnableErrorNotification(); MonoDevelop.Ide.WelcomePage.WelcomePageService.Initialize(); MonoDevelop.Ide.WelcomePage.WelcomePageService.ShowWelcomePage(); monitor.Step(1); Counters.Initialization.Trace("Restoring Workbench State"); workbench.Show("SharpDevelop.Workbench.WorkbenchMemento"); monitor.Step(1); Counters.Initialization.Trace("Flushing GUI events"); DispatchService.RunPendingEvents(); Counters.Initialization.Trace("Flushed GUI events"); MessageService.RootWindow = workbench.RootWindow; commandService.EnableIdleUpdate = true; // Perser service initialization TypeSystemService.TrackFileChanges = true; TypeSystemService.ParseProgressMonitorFactory = new ParseProgressMonitorFactory(); Customizer.OnIdeInitialized(); // Startup commands Counters.Initialization.Trace("Running Startup Commands"); AddinManager.AddExtensionNodeHandler("/MonoDevelop/Ide/StartupHandlers", OnExtensionChanged); monitor.Step(1); monitor.EndTask(); // Set initial run flags Counters.Initialization.Trace("Upgrading Settings"); if (PropertyService.Get("MonoDevelop.Core.FirstRun", false)) { isInitialRun = true; PropertyService.Set("MonoDevelop.Core.FirstRun", false); PropertyService.Set("MonoDevelop.Core.LastRunVersion", BuildInfo.Version); PropertyService.Set("MonoDevelop.Core.LastRunRevision", CurrentRevision); PropertyService.SaveProperties(); } string lastVersion = PropertyService.Get("MonoDevelop.Core.LastRunVersion", "1.9.1"); int lastRevision = PropertyService.Get("MonoDevelop.Core.LastRunRevision", 0); if (lastRevision != CurrentRevision && !isInitialRun) { isInitialRunAfterUpgrade = true; if (lastRevision == 0) { switch (lastVersion) { case "1.0": lastRevision = 1; break; case "2.0": lastRevision = 2; break; case "2.2": lastRevision = 3; break; case "2.2.1": lastRevision = 4; break; } } upgradedFromRevision = lastRevision; PropertyService.Set("MonoDevelop.Core.LastRunVersion", BuildInfo.Version); PropertyService.Set("MonoDevelop.Core.LastRunRevision", CurrentRevision); PropertyService.SaveProperties(); } // The ide is now initialized isInitialized = true; if (isInitialRun) { try { OnInitialRun(); } catch (Exception e) { LoggingService.LogError("Error found while initializing the IDE", e); } } if (isInitialRunAfterUpgrade) { try { OnUpgraded(upgradedFromRevision); } catch (Exception e) { LoggingService.LogError("Error found while initializing the IDE", e); } } if (initializedEvent != null) { initializedEvent(null, EventArgs.Empty); initializedEvent = null; } //FIXME: we should really make this on-demand. consumers can display a "loading help cache" message like VS MonoDevelop.Projects.HelpService.AsyncInitialize(); UpdateInstrumentationIcon(); IdeApp.Preferences.EnableInstrumentationChanged += delegate { UpdateInstrumentationIcon(); }; AutoTestService.NotifyEvent("MonoDevelop.Ide.IdeStart"); }
public static void Initialize (ProgressMonitor monitor) { // Already done in IdeSetup, but called again since unit tests don't use IdeSetup. DispatchService.Initialize (); Counters.Initialization.Trace ("Creating Workbench"); workbench = new Workbench (); Counters.Initialization.Trace ("Creating Root Workspace"); workspace = new RootWorkspace (); Counters.Initialization.Trace ("Creating Services"); projectOperations = new ProjectOperations (); helpOperations = new HelpOperations (); commandService = new CommandManager (); ideServices = new IdeServices (); CustomToolService.Init (); commandService.CommandTargetScanStarted += CommandServiceCommandTargetScanStarted; commandService.CommandTargetScanFinished += CommandServiceCommandTargetScanFinished; commandService.KeyBindingFailed += KeyBindingFailed; KeyBindingService.LoadBindingsFromExtensionPath ("/MonoDevelop/Ide/KeyBindingSchemes"); KeyBindingService.LoadCurrentBindings ("MD2"); commandService.CommandError += delegate (object sender, CommandErrorArgs args) { LoggingService.LogInternalError (args.ErrorMessage, args.Exception); }; FileService.ErrorHandler = FileServiceErrorHandler; monitor.BeginTask (GettextCatalog.GetString("Loading Workbench"), 5); Counters.Initialization.Trace ("Loading Commands"); commandService.LoadCommands ("/MonoDevelop/Ide/Commands"); monitor.Step (1); Counters.Initialization.Trace ("Initializing Workbench"); workbench.Initialize (monitor); monitor.Step (1); MonoDevelop.Ide.WelcomePage.WelcomePageService.Initialize (); MonoDevelop.Ide.WelcomePage.WelcomePageService.ShowWelcomePage (); monitor.Step (1); Counters.Initialization.Trace ("Restoring Workbench State"); workbench.Show ("SharpDevelop.Workbench.WorkbenchMemento"); monitor.Step (1); Counters.Initialization.Trace ("Flushing GUI events"); DispatchService.RunPendingEvents (); Counters.Initialization.Trace ("Flushed GUI events"); MessageService.RootWindow = workbench.RootWindow; commandService.EnableIdleUpdate = true; // Perser service initialization TypeSystemService.TrackFileChanges = true; if (Customizer != null) Customizer.OnIdeInitialized (); // Startup commands Counters.Initialization.Trace ("Running Startup Commands"); AddinManager.AddExtensionNodeHandler ("/MonoDevelop/Ide/StartupHandlers", OnExtensionChanged); monitor.Step (1); monitor.EndTask (); // Set initial run flags Counters.Initialization.Trace ("Upgrading Settings"); if (PropertyService.Get("MonoDevelop.Core.FirstRun", false)) { isInitialRun = true; PropertyService.Set ("MonoDevelop.Core.FirstRun", false); PropertyService.Set ("MonoDevelop.Core.LastRunVersion", BuildInfo.Version); PropertyService.Set ("MonoDevelop.Core.LastRunRevision", CurrentRevision); PropertyService.SaveProperties (); } string lastVersion = PropertyService.Get ("MonoDevelop.Core.LastRunVersion", "1.9.1"); int lastRevision = PropertyService.Get ("MonoDevelop.Core.LastRunRevision", 0); if (lastRevision != CurrentRevision && !isInitialRun) { isInitialRunAfterUpgrade = true; if (lastRevision == 0) { switch (lastVersion) { case "1.0": lastRevision = 1; break; case "2.0": lastRevision = 2; break; case "2.2": lastRevision = 3; break; case "2.2.1": lastRevision = 4; break; } } upgradedFromRevision = lastRevision; PropertyService.Set ("MonoDevelop.Core.LastRunVersion", BuildInfo.Version); PropertyService.Set ("MonoDevelop.Core.LastRunRevision", CurrentRevision); PropertyService.SaveProperties (); } // The ide is now initialized isInitialized = true; if (isInitialRun) { try { OnInitialRun (); } catch (Exception e) { LoggingService.LogError ("Error found while initializing the IDE", e); } } if (isInitialRunAfterUpgrade) { try { OnUpgraded (upgradedFromRevision); } catch (Exception e) { LoggingService.LogError ("Error found while initializing the IDE", e); } } if (initializedEvent != null) { initializedEvent (null, EventArgs.Empty); initializedEvent = null; } //FIXME: we should really make this on-demand. consumers can display a "loading help cache" message like VS MonoDevelop.Projects.HelpService.AsyncInitialize (); UpdateInstrumentationIcon (); IdeApp.Preferences.EnableInstrumentation.Changed += delegate { UpdateInstrumentationIcon (); }; AutoTestService.Start (commandService, Preferences.EnableAutomatedTesting); AutoTestService.NotifyEvent ("MonoDevelop.Ide.IdeStart"); Gtk.LinkButton.SetUriHook ((button, uri) => Xwt.Desktop.OpenUrl (uri)); }
public static async Task Initialize(ProgressMonitor monitor) { // Already done in IdeSetup, but called again since unit tests don't use IdeSetup. DispatchService.Initialize(); // Set initial run flags Counters.Initialization.Trace("Upgrading Settings"); if (PropertyService.Get("MonoDevelop.Core.FirstRun", true)) { isInitialRun = true; PropertyService.Set("MonoDevelop.Core.FirstRun", false); PropertyService.Set("MonoDevelop.Core.LastRunVersion", Runtime.Version.ToString()); PropertyService.SaveProperties(); } string lastVersionString = PropertyService.Get("MonoDevelop.Core.LastRunVersion", "1.0"); Version.TryParse(lastVersionString, out var lastVersion); if (Runtime.Version > lastVersion && !isInitialRun) { isInitialRunAfterUpgrade = true; upgradedFromVersion = lastVersion; PropertyService.Set("MonoDevelop.Core.LastRunVersion", Runtime.Version.ToString()); PropertyService.SaveProperties(); } Counters.Initialization.Trace("Initializing WelcomePage service"); WelcomePage.WelcomePageService.Initialize().Ignore(); Counters.Initialization.Trace("Creating Services"); var serviceInitialization = Task.WhenAll( Runtime.GetService <DesktopService> (), Runtime.GetService <FontService> (), Runtime.GetService <TaskService> (), Runtime.GetService <ProjectOperations> (), Runtime.GetService <TextEditorService> (), Runtime.GetService <NavigationHistoryService> (), Runtime.GetService <DisplayBindingService> (), Runtime.GetService <RootWorkspace> (), Runtime.GetService <HelpOperations> (), Runtime.GetService <HelpService> () ); commandService = await Runtime.GetService <CommandManager> (); await serviceInitialization; Counters.Initialization.Trace("Creating Workbench"); workbench = new Workbench(); Counters.Initialization.Trace("Creating Root Workspace"); CustomToolService.Init(); FileService.ErrorHandler = FileServiceErrorHandler; monitor.BeginTask(GettextCatalog.GetString("Loading Workbench"), 3); // Before startup commands. Counters.Initialization.Trace("Running Pre-Startup Commands"); AddinManager.AddExtensionNodeHandler("/MonoDevelop/Ide/PreStartupHandlers", OnExtensionChanged); monitor.Step(1); Counters.Initialization.Trace("Initializing Workbench"); await workbench.Initialize(monitor); monitor.Step(1); Counters.Initialization.Trace("Realizing Workbench Window"); workbench.Realize(); monitor.Step(1); MessageService.RootWindow = workbench.RootWindow; Xwt.MessageDialog.RootWindow = Xwt.Toolkit.CurrentEngine.WrapWindow(workbench.RootWindow); commandService.EnableIdleUpdate = true; if (Customizer != null) { Customizer.OnIdeInitialized(); } monitor.EndTask(); UpdateInstrumentationIcon(); IdeApp.Preferences.EnableInstrumentation.Changed += delegate { UpdateInstrumentationIcon(); }; AutoTestService.Start(commandService, Preferences.EnableAutomatedTesting); AutoTestService.NotifyEvent("MonoDevelop.Ide.IdeStart"); Gtk.LinkButton.SetUriHook((button, uri) => Xwt.Desktop.OpenUrl(uri)); // Start initializing the type system service in the background Runtime.GetService <TypeSystemService> ().Ignore(); // The ide is now initialized OnInitialized(); }
internal static void Initialize(ProgressMonitor monitor, bool hideWelcomePage) { // Already done in IdeSetup, but called again since unit tests don't use IdeSetup. DispatchService.Initialize(); Counters.Initialization.Trace("Creating Workbench"); workbench = new Workbench(); Counters.Initialization.Trace("Creating Root Workspace"); workspace = new RootWorkspace(); Counters.Initialization.Trace("Creating Services"); projectOperations = new ProjectOperations(); helpOperations = new HelpOperations(); commandService = new CommandManager(); ideServices = new IdeServices(); CustomToolService.Init(); commandService.CommandTargetScanStarted += CommandServiceCommandTargetScanStarted; commandService.CommandTargetScanFinished += CommandServiceCommandTargetScanFinished; commandService.KeyBindingFailed += KeyBindingFailed; KeyBindingService.LoadBindingsFromExtensionPath("/MonoDevelop/Ide/KeyBindingSchemes"); KeyBindingService.LoadCurrentBindings("MD2"); commandService.CommandError += delegate(object sender, CommandErrorArgs args) { LoggingService.LogInternalError(args.ErrorMessage, args.Exception); }; FileService.ErrorHandler = FileServiceErrorHandler; monitor.BeginTask(GettextCatalog.GetString("Loading Workbench"), 5); Counters.Initialization.Trace("Loading Commands"); commandService.LoadCommands("/MonoDevelop/Ide/Commands"); monitor.Step(1); // Before startup commands. Counters.Initialization.Trace("Running Pre-Startup Commands"); AddinManager.AddExtensionNodeHandler("/MonoDevelop/Ide/PreStartupHandlers", OnExtensionChanged); monitor.Step(1); Counters.Initialization.Trace("Initializing Workbench"); workbench.Initialize(monitor); monitor.Step(1); Counters.Initialization.Trace("Initializing WelcomePage service"); MonoDevelop.Ide.WelcomePage.WelcomePageService.Initialize(); monitor.Step(1); Counters.Initialization.Trace("Realizing Workbench Window"); workbench.Realize("SharpDevelop.Workbench.WorkbenchMemento"); monitor.Step(1); MessageService.RootWindow = workbench.RootWindow; Xwt.MessageDialog.RootWindow = Xwt.Toolkit.CurrentEngine.WrapWindow(workbench.RootWindow); commandService.EnableIdleUpdate = true; if (Customizer != null) { Customizer.OnIdeInitialized(hideWelcomePage); } // Startup commands Counters.Initialization.Trace("Running Startup Commands"); AddinManager.AddExtensionNodeHandler("/MonoDevelop/Ide/StartupHandlers", OnExtensionChanged); monitor.Step(1); monitor.EndTask(); // Set initial run flags Counters.Initialization.Trace("Upgrading Settings"); if (PropertyService.Get("MonoDevelop.Core.FirstRun", true)) { isInitialRun = true; PropertyService.Set("MonoDevelop.Core.FirstRun", false); PropertyService.Set("MonoDevelop.Core.LastRunVersion", Runtime.Version.ToString()); PropertyService.SaveProperties(); } string lastVersionString = PropertyService.Get("MonoDevelop.Core.LastRunVersion", "1.0"); Version.TryParse(lastVersionString, out var lastVersion); if (Runtime.Version > lastVersion && !isInitialRun) { isInitialRunAfterUpgrade = true; upgradedFromVersion = lastVersion; PropertyService.Set("MonoDevelop.Core.LastRunVersion", Runtime.Version.ToString()); PropertyService.SaveProperties(); } // The ide is now initialized isInitialized = true; if (initializedEvent != null) { initializedEvent(null, EventArgs.Empty); initializedEvent = null; } //FIXME: we should really make this on-demand. consumers can display a "loading help cache" message like VS MonoDevelop.Projects.HelpService.AsyncInitialize(); UpdateInstrumentationIcon(); IdeApp.Preferences.EnableInstrumentation.Changed += delegate { UpdateInstrumentationIcon(); }; AutoTestService.Start(commandService, Preferences.EnableAutomatedTesting); AutoTestService.NotifyEvent("MonoDevelop.Ide.IdeStart"); Gtk.LinkButton.SetUriHook((button, uri) => Xwt.Desktop.OpenUrl(uri)); }