private void btAddSM_Click(object sender, EventArgs e)
        {
            TreeNodeObject ne = treeViewAll.SelectedNode as TreeNodeObject;

            if (ne != null && ne.Parent == null)
            {
                IMethod ep  = ne.OwnerPointer as IMethod;
                string  key = ep.MethodSignature;
                for (int i = 0; i < lstS.Items.Count; i++)
                {
                    MenuItemDataMethod m = lstS.Items[i] as MenuItemDataMethod;
                    if (m.Key == key)
                    {
                        lstS.SelectedIndex = i;
                        return;
                    }
                }
                MenuItemDataMethod mi = MenuItemDataMethod.CreateMenuItem(ep, _menus);
                lstS.SelectedIndex = lstS.Items.Add(mi);
                for (int i = 0; i < lstP.Items.Count; i++)
                {
                    MenuItemDataMethod m = lstP.Items[i] as MenuItemDataMethod;
                    if (m.Key == key)
                    {
                        lstP.Items.RemoveAt(i);
                        break;
                    }
                }
                FrequentlyUsedMethodsChanged = true;
            }
        }
Esempio n. 2
0
        protected override IAction OnCreateAction(MenuItemDataMethod data, ILimnorDesignPane designPane)
        {
            ActionBranchParameter        ab  = (ActionBranchParameter)ClassPointer;
            ActionBranchParameterPointer abp = new ActionBranchParameterPointer(ab, designPane.RootClass);

            abp.MethodId = MethodViewer.Method.MethodID;
            abp.BranchId = ActionBranch.BranchId;
            IClass op = data.Owner;

            data.ResetOwner(abp);
            try
            {
                IAction act = data.CreateMethodAction(designPane, abp, MethodViewer.Method, MethodViewer.ActionsHolder);
                if (act != null)
                {
                    act.ScopeMethod  = MethodViewer.Method;
                    act.ActionHolder = MethodViewer.ActionsHolder;
                }

                data.ResetOwner(op);
                return(act);
            }
            catch
            {
                throw;
            }
            finally
            {
                data.ResetOwner(op);
            }
        }
Esempio n. 3
0
        protected override IAction OnCreateAction(MenuItemDataMethod data, ILimnorDesignPane designPane)
        {
            IAction act = data.CreateMethodAction(designPane, this.LocalPointer, MethodViewer.Method, MethodViewer.ActionsHolder);

            if (act != null)
            {
                act.ScopeMethod  = MethodViewer.Method;
                act.ActionHolder = MethodViewer.ActionsHolder;
            }
            return(act);
        }
 private void createNewAction(MenuItemDataMethod data)
 {
     if (OnBeforeUseComponent())
     {
         EventPath ep = this.Parent as EventPath;
         if (ep != null)
         {
             ILimnorDesignPane dp  = ep.Panes.Loader.DesignPane;
             IAction           act = data.CreateMethodAction(dp, this.ClassPointer, null, null);
             if (act != null)
             {
             }
         }
     }
 }
Esempio n. 5
0
        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
                {
                }
            }
        }
        private void lstS_SelectedIndexChanged(object sender, EventArgs e)
        {
            int n = lstS.SelectedIndex;

            if (n >= 0)
            {
                MenuItemDataMethod mi = lstS.SelectedItem as MenuItemDataMethod;
                if (mi != null)
                {
                    for (int i = 0; i < treeViewAll.Nodes.Count; i++)
                    {
                        IMethod ep  = ((TreeNodeObject)(treeViewAll.Nodes[i])).OwnerPointer as IMethod;
                        string  key = ep.MethodSignature;
                        if (key == mi.Key)
                        {
                            treeViewAll.SelectedNode = treeViewAll.Nodes[i];
                            break;
                        }
                    }
                    lstP.SelectedIndex = -1;
                }
            }
        }
Esempio n. 7
0
 protected abstract IAction OnCreateAction(MenuItemDataMethod data, ILimnorDesignPane designPane);
Esempio n. 8
0
 protected override IAction OnCreateAction(MenuItemDataMethod data, ILimnorDesignPane designPane)
 {
     return(data.CreateMethodAction(designPane, ClassPointer, MethodViewer.Method, MethodViewer.ActionsHolder));
 }
Esempio n. 9
0
        private void miAction_Click(object sender, EventArgs e)
        {
            MenuItemDataMethod data = (MenuItemDataMethod)(((MenuItem)sender).Tag);

            createNewAction(data);
        }