コード例 #1
0
        IWpfTextView IInteractiveWindowEditorFactoryService.CreateTextView(IInteractiveWindow window, ITextBuffer buffer, ITextViewRoleSet roles)
        {
            WpfTestCase.RequireWpfFact($"Creates an IWpfTextView in {nameof(InteractiveWindowEditorsFactoryService)}");

            var textView = _textEditorFactoryService.CreateTextView(buffer, roles);
            return _textEditorFactoryService.CreateTextViewHost(textView, false).TextView;
        }
コード例 #2
0
ファイル: TextViewRoleSet.cs プロジェクト: manojdjoshi/dnSpy
		public ITextViewRoleSet UnionWith(ITextViewRoleSet roleSet) {
			if (roleSet == null)
				throw new ArgumentNullException(nameof(roleSet));
			if (this == roleSet)
				return this;
			return new TextViewRoleSet(new HashSet<string>(roles, StringComparer.OrdinalIgnoreCase));
		}
コード例 #3
0
        IWpfTextView IInteractiveWindowEditorFactoryService.CreateTextView(IInteractiveWindow window, ITextBuffer buffer, ITextViewRoleSet roles)
        {
            var bufferAdapter = _adapterFactory.CreateVsTextBufferAdapterForSecondaryBuffer(_provider, buffer);

            // Create and initialize text view adapter.
            // WARNING: This might trigger various services like IntelliSense, margins, taggers, etc.
            var textViewAdapter = _adapterFactory.CreateVsTextViewAdapter(_provider, roles);

            var commandFilter = new VsInteractiveWindowCommandFilter(_adapterFactory, window, textViewAdapter, bufferAdapter, _oleCommandTargetProviders, _contentTypeRegistry);
            window.Properties[typeof(VsInteractiveWindowCommandFilter)] = commandFilter;
            return commandFilter.TextViewHost.TextView;
        }
コード例 #4
0
 public ElisionBufferDeferredContent(
     SnapshotSpan span,
     IProjectionBufferFactoryService projectionBufferFactoryService,
     IEditorOptionsFactoryService editorOptionsFactoryService,
     ITextEditorFactoryService textEditorFactoryService,
     IContentType contentType = null,
     ITextViewRoleSet roleSet = null)
 {
     _span = span;
     _projectionBufferFactoryService = projectionBufferFactoryService;
     _editorOptionsFactoryService = editorOptionsFactoryService;
     _textEditorFactoryService = textEditorFactoryService;
     _contentType = contentType;
     _roleSet = roleSet ?? _textEditorFactoryService.NoRoles;
 }
コード例 #5
0
        public PreviewFactoryService(
            ITextBufferFactoryService textBufferFactoryService,
            IContentTypeRegistryService contentTypeRegistryService,
            IProjectionBufferFactoryService projectionBufferFactoryService,
            ITextEditorFactoryService textEditorFactoryService,
            IEditorOptionsFactoryService editorOptionsFactoryService,
            ITextDifferencingSelectorService differenceSelectorService,
            IDifferenceBufferFactoryService differenceBufferService,
            IWpfDifferenceViewerFactoryService differenceViewerService)
        {
            _textBufferFactoryService = textBufferFactoryService;
            _contentTypeRegistryService = contentTypeRegistryService;
            _projectionBufferFactoryService = projectionBufferFactoryService;
            _editorOptionsFactoryService = editorOptionsFactoryService;
            _differenceSelectorService = differenceSelectorService;
            _differenceBufferService = differenceBufferService;
            _differenceViewerService = differenceViewerService;

            _previewRoleSet = textEditorFactoryService.CreateTextViewRoleSet(
                TextViewRoles.PreviewRole, PredefinedTextViewRoles.Analyzable);
        }
コード例 #6
0
 protected override IWpfTextView CreateTextView(ITextViewModel viewModel, ITextViewRoleSet roles)
 => Imports.TextEditorFactoryService.CreateTextView(viewModel, roles, Imports.EditorOptionsFactoryService.GlobalOptions);
コード例 #7
0
        IWpfTextView IInteractiveWindowEditorFactoryService.CreateTextView(IInteractiveWindow window, ITextBuffer buffer, ITextViewRoleSet roles)
        {
            WpfTestRunner.RequireWpfFact($"Creates an {nameof(IWpfTextView)} in {nameof(InteractiveWindowEditorsFactoryService)}");

            var textView = _textEditorFactoryService.CreateTextView(buffer, roles);

            return(_textEditorFactoryService.CreateTextViewHost(textView, false).TextView);
        }
コード例 #8
0
 private static bool RolesMatch(
     IEnumerable <string> roles,
     ITextViewRoleSet roleSet)
 {
     return((roles == null) || (roleSet == null) || roleSet.ContainsAll(roles));
 }
コード例 #9
0
 public IWpfTextView CreateTextView(ITextBuffer textBuffer, ITextViewRoleSet roles, IEditorOptions parentOptions) =>
 CreateTextView(textBuffer, roles, parentOptions, null);
コード例 #10
0
 protected abstract TView CreateTextView(ITextViewModel viewModel, ITextViewRoleSet roles);
コード例 #11
0
        protected override async Task <ICocoaDifferenceViewer> CreateDifferenceViewAsync(IDifferenceBuffer diffBuffer, ITextViewRoleSet previewRoleSet, DifferenceViewMode mode, double zoomLevel, CancellationToken cancellationToken)
        {
            var diffViewer = _differenceViewerService.CreateDifferenceView(diffBuffer, previewRoleSet);

            diffViewer.ViewMode = mode;

            // We use ConfigureAwait(true) to stay on the UI thread.
            await diffViewer.SizeToFitAsync(ThreadingContext, cancellationToken : cancellationToken).ConfigureAwait(true);

            return(diffViewer);
        }
コード例 #12
0
		public IDsWpfTextView CreateTextView(ITextViewModel viewModel, ITextViewRoleSet roles, IEditorOptions parentOptions, TextViewCreatorOptions options) {
			if (viewModel == null)
				throw new ArgumentNullException(nameof(viewModel));
			if (roles == null)
				throw new ArgumentNullException(nameof(roles));
			if (parentOptions == null)
				throw new ArgumentNullException(nameof(parentOptions));
			return CreateTextViewImpl(viewModel, roles, parentOptions, options);
		}
コード例 #13
0
        void ShowButtonClick3D(object sender, RoutedEventArgs e)
        {
            // todo: why is zooming weird when that role is supplied?

            ITextViewRoleSet roles     = this.factory.CreateTextViewRoleSet("INTERACTIVE", "STRUCTURED", "DOCUMENT");
            IWpfTextView     localView = this.factory.CreateTextView(this.textBuffer, roles);
            IWpfTextViewHost localHost = this.factory.CreateTextViewHost(localView, false);

            // figure out coordinates based on current view size.
            double height = this.textViewHost.HostControl.ActualHeight;
            double width  = this.textViewHost.HostControl.ActualWidth;

            localHost.HostControl.Height = height;
            localHost.HostControl.Width  = width;

            Point3D upperLeft3D  = new Point3D(-width / 2, height / 2, 0);
            Point3D upperRight3D = new Point3D(width / 2, height / 2, 0);
            Point3D lowerLeft3D  = new Point3D(-width / 2, -height / 2, 0);
            Point3D lowerRight3D = new Point3D(width / 2, -height / 2, 0);

            Viewport3D viewport = new Viewport3D();

            PerspectiveCamera camera = new PerspectiveCamera();

            camera.Position = new Point3D(0, 0, 2000);
            viewport.Camera = camera;

            Viewport2DVisual3D zanyView = new Viewport2DVisual3D();

            zanyView.Visual = localHost.HostControl;

            RotateTransform3D transform = new RotateTransform3D();

            transform.Rotation = new AxisAngleRotation3D(new Vector3D(1, 0, 0), -60);
            zanyView.Transform = transform;

            MeshGeometry3D geo = new MeshGeometry3D();

            // vertices forming a square in the XY plane
            //geo.Positions = new Point3DCollection() { new Point3D(-1, 1, 0), new Point3D(-1, -1, 0), new Point3D(1, -1, 0), new Point3D(1, 1, 0)};
            geo.Positions = new Point3DCollection()
            {
                upperLeft3D, lowerLeft3D, lowerRight3D, upperRight3D
            };

            // two triangles that form the square, counterclockwise vertex list, indices into Positions
            geo.TriangleIndices = new Int32Collection()
            {
                0, 1, 2, 0, 2, 3
            };

            // these are brush coordinates
            geo.TextureCoordinates = new PointCollection()
            {
                new Point(0, 0), new Point(0, 1), new Point(1, 1), new Point(1, 0)
            };
            zanyView.Geometry = geo;

            DiffuseMaterial frontMaterial = new DiffuseMaterial();

            Viewport2DVisual3D.SetIsVisualHostMaterial(frontMaterial, true);
            zanyView.Material = frontMaterial;

            viewport.Children.Add(zanyView);

            ModelVisual3D model = new ModelVisual3D();

            model.Content = new AmbientLight(Colors.White); //, new Vector3D(0, 0, -20));
            viewport.Children.Add(model);

            Window window = new Window();
            Grid   grid   = new Grid();

            grid.Children.Add(viewport);
            window.Content = grid;
            window.Show();
        }
コード例 #14
0
 public ITextViewRoleSet UnionWith(ITextViewRoleSet roleSet)
 {
     return(new TextViewRoleSet(this, roleSet));
 }
コード例 #15
0
ファイル: WpfTextView.cs プロジェクト: manojdjoshi/dnSpy
#pragma warning restore 0169

		public WpfTextView(ITextViewModel textViewModel, ITextViewRoleSet roles, IEditorOptions parentOptions, IEditorOptionsFactoryService editorOptionsFactoryService, ICommandService commandService, ISmartIndentationService smartIndentationService, IFormattedTextSourceFactoryService formattedTextSourceFactoryService, IViewClassifierAggregatorService viewClassifierAggregatorService, ITextAndAdornmentSequencerFactoryService textAndAdornmentSequencerFactoryService, IClassificationFormatMapService classificationFormatMapService, IEditorFormatMapService editorFormatMapService, IAdornmentLayerDefinitionService adornmentLayerDefinitionService, ILineTransformProviderService lineTransformProviderService, ISpaceReservationStackProvider spaceReservationStackProvider, IWpfTextViewConnectionListenerServiceProvider wpfTextViewConnectionListenerServiceProvider, IBufferGraphFactoryService bufferGraphFactoryService, Lazy<IWpfTextViewCreationListener, IDeferrableContentTypeAndTextViewRoleMetadata>[] wpfTextViewCreationListeners) {
			if (textViewModel == null)
				throw new ArgumentNullException(nameof(textViewModel));
			if (roles == null)
				throw new ArgumentNullException(nameof(roles));
			if (parentOptions == null)
				throw new ArgumentNullException(nameof(parentOptions));
			if (editorOptionsFactoryService == null)
				throw new ArgumentNullException(nameof(editorOptionsFactoryService));
			if (commandService == null)
				throw new ArgumentNullException(nameof(commandService));
			if (smartIndentationService == null)
				throw new ArgumentNullException(nameof(smartIndentationService));
			if (formattedTextSourceFactoryService == null)
				throw new ArgumentNullException(nameof(formattedTextSourceFactoryService));
			if (viewClassifierAggregatorService == null)
				throw new ArgumentNullException(nameof(viewClassifierAggregatorService));
			if (textAndAdornmentSequencerFactoryService == null)
				throw new ArgumentNullException(nameof(textAndAdornmentSequencerFactoryService));
			if (classificationFormatMapService == null)
				throw new ArgumentNullException(nameof(classificationFormatMapService));
			if (editorFormatMapService == null)
				throw new ArgumentNullException(nameof(editorFormatMapService));
			if (adornmentLayerDefinitionService == null)
				throw new ArgumentNullException(nameof(adornmentLayerDefinitionService));
			if (lineTransformProviderService == null)
				throw new ArgumentNullException(nameof(lineTransformProviderService));
			if (spaceReservationStackProvider == null)
				throw new ArgumentNullException(nameof(spaceReservationStackProvider));
			if (wpfTextViewCreationListeners == null)
				throw new ArgumentNullException(nameof(wpfTextViewCreationListeners));
			if (wpfTextViewConnectionListenerServiceProvider == null)
				throw new ArgumentNullException(nameof(wpfTextViewConnectionListenerServiceProvider));
			if (bufferGraphFactoryService == null)
				throw new ArgumentNullException(nameof(bufferGraphFactoryService));
			mouseHoverHelper = new MouseHoverHelper(this);
			physicalLineCache = new PhysicalLineCache(32);
			visiblePhysicalLines = new List<PhysicalLine>();
			invalidatedRegions = new List<SnapshotSpan>();
			this.formattedTextSourceFactoryService = formattedTextSourceFactoryService;
			zoomLevel = ZoomConstants.DefaultZoom;
			DsImage.SetZoom(VisualElement, zoomLevel / 100);
			this.adornmentLayerDefinitionService = adornmentLayerDefinitionService;
			this.lineTransformProviderService = lineTransformProviderService;
			this.wpfTextViewCreationListeners = wpfTextViewCreationListeners.Where(a => roles.ContainsAny(a.Metadata.TextViewRoles)).ToArray();
			recreateLineTransformProvider = true;
			normalAdornmentLayerCollection = new AdornmentLayerCollection(this, LayerKind.Normal);
			overlayAdornmentLayerCollection = new AdornmentLayerCollection(this, LayerKind.Overlay);
			underlayAdornmentLayerCollection = new AdornmentLayerCollection(this, LayerKind.Underlay);
			IsVisibleChanged += WpfTextView_IsVisibleChanged;
			Properties = new PropertyCollection();
			TextViewModel = textViewModel;
			BufferGraph = bufferGraphFactoryService.CreateBufferGraph(TextViewModel.VisualBuffer);
			Roles = roles;
			Options = editorOptionsFactoryService.GetOptions(this);
			Options.Parent = parentOptions;
			ViewScroller = new ViewScroller(this);
			hasKeyboardFocus = IsKeyboardFocusWithin;
			oldViewState = new ViewState(this);
			aggregateClassifier = viewClassifierAggregatorService.GetClassifier(this);
			textAndAdornmentSequencer = textAndAdornmentSequencerFactoryService.Create(this);
			classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(this);
			editorFormatMap = editorFormatMapService.GetEditorFormatMap(this);
			spaceReservationStack = spaceReservationStackProvider.Create(this);

			textLayer = new TextLayer(GetAdornmentLayer(PredefinedAdornmentLayers.Text));
			Selection = new TextSelection(this, GetAdornmentLayer(PredefinedAdornmentLayers.Selection), editorFormatMap);
			TextCaret = new TextCaret(this, GetAdornmentLayer(PredefinedAdornmentLayers.Caret), smartIndentationService, classificationFormatMap);

			Children.Add(underlayAdornmentLayerCollection);
			Children.Add(normalAdornmentLayerCollection);
			Children.Add(overlayAdornmentLayerCollection);
			Cursor = Cursors.IBeam;
			Focusable = true;
			FocusVisualStyle = null;
			InitializeOptions();

			Options.OptionChanged += EditorOptions_OptionChanged;
			TextBuffer.ChangedLowPriority += TextBuffer_ChangedLowPriority;
			TextViewModel.DataModel.ContentTypeChanged += DataModel_ContentTypeChanged;
			aggregateClassifier.ClassificationChanged += AggregateClassifier_ClassificationChanged;
			textAndAdornmentSequencer.SequenceChanged += TextAndAdornmentSequencer_SequenceChanged;
			classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged;
			editorFormatMap.FormatMappingChanged += EditorFormatMap_FormatMappingChanged;
			spaceReservationStack.GotAggregateFocus += SpaceReservationStack_GotAggregateFocus;
			spaceReservationStack.LostAggregateFocus += SpaceReservationStack_LostAggregateFocus;

			UpdateBackground();
			CreateFormattedLineSource(ViewportWidth);
			InitializeZoom();
			UpdateRemoveExtraTextLineVerticalPixels();

			if (Roles.Contains(PredefinedTextViewRoles.Interactive))
				RegisteredCommandElement = commandService.Register(VisualElement, this);
			else
				RegisteredCommandElement = NullRegisteredCommandElement.Instance;

			wpfTextViewConnectionListenerServiceProvider.Create(this);
			NotifyTextViewCreated(TextViewModel.DataModel.ContentType, null);
		}
 public ITextViewModel CreateTextViewModel(ITextDataModel dataModel, ITextViewRoleSet roles)
 {
     //Create a projection buffer based on the specified start and end position.
     var projectionBuffer = CreateProjectionBuffer(dataModel);
     //Display this projection buffer in the visual buffer, while still maintaining
     //the full file buffer as the underlying data buffer.
     var textViewModel = new ProjectionTextViewModel(dataModel, projectionBuffer);
     return textViewModel;
 }
コード例 #17
0
        public ITextView CreateTextView(MonoDevelop.Ide.Editor.TextEditor textEditor, ITextViewRoleSet roles = null, IEditorOptions parentOptions = null)
        {
            if (textEditor == null)
            {
                throw new ArgumentNullException("textEditor");
            }

            if (roles == null)
            {
                roles = _defaultRoles;
            }

            ITextBuffer    textBuffer = textEditor.GetContent <Mono.TextEditor.ITextEditorDataProvider>().GetTextEditorData().Document.TextBuffer;
            ITextDataModel dataModel  = new VacuousTextDataModel(textBuffer);

            ITextViewModel viewModel = UIExtensionSelector.InvokeBestMatchingFactory
                                           (TextViewModelProviders,
                                           dataModel.ContentType,
                                           roles,
                                           (provider) => (provider.CreateTextViewModel(dataModel, roles)),
                                           ContentTypeRegistryService,
                                           this.GuardedOperations,
                                           this) ?? new VacuousTextViewModel(dataModel);

            var view = ((MonoDevelop.SourceEditor.SourceEditorView)textEditor.Implementation).TextEditor;

            view.Initialize(viewModel, roles, parentOptions ?? this.EditorOptionsFactoryService.GlobalOptions, this);
            view.Properties.AddProperty(typeof(MonoDevelop.Ide.Editor.TextEditor), textEditor);

            this.TextViewCreated?.Invoke(this, new TextViewCreatedEventArgs(view));

            return(view);
        }
コード例 #18
0
ファイル: MemoryLeakTest.cs プロジェクト: briandonahue/VsVim
 public IVsTextView CreateVsTextViewAdapter(Microsoft.VisualStudio.OLE.Interop.IServiceProvider serviceProvider, ITextViewRoleSet roles)
 {
     throw new NotImplementedException();
 }
コード例 #19
0
        protected override async Task <ICocoaDifferenceViewer> CreateDifferenceViewAsync(IDifferenceBuffer diffBuffer, ITextViewRoleSet previewRoleSet, DifferenceViewMode mode, double zoomLevel, CancellationToken cancellationToken)
        {
            var diffViewer = _differenceViewerService.CreateDifferenceView(diffBuffer, previewRoleSet);

            diffViewer.ViewMode = mode;
            const string DiffOverviewMarginName = "deltadifferenceViewerOverview";

            if (mode == DifferenceViewMode.RightViewOnly)
            {
                diffViewer.RightHost.GetTextViewMargin(DiffOverviewMarginName).VisualElement.Hidden = true;
            }
            else if (mode == DifferenceViewMode.LeftViewOnly)
            {
                diffViewer.LeftHost.GetTextViewMargin(DiffOverviewMarginName).VisualElement.Hidden = true;
            }
            else
            {
                Contract.ThrowIfFalse(mode == DifferenceViewMode.Inline);
                diffViewer.InlineHost.GetTextViewMargin(DiffOverviewMarginName).VisualElement.Hidden = true;
            }

            // We use ConfigureAwait(true) to stay on the UI thread.
            await diffViewer.SizeToFitAsync(ThreadingContext, cancellationToken : cancellationToken).ConfigureAwait(true);

            return(diffViewer);
        }
コード例 #20
0
 /// <summary>
 /// DIFF roles do not have CodeStream margins
 /// </summary>
 /// <param name="roles"></param>
 /// <returns></returns>
 public static bool HasValidMarginRoles(this ITextViewRoleSet roles)
 {
     return(roles.ContainsAll(TextViewRoles.DefaultDocumentRoles) &&
            roles.Intersect(TextViewRoles.InvalidMarginRoles).Any() == false);
 }
コード例 #21
0
        IWpfTextView IInteractiveWindowEditorFactoryService.CreateTextView(IInteractiveWindow window, ITextBuffer buffer, ITextViewRoleSet roles)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            var provider      = (IOleServiceProvider)_provider;
            var bufferAdapter = _adapterFactory.CreateVsTextBufferAdapterForSecondaryBuffer(provider, buffer);

            // Create and initialize text view adapter.
            // WARNING: This might trigger various services like IntelliSense, margins, taggers, etc.
            var textViewAdapter = _adapterFactory.CreateVsTextViewAdapter(provider, roles);

            var commandFilter = new VsInteractiveWindowCommandFilter(_adapterFactory, window, textViewAdapter, bufferAdapter, _oleCommandTargetProviders, _contentTypeRegistry);

            window.Properties[typeof(VsInteractiveWindowCommandFilter)] = commandFilter;
            return(commandFilter.TextViewHost.TextView);
        }
コード例 #22
0
		IDsWpfTextView CreateTextViewImpl(ITextViewModel textViewModel, ITextViewRoleSet roles, IEditorOptions parentOptions, TextViewCreatorOptions options) {
			var wpfTextView = new WpfTextView(textViewModel, roles, parentOptions, editorOptionsFactoryService, commandService, smartIndentationService, formattedTextSourceFactoryService, viewClassifierAggregatorService, textAndAdornmentSequencerFactoryService, classificationFormatMapService, editorFormatMapService, adornmentLayerDefinitionService, lineTransformProviderService, spaceReservationStackProvider, wpfTextViewConnectionListenerServiceProvider, bufferGraphFactoryService, wpfTextViewCreationListeners);

			if (options?.MenuGuid != null) {
				var guidObjectsProvider = new GuidObjectsProvider(wpfTextView, options?.CreateGuidObjects);
				menuService.InitializeContextMenu(wpfTextView.VisualElement, options.MenuGuid.Value, guidObjectsProvider, new ContextMenuInitializer(wpfTextView));
			}

			if (options?.EnableUndoHistory != false)
				textViewUndoManagerProvider.Value.GetTextViewUndoManager(wpfTextView);

			TextViewCreated?.Invoke(this, new TextViewCreatedEventArgs(wpfTextView));

			return wpfTextView;
		}
コード例 #23
0
        protected override async Task <IWpfDifferenceViewer> CreateDifferenceViewAsync(IDifferenceBuffer diffBuffer, ITextViewRoleSet previewRoleSet, DifferenceViewMode mode, double zoomLevel, CancellationToken cancellationToken)
        {
            var diffViewer = _differenceViewerService.CreateDifferenceView(diffBuffer, previewRoleSet);

            const string DiffOverviewMarginName = "deltadifferenceViewerOverview";

            diffViewer.ViewMode = mode;

            if (mode == DifferenceViewMode.RightViewOnly)
            {
                diffViewer.RightView.ZoomLevel *= zoomLevel;
                diffViewer.RightHost.GetTextViewMargin(DiffOverviewMarginName).VisualElement.Visibility = Visibility.Collapsed;
            }
            else if (mode == DifferenceViewMode.LeftViewOnly)
            {
                diffViewer.LeftView.ZoomLevel *= zoomLevel;
                diffViewer.LeftHost.GetTextViewMargin(DiffOverviewMarginName).VisualElement.Visibility = Visibility.Collapsed;
            }
            else
            {
                Contract.ThrowIfFalse(mode == DifferenceViewMode.Inline);
                diffViewer.InlineView.ZoomLevel *= zoomLevel;
                diffViewer.InlineHost.GetTextViewMargin(DiffOverviewMarginName).VisualElement.Visibility = Visibility.Collapsed;
            }

            // Disable focus / tab stop for the diff viewer.
            diffViewer.RightView.VisualElement.Focusable  = false;
            diffViewer.LeftView.VisualElement.Focusable   = false;
            diffViewer.InlineView.VisualElement.Focusable = false;

#pragma warning disable CA2007 // Consider calling ConfigureAwait on the awaited task (containing method uses JTF)
            await diffViewer.SizeToFitAsync(ThreadingContext, cancellationToken : cancellationToken);

#pragma warning restore CA2007 // Consider calling ConfigureAwait on the awaited task

            return(diffViewer);
        }
コード例 #24
0
 public IVsTextView CreateVsTextViewAdapter(OLE.Interop.IServiceProvider serviceProvider, ITextViewRoleSet roles) {
     return CreateVsTextViewAdapter(serviceProvider);
 }
コード例 #25
0
 public IVsTextView CreateVsTextViewAdapter(IServiceProvider serviceProvider, ITextViewRoleSet roles)
 {
     throw new NotImplementedException();
 }
コード例 #26
0
 public IWpfTextView CreateTextView(ITextBuffer textBuffer, ITextViewRoleSet roles) =>
 CreateTextView(textBuffer, roles, (TextViewCreatorOptions)null);
コード例 #27
0
 public WpfDifferenceViewElementFactory(IWpfDifferenceViewerFactoryService diffFactory, ITextEditorFactoryService textEditorFactoryService)
 {
     _diffFactory    = diffFactory;
     _previewRoleSet = textEditorFactoryService.CreateTextViewRoleSet(PredefinedTextViewRoles.Analyzable);
 }
コード例 #28
0
 public IWpfTextView CreateTextView(ITextViewModel viewModel, ITextViewRoleSet roles, IEditorOptions parentOptions) =>
 CreateTextView(viewModel, roles, parentOptions, null);
コード例 #29
0
        public bool IsCompletionSupported(IContentType contentType) => CompletionAvailability.IsAvailable(contentType, roles: null);                                       // This will call HasCompletionProviders among doing other checks

        public bool IsCompletionSupported(IContentType contentType, ITextViewRoleSet textViewRoleSet) => CompletionAvailability.IsAvailable(contentType, textViewRoleSet); // This will call HasCompletionProviders among doing other checks
コード例 #30
0
        IWpfTextView IInteractiveWindowEditorFactoryService.CreateTextView(IInteractiveWindow window, ITextBuffer buffer, ITextViewRoleSet roles)
        {
            var textView = _textEditorFactoryService.CreateTextView(buffer, roles);

            return(_textEditorFactoryService.CreateTextViewHost(textView, false).TextView);
        }
コード例 #31
0
		public IWpfTextView CreateTextView(ITextBuffer textBuffer, ITextViewRoleSet roles) =>
			CreateTextView(textBuffer, roles, (TextViewCreatorOptions)null);
コード例 #32
0
ファイル: MemoryLeakTest.cs プロジェクト: bentayloruk/VsVim
 public IVsTextView CreateVsTextViewAdapter(Microsoft.VisualStudio.OLE.Interop.IServiceProvider serviceProvider, ITextViewRoleSet roles)
 {
     throw new NotImplementedException();
 }
コード例 #33
0
		public IDsWpfTextView CreateTextView(ITextBuffer textBuffer, ITextViewRoleSet roles, TextViewCreatorOptions options) {
			if (textBuffer == null)
				throw new ArgumentNullException(nameof(textBuffer));
			if (roles == null)
				throw new ArgumentNullException(nameof(roles));
			return CreateTextView(new TextDataModel(textBuffer), roles, editorOptionsFactoryService.GlobalOptions, options);
		}
コード例 #34
0
 public ITextViewRoleSet UnionWith(ITextViewRoleSet roleSet)
 {
     return new TextViewRoleSet(this, roleSet);
 }
コード例 #35
0
		public IWpfTextView CreateTextView(ITextBuffer textBuffer, ITextViewRoleSet roles, IEditorOptions parentOptions) =>
			CreateTextView(textBuffer, roles, parentOptions, null);
コード例 #36
0
		public IDsWpfTextView CreateTextView(ITextBuffer textBuffer, ITextViewRoleSet roles, IEditorOptions parentOptions, TextViewCreatorOptions options) {
			if (textBuffer == null)
				throw new ArgumentNullException(nameof(textBuffer));
			if (roles == null)
				throw new ArgumentNullException(nameof(roles));
			if (parentOptions == null)
				throw new ArgumentNullException(nameof(parentOptions));
			return CreateTextView(new TextDataModel(textBuffer), roles, parentOptions, options);
		}
コード例 #37
0
		ITextViewModel CreateTextViewModel(ITextDataModel dataModel, ITextViewRoleSet roles) {
			if (providerSelector == null)
				providerSelector = new ProviderSelector<ITextViewModelProvider, IContentTypeAndTextViewRoleMetadata>(contentTypeRegistryService, textViewModelProviders);
			var contentType = dataModel.ContentType;
			foreach (var p in providerSelector.GetProviders(contentType)) {
				var model = p.Value.CreateTextViewModel(dataModel, roles);
				if (model != null)
					return model;
			}
			return new TextViewModel(dataModel);
		}
コード例 #38
0
ファイル: MockObjectFactory.cs プロジェクト: sehe/VsVim
 public static Mock<ITextView> CreateTextView(
     ITextBuffer textBuffer = null,
     ITextCaret caret = null,
     ITextSelection selection = null,
     ITextViewRoleSet textViewRoleSet = null,
     ITextViewModel textViewModel = null,
     IEditorOptions editorOptions = null,
     IBufferGraph bufferGraph = null,
     PropertyCollection propertyCollection = null,
     MockRepository factory = null)
 {
     factory = factory ?? new MockRepository(MockBehavior.Strict);
     textBuffer = textBuffer ?? CreateTextBuffer(100, factory: factory).Object;
     caret = caret ?? CreateCaret(factory: factory).Object;
     selection = selection ?? CreateSelection(factory: factory).Object;
     propertyCollection = propertyCollection ?? new PropertyCollection();
     textViewRoleSet = textViewRoleSet ?? CreateTextViewRoleSet(factory: factory).Object;
     editorOptions = editorOptions ?? CreateEditorOptions(factory: factory).Object;
     bufferGraph = bufferGraph ?? CreateBufferGraph(factory: factory).Object;
     textViewModel = textViewModel ?? CreateTextViewModel(textBuffer: textBuffer, factory: factory).Object;
     var view = factory.Create<ITextView>();
     view.SetupGet(x => x.Caret).Returns(caret);
     view.SetupGet(x => x.Selection).Returns(selection);
     view.SetupGet(x => x.TextBuffer).Returns(textBuffer);
     view.SetupGet(x => x.TextSnapshot).Returns(() => textBuffer.CurrentSnapshot);
     view.SetupGet(x => x.Properties).Returns(propertyCollection);
     view.SetupGet(x => x.Roles).Returns(textViewRoleSet);
     view.SetupGet(x => x.Options).Returns(editorOptions);
     view.SetupGet(x => x.BufferGraph).Returns(bufferGraph);
     view.SetupGet(x => x.TextViewModel).Returns(textViewModel);
     return view;
 }
コード例 #39
0
		public IWpfTextView CreateTextView(ITextViewModel viewModel, ITextViewRoleSet roles, IEditorOptions parentOptions) =>
			CreateTextView(viewModel, roles, parentOptions, null);
 public IWpfTextView CreateTextView(IInteractiveWindow window, ITextBuffer buffer, ITextViewRoleSet roles) {
     var textView = _textEditorFactoryService.CreateTextView(buffer, roles);
     return _textEditorFactoryService.CreateTextViewHost(textView, false).TextView;
 }
コード例 #41
0
 public ITextViewRoleSet UnionWith(ITextViewRoleSet roleSet)
 {
     _roles.UnionWith(roleSet);
     return(this);
 }