Exemple #1
0
        public static void InitializeWorkbench(IWorkbench workbench, IWorkbenchLayout layout)
        {
            WorkbenchSingleton.workbench = workbench;

            LanguageService.ValidateLanguage();

            DisplayBindingService.InitializeService();
            LayoutConfiguration.LoadLayoutConfiguration();
            FileService.InitializeService();

            //by hanz
            //DomHostCallback.Register(); // must be called after StatusBarService.Initialize()
            //ParserService.InitializeParserService();
            //TaskService.Initialize();
            //Bookmarks.BookmarkManager.Initialize();
            //Project.CustomToolsService.Initialize();
            //Project.BuildModifiedProjectsOnlyService.Initialize();

            var messageService = ICSharpCode.Core.Services.ServiceManager.Instance.MessageService as IDialogMessageService;

            if (messageService != null)
            {
                messageService.DialogOwner = workbench.MainWin32Window;
                Debug.Assert(messageService.DialogOwner != null);
                messageService.DialogSynchronizeInvoke = workbench.SynchronizingObject;
            }

            workbench.Initialize();
            workbench.SetMemento(PropertyService.Get(workbenchMemento, new Properties()));
            workbench.WorkbenchLayout = layout;

            ApplicationStateInfoService.RegisterStateGetter(activeContentState, delegate { return(WorkbenchSingleton.Workbench.ActiveContent); });

            OnWorkbenchCreated();

            // initialize workbench-dependent services:
            //Project.ProjectService.InitializeService();//by hanz
            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);
            };
        }