Пример #1
0
        public FileChange(TextDocument left,
            TextDocument right,
            IComponentModel componentModel,
            AbstractChange parent,
            PreviewEngine engine,
            IVsImageService2 imageService) : base(engine)
        {
            Contract.ThrowIfFalse(left != null || right != null);

            this.Id = left != null ? left.Id : right.Id;
            _left = left;
            _right = right;
            _imageService = imageService;

            _componentModel = componentModel;
            var bufferFactory = componentModel.GetService<ITextBufferFactoryService>();
            var bufferText = left != null ?
                left.GetTextAsync(CancellationToken.None).WaitAndGetResult(CancellationToken.None) :
                right.GetTextAsync(CancellationToken.None).WaitAndGetResult(CancellationToken.None);
            _buffer = bufferFactory.CreateTextBuffer(bufferText.ToString(), bufferFactory.InertContentType);
            _encoding = bufferText.Encoding;

            this.Children = ComputeChildren(left, right, CancellationToken.None);
            this.parent = parent;
        }
Пример #2
0
 protected ReferenceChange(ProjectId projectId, string projectName, bool isAddedReference, PreviewEngine engine)
     : base(engine)
 {
     _projectId = projectId;
     _projectName = projectName;
     _isAddedReference = isAddedReference;
 }
Пример #3
0
 public Solution PreviewChanges(
     string title,
     string helpString,
     string description,
     string topLevelName,
     Glyph topLevelGlyph,
     Solution newSolution,
     Solution oldSolution,
     bool showCheckBoxes = true)
 {
     var engine = new PreviewEngine(
         title,
         helpString,
         description,
         topLevelName,
         topLevelGlyph,
         newSolution,
         oldSolution,
         _componentModel,
         _imageService,
         showCheckBoxes);
     _previewChanges.PreviewChanges(engine);
     engine.CloseWorkspace();
     return engine.FinalSolution;
 }
Пример #4
0
 public AbstractChange(PreviewEngine engine)
 {
     this.engine = engine;
     if (engine.ShowCheckBoxes)
     {
         CheckState = __PREVIEWCHANGESITEMCHECKSTATE.PCCS_Checked;
     }
     else
     {
         CheckState = __PREVIEWCHANGESITEMCHECKSTATE.PCCS_None;
     }
 }
Пример #5
0
 public SpanChange(ITrackingSpan span, ITextBuffer buffer, DocumentId id, string text, string leftText, string rightText, bool isDeletion, AbstractChange parent, PreviewEngine engine)
     : base(engine)
 {
     _span = span;
     _id = id;
     _buffer = buffer;
     _text = text;
     this.parent = parent;
     _rightText = rightText;
     _leftText = leftText;
     _isDeletion = isDeletion;
     this.Children = new ChangeList(new AbstractChange[0]);
 }
Пример #6
0
 public TopLevelChange(
     string name,
     Glyph glyph,
     Solution newSolution,
     Solution oldSolution,
     IComponentModel componentModel,
     PreviewEngine engine)
     : base(engine)
 {
     _name = name;
     _glyph = glyph;
     _componentModel = componentModel;
     _newSolution = newSolution;
     _oldSolution = oldSolution;
 }
Пример #7
0
        public static void AppendReferenceChanges(IEnumerable<ProjectChanges> projectChangesList, PreviewEngine engine, ArrayBuilder<AbstractChange> builder)
        {
            foreach (var projectChanges in projectChangesList)
            {
                var projectId = projectChanges.ProjectId;
                var oldSolution = projectChanges.OldProject.Solution;
                var newSolution = projectChanges.NewProject.Solution;
                var projectName = oldSolution.GetProject(projectId).Name;

                // Metadata references
                var addedMetadataReferenceChanges = projectChanges
                    .GetAddedMetadataReferences()
                    .Select(r => new MetadataReferenceChange(r, projectId, projectName, isAdded: true, engine: engine));
                builder.AddRange(addedMetadataReferenceChanges);

                var removedMetadataReferenceChanges = projectChanges
                    .GetRemovedMetadataReferences()
                    .Select(r => new MetadataReferenceChange(r, projectId, projectName, isAdded: false, engine: engine));
                builder.AddRange(removedMetadataReferenceChanges);

                // Project references
                var addedProjectReferenceChanges = projectChanges
                    .GetAddedProjectReferences()
                    .Select(r => new ProjectReferenceChange(r, newSolution.GetProject(r.ProjectId).Name, projectId, projectName, isAdded: true, engine: engine));
                builder.AddRange(addedProjectReferenceChanges);

                var removedProjectReferenceChanges = projectChanges
                    .GetRemovedProjectReferences()
                    .Select(r => new ProjectReferenceChange(r, oldSolution.GetProject(r.ProjectId).Name, projectId, projectName, isAdded: false, engine: engine));
                builder.AddRange(removedProjectReferenceChanges);

                // Analyzer references
                var addedAnalyzerReferenceChanges = projectChanges
                    .GetAddedAnalyzerReferences()
                    .Select(r => new AnalyzerReferenceChange(r, projectId, projectName, isAdded: true, engine: engine));
                builder.AddRange(addedAnalyzerReferenceChanges);

                var removedAnalyzerReferenceChanges = projectChanges
                    .GetRemovedAnalyzerReferences()
                    .Select(r => new AnalyzerReferenceChange(r, projectId, projectName, isAdded: false, engine: engine));
                builder.AddRange(removedAnalyzerReferenceChanges);
            }
        }
Пример #8
0
 public NoChange(PreviewEngine engine) : base(engine)
 {
 }
 public MetadataReferenceChange(MetadataReference reference, ProjectId projectId, string projectName, bool isAdded, PreviewEngine engine)
     : base(projectId, projectName, isAdded, engine)
 {
     _reference = reference;
 }
 public ProjectReferenceChange(ProjectReference reference, string projectReferenceName, ProjectId projectId, string projectName, bool isAdded, PreviewEngine engine)
     : base(projectId, projectName, isAdded, engine)
 {
     _reference = reference;
     _projectReferenceName = projectReferenceName;
 }