private ContextMenuStrip BuildContextMenu(IExplorerObject exObject, List <IExplorerObject> context, bool emptyContentsClick) { if (_strip != null && _strip.Visible == true) { _strip.Close(); } _strip = contextStrip; for (int i = _strip.Items.Count - 1; i >= _contextItemCount; i--) { _strip.Items.RemoveAt(i); } toolStripMenuItemNew.DropDownItems.Clear(); PlugInManager compMan = new PlugInManager(); foreach (XmlNode compNode in compMan.GetPluginNodes(Plugins.Type.IExplorerObject)) { IExplorerObject ex = compMan.CreateInstance(compNode) as IExplorerObject; if (ex is IExplorerObjectCreatable) { if (!((IExplorerObjectCreatable)ex).CanCreate(_exObject)) { continue; } ToolStripItem createNewItem = new CreateNewToolStripItem(ex); createNewItem.Click += new EventHandler(createNewItem_Click); toolStripMenuItemNew.DropDownItems.Add(createNewItem); } } toolStripMenuItemNew.Enabled = (toolStripMenuItemNew.DropDownItems.Count != 0); if (_app != null) { _app.AppendContextMenuItems(_strip, emptyContentsClick ? null : context /*this.SelectedExplorerObjects*/); } CommandInterpreter.AppendMenuItems(_strip, exObject); if (!emptyContentsClick) { //if (exObject is IExplorerObjectRenamable) //{ // if (_strip.Items.Count > 0) _strip.Items.Add(new ToolStripSeparator()); // _strip.Items.Add(_renameMenuItem); //} //if (exObject is IExplorerObjectDeletable) //{ // _strip.Items.Add(_deleteMenuItem); //} } if (exObject is IExplorerObjectContextMenu) { ToolStripItem[] contextItems = ((IExplorerObjectContextMenu)exObject).ContextMenuItems; if (contextItems != null && contextItems.Length > 0) { _strip.Items.Add(new ToolStripSeparator()); foreach (ToolStripItem contextItem in contextItems) { _strip.Items.Add(contextItem); } } } if (exObject is IExplorerObjectContextMenu2) { ToolStripItem[] contextItems = ((IExplorerObjectContextMenu2)exObject).ContextMenuItems(RefreshContents); if (contextItems != null && contextItems.Length > 0) { _strip.Items.Add(new ToolStripSeparator()); foreach (ToolStripItem contextItem in contextItems) { _strip.Items.Add(contextItem); } } } if (exObject != null && exObject.Object is IFeatureClass) { IFeatureClass fc = (IFeatureClass)exObject.Object; if (fc.Dataset != null && fc.Dataset.Database is IFeatureDatabaseReplication) { _strip.Items.Add(new ToolStripSeparator()); _strip.Items.Add(_replicationMenuItem); _appendReplicationIDMenuItem.Enabled = !Replication.FeatureClassHasRelicationID(fc); _checkoutMenuItem.Enabled = Replication.FeatureClassCanReplicate(fc); _checkinMenuItem.Enabled = (Replication.FeatureClassGeneration(fc) > 0); } } if (exObject is IMetadata) { _strip.Items.Add(new ToolStripSeparator()); _strip.Items.Add(_metadataMenuItem); } _contextObject = exObject; return(_strip); }