Exemple #1
0
 public NodeEditorDialog(DotNetProject project, AddinRegistry reg, ExtensionNodeType ntype, AddinDescription parentAddinDescription, string parentPath, ExtensionNodeDescription node)
 {
     editor             = new NodeEditorWidget(project, reg, ntype, parentAddinDescription, parentPath, node);
     editor.BorderWidth = 12;
     this.VBox.PackStart(editor, true, true, 0);
     this.AddButton(Stock.Cancel, ResponseType.Cancel);
     this.AddButton(Stock.Ok, ResponseType.Ok);
     this.DefaultWidth = 400;
     ShowAll();
 }
		public NodeEditorDialog (DotNetProject project, AddinRegistry reg, ExtensionNodeType ntype, AddinDescription parentAddinDescription, string parentPath, ExtensionNodeDescription node)
		{
			editor = new NodeEditorWidget (project, reg, ntype, parentAddinDescription, parentPath, node);
			editor.BorderWidth = 12;
			this.VBox.PackStart (editor, true, true, 0);
			this.AddButton (Stock.Cancel, ResponseType.Cancel);
			this.AddButton (Stock.Ok, ResponseType.Ok);
			this.DefaultWidth = 400;
			ShowAll ();
		}
        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;
        }
		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;
		}