コード例 #1
0
		public override void Run()
		{
			if (this.Owner is WatchPad) {
				WatchPad pad = (WatchPad)this.Owner;
				
				var inputWindow = new WatchInputBox(StringParser.Parse("${res:MainWindow.Windows.Debug.Watch.AddWatch}"),
				                                    StringParser.Parse("${res:MainWindow.Windows.Debug.Watch.EnterExpression}"));
				inputWindow.Owner = ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainWindow;
				var result = inputWindow.ShowDialog();
				if (!result.HasValue || !result.Value)
					return;
				
				string input = inputWindow.CommandText;
				
				if (!string.IsNullOrEmpty(input)) {
					// get language
					if (ProjectService.CurrentProject == null) return;
					
					string language = ProjectService.CurrentProject.Language;
					
					var text = new TextNode(null, input,
					                        language == "VB" || language == "VBNet" ? SupportedLanguage.VBNet : SupportedLanguage.CSharp).ToSharpTreeNode();
					var list = pad.WatchList;
					
					if(!list.WatchItems.Any(n => text.Node.FullName == ((TreeNodeWrapper)n).Node.FullName))
						list.WatchItems.Add(text);
				}
				
				pad.RefreshPad();
			}
		}
コード例 #2
0
		void watchList_Drop(object sender, DragEventArgs e)
		{
			if (ProjectService.CurrentProject == null) return;
			if (e.Data == null) return;
			if (!e.Data.GetDataPresent(DataFormats.StringFormat)) return;
			if (string.IsNullOrEmpty(e.Data.GetData(DataFormats.StringFormat).ToString())) return;
			
			string language = ProjectService.CurrentProject.Language;	
			
			// FIXME languages
			TextNode text = new TextNode(e.Data.GetData(DataFormats.StringFormat).ToString(), 
			                            language == "VB" || language == "VBNet" ? SupportedLanguage.VBNet : SupportedLanguage.CSharp);

			if (!watchList.WatchItems.Contains(text))
				watchList.WatchItems.ContainsItem(text);
			
			this.RefreshPad();
		}
コード例 #3
0
ファイル: TreeNodeWrapper.cs プロジェクト: nylen/SharpDevelop
		public override void Drop(DragEventArgs e, int index)
		{
			if (ProjectService.CurrentProject == null) return;
			if (e.Data == null) return;
			if (!e.Data.GetDataPresent(DataFormats.StringFormat)) return;
			if (string.IsNullOrEmpty(e.Data.GetData(DataFormats.StringFormat).ToString())) return;
			
			string language = ProjectService.CurrentProject.Language;
			
			// FIXME languages
			TextNode text = new TextNode(null, e.Data.GetData(DataFormats.StringFormat).ToString(),
			                             language == "VB" || language == "VBNet" ? SupportedLanguage.VBNet : SupportedLanguage.CSharp);

			var node = text.ToSharpTreeNode();
			if (!WatchPad.Instance.WatchList.WatchItems.Any(n => text.FullName == ((TreeNodeWrapper)n).Node.FullName))
				WatchPad.Instance.WatchList.WatchItems.Add(node);
			
			WatchPad.Instance.RefreshPad();
		}
コード例 #4
0
		public override void Run()
		{
			if (this.Owner is WatchPad) {
				WatchPad pad = (WatchPad)this.Owner;
				TreeViewAdv ctrl = (TreeViewAdv)pad.Control;
				
				string input = MessageService.ShowInputBox(StringParser.Parse("${res:MainWindow.Windows.Debug.Watch.AddWatch}"),
				                                           StringParser.Parse("${res:MainWindow.Windows.Debug.Watch.EnterExpression}"),
				                                           "");
				if (!string.IsNullOrEmpty(input)) {
					ctrl.BeginUpdate();
					TextNode text = new TextNode(input, SupportedLanguage.CSharp);
					TreeViewVarNode node = new TreeViewVarNode(pad.Process, ctrl, text);
					
					pad.Watches.Add(text);
					ctrl.Root.Children.Add(node);
					ctrl.EndUpdate();
				}
				
				pad.RefreshPad();
			}
		}
コード例 #5
0
		public override void Run()
		{
			if (this.Owner is WatchPad) {
				WatchPad pad = (WatchPad)this.Owner;
				
				var inputWindow = new WatchInputBox(StringParser.Parse("${res:MainWindow.Windows.Debug.Watch.AddWatch}"),
				                                    StringParser.Parse("${res:MainWindow.Windows.Debug.Watch.EnterExpression}"));
				inputWindow.Owner = ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainWindow;
				if (inputWindow.ShowDialog() != true)
					return;
				
				string input = inputWindow.CommandText;
				
				if (!string.IsNullOrEmpty(input)) {
					var text = new TextNode(null, input, inputWindow.ScriptLanguage).ToSharpTreeNode();
					var list = pad.WatchList;
					
					if(!list.WatchItems.Any(n => text.Node.FullName == ((TreeNodeWrapper)n).Node.FullName))
						list.WatchItems.Add(text);
				}
				
				pad.InvalidatePad();
			}
		}
コード例 #6
0
		ToolStripMenuItem MakeItem(string title, string name, TextNode tag, EventHandler onClick)
		{
			ToolStripMenuItem menuItem = new ToolStripMenuItem(StringParser.Parse(title));
			menuItem.Click += onClick;
			menuItem.Name = name;
			menuItem.Tag = tag;
			
			if (name == tag.Language.ToString())
				menuItem.Checked = true;
			
			return menuItem;
		}
コード例 #7
0
ファイル: WatchPad.cs プロジェクト: Bombadil77/SharpDevelop
		void watchList_DragDrop(object sender, DragEventArgs e)
		{
			watchList.BeginUpdate();
			TextNode text = new TextNode(e.Data.GetData(DataFormats.StringFormat).ToString(), SupportedLanguage.CSharp);
			TreeViewVarNode node = new TreeViewVarNode(this.debuggedProcess, this.watchList, text);
			watches.Add(text);
			watchList.Root.Children.Add(node);
			watchList.EndUpdate();
			
			node.IsSelected = true;
			
			this.RefreshPad();
		}
コード例 #8
0
ファイル: WatchPad.cs プロジェクト: Bombadil77/SharpDevelop
		void watchList_DoubleClick(object sender, MouseEventArgs e)
		{
			if (watchList.SelectedNode == null)
			{
				watchList.BeginUpdate();
				TextNode text = new TextNode("", SupportedLanguage.CSharp);
				TreeViewVarNode node = new TreeViewVarNode(this.debuggedProcess, this.watchList, text);
				watches.Add(text);
				watchList.Root.Children.Add(node);
				watchList.EndUpdate();
				
				node.IsSelected = true;
				
				this.RefreshPad();
				
				foreach (NodeControlInfo nfo in watchList.GetNodeControls(node)) {
					if (nfo.Control is WatchItemName)
						((EditableControl)nfo.Control).MouseUp(new TreeNodeAdvMouseEventArgs(e));
				}
			}
		}