Esempio n. 1
0
 private void SaveReplInfo(int id, IReplEvaluator evaluator, IContentType contentType, string[] roles, string title, Guid languageServiceGuid, string replId)
 {
     using (var root = GetRegistryRoot()) {
         if (root != null) {
             using (var replInfo = root.CreateSubKey(id.ToString())) {
                 replInfo.SetValue(ContentTypeKey, contentType.TypeName);
                 replInfo.SetValue(TitleKey, title);
                 replInfo.SetValue(ReplIdKey, replId.ToString());
                 replInfo.SetValue(LanguageServiceGuidKey, languageServiceGuid.ToString());
             }
         }
     }
 }
Esempio n. 2
0
 public IReplWindow CreateReplWindow(IReplEvaluator/*!*/ evaluator, IContentType/*!*/ contentType, string[] roles, int id, string/*!*/ title, Guid languageServiceGuid, string replId)
 {
     return CreateReplWindowInternal(evaluator, contentType, roles, id, title, languageServiceGuid, replId);
 }
Esempio n. 3
0
        private ReplWindow CreateReplWindowInternal(IReplEvaluator evaluator, IContentType contentType, string[] roles, int id, string title, Guid languageServiceGuid, string replId)
        {
            var service = (IVsUIShell)ServiceProvider.GlobalProvider.GetService(typeof(SVsUIShell));
            var model = (IComponentModel)ServiceProvider.GlobalProvider.GetService(typeof(SComponentModel));

            SaveReplInfo(id, evaluator, contentType, roles, title, languageServiceGuid, replId);

            var replWindow = new ReplWindow(model, evaluator, contentType, roles, title, languageServiceGuid, replId);

            Guid clsId = replWindow.ToolClsid;
            Guid toolType = typeof(ReplWindow).GUID;
            Guid empty = Guid.Empty;
            IVsWindowFrame frame;

            // we don't pass __VSCREATETOOLWIN.CTW_fMultiInstance because multi instance panes are
            // destroyed when closed.  We are really multi instance but we don't want to be closed.  This
            // seems to work fine.
            ErrorHandler.ThrowOnFailure(
                service.CreateToolWindow(
                    (uint)(__VSCREATETOOLWIN.CTW_fInitNew | __VSCREATETOOLWIN.CTW_fForceCreate),
                    (uint)id,
                    replWindow.GetIVsWindowPane(),
                    ref clsId,
                    ref toolType,
                    ref empty,
                    null,
                    title,
                    null,
                    out frame
                )
            );

            replWindow.Frame = frame;

            replWindow.OnToolBarAdded();
            _windows[id] = replWindow;

            return replWindow;
        }