public PasteToTargetOperationUI(PasteToTargetOperation op, IWpfTextViewHost targetHost)
        {
            _op = op;
            _op.StateChanged += _op_StateChanged;

            m_targetHost = targetHost;

            m_adornment         = new PasteToTargetStatusAdornment(m_targetHost.TextView);
            m_adornment.Cancel += adornment_Cancel;

            m_highlightTarget = m_targetHost.TextView.Properties.GetOrCreateSingletonProperty <PasteToTargetHighlight>(delegate
            {
                throw new Exception("Unexpected: ITagger PasteToTargetHighlight was not created");
            });
            m_highlightTarget.FireTagsChanged(
                PasteToTargetState.CaptureMode,
                _op.SelectionState.GetSelectedSpans(m_targetHost.TextView.TextBuffer.CurrentSnapshot));
        }
        void _op_StateChanged(object sender, PasteToTargetState e)
        {
            switch (e)
            {
            case PasteToTargetState.CaptureMode:
                m_adornment.Visible = true;

                break;

            case PasteToTargetState.Inactive:
                m_adornment.Visible = false;
                m_adornment         = null;

                m_highlightTarget.FireTagsChanged(e, null);
                m_highlightTarget = null;

                break;
            }

            if (m_adornment != null)
            {
                m_adornment.State = e;
            }
        }