public void Dispose()
        {
            var disposableProvider = provider as IDisposable;

            if (disposableProvider != null)
            {
                disposableProvider.Dispose();
            }
            lastItem = null;
        }
        public override async Task <MonoDevelop.Ide.Editor.TooltipItem> GetItem(MonoTextEditor editor, int offset, CancellationToken token = default(CancellationToken))
        {
            var wrappedEditor = WrapEditor(editor);

            if (wrappedEditor == null)
            {
                return(null);
            }
            var doc = IdeApp.Workbench.ActiveDocument;

            if (doc == null)
            {
                return(null);
            }
            var task = provider.GetItem(wrappedEditor, doc, offset, token);

            if (task == null)
            {
                LoggingService.LogWarning("Tooltip provider " + provider + " gave back null on GetItem (should always return a non null task).");
                return(null);
            }
            var item = await task;

            if (item == null)
            {
                return(null);
            }
            if (lastItem != null)
            {
                if (lastItem.Offset == item.Offset &&
                    lastItem.Length == item.Length &&
                    lastItem.Item.Equals(item.Item))
                {
                    return(lastItem);
                }
            }
            lastItem = item;
            return(item);
        }
Esempio n. 3
0
        public override Xwt.WindowFrame ShowTooltipWindow(MonoTextEditor editor, Xwt.WindowFrame tipWindow, int offset, Gdk.ModifierType modifierState, int mouseX, int mouseY, Ide.Editor.TooltipItem item)
        {
            var wrappedEditor = WrapEditor(editor);

            if (wrappedEditor == null)
            {
                return(tipWindow);
            }
            provider.ShowTooltipWindow(wrappedEditor, tipWindow, item, modifierState.ToXwtValue(), mouseX, mouseY);
            return(tipWindow);
        }
Esempio n. 4
0
        public override Xwt.WindowFrame CreateTooltipWindow(MonoTextEditor editor, int offset, Gdk.ModifierType modifierState, Ide.Editor.TooltipItem item)
        {
            var wrappedEditor = WrapEditor(editor);

            if (wrappedEditor == null)
            {
                return(null);
            }
            var control = provider.CreateTooltipWindow(wrappedEditor, IdeApp.Workbench.ActiveDocument, item, offset, modifierState.ToXwtValue());

            if (control == null)
            {
                return(null);
            }
            return(control);
        }
		public override async Task<TooltipItem> GetItem (MonoTextEditor editor, int offset, CancellationToken token = default(CancellationToken))
		{
			var wrappedEditor = WrapEditor (editor);
			if (wrappedEditor == null)
				return null;
			var doc = IdeApp.Workbench.ActiveDocument;
			if (doc == null)
				return null;
			var task = provider.GetItem (wrappedEditor, doc, offset, token);
			if (task == null) {
				LoggingService.LogWarning ("Tooltip provider " + provider + " gave back null on GetItem (should always return a non null task).");
				return null;
			}
			var item = await task;
			if (item == null)
				return null;
			if (lastUnwrappedItem != null) {
				if (lastUnwrappedItem.Offset == item.Offset &&
					lastUnwrappedItem.Length == item.Length &&
					lastUnwrappedItem.Item.Equals (item.Item)) {
					return lastWrappedItem;
				}
			}
			lastUnwrappedItem = item;
			return lastWrappedItem = new TooltipItem (item.Item, item.Offset, item.Length);
		}
		public void Dispose ()
		{
			var disposableProvider = provider as IDisposable;
			if (disposableProvider != null) {
				disposableProvider.Dispose ();
			}
			lastWrappedItem = null;
			lastUnwrappedItem = null;
		}