public FunctionNode(CodeFunction cf, CodeModelEditor.BrowseKind kind, CodeModelEditorForm context)
                : base(kind | CodeModelEditor.BrowseKind.Function, context)
            {
                StringBuilder sb = new StringBuilder();

                if (cf.FunctionKind == vsCMFunction.vsCMFunctionConstructor)
                {
                    sb.Append(".ctor");
                }
                else if (cf.FunctionKind == vsCMFunction.vsCMFunctionDestructor)
                {
                    sb.Append(".dtor");
                }
                else
                {
                    sb.Append(cf.Name);
                }
                sb.Append("(");
                int iParam = 0;

                foreach (CodeParameter codeParameter in cf.Parameters)
                {
                    iParam++;
                    sb.Append(codeParameter.Type.AsString);
                    if (iParam != cf.Parameters.Count)
                    {
                        sb.Append(",");
                    }
                }
                sb.Append(")");
                base.Text             = sb.ToString();
                base.Tag              = cf;
                base.ImageKey         = "Method";
                base.SelectedImageKey = "Method";
            }
 public ClassNode(CodeClass cc, CodeModelEditorForm context)
     : base(CodeModelEditor.BrowseKind.Class, context)
 {
     base.Tag              = cc;
     base.ImageKey         = "Class";
     base.SelectedImageKey = "Class";
     SetText(cc.Name);
 }
 public PropertyNode(CodeProperty cp, CodeModelEditorForm context)
     : base(CodeModelEditor.BrowseKind.ClassProperty, context)
 {
     base.Tag              = cp;
     base.ImageKey         = "Property";
     base.SelectedImageKey = "Property";
     SetText(cp.Name);
 }
 public EventNode(CodeEvent ce, CodeModelEditorForm context)
     : base(CodeModelEditor.BrowseKind.ClassEvent, context)
 {
     base.Tag              = ce;
     base.ImageKey         = "Event";
     base.SelectedImageKey = "Event";
     SetText(ce.Name);
 }
 public MemberNode(CodeVariable cv, CodeModelEditorForm context)
     : base(CodeModelEditor.BrowseKind.ClassMember, context)
 {
     base.Tag              = cv;
     base.ImageKey         = "Member";
     base.SelectedImageKey = "Member";
     SetText(cv.Name);
 }
 public DelegateNode(CodeDelegate cd, CodeModelEditorForm context)
     : base(CodeModelEditor.BrowseKind.Delegate, context)
 {
     base.Tag              = cd;
     base.ImageKey         = "Delegate";
     base.SelectedImageKey = "Delegate";
     SetText(cd.Name);
 }
 public EnumNode(CodeEnum ce, CodeModelEditorForm context)
     : base(CodeModelEditor.BrowseKind.Enum, context)
 {
     base.Tag              = ce;
     base.ImageKey         = "Enum";
     base.SelectedImageKey = "Enum";
     SetText(ce.Name);
 }
 public InterfaceNode(CodeInterface ci, CodeModelEditorForm context)
     : base(CodeModelEditor.BrowseKind.Interface, context)
 {
     base.Tag              = ci;
     base.ImageKey         = "Interface";
     base.SelectedImageKey = "Interface";
     SetText(ci.Name);
 }
 public NamespaceNode(string Name, CodeModelEditorForm context)
     : base(CodeModelEditor.BrowseKind.Namespace, context)
 {
     base.Name = Name;
     SetText(Name);
     base.Tag              = new List <CodeNamespace>();
     base.ImageKey         = "Namespace";
     base.SelectedImageKey = "Namespace";
 }
Exemple #10
0
        /// <summary>
        /// See <see cref="UITypeEditor.EditValue(System.ComponentModel.ITypeDescriptorContext,IServiceProvider,object)"/>.
        /// </summary>
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            // We need the editor service.
            if (provider.GetService(typeof(IWindowsFormsEditorService)) == null ||
                provider.GetService(typeof(DTE)) == null)
            {
                return(base.EditValue(context, provider, value));
            }

            ICodeModelEditorFilter filter = null;

            using (CreateFilter(provider, this.filterTypeName, this.attributes, out filter))
            {
                CodeElement customRoot = null;
                if (!string.IsNullOrEmpty(customRootEntryName))
                {
                    IDictionaryService dictService =
                        (IDictionaryService)provider.GetService(typeof(IDictionaryService));
                    try
                    {
                        customRoot = (CodeElement)dictService.GetValue(customRootEntryName);
                    }
                    catch
                    {
                        // Error getting the root object
                        return(null);
                    }
                }
                using (CodeModelEditorForm form = new CodeModelEditorForm(context, root, kind, filter, customRoot, onlyUserCode))
                {
                    IWindowsFormsEditorService svc = (IWindowsFormsEditorService)
                                                     provider.GetService(typeof(IWindowsFormsEditorService));
                    form.Site = new Site(provider, form, form.GetType().FullName);
                    if (svc.ShowDialog(form) == DialogResult.OK)
                    {
                        return(form.SelectedObject);
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
        }
 public CodeModelNode(CodeModelEditor.BrowseKind kind, CodeModelEditorForm parentForm)
 {
     this.kind       = kind;
     this.parentForm = parentForm;
 }
 public MethodNode(CodeFunction cf, CodeModelEditorForm context)
     : base(cf, CodeModelEditor.BrowseKind.Class, context)
 {
 }