// Adds an object to this node, might or might not be a new object internal ObjectInfo AddObject(Object obj) { ObjectInfo newObjInfo = ObjectInfoFactory.GetObjectInfo(IsComNode, obj); if (AddObject(newObjInfo)) { return(newObjInfo); } return(null); }
// For linking to the type information for this object public String GetLinkName(Object linkModifier) { ObjectInfo objInfo = ObjectInfoFactory.GetObjectInfo(true, linkModifier); String retString = linkModifier.ToString(); // Don't return a boring type if (retString.Equals(Win32.ActiveX.COM_ROOT_TYPE_NAME)) { return(objInfo.ObjType.ToString()); } return(retString); }
// Returns ObjectInfo objects for the children // Here we flatten out each delegate that will get an event public override ICollection GetChildren() { ArrayList retVal = new ArrayList(); EventHandlerList obj = (EventHandlerList)_node.ObjectInfo.Obj; if (obj != null) { Object listEntry = _headField.GetValue(obj); while (listEntry != null) { Delegate handler = (Delegate)_handlerField.GetValue(listEntry); // These can be null if the list was contracted if (handler != null) { Delegate[] invList = handler.GetInvocationList(); foreach (Delegate d in invList) { // Skip the registrations associated with tracing Assembly assembly = d.Target.GetType().Assembly; if (assembly.GetName().Name. Equals(AssemblySupport.DUMMY_ASSY_NAME)) { continue; } ObjectInfo newObjInfo = ObjectInfoFactory. GetObjectInfo(false, d); // Name the thing according to its delegate newObjInfo.ObjectName = d.Method.Name + " | " + d.Target.ToString(); retVal.Add(newObjInfo); } } listEntry = _nextField.GetValue(listEntry); } } return(retVal); }
// Allocates the correct type of node protected override BrowserTreeNode AllocateChildNode(Object obj) { if (_typeHandler != null && _typeHandler.Enabled) { return(_typeHandler.AllocateChildNode((ObjectInfo)obj)); } MemberInfo member = (MemberInfo)obj; ObjectInfo objInfo = ObjectInfoFactory.GetObjectInfo(_comNode, member, ObjType); if (TraceUtil.If(this, TraceLevel.Verbose)) { Trace.WriteLine("AllocateChild (member): " + member); } ObjectTypeTreeNode newNode = new ObjectTypeTreeNode(_comNode, objInfo, member, _useIntermediates); return(newNode); }
// Returns ObjectInfo objects for the children protected ICollection GetChildren(IEnumerator e) { ArrayList retVal = new ArrayList(); if (e != null) { e.Reset(); while (e.MoveNext()) { if (e.Current == null) { continue; } ObjectInfo newObjInfo = ObjectInfoFactory.GetObjectInfo(_node.IsComNode, e.Current); retVal.Add(newObjInfo); } } return(retVal); }
protected static void AddRunningObjs() { TraceUtil.WriteLineInfo(null, "AddRunningObjs"); ObjectTreeNode tlNode = null; // Running objects - added to object tree if (_runningObjInfo == null) { _runningObjInfo = ObjectInfoFactory.GetObjectInfo(false, new ArrayList()); _runningObjInfo.ObjectName = StringParser.Parse("${res:ComponentInspector.ComRunningObjectsTreeNode.Text}"); tlNode = new ObjectTreeNode(true, _runningObjInfo); // The children are explicitly added here tlNode.ChildrenAlreadyAdded = true; tlNode.NodeOrder = 20; tlNode.AllowDelete = false; tlNode.IsDropTarget = false; ObjectBrowser.ObjTree.CreateControl(); ObjectBrowser.ObjTree.Invoke(new BrowserTree.AddNodeInvoker(ObjectBrowser.ObjTree.AddNode), new Object[] { tlNode }); } else { tlNode = ObjectTreeNode.FindObject(_runningObjInfo.Obj, !ObjectTreeNode.CREATE_OBJ); ((ArrayList)_runningObjInfo.Obj).Clear(); tlNode.InvalidateNode(); } ProgressDialog progress = new ProgressDialog(); progress.Setup(StringParser.Parse("${res:ComponentInspector.ProgressDialog.AddingRunningComObjectsDialogTitle}"), StringParser.Parse("${res:ComponentInspector.ProgressDialog.AddingRunningComObjectsMessage}"), ComObjectInfo.GetRunningObjectCount(), ProgressDialog.HAS_PROGRESS_TEXT, ProgressDialog.FINAL); progress.ShowIfNotDone(); foreach (ComObjectInfo comObjInfo in ComObjectInfo.GetRunningObjects(progress)) { ObjectBrowser.ObjTree.Invoke(new ObjectTreeNode.AddObjectInvoker(tlNode.AddObject), new Object[] { comObjInfo }); } tlNode.Expand(); progress.Finished(); }
void InitializeComponent(bool showStatusPanel, bool tabbedLayout) { SuspendLayout(); CausesValidation = false; AutoScaleDimensions = new SizeF(6F, 13F); AutoScaleMode = AutoScaleMode.Font; Name = "ObjectBrowserControl"; Size = new Size(800, 700); // All of the dimensions are here int objTreeWidth = (int)(ClientSize.Width * 2 / WIDTH_UNITS); int assyTreeWidth = (int)(ClientSize.Width * 3 / WIDTH_UNITS); int paramsWidth = (int)(ClientSize.Width * 1 / WIDTH_UNITS); int imageWidth = (int)(ClientSize.Width * 2 / WIDTH_UNITS); int topHeight = (int)(ClientSize.Height * 2.5 / HEIGHT_UNITS); int bottomHeight = (int)(ClientSize.Height * 2.5 / HEIGHT_UNITS); int detailHeight = (int)(ClientSize.Height * 1 / HEIGHT_UNITS); int objTreeHeight = ClientSize.Height - detailHeight; // Contents of treePanel, on the left _objTree = new BrowserTree(TOP_OBJ_NAME); // Hook up the routines that get called when preferences change ComponentInspectorProperties.ShowPropertyAccessorMethodsChanged += ObjectTreeInvalidated; ComponentInspectorProperties.ShowFieldsChanged += ObjectTreeInvalidated; ComponentInspectorProperties.ShowPropertiesChanged += ObjectTreeInvalidated; ComponentInspectorProperties.ShowMethodsChanged += ObjectTreeInvalidated; ComponentInspectorProperties.ShowEventsChanged += ObjectTreeInvalidated; ComponentInspectorProperties.ShowBaseClassesChanged += ObjectTreeInvalidated; ComponentInspectorProperties.ShowPublicMembersOnlyChanged += ObjectTreeInvalidated; ComponentInspectorProperties.ShowMemberCategoriesChanged += ObjectTreePreferencesChanged; ComponentInspectorProperties.ShowBaseCategoriesChanged += ObjectTreePreferencesChanged; ComponentInspectorProperties.CategoryThresholdChanged += ObjectTreePreferencesChanged; ComponentInspectorProperties.ShowBaseClassNamesChanged += ObjectTreeInvalidated; ComponentInspectorProperties.DisplayHexChanged += ObjectTreeInvalidated; ComponentInspectorProperties.ShowAssemblyPanelChanged += TabPanelChanged; ComponentInspectorProperties.ShowControlPanelChanged += TabPanelChanged; ComponentInspectorProperties.ShowGacPanelChanged += TabPanelChanged; ComponentInspectorProperties.TypeHandlerChanged += ObjectTreeInvalidated; ColumnHeader ch = new ColumnHeader(); ch.Text = StringParser.Parse("${res:ComponentInspector.ObjectBrowser.ValueColumnHeader}"); ch.TextAlign = HorizontalAlignment.Left; _objTree.Columns.Add(ch); _objTree.BorderStyle = BorderStyle.None; _objTree.AllowDrop = true; _objTree.IsObjectContainer = true; _objTree.IsDropTarget = true; _objTree.UseCompareTo = true; _objTree.GotFocus += new EventHandler(TreeFocused); UpdateObjectTreePreferences(); _objTree.SetupPanel(); _objTree.Panel.Dock = DockStyle.Fill; _objTree.Panel.Width = objTreeWidth; _objTree.Panel.Height = objTreeHeight; _objTree.Panel.BorderStyle = BorderStyle.None; _objTreePanel = new Panel(); _objTreePanel.Dock = DockStyle.Left; _objTreePanel.Width = _objTree.Panel.Width; // Note we add the parent, because the tree comes with a // panel that's the parent of the tree _objTreePanel.Controls.Add(_objTree.Panel); _objTreePanel.BorderStyle = BorderStyle.Fixed3D; new PanelLabel(_objTreePanel, StringParser.Parse("${res:ComponentInspector.ObjectBrowser.ObjectsTreePanel}")); // Image panel _imagePanel = NoGoop.ObjBrowser.ImagePanel.CreateImagePanel(objTreeWidth, !tabbedLayout); _imagePanel.WrapperPanel.Dock = DockStyle.Fill; // For text associated with each tree node _detailPanel = new DetailPanel(); _detailPanel.Dock = DockStyle.Bottom; _params = new ParamPanel(); _params.Dock = DockStyle.Fill; _params.Width = paramsWidth; _eventLog = new EventLogList(this); AssemblySupport.Init(); AssemblySupport.AssyTree.GotFocus += new EventHandler(TreeFocused); // Splitter between main tree and the rest, vertical Splitter mainSplitter = new Splitter(); mainSplitter.Dock = DockStyle.Left; mainSplitter.Width = Utils.SPLITTER_SIZE; Panel paramPanel = new Panel(); paramPanel.Dock = DockStyle.Left; paramPanel.Width = _params.Width; paramPanel.Controls.Add(_params); paramPanel.BorderStyle = BorderStyle.Fixed3D; new PanelLabel(paramPanel, StringParser.Parse("${res:ComponentInspector.ObjectBrowser.ParametersPanel}")); Splitter propImageSplitter = new Splitter(); propImageSplitter.Dock = DockStyle.Left; propImageSplitter.Width = Utils.SPLITTER_SIZE; // Contains the property panel and image panel Panel propImagePanel = new Panel(); propImagePanel.Dock = DockStyle.Top; propImagePanel.Height = topHeight; propImagePanel.Controls.Add(_imagePanel.WrapperPanel); propImagePanel.Controls.Add(propImageSplitter); propImagePanel.Controls.Add(paramPanel); // Splitter between node details and the rest _topTabSplitter = new Splitter(); _topTabSplitter.Dock = DockStyle.Top; _topTabSplitter.Height = Utils.SPLITTER_SIZE; GacList gacList = new GacList(); gacList.Width = assyTreeWidth; gacList.Dock = DockStyle.Fill; gacList.BorderStyle = BorderStyle.None; _gacTabPage = new TabPage(); _gacTabPage.Controls.Add(gacList); _gacTabPage.Text = "GAC"; _gacTabPage.BorderStyle = BorderStyle.None; // Object tab page. if (tabbedLayout) { _objTreeTabPage = new TabPage(); _objTreeTabPage.Controls.Add(_objTreePanel); _objTreeTabPage.Text = StringParser.Parse("${res:ComponentInspector.ObjectBrowser.ObjectsTreePanel}"); _objTreeTabPage.BorderStyle = BorderStyle.None; } // Not presently used _outputList = new OutputList(); _outputList.Width = assyTreeWidth; _outputList.Dock = DockStyle.Fill; _outputList.BorderStyle = BorderStyle.None; TabPage outputTabPage = new TabPage(); outputTabPage.Controls.Add(_outputList); outputTabPage.Text = StringParser.Parse("${res:ComponentInspector.ObjectBrowser.OutputTab}"); outputTabPage.BorderStyle = BorderStyle.None; _tabControl = new TabControl(); _tabControl.Dock = DockStyle.Fill; _tabControl.Width = assyTreeWidth; _tabControl.SelectedIndexChanged += new EventHandler(TabIndexChangedHandler); // Contains the property panel and image panel Panel tabPanel = new Panel(); tabPanel.Dock = DockStyle.Fill; if (tabbedLayout) { propImagePanel.Dock = DockStyle.Fill; } else { tabPanel.Controls.Add(_tabControl); tabPanel.Controls.Add(_topTabSplitter); } tabPanel.Controls.Add(propImagePanel); // All of the panels on the top _topPanel = new Panel(); _topPanel.Dock = DockStyle.Fill; _topPanel.Height = topHeight + bottomHeight; _topPanel.Controls.Add(tabPanel); _topPanel.Controls.Add(mainSplitter); if (tabbedLayout) { _tabControl.Dock = DockStyle.Left; _objTreePanel.Dock = DockStyle.Fill; _topPanel.Controls.Add(_tabControl); } else { _topPanel.Controls.Add(_objTreePanel); } if (!tabbedLayout) { _topBottomSplitter = new Splitter(); _topBottomSplitter.Dock = DockStyle.Bottom; _topBottomSplitter.Height = Utils.SPLITTER_SIZE; _topBottomSplitter.MinSize = detailHeight; } if (showStatusPanel) { _statusPanel = new StatusPanel(); _statusPanelLabel = new PanelLabel(_statusPanel); _statusPanelLabel.Dock = DockStyle.Top; } Controls.Add(_topPanel); if (showStatusPanel) { Controls.Add(_statusPanelLabel); } if (!tabbedLayout) { Controls.Add(_topBottomSplitter); Controls.Add(_detailPanel); } // To allow file dropping DragEnter += new DragEventHandler(DragEnterEvent); DragDrop += new DragEventHandler(DragDropEvent); DragOver += new DragEventHandler(DragOverEvent); AllowDrop = true; _objTree.BeginUpdate(); // Add top level nodes ArrayList tlList = new ArrayList(); ObjectInfo objInfo = ObjectInfoFactory.GetObjectInfo(false, tlList); objInfo.ObjectName = TOP_OBJ_NAME; BrowserTreeNode node = new ObjectTreeNode(false, objInfo); // Make sure this is the first node node.NodeOrder = 0; node.AllowDelete = false; _objTree.Nodes.Add(node); // Just for testing if (LocalPrefs.Get(LocalPrefs.DEV) != null) { tlList.Add(this); } _objTree.EndUpdate(); ComSupport.Init(); ComSupport.ComTree.GotFocus += new EventHandler(TreeFocused); SetTabPanels(); ResumeLayout(); }