Esempio n. 1
0
        public override void Recalculate()
        {
            if (IsDismissed)
            {
                throw new InvalidOperationException();
            }
            IsStarted = true;

            DisposeQuickInfoSources();
            quickInfoSources = CreateQuickInfoSources();

            var newContent       = new List <object>();
            var applicableToSpan = default(HexBufferSpanSelection);

            foreach (var source in quickInfoSources)
            {
                HexBufferSpanSelection applicableToSpanTmp;
                source.AugmentQuickInfoSession(this, newContent, out applicableToSpanTmp);
                if (IsDismissed)
                {
                    return;
                }
                if (applicableToSpan.IsDefault)
                {
                    applicableToSpan = applicableToSpanTmp;
                }
            }

            if (newContent.Count == 0 || applicableToSpan.IsDefault)
            {
                Dismiss();
            }
            else
            {
                QuickInfoContent.BeginBulkOperation();
                QuickInfoContent.Clear();
                QuickInfoContent.AddRange(newContent);
                QuickInfoContent.EndBulkOperation();

                hasInteractiveContent = CalculateHasInteractiveContent();
                SetApplicableToSpan(applicableToSpan);
                if (quickInfoPresenter == null)
                {
                    quickInfoPresenter = intellisensePresenterFactoryService.TryCreateIntellisensePresenter(this);
                    if (quickInfoPresenter == null)
                    {
                        Dismiss();
                        return;
                    }
                    PresenterChanged?.Invoke(this, EventArgs.Empty);
                }
            }
            Recalculated?.Invoke(this, EventArgs.Empty);
        }
Esempio n. 2
0
		public override void Recalculate() {
			if (IsDismissed)
				throw new InvalidOperationException();
			IsStarted = true;

			DisposeQuickInfoSources();
			quickInfoSources = CreateQuickInfoSources();

			var newContent = new List<object>();
			var applicableToSpan = default(HexBufferSpanSelection);
			foreach (var source in quickInfoSources) {
				HexBufferSpanSelection applicableToSpanTmp;
				source.AugmentQuickInfoSession(this, newContent, out applicableToSpanTmp);
				if (IsDismissed)
					return;
				if (applicableToSpan.IsDefault)
					applicableToSpan = applicableToSpanTmp;
			}

			if (newContent.Count == 0 || applicableToSpan.IsDefault)
				Dismiss();
			else {
				QuickInfoContent.BeginBulkOperation();
				QuickInfoContent.Clear();
				QuickInfoContent.AddRange(newContent);
				QuickInfoContent.EndBulkOperation();

				hasInteractiveContent = CalculateHasInteractiveContent();
				SetApplicableToSpan(applicableToSpan);
				if (quickInfoPresenter == null) {
					quickInfoPresenter = intellisensePresenterFactoryService.TryCreateIntellisensePresenter(this);
					if (quickInfoPresenter == null) {
						Dismiss();
						return;
					}
					PresenterChanged?.Invoke(this, EventArgs.Empty);
				}
			}
			Recalculated?.Invoke(this, EventArgs.Empty);
		}