Beispiel #1
0
 public DocumentViewer(IWpfCommandService wpfCommandService, IDocumentViewerServiceImpl documentViewerServiceImpl, IMenuService menuService, DocumentViewerControl documentViewerControl)
 {
     if (wpfCommandService == null)
     {
         throw new ArgumentNullException(nameof(wpfCommandService));
     }
     if (documentViewerServiceImpl == null)
     {
         throw new ArgumentNullException(nameof(documentViewerServiceImpl));
     }
     if (menuService == null)
     {
         throw new ArgumentNullException(nameof(menuService));
     }
     if (documentViewerControl == null)
     {
         throw new ArgumentNullException(nameof(documentViewerControl));
     }
     this.wpfCommandService         = wpfCommandService;
     this.documentViewerServiceImpl = documentViewerServiceImpl;
     this.documentViewerControl     = documentViewerControl;
     menuService.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
     menuService.InitializeContextMenu(documentViewerControl, Guid.NewGuid());
     wpfCommandService.Add(ControlConstants.GUID_DOCUMENTVIEWER_UICONTEXT, documentViewerControl);
     documentViewerControl.TextView.Properties.AddProperty(typeof(DocumentViewer), this);
     documentViewerControl.TextView.TextBuffer.Properties.AddProperty(DocumentViewerExtensions.DocumentViewerTextBufferKey, this);
 }
 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;
 }
		public DocumentTabUIContext? Create<T>() where T : class {
			if (typeof(T) == typeof(IDocumentViewer)) {
				var helper = new DocumentViewerHelper();
				var uiCtxCtrl = new DocumentViewerControl(textBufferFactoryService, dsTextEditorFactoryService, helper);
				var uiContext = new DocumentViewer(wpfCommandService, documentViewerServiceImpl, menuService, uiCtxCtrl);
				helper.RealInstance = uiContext;
				documentViewerServiceImpl.RaiseAddedEvent(uiContext);
				return uiContext;
			}
			return null;
		}