private void createNewAction(MenuItemDataMethod data) { ILimnorDesignPane dp = Designer.Project.GetTypedData <ILimnorDesignPane>(Designer.ObjectMap.ClassId); IAction act = OnCreateAction(data, dp); if (act != null) { if (!(this.ClassPointer is LocalVariable)) { if (MethodEditContext.IsWebPage) { if (!MethodEditContext.CheckAction(act, this.FindForm())) { return; } } } MethodDiagramViewer mv = MethodViewer.GetCurrentViewer(); act.ScopeMethod = _methodClass; act.ActionHolder = MethodViewer.ActionsHolder; double x0, y0; ComponentIconEvent.CreateRandomPoint((double)((mv.Width - 20) / 2), out x0, out y0); if (x0 < 0) { x0 = 10; } if (y0 < 0) { y0 = 10; } ActionViewer av = MethodViewer.AddNewAction(act, new Point((mv.Width - 20) / 2 + (int)x0, (mv.Height - 20) / 2 + (int)y0)); if (av.Parent == null) { #if DEBUG MessageBox.Show("Adding action viewer failed (1)"); #endif mv.Controls.Add(av); } else { } } }