Пример #1
0
 public DocumentViewer(IWpfCommandManager wpfCommandManager, IDocumentViewerServiceImpl documentViewerServiceImpl, IMenuManager menuManager, DocumentViewerControl documentViewerControl)
 {
     if (wpfCommandManager == null)
     {
         throw new ArgumentNullException(nameof(wpfCommandManager));
     }
     if (documentViewerServiceImpl == null)
     {
         throw new ArgumentNullException(nameof(documentViewerServiceImpl));
     }
     if (menuManager == null)
     {
         throw new ArgumentNullException(nameof(menuManager));
     }
     if (documentViewerControl == null)
     {
         throw new ArgumentNullException(nameof(documentViewerControl));
     }
     this.wpfCommandManager         = wpfCommandManager;
     this.documentViewerServiceImpl = documentViewerServiceImpl;
     this.documentViewerControl     = documentViewerControl;
     menuManager.InitializeContextMenu(documentViewerControl.TextView.VisualElement, MenuConstants.GUIDOBJ_DOCUMENTVIEWERCONTROL_GUID, new GuidObjectsProvider(this), new ContextMenuInitializer(documentViewerControl.TextView));
     // Prevent the tab control's context menu from popping up when right-clicking in the textview host margin
     menuManager.InitializeContextMenu(documentViewerControl, Guid.NewGuid());
     wpfCommandManager.Add(ControlConstants.GUID_DOCUMENTVIEWER_UICONTEXT, documentViewerControl);
     documentViewerControl.TextView.Properties.AddProperty(typeof(DocumentViewer), this);
     documentViewerControl.TextView.TextBuffer.Properties.AddProperty(DocumentViewerExtensions.DocumentViewerTextBufferKey, this);
 }
Пример #2
0
 public GoToHelper(DocumentViewerControl owner, SpanData <ReferenceInfo> spanData, bool newTab, bool followLocalRefs, bool canRecordHistory, bool canJumpToReference)
 {
     this.owner              = owner;
     this.spanData           = spanData;
     this.newTab             = newTab;
     this.followLocalRefs    = followLocalRefs;
     this.canRecordHistory   = canRecordHistory;
     this.canJumpToReference = canJumpToReference;
     owner.TextView.ViewportHeightChanged += TextView_ViewportHeightChanged;
 }
Пример #3
0
 public IFileTabUIContext Create <T>() where T : class, IFileTabUIContext
 {
     if (typeof(T) == typeof(IDocumentViewer))
     {
         var helper    = new DocumentViewerHelper();
         var uiCtxCtrl = new DocumentViewerControl(textBufferFactoryService, dnSpyTextEditorFactoryService, helper);
         var uiContext = new DocumentViewer(wpfCommandManager, documentViewerServiceImpl, menuManager, uiCtxCtrl);
         helper.RealInstance = uiContext;
         documentViewerServiceImpl.RaiseAddedEvent(uiContext);
         return(uiContext);
     }
     return(null);
 }