コード例 #1
0
        ExtensionNodeTypeCollection GetAllowedChildTypes()
        {
            ExtensionNodeInfo en     = (ExtensionNodeInfo)CurrentNode.DataItem;
            object            parent = en.Node.Parent;

            Extension ext = parent as Extension;

            if (ext != null)
            {
                return(ext.GetAllowedNodeTypes());
            }
            else
            {
                ExtensionNodeDescription node = (ExtensionNodeDescription)parent;
                if (node != null)
                {
                    ExtensionNodeType tn = node.GetNodeType();
                    if (tn != null)
                    {
                        return(tn.GetAllowedNodeTypes());
                    }
                }
            }
            return(new ExtensionNodeTypeCollection());
        }
コード例 #2
0
        public override CellEditable StartEditing(Gdk.Event ev, Widget widget, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, CellRendererState flags)
        {
            TreeView tree = (TreeView)widget;
            TreeIter iter;

            tree.Model.GetIterFromString(out iter, path);
            ExtensionNodeDescription node = tree.Model.GetValue(iter, 2) as ExtensionNodeDescription;

            if (node != null)
            {
                editor = new ExtensionEditor(node);
                tree.Model.EmitRowChanged(new TreePath(path), iter);
                TreeViewCellContainer tc = new TreeViewCellContainer(editor);
                tc.EditingDone += delegate {
                    editor = null;
                    tree.Model.EmitRowChanged(new TreePath(path), iter);
                };
                return(tc);
            }
            else
            {
                this.StopEditing(false);
                return(null);
            }
        }
コード例 #3
0
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, ref string label, ref Pixbuf icon, ref Pixbuf closedIcon)
        {
            ExtensionNodeInfo        ninfo = (ExtensionNodeInfo)dataObject;
            ExtensionNodeDescription node  = ninfo.Node;

            label = GLib.Markup.EscapeText(node.NodeName);
            StringBuilder desc = new StringBuilder();

            foreach (NodeAttribute at in node.Attributes)
            {
                if (desc.Length > 0)
                {
                    desc.Append("  ");
                }
                desc.Append(at.Name).Append("=\"").Append(GLib.Markup.EscapeText(at.Value)).Append('"');
            }
            if (desc.Length > 0)
            {
                label += "(<i>" + desc + "</i>)";
            }

            icon = Context.GetIcon("md-extension-node");

            if (treeBuilder.Options ["ShowExistingNodes"] && !ninfo.CanModify)
            {
                Gdk.Pixbuf gicon = Context.GetComposedIcon(icon, "fade");
                if (gicon == null)
                {
                    gicon = ImageService.MakeTransparent(icon, 0.5);
                    Context.CacheComposedIcon(icon, "fade", gicon);
                }
                icon = gicon;
            }
        }
コード例 #4
0
ファイル: ExtensionTree.cs プロジェクト: ewin66/mono-addins
 BaseCondition ReadComplexCondition(ExtensionNodeDescription elem, BaseCondition parentCondition)
 {
     if (elem.NodeName == "Or" || elem.NodeName == "And" || elem.NodeName == "Not")
     {
         var conds = new List <BaseCondition> ();
         foreach (ExtensionNodeDescription celem in elem.ChildNodes)
         {
             conds.Add(ReadComplexCondition(celem, null));
         }
         if (elem.NodeName == "Or")
         {
             return(new OrCondition(conds.ToArray(), parentCondition));
         }
         else if (elem.NodeName == "And")
         {
             return(new AndCondition(conds.ToArray(), parentCondition));
         }
         else
         {
             if (conds.Count != 1)
             {
                 addinEngine.ReportError("Invalid complex condition element '" + elem.NodeName + "'. 'Not' condition can only have one parameter.", null, null, false);
                 return(new NullCondition());
             }
             return(new NotCondition(conds [0], parentCondition));
         }
     }
     if (elem.NodeName == "Condition")
     {
         return(new Condition(AddinEngine, elem, parentCondition));
     }
     addinEngine.ReportError("Invalid complex condition element '" + elem.NodeName + "'.", null, null, false);
     return(new NullCondition());
 }
コード例 #5
0
        public ExtensionEditor(ExtensionNodeDescription node)
        {
            HBox fieldsBox = new HBox();

            fieldsBox.Spacing = 3;
            Gtk.Label lab = new Gtk.Label();
            lab.Markup = "<b>" + node.NodeName + "</b>";
            fieldsBox.PackStart(lab, false, false, 0);
            ExtensionNodeType nt = node.GetNodeType();

            if (nt == null)
            {
                fieldsBox.PackStart(new Gtk.Label("Unknown node type"), false, false, 0);
            }
            else
            {
                AddAttribute(fieldsBox, node, "id", "System.String", false);
                Console.WriteLine("ppAA: " + nt.Attributes.Count);
                foreach (NodeTypeAttribute at in nt.Attributes)
                {
                    AddAttribute(fieldsBox, node, at.Name, at.Type, at.Required);
                }
            }
            PackStart(fieldsBox, false, false, 0);
            ShowAll();
        }
コード例 #6
0
 BaseCondition ReadComplexCondition(ExtensionNodeDescription elem, BaseCondition parentCondition)
 {
     if (elem.NodeName == "Or" || elem.NodeName == "And")
     {
         ArrayList conds = new ArrayList();
         foreach (ExtensionNodeDescription celem in elem.ChildNodes)
         {
             conds.Add(ReadComplexCondition(celem, null));
         }
         if (elem.NodeName == "Or")
         {
             return(new OrCondition((BaseCondition[])conds.ToArray(typeof(BaseCondition)), parentCondition));
         }
         else
         {
             return(new AndCondition((BaseCondition[])conds.ToArray(typeof(BaseCondition)), parentCondition));
         }
     }
     if (elem.NodeName == "Condition")
     {
         return(new Condition(elem, parentCondition));
     }
     AddinManager.ReportError("Invalid complex condition element '" + elem.NodeName + "'.", null, null, false);
     return(new NullCondition());
 }
コード例 #7
0
        bool GetNodeBranch(TreeIter parent, string name, ExtensionNodeSet nset, out TreeIter citer, out ExtensionNodeSet cset)
        {
            TreeIter iter;
            bool     more;

            if (!parent.Equals(TreeIter.Zero))
            {
                more = store.IterChildren(out iter, parent);
            }
            else
            {
                more = store.GetIterFirst(out iter);
            }

            if (more)
            {
                do
                {
                    if (((string)store.GetValue(iter, ColLabel)) == name)
                    {
                        ExtensionNodeDescription node = (ExtensionNodeDescription)store.GetValue(iter, ColObject);
                        ExtensionNodeType        nt   = nset.GetAllowedNodeTypes() [node.NodeName];
                        cset  = nt;
                        citer = iter;
                        return(true);
                    }
                } while (store.IterNext(ref iter));
            }
            citer = iter;
            cset  = null;
            return(false);
        }
コード例 #8
0
 void CollectExtensions(AddinDescription desc, string path, List <Extension> extensions, List <ExtensionNodeDescription> nodes)
 {
     foreach (Extension ext in desc.MainModule.Extensions)
     {
         if (ext.Path == path || ext.Path.StartsWith(path + "/"))
         {
             extensions.Add(ext);
         }
         else if (path.StartsWith(ext.Path + "/"))
         {
             string subp = path.Substring(ext.Path.Length);
             ExtensionNodeDescription           foundNode = null;
             ExtensionNodeDescriptionCollection list      = ext.ExtensionNodes;
             foreach (string p in subp.Split('/'))
             {
                 if (p.Length == 0)
                 {
                     continue;
                 }
                 foundNode = list [p];
                 if (foundNode == null)
                 {
                     break;
                 }
             }
             if (foundNode != null)
             {
                 foreach (ExtensionNodeDescription n in foundNode.ChildNodes)
                 {
                     nodes.Add(n);
                 }
             }
         }
     }
 }
コード例 #9
0
        public void LocalizerProperties(string addinId, string expectedType)
        {
            Addin ad = AddinManager.Registry.GetAddin(addinId);
            ExtensionNodeDescription localizer = ad.Description.Localizer;

            Assert.AreEqual(expectedType, localizer.GetAttribute("type"));
        }
コード例 #10
0
        ExtensionNodeTypeCollection GetAllowedChildTypes(TreeIter it)
        {
            ExtensionNodeTypeCollection types = null;

            Extension ext = (Extension)store.GetValue(it, ColExtension);

            if (ext != null)
            {
                if (ext.Parent == null)
                {
                    ExtensionPoint ep = (ExtensionPoint)store.GetValue(it, ColExtensionPoint);
                    types = ep.NodeSet.GetAllowedNodeTypes();
                }
                else
                {
                    types = ext.GetAllowedNodeTypes();
                }
            }

            ExtensionNodeDescription node = (ExtensionNodeDescription)store.GetValue(it, ColNode);

            if (node != null)
            {
                ExtensionNodeType tn = node.GetNodeType();
                if (tn != null)
                {
                    types = tn.GetAllowedNodeTypes();
                }
            }
            return(types);
        }
コード例 #11
0
 internal Condition(AddinEngine addinEngine, ExtensionNodeDescription element, BaseCondition parent) : base(parent)
 {
     this.addinEngine = addinEngine;
     typeId           = element.GetAttribute("id");
     addin            = element.GetAttribute(SourceAddinAttribute);
     node             = element;
 }
コード例 #12
0
        public void OnAddExtension()
        {
            DotNetProject project = (DotNetProject)CurrentNode.DataItem;

            if (project == null)
            {
                return;
            }
            AddinData data = project.GetAddinData();

            if (project == null)
            {
                return;
            }

            AddinDescription adesc = data.CachedAddinManifest;

            ExtensionSelectorDialog dlg = new ExtensionSelectorDialog(data.AddinRegistry, adesc, adesc.IsRoot, false);

            if (dlg.Run() == (int)Gtk.ResponseType.Ok)
            {
                foreach (object ob in dlg.GetSelection())
                {
                    AddinDescription desc = null;
                    if (ob is ExtensionPoint)
                    {
                        ExtensionPoint ep  = (ExtensionPoint)ob;
                        Extension      ext = new Extension(ep.Path);
                        adesc.MainModule.Extensions.Add(ext);
                        desc = (AddinDescription)ep.Parent;
                    }
                    else if (ob is ExtensionNodeDescription)
                    {
                        ExtensionNodeDescription node = (ExtensionNodeDescription)ob;
                        desc = node.ParentAddinDescription;
                        string path = "";
                        while (node != null && !(node.Parent is Extension))
                        {
                            if (!node.IsCondition)
                            {
                                path = "/" + node.Id + path;
                            }
                            node = node.Parent as ExtensionNodeDescription;
                        }
                        Extension eext = (Extension)node.Parent;
                        Extension ext  = new Extension(eext.Path + "/" + node.Id + path);
                        adesc.MainModule.Extensions.Add(ext);
                    }
                    if (adesc.AddinId != desc.AddinId && !adesc.MainModule.DependsOnAddin(desc.AddinId))
                    {
                        adesc.MainModule.Dependencies.Add(new AddinDependency(desc.AddinId));
                    }
                }
                adesc.Save();
            }
            dlg.Destroy();
        }
コード例 #13
0
        ExtensionNodeDescription InsertNode(AddinData adata, ExtensionNodeInfo refNode, DropPosition pos, ExtensionNodeDescription newNode)
        {
            ExtensionNodeDescriptionCollection nodes = null;

            newNode.InsertBefore = "";
            newNode.InsertAfter  = "";

            if (refNode.CanModify)
            {
                if (pos == DropPosition.Into)
                {
                    nodes = refNode.Node.ChildNodes;
                }
                else if (refNode.Node.Parent is ExtensionNodeDescription)
                {
                    nodes = ((ExtensionNodeDescription)refNode.Node.Parent).ChildNodes;
                }
            }
            else
            {
                if (pos == DropPosition.After)
                {
                    newNode.InsertAfter = refNode.Node.Id;
                }
                else if (pos == DropPosition.Before)
                {
                    newNode.InsertBefore = refNode.Node.Id;
                }
            }
            if (nodes == null)
            {
                string path = refNode.Node.GetParentPath();
                if (pos == DropPosition.Into)
                {
                    path += "/" + refNode.Node.Id;
                }
                Extension ext = adata.CachedAddinManifest.MainModule.GetExtension(path);
                nodes = ext.ExtensionNodes;
            }

            for (int n = 0; n < nodes.Count; n++)
            {
                ExtensionNodeDescription node = nodes [n];
                if (node == refNode.Node)
                {
                    if (pos == DropPosition.After)
                    {
                        n++;
                    }
                    nodes.Insert(n, newNode);
                    return(newNode);
                }
            }
            nodes.Add(newNode);
            return(newNode);
        }
コード例 #14
0
ファイル: AddinData.cs プロジェクト: miaojiang1/monodevelop-1
        internal static ExtensionNodeDescriptionCollection GetExtensionNodes(AddinRegistry registry, AddinDescription desc, string path)
        {
            ArrayList extensions = new ArrayList();

            CollectExtensions(desc, path, extensions);
            foreach (Dependency dep in desc.MainModule.Dependencies)
            {
                AddinDependency adep = dep as AddinDependency;
                if (adep == null)
                {
                    continue;
                }
                Addin addin = registry.GetAddin(adep.FullAddinId);
                if (addin != null)
                {
                    CollectExtensions(addin.Description, path, extensions);
                }
            }

            // Sort the extensions, to make sure they are added in the correct order
            // That is, deepest children last.
            extensions.Sort(new ExtensionComparer());

            ExtensionNodeDescriptionCollection nodes = new ExtensionNodeDescriptionCollection();

            // Add the nodes
            foreach (Extension ext in extensions)
            {
                string subp = path.Substring(ext.Path.Length);
                ExtensionNodeDescriptionCollection col = ext.ExtensionNodes;
                foreach (string p in subp.Split('/'))
                {
                    if (p.Length == 0)
                    {
                        continue;
                    }
                    ExtensionNodeDescription node = col [p];
                    if (node == null)
                    {
                        col = null;
                        break;
                    }
                    else
                    {
                        col = node.ChildNodes;
                    }
                }
                if (col != null)
                {
                    nodes.AddRange(col);
                }
            }
            return(nodes);
        }
コード例 #15
0
        void AddAttribute(HBox fieldsBox, ExtensionNodeDescription node, string name, string type, bool req)
        {
            HBox box = new HBox();

            Gtk.Label lab = new Gtk.Label();
            lab.Markup = "<b>" + name + "</b>=\"";
            box.PackStart(lab, false, false, 0);
            Gtk.Entry entry = new AutoSizeEntry();
            entry.Text = node.GetAttribute(name);
            box.PackStart(entry, false, false, 0);
            box.PackStart(new Gtk.Label("\" "), false, false, 0);
            fieldsBox.PackStart(box, false, false, 0);
        }
コード例 #16
0
        void UpdateButtons()
        {
            TreeIter iter;

            if (!tree.Selection.GetSelected(out iter))
            {
                addNodeButton.Sensitive = false;
                buttonRemove.Sensitive  = false;
                DisposeEditor();
                return;
            }

            DisposeEditor();

            ExtensionNodeDescription node = store.GetValue(iter, ColNode) as ExtensionNodeDescription;

            if (node == null)
            {
                ExtensionPoint ep = (ExtensionPoint)store.GetValue(iter, ColExtensionPoint);
                if (ep != null)
                {
                    addNodeButton.Sensitive = true;
                    buttonRemove.Sensitive  = false;
                }
                else
                {
                    addNodeButton.Sensitive = false;
                    buttonRemove.Sensitive  = false;
                }
                return;
            }

            ExtensionNodeType nt = node.GetNodeType();

            if (nt == null)
            {
                return;
            }

            NodeEditorWidget editor = new NodeEditorWidget(data.Project, data.AddinRegistry, nt, adesc, node.GetParentPath(), node);

            editorBox.AddWithViewport(editor);
            editor.Show();
            editor.BorderWidth = 3;
            currentEditor      = editor;

            ExtensionNodeTypeCollection types = GetAllowedChildTypes(iter);

            addNodeButton.Sensitive = types != null && types.Count > 0;
            buttonRemove.Sensitive  = true;
        }
コード例 #17
0
        public void AddNodeBefore(object data)
        {
            DotNetProject p     = (DotNetProject)CurrentNode.GetParentDataItem(typeof(Project), false);
            AddinData     adata = p.GetAddinData();

            ExtensionNodeInfo        en      = (ExtensionNodeInfo)CurrentNode.DataItem;
            ExtensionNodeType        ntype   = (ExtensionNodeType)data;
            ExtensionNodeDescription newNode = new ExtensionNodeDescription(ntype.NodeName);

            InsertNode(adata, en, DropPosition.Before, newNode);

            adata.CachedAddinManifest.Save();
            adata.NotifyChanged(false);
        }
コード例 #18
0
        public MyPropertyDescriptor(string name, Type type, string desc, string category, ExtensionNodeDescription node) : base(name, new Attribute [0])
        {
            if (type == typeof(Type))
            {
                type       = typeof(string);
                editorType = typeof(TypeCellEditor);
            }

            this.name     = name;
            this.type     = type;
            this.node     = node;
            this.desc     = desc;
            this.category = category;
        }
コード例 #19
0
        public static string GetDisplayName(Extension ext)
        {
            ObjectDescription ob   = ext.GetExtendedObject();
            string            desc = "";
            string            label;
            Extension         lastExtension = ext;

            while (ob is ExtensionNodeDescription)
            {
                ExtensionNodeDescription en = (ExtensionNodeDescription)ob;
                if (desc.Length > 0)
                {
                    desc = " / " + desc;
                }
                desc = en.Id + desc;
                ob   = (ObjectDescription)en.Parent;
                if (ob is Extension)
                {
                    lastExtension = (Extension)ob;
                    ob            = lastExtension.GetExtendedObject();
                }
            }
            ExtensionPoint ep = ob as ExtensionPoint;

            if (ep != null)
            {
                if (!string.IsNullOrEmpty(ep.Name))
                {
                    label = ep.Name;
                }
                else
                {
                    label = ep.Path;
                }
            }
            else if (lastExtension != null)
            {
                label = lastExtension.Path;
            }
            else
            {
                label = "(Unknown Extension Point)";
            }
            if (!string.IsNullOrEmpty(desc))
            {
                label += " / " + desc;
            }
            return(label);
        }
コード例 #20
0
        void DeleteSelection()
        {
            TreeIter it;

            if (!tree.Selection.GetSelected(out it))
            {
                return;
            }

            string    aid = (string)store.GetValue(it, ColAddin);
            Extension ext = (Extension)store.GetValue(it, ColExtension);
            ExtensionNodeDescription node = (ExtensionNodeDescription)store.GetValue(it, ColNode);

            if (aid != null)
            {
                if (store.IterChildren(out it, it))
                {
                    do
                    {
                        Extension aext = (Extension)store.GetValue(it, ColExtension);
                        adesc.MainModule.Extensions.Remove(aext);
                    }while (store.IterNext(ref it));
                }
            }
            else if (ext != null)
            {
                adesc.MainModule.Extensions.Remove(ext);
            }
            else if (node != null)
            {
                if (node.Parent is ExtensionNodeDescription)
                {
                    ((ExtensionNodeDescription)node.Parent).ChildNodes.Remove(node);
                }
                else if (node.Parent is Extension)
                {
                    ((Extension)node.Parent).ExtensionNodes.Remove(node);
                }
            }

            store.Remove(ref it);
            if (!it.Equals(TreeIter.Zero))
            {
                tree.Selection.SelectIter(it);
            }
            NotifyChanged();
        }
コード例 #21
0
        TreeIter AddNode(TreeIter it, ExtensionNodeDescription node)
        {
            string txt = GLib.Markup.EscapeText(node.NodeName) + " (<i>";

            foreach (NodeAttribute at in node.Attributes)
            {
                txt += at.Name + "=\"" + GLib.Markup.EscapeText(at.Value) + "\"  ";
            }
            txt += "</i>)";
            it   = store.AppendValues(it, txt, null, null, node, pixExtensionNode, true, null);

            foreach (ExtensionNodeDescription cnode in node.ChildNodes)
            {
                AddNode(it, cnode);
            }
            return(it);
        }
コード例 #22
0
        protected virtual void OnButtonAddClicked(object sender, System.EventArgs e)
        {
            ExtensionSelectorDialog dlg = new ExtensionSelectorDialog(data.AddinRegistry, adesc, adesc.IsRoot, false);

            if (dlg.Run() == (int)Gtk.ResponseType.Ok)
            {
                foreach (object ob in dlg.GetSelection())
                {
                    AddinDescription desc = null;
                    if (ob is ExtensionPoint)
                    {
                        ExtensionPoint ep  = (ExtensionPoint)ob;
                        Extension      ext = new Extension(ep.Path);
                        adesc.MainModule.Extensions.Add(ext);
                        desc = (AddinDescription)ep.Parent;
                    }
                    else if (ob is ExtensionNodeDescription)
                    {
                        ExtensionNodeDescription node = (ExtensionNodeDescription)ob;
                        desc = node.ParentAddinDescription;
                        string path = "";
                        while (node != null && !(node.Parent is Extension))
                        {
                            if (!node.IsCondition)
                            {
                                path = "/" + node.Id + path;
                            }
                            node = node.Parent as ExtensionNodeDescription;
                        }
                        Extension eext = (Extension)node.Parent;
                        Extension ext  = new Extension(eext.Path + "/" + node.Id + path);
                        adesc.MainModule.Extensions.Add(ext);
                    }
                    if (adesc.AddinId != desc.AddinId && !adesc.MainModule.DependsOnAddin(desc.AddinId))
                    {
                        adesc.MainModule.Dependencies.Add(new AddinDependency(desc.AddinId));
                    }
                }
                NotifyChanged();
                Fill();
            }
            dlg.Destroy();
        }
コード例 #23
0
        string GetLabelForNode(ExtensionNodeDescription node)
        {
            if (node.IsCondition)
            {
                var value = node.GetAttribute("value");
                if (!string.IsNullOrEmpty(value))
                {
                    return($"Condition: {node.Id} == {value}");
                }
                return($"Condition: {node.Id}");
            }

            var type = node.GetAttribute("class");

            if (!string.IsNullOrEmpty(type))
            {
                return(type);
            }

            return(node.Id);
        }
コード例 #24
0
        void CreateNode(TreeIter it, Extension ext, ExtensionNodeDescription node, ExtensionNodeType nt)
        {
            ExtensionNodeDescription newNode = new ExtensionNodeDescription(nt.NodeName);

            if (ext != null)
            {
                if (ext.Parent == null)
                {
                    adesc.MainModule.Extensions.Add(ext);
                }
                ext.ExtensionNodes.Add(newNode);
            }
            else
            {
                node.ChildNodes.Add(newNode);
            }
            TreeIter nit = AddNode(it, newNode);

            tree.ExpandRow(store.GetPath(it), false);
            tree.Selection.SelectIter(nit);
            NotifyChanged();
        }
コード例 #25
0
        void RegisterTypeNode(AddinDescription config, ExtensionAttribute eatt, string path, string nodeName, Type t)
        {
            ExtensionNodeDescription elem = config.MainModule.AddExtensionNode(path, nodeName);

            if (eatt.Id.Length > 0)
            {
                elem.SetAttribute("id", eatt.Id);
                elem.SetAttribute("type", t.FullName);
            }
            else
            {
                elem.SetAttribute("id", t.FullName);
            }
            if (eatt.InsertAfter.Length > 0)
            {
                elem.SetAttribute("insertafter", eatt.InsertAfter);
            }
            if (eatt.InsertBefore.Length > 0)
            {
                elem.SetAttribute("insertbefore", eatt.InsertAfter);
            }
        }
コード例 #26
0
        public void Fill(ExtensionNodeDescription node)
        {
            ExtensionNodeType ntype = node.GetNodeType();

            labelName.Markup = "<small>Extension Node</small>\n<big><b>" + GLib.Markup.EscapeText(ntype.NodeName) + "</b></big>";

            if (!string.IsNullOrEmpty(ntype.Description))
            {
                labelDesc.Text = ntype.Description;
            }
            else
            {
                labelDesc.Text = AddinManager.CurrentLocalizer.GetString("No additional documentation");
            }

            uint row = 0;

            foreach (var att in node.Attributes)
            {
                Gtk.Label lab = new Gtk.Label();
                lab.Markup       = "<b>" + GLib.Markup.EscapeText(att.Name) + ":</b>";
                lab.UseUnderline = false;
                lab.Xalign       = 0;
                tableAtts.Attach(lab, 0, 1, row, row + 1);
                Gtk.Table.TableChild ct = (Gtk.Table.TableChild)tableAtts [lab];
                ct.XOptions = Gtk.AttachOptions.Fill;

                lab = new Gtk.Label(att.Value);
                lab.UseUnderline = false;
                lab.Xalign       = 0;
                lab.Wrap         = true;
                tableAtts.Attach(lab, 1, 2, row, row + 1);
                ct          = (Gtk.Table.TableChild)tableAtts [lab];
                ct.XOptions = Gtk.AttachOptions.Fill;
                row++;
            }
            tableAtts.ShowAll();
        }
コード例 #27
0
        void PopulateNodeTypes(Gtk.Menu menu, TreeIter it)
        {
            ExtensionNodeTypeCollection types = GetAllowedChildTypes(it);
            Extension ext = (Extension)store.GetValue(it, ColExtension);
            ExtensionNodeDescription node = (ExtensionNodeDescription)store.GetValue(it, ColNode);

            if (types != null && types.Count > 0)
            {
                if (menu.Children.Length > 0)
                {
                    menu.Insert(new Gtk.SeparatorMenuItem(), -1);
                }
                foreach (ExtensionNodeType nt in types)
                {
                    Gtk.ImageMenuItem mi = new Gtk.ImageMenuItem(AddinManager.CurrentLocalizer.GetString("Add node '{0}'", nt.NodeName));
                    menu.Insert(mi, -1);
                    ExtensionNodeType ntc = nt;
                    mi.Activated += delegate {
                        CreateNode(it, ext, node, ntc);
                    };
                }
            }
        }
コード例 #28
0
        public void AddNodeBefore(object data)
        {
            DotNetProject p     = (DotNetProject)CurrentNode.GetParentDataItem(typeof(Project), false);
            AddinData     adata = p.GetAddinData();

            Extension         en    = GetExtension();
            ExtensionNodeType ntype = (ExtensionNodeType)data;

            ExtensionNodeDescription newNode = new ExtensionNodeDescription(ntype.NodeName);

            en.ExtensionNodes.Add(newNode);
            CurrentNode.Expanded = true;

            adata.SaveAddinManifest();
            adata.NotifyChanged(false);

            DispatchService.GuiDispatch(delegate {
                ITreeNavigator nav = Tree.GetNodeAtObject(new ExtensionNodeInfo(newNode, false));
                if (nav != null)
                {
                    nav.Selected = true;
                }
            });
        }
コード例 #29
0
        public NodeEditorWidget(DotNetProject project, AddinRegistry reg, ExtensionNodeType ntype, AddinDescription parentAddinDescription, string parentPath, ExtensionNodeDescription node)
        {
            this.node    = node;
            this.project = project;
            tips         = new Tooltips();
            Spacing      = 0;

            // Header

            Label label = new Label();

            label.Wrap         = true;
            label.WidthRequest = 480;
            string txt = "<b>" + node.NodeName + "</b>";

            if (ntype.Description.Length > 0)
            {
                txt += "\n" + GLib.Markup.EscapeText(ntype.Description);
            }
            label.Markup = txt;
            label.Xalign = 0f;
            PackStart(label, false, false, 6);
            PackStart(new HSeparator(), false, false, 0);

            // Attributes

            grid = new PropertyGrid();
            grid.CurrentObject = new NodeWrapper(project, reg, ntype, parentAddinDescription, parentPath, node);

            PackStart(grid, true, true, 0);

            ShowAll();

            grid.ShowHelp    = true;
            grid.ShowToolbar = false;
        }
コード例 #30
0
 public ExtensionNodeInfo(ExtensionNodeDescription node, bool canModify, int order)
 {
     this.Node      = node;
     this.CanModify = canModify;
     this.Order     = order;
 }