public override void OnMouseUp(MouseEvent e) { base.OnMouseUp(e); if (CurrentConnection != null) { InvertApplication.Execute(new LambdaCommand("Create Connection", () => { CurrentConnection.Apply(CurrentConnection); })); } else { var mouseData = e; InvertApplication.SignalEvent <IShowConnectionMenu>( _ => _.Show(DiagramViewModel, StartConnector, mouseData.MouseUpPosition)); //var allowedFilterNodes = FilterExtensions.AllowedFilterNodes[this.DiagramViewModel.CurrentRepository.CurrentFilter.GetType()]; //var menu = InvertGraphEditor.CreateCommandUI<ContextMenuUI>(); //foreach (var item in allowedFilterNodes) //{ // if (item.IsInterface) continue; // if (item.IsAbstract) continue; // var node = Activator.CreateInstance(item) as IDiagramNode; // node.Graph = this.DiagramViewModel.GraphData; // var vm = InvertGraphEditor.Container.GetNodeViewModel(node, this.DiagramViewModel) as DiagramNodeViewModel; // if (vm == null) continue; // vm.IsCollapsed = false; // var connectors = new List<ConnectorViewModel>(); // vm.GetConnectors(connectors); // var config = InvertGraphEditor.Container.Resolve<NodeConfigBase>(item.Name); // var name = config == null ? item.Name : config.Name; // foreach (var connector in connectors) // { // foreach (var strategy in InvertGraphEditor.ConnectionStrategies) // { // var connection = strategy.Connect(this.DiagramViewModel, StartConnector, connector); // if (connection == null) continue; // var node1 = node; // var message = string.Format("Create {0}", name); // if (!string.IsNullOrEmpty(connector.Name)) // { // message += string.Format(" and connect to {0}", connector.Name); // } // var value = new KeyValuePair<IDiagramNode, ConnectionViewModel>(node1, connection); // menu.AddCommand( // new SimpleEditorCommand<DiagramViewModel>(delegate(DiagramViewModel n) // { // //UnityEditor.EditorWindow.FocusWindowIfItsOpen(typeof (ElementsDesigner)); // InvertGraphEditor.ExecuteCommand(_ => // { // this.DiagramViewModel.AddNode(value.Key,e.MouseUpPosition); // connection.Apply(value.Value as ConnectionViewModel); // value.Key.IsSelected = true; // value.Key.IsEditing = true; // value.Key.Name = ""; // }); // },message)); // } // } //} //menu.Go(); } foreach (var a in PossibleConnections) { a.IsMouseOver = false; a.IsSelected = false; } e.Cancel(); }