Beispiel #1
0
        private void codeProvider_Apply(object sender, ApplyContentEventArgs ea)
        {
            //select the entire block that belongs to the active element.
            _activeElement.SelectFullBlock();
            //_fullBlockText = Environment.NewLine + CodeRush.Selection.Text;
            //CodeRush.Selection.Delete();
            _activeBlock = CodeRush.TextViews.Active.Selection;

            //get the document for the parent class and activate it.
            Document parentDocument = CodeRush.Documents.Get(_parentClass.FileNode.Name);

            CodeRush.Documents.Activate(parentDocument);

            //now select the target location in the parent class' document.
            if (_parentClass.FirstChild == null)
            {
                //this is temporary. i would like to use the "cc" command in the dxcore but dont know how...
                actionHint.Color = Color.Orange;
                actionHint.Text  = "Add a constructor first..";
                actionHint.PointTo(_parentClass.NameRange.End.Line, _parentClass.NameRange.End.Offset);
                _activeBlock.Clear();
            }
            else
            {
                targetPicker.Start(_parentClass.View as TextView, _parentClass.FirstChild);
            }
        }
Beispiel #2
0
 private void targetPicker_Canceled(object sender, EventArgs e)
 {
     _activeBlock.Clear();
 }
        private void codeProvider_Apply(object sender, ApplyContentEventArgs ea)
        {
            //select the entire block that belongs to the active element.
            _activeElement.SelectFullBlock();
            //_fullBlockText = Environment.NewLine + CodeRush.Selection.Text;
            //CodeRush.Selection.Delete();
            _activeBlock = CodeRush.TextViews.Active.Selection;

            //get the document for the parent class and activate it.
            Document parentDocument = CodeRush.Documents.Get(_parentClass.FileNode.Name);
            CodeRush.Documents.Activate(parentDocument);

            //now select the target location in the parent class' document.
            if(_parentClass.FirstChild == null)
            {
                //this is temporary. i would like to use the "cc" command in the dxcore but dont know how...
                actionHint.Color = Color.Orange;
                actionHint.Text = "Add a constructor first..";
                actionHint.PointTo(_parentClass.NameRange.End.Line, _parentClass.NameRange.End.Offset);
                _activeBlock.Clear();
            }
            else 
            {
                targetPicker.Start(_parentClass.View as TextView,_parentClass.FirstChild);
            }
        }