private void PrintNode(IAddInTreeNode node, StringBuilder sb)
 {
     sb.AppendFormat("Tree Node Path:{0}, Codon:{1}", node.GetFullPath(), node.Codon == null ? null : node.Codon.ID);
     sb.AppendLine();
     foreach (IAddInTreeNode childNode in node.ChildNodes.Values)
     {
         PrintNode(childNode, sb);
     }
 }
Beispiel #2
0
 public GetEntityListFormToolBarService()
 {
     try
     {
         this.node = AddInTreeSingleton.AddInTree.GetTreeNode(toolBarPath);
     }
     catch (TreePathNotFoundException)
     {
         this.node = null;
     }
 }
Beispiel #3
0
        /// <summary>
        /// Get's the direct child nodes of the TreeNode node as an array. The
        /// array is sorted acordingly to the insertafter and insertbefore preferences
        /// the node has using topoligical sort.
        /// </summary>
        /// <param name="node">
        /// The TreeNode which childs are given back.
        /// </param>
        /// <returns>
        /// A valid topological sorting of the childs of the TreeNode as an array.
        /// </returns>
        private IAddInTreeNode[] GetSubnodesAsSortedArray()
        {
            IAddInTreeNode node  = this;
            int            index = node.ChildNodes.Count;

            IAddInTreeNode[] sortedNodes = new IAddInTreeNode[index];
            Hashtable        visited     = new Hashtable(index);
            Hashtable        anchestor   = new Hashtable(index);

            foreach (string key in node.ChildNodes.Keys)
            {
                visited[key]   = false;
                anchestor[key] = new ArrayList();
            }

            foreach (DictionaryEntry child in node.ChildNodes)
            {
                if (((IAddInTreeNode)child.Value).Codon.InsertAfter != null)
                {
                    for (int i = 0; i < ((IAddInTreeNode)child.Value).Codon.InsertAfter.Length; ++i)
                    {
                        //						Console.WriteLine(((IAddInTreeNode)child.Value).Codon.ID + " " + ((IAddInTreeNode)child.Value).Codon.InsertAfter[i].ToString());
                        if (anchestor.Contains(((IAddInTreeNode)child.Value).Codon.InsertAfter[i].ToString()))
                        {
                            ((ArrayList)anchestor[((IAddInTreeNode)child.Value).Codon.InsertAfter[i].ToString()]).Add(child.Key);
                        }
                    }
                }

                if (((IAddInTreeNode)child.Value).Codon.InsertBefore != null)
                {
                    for (int i = 0; i < ((IAddInTreeNode)child.Value).Codon.InsertBefore.Length; ++i)
                    {
                        if (anchestor.Contains(child.Key))
                        {
                            ((ArrayList)anchestor[child.Key]).Add(((IAddInTreeNode)child.Value).Codon.InsertBefore[i]);
                        }
                    }
                }
            }

            string[] keyarray = new string[visited.Keys.Count];
            visited.Keys.CopyTo(keyarray, 0);

            for (int i = 0; i < keyarray.Length; ++i)
            {
                if ((bool)visited[keyarray[i]] == false)
                {
                    index = Visit(keyarray[i], node.ChildNodes, sortedNodes, visited, anchestor, index);
                }
            }
            return(sortedNodes);
        }
        private string GetWholeAddinTreeStructure()
        {
            StringBuilder sb         = new StringBuilder();
            IEnumerator   enumerator = AddInTreeSingleton.AddInTree.GetTreeNode(null).ChildNodes.Values.GetEnumerator();

            enumerator.MoveNext();
            IAddInTreeNode rootNode = enumerator.Current as IAddInTreeNode;

            PrintNode(rootNode, sb);

            return(sb.ToString());
        }
 /// <summary>
 /// 通过一个指定的路径初始化所有的算法对象,并保存到一个ArrayList中
 /// </summary>
 /// <param name="algorithmPath">一个从插件文件中读取的逻辑路径(即密码子的路径)</param>
 public void InitializeAlgorithms(string algorithmPath)
 {
     try
     {
         IAddInTreeNode treeNode   = AddInTreeSingleton.AddInTree.GetTreeNode(algorithmPath);
         ArrayList      childItems = treeNode.BuildChildItems(this);
         AddAlgorithms((IAlgorithm[])childItems.ToArray(typeof(IAlgorithm)));
     }
     catch
     {
     }
 }
Beispiel #6
0
        public override void Run()
        {
            PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
            IProperties     proterties      = (IProperties)propertyService.GetProperty("NetFocus.DataStructure.TextEditor.Document.DefaultDocumentProperties", new DefaultProperties());
            IAddInTreeNode  treeNode        = AddInTreeSingleton.AddInTree.GetTreeNode("/DataStructure/Dialogs/OptionsDialog");

            using (TreeViewOptions optionsDialog = new TreeViewOptions(proterties, treeNode)) {
                optionsDialog.FormBorderStyle = FormBorderStyle.FixedDialog;

                optionsDialog.Owner = (Form)WorkbenchSingleton.Workbench;
                optionsDialog.ShowDialog();
            }
        }
        public UnitTestOptionsDialog(Gtk.Window parent, UnitTest test)
            : base(parent, null, null)
        {
            IAddInTreeNode node = AddInTreeSingleton.AddInTree.GetTreeNode("/SharpDevelop/Workbench/UnitTestOptions/GeneralOptions");
            configurationNode = AddInTreeSingleton.AddInTree.GetTreeNode("/SharpDevelop/Workbench/UnitTestOptions/ConfigurationProperties");

            this.test = test;
            this.Title = GettextCatalog.GetString ("Unit Test Options");

            properties = new DefaultProperties();
            properties.SetProperty ("UnitTest", test);
            AddNodes (properties, Gtk.TreeIter.Zero, node.BuildChildItems (this));
            SelectFirstNode ();
        }
        /// <remarks>
        /// 初始化服务子系统,由插件文件中定义的代码子来确定要初始化哪些服务.
        /// </remarks>
        private static void InitializeServicesSubsystem(string servicesPath)
        {
            IAddInTreeNode treeNode   = AddInTreeSingleton.AddInTree.GetTreeNode(servicesPath);
            ArrayList      childItems = treeNode.BuildChildItems(defaultServiceManager);

            foreach (IService service in (IService[])childItems.ToArray(typeof(IService)))
            {
                serviceList.Add(service);
            }
            // 下面通过迭代来初始化所有的服务.
            foreach (IService service in serviceList)
            {
                service.InitializeService();
            }
        }
Beispiel #9
0
        public string GetFullPath()
        {
            string         path        = string.Empty;
            IAddInTreeNode currentNode = this;

            while (currentNode != null)
            {
                path        = currentNode.Path + "/" + path;
                currentNode = currentNode.Parent;
            }
            if (!string.IsNullOrEmpty(path) && path.StartsWith("//"))
            {
                path = path.Substring(1);
            }
            return(path);
        }
        public void CreateMenu(object sender, EventArgs e)
        {
            TopMenu.MenuBar = true;
            TopMenu.Stretch = true;
            IAddInTreeNode node       = AddInTreeSingleton.AddInTree.GetTreeNode(mainMenuPath);
            ArrayList      objectList = node.BuildChildItems(this);

            ButtonItem[] items = (ButtonItem[])objectList.ToArray(typeof(ButtonItem));
            TopMenu.Items.Clear();
            TopMenu.Items.AddRange(items);
            if (dotNetBarManager1.Bars.Contains(TopMenu) == false)
            {
                dotNetBarManager1.Bars.Add(TopMenu);
            }
            TopMenu.DockSide = eDockSide.Top;
        }
        public CombineOptionsDialog(Gtk.Window parentWindow, Combine combine, IAddInTreeNode node, IAddInTreeNode configurationNode)
            : base(parentWindow, null, null)
        {
            this.combine = combine;
            this.configurationNode = configurationNode;
            this.Title = GettextCatalog.GetString ("Combine Options");

            configData = ConfigurationData.Build (combine);
            configData.ConfigurationsChanged += new EventHandler (OnConfigChanged);

            properties = new DefaultProperties();
            properties.SetProperty ("Combine", combine);
            properties.SetProperty ("CombineConfigData", configData);

            AddNodes (properties, Gtk.TreeIter.Zero, node.BuildChildItems (this));

            SelectFirstNode ();
        }
Beispiel #12
0
        public TreeViewOptions(IProperties properties, IAddInTreeNode node)
        {
            this.properties = properties;

            this.Text = StringParserService.Parse("${res:Dialog.Options.TreeViewOptions.DialogName}");

            this.InitializeComponent();

            plainFont = new Font(((TreeView)ControlDictionary["optionsTreeView"]).Font, FontStyle.Regular);
            boldFont  = new Font(((TreeView)ControlDictionary["optionsTreeView"]).Font, FontStyle.Bold);

            InitImageList();

            if (node != null)
            {
                AddNodes(properties, ((TreeView)ControlDictionary["optionsTreeView"]).Nodes, node.BuildChildItems(this));
            }
        }
		/// <summary>
		/// Get's the direct child nodes of the TreeNode node as an array. The 
		/// array is sorted acordingly to the insertafter and insertbefore preferences
		/// the node has using topoligical sort.
		/// </summary>
		/// <param name="node">
		/// The TreeNode which childs are given back.
		/// </param>
		/// <returns>
		/// A valid topological sorting of the childs of the TreeNode as an array.
		/// </returns>
		IAddInTreeNode[] GetSubnodesAsSortedArray()
		{
			IAddInTreeNode node = this;
			int index = node.ChildNodes.Count;
			IAddInTreeNode[] sortedNodes = new IAddInTreeNode[index];
			Hashtable  visited   = new Hashtable(index);
			Hashtable  anchestor = new Hashtable(index);
			
			foreach(string key in node.ChildNodes.Keys) {
				visited[key] = false;
				anchestor[key] = new ArrayList();
			}
			
			foreach(DictionaryEntry child in node.ChildNodes){
				if(((IAddInTreeNode)child.Value).Codon.InsertAfter != null){
					for(int i = 0; i < ((IAddInTreeNode)child.Value).Codon.InsertAfter.Length; ++i){
//						Console.WriteLine(((IAddInTreeNode)child.Value).Codon.ID + " " + ((IAddInTreeNode)child.Value).Codon.InsertAfter[i].ToString());
						if(anchestor.Contains(((IAddInTreeNode)child.Value).Codon.InsertAfter[i].ToString())){
							((ArrayList)anchestor[((IAddInTreeNode)child.Value).Codon.InsertAfter[i].ToString()]).Add(child.Key);
						}
					}
				}
				
				if(((IAddInTreeNode)child.Value).Codon.InsertBefore != null){
					for(int i = 0; i < ((IAddInTreeNode)child.Value).Codon.InsertBefore.Length; ++i){
						if(anchestor.Contains(child.Key)){
							((ArrayList)anchestor[child.Key]).Add(((IAddInTreeNode)child.Value).Codon.InsertBefore[i]);
						}
					}
				}
			}
			
			string[] keyarray = new string[visited.Keys.Count];
			visited.Keys.CopyTo(keyarray, 0);
			
			for (int i = 0; i < keyarray.Length; ++i) {
				if((bool)visited[keyarray[i]] == false){
					index = Visit(keyarray[i], node.ChildNodes, sortedNodes, visited, anchestor, index);
				}
			}
			return sortedNodes;
		}
        Gtk.CellRendererText textRenderer; // used to set an editable node

        #endregion Fields

        #region Constructors

        public ProjectOptionsDialog(Gtk.Window parentWindow, Project project, IAddInTreeNode node, IAddInTreeNode configurationNode)
            : base(parentWindow, null, null)
        {
            this.project = project;
            this.configurationNode = configurationNode;
            this.Title = GettextCatalog.GetString ("Project Options");

            properties = new DefaultProperties();
            properties.SetProperty("Project", project);

            AddNodes(properties, Gtk.TreeIter.Zero, node.BuildChildItems(this));

            //
            // This code has to add treeview node items to the treeview. under a configuration node
            //
            AddConfigurationNodes();

            //TreeView.ButtonReleaseEvent += new EventHandler (OnButtonRelease);

            SelectFirstNode ();
        }
        public TreeViewOptions(Gtk.Window parentWindow, IProperties properties, IAddInTreeNode node)
        {
            this.properties = properties;

            Glade.XML treeViewXml = new Glade.XML (null, "Base.glade", "TreeViewOptionDialog", null);
            treeViewXml.Autoconnect (this);

            TreeViewOptionDialog.TransientFor = parentWindow;
            TreeViewOptionDialog.WindowPosition = Gtk.WindowPosition.CenterOnParent;

            TreeViewOptionDialog.Title = GettextCatalog.GetString ("MonoDevelop options");

            cmdManager = new CommandManager (TreeViewOptionDialog);
            cmdManager.RegisterGlobalHandler (this);

            this.InitializeComponent();

            if (node != null)
                AddNodes (properties, Gtk.TreeIter.Zero, node.BuildChildItems(this));

            SelectFirstNode ();
        }
		public ToolbarService()//初始化插件树中的toolBar节点.
		{
			this.node  = AddInTreeSingleton.AddInTree.GetTreeNode(toolBarPath);
		}
 void ShowCodonTree(IAddInTreeNode node, string ident)
 {
     foreach (DictionaryEntry entry in node.ChildNodes) {
         Console.WriteLine(ident + entry.Key);
         ShowCodonTree((IAddInTreeNode)entry.Value, ident + '\t');
     }
 }
Beispiel #18
0
 public ToolbarService()        //初始化插件树中的toolBar节点.
 {
     this.node = AddInTreeSingleton.AddInTree.GetTreeNode(toolBarPath);
 }
        int Visit(string key, Hashtable nodes, IAddInTreeNode[] sortedNodes, Hashtable visited, Hashtable anchestor, int index)
        {
            visited[key] = true;
            foreach (string anch in (ArrayList)anchestor[key]) {
                if ((bool)visited[anch] == false) {
                    index = Visit(anch, nodes, sortedNodes, visited, anchestor, index);
                }
            }

            sortedNodes[--index] = (IAddInTreeNode)nodes[key];
            return index;
        }
        void InitializeIcons(IAddInTreeNode treeNode)
        {
            extensionHashtable[".PRJX"] = Stock.SolutionIcon;
            extensionHashtable[".CMBX"] = Stock.CombineIcon;
            extensionHashtable[".MDS"] = Stock.CombineIcon;
            extensionHashtable[".MDP"] = Stock.SolutionIcon;

            IconCodon[] icons = (IconCodon[])treeNode.BuildChildItems(null).ToArray(typeof(IconCodon));
            for (int i = 0; i < icons.Length; ++i) {
                IconCodon iconCodon = icons[i];
                string image;
                if (iconCodon.Location != null)
                    throw new Exception ("This should be using stock icons");
                else if (iconCodon.Resource != null)
                    image = iconCodon.Resource;
                else
                    image = iconCodon.ID;

                image = ResourceService.GetStockId (iconCodon.AddIn, image);

                if (iconCodon.Extensions != null) {
                    foreach (string ext in iconCodon.Extensions)
                        extensionHashtable [ext.ToUpper()] = image;
                }
                if (iconCodon.Language != null)
                    projectFileHashtable [iconCodon.Language] = image;
            }
        }
 private void PrintNode(IAddInTreeNode node, StringBuilder sb)
 {
     sb.AppendFormat("Tree Node Path:{0}, Codon:{1}", node.GetFullPath(), node.Codon == null ? null : node.Codon.ID);
     sb.AppendLine();
     foreach (IAddInTreeNode childNode in node.ChildNodes.Values)
     {
         PrintNode(childNode, sb);
     }
 }
		public TreeViewOptions(IProperties properties, IAddInTreeNode node) 
		{
			this.properties = properties;
			
			this.Text = StringParserService.Parse("${res:Dialog.Options.TreeViewOptions.DialogName}");

			this.InitializeComponent();
			
			plainFont = new Font(((TreeView)ControlDictionary["optionsTreeView"]).Font, FontStyle.Regular);
			boldFont  = new Font(((TreeView)ControlDictionary["optionsTreeView"]).Font, FontStyle.Bold);
			
			InitImageList();
			
			if (node != null) {
				AddNodes(properties, ((TreeView)ControlDictionary["optionsTreeView"]).Nodes, node.BuildChildItems(this));
			}
		}