public void AddFolderHandler(object sender, EventArgs args)
        {
            ShortcutFolder folder = (ShortcutFolder)acceptor.getFactory().createShortcutFolder();

            folder.Name = "<Folder " + (Item.Folders.Count + 1) + ">";
            Item.appendFolders(folder);
        }
Пример #2
0
        /// <summary>
        /// Creates a new folderTreeNode
        /// </summary>
        /// <param name="folder"></param>
        /// <returns></returns>
        public ShortcutFolderTreeNode createFolder(DataDictionary.Shortcuts.ShortcutFolder folder)
        {
            ShortcutFolderTreeNode retVal;

            Item.appendFolders(folder);
            retVal = new ShortcutFolderTreeNode(folder);
            Nodes.Add(retVal);
            SortSubNodes();

            return(retVal);
        }
        /// <summary>
        ///     Accepts a drop event
        /// </summary>
        /// <param name="sourceNode"></param>
        public override void AcceptDrop(BaseTreeNode sourceNode)
        {
            {
                if (sourceNode is ShortcutTreeNode)
                {
                    ShortcutTreeNode shortcut = sourceNode as ShortcutTreeNode;

                    if (shortcut.Item.Dictionary == Item.Dictionary)
                    {
                        Shortcut otherShortcut = (Shortcut)shortcut.Item.Duplicate();
                        Item.appendShortcuts(otherShortcut);

                        shortcut.Delete();
                    }
                }
                else if (sourceNode is ShortcutFolderTreeNode)
                {
                    ShortcutFolderTreeNode folder = sourceNode as ShortcutFolderTreeNode;

                    if (folder.Item.Dictionary == Item.Dictionary)
                    {
                        ShortcutFolder otherFolder = (ShortcutFolder)folder.Item.Duplicate();
                        Item.appendFolders(otherFolder);

                        folder.Delete();
                    }
                }
                else if (sourceNode is RuleTreeNode)
                {
                    RuleTreeNode rule = sourceNode as RuleTreeNode;

                    if (rule.Item.Dictionary == Item.Dictionary)
                    {
                        Shortcut shortcut = (Shortcut)acceptor.getFactory().createShortcut();
                        shortcut.CopyFrom(rule.Item);
                        Item.appendShortcuts(shortcut);
                    }
                }
                else if (sourceNode is FunctionTreeNode)
                {
                    FunctionTreeNode function = sourceNode as FunctionTreeNode;

                    if (function.Item.Dictionary == Item.Dictionary)
                    {
                        Shortcut shortcut = (Shortcut)acceptor.getFactory().createShortcut();
                        shortcut.CopyFrom(function.Item);
                        Item.appendShortcuts(shortcut);
                    }
                }
                else if (sourceNode is ProcedureTreeNode)
                {
                    ProcedureTreeNode procedure = sourceNode as ProcedureTreeNode;

                    if (procedure.Item.Dictionary == Item.Dictionary)
                    {
                        Shortcut shortcut = (Shortcut)acceptor.getFactory().createShortcut();
                        shortcut.CopyFrom(procedure.Item);
                        Item.appendShortcuts(shortcut);
                    }
                }
                else if (sourceNode is VariableTreeNode)
                {
                    VariableTreeNode variable = sourceNode as VariableTreeNode;

                    if (variable.Item.Dictionary == Item.Dictionary)
                    {
                        Shortcut shortcut = (Shortcut)acceptor.getFactory().createShortcut();
                        shortcut.CopyFrom(variable.Item);
                        Item.appendShortcuts(shortcut);
                    }
                }
            }
        }
Пример #4
0
 public void AddFolderHandler(object sender, EventArgs args)
 {
     DataDictionary.Shortcuts.ShortcutFolder folder = (DataDictionary.Shortcuts.ShortcutFolder)DataDictionary.Generated.acceptor.getFactory().createShortcutFolder();
     folder.Name = "<Folder " + (Item.Folders.Count + 1) + ">";
     createFolder(folder);
 }
Пример #5
0
        /// <summary>
        /// Accepts a drop event
        /// </summary>
        /// <param name="SourceNode"></param>
        public override void AcceptDrop(BaseTreeNode SourceNode)
        {
            {
                if (SourceNode is ShortcutTreeNode)
                {
                    ShortcutTreeNode shortcut = SourceNode as ShortcutTreeNode;

                    if (shortcut.Item.Dictionary == Item.Dictionary)
                    {
                        DataDictionary.Shortcuts.Shortcut otherShortcut = (DataDictionary.Shortcuts.Shortcut)DataDictionary.Generated.acceptor.getFactory().createShortcut();
                        shortcut.Item.copyTo(otherShortcut);
                        createShortcut(otherShortcut);

                        shortcut.Delete();
                    }
                }
                else if (SourceNode is ShortcutFolderTreeNode)
                {
                    ShortcutFolderTreeNode folder = SourceNode as ShortcutFolderTreeNode;

                    if (folder.Item.Dictionary == Item.Dictionary)
                    {
                        DataDictionary.Shortcuts.ShortcutFolder otherFolder = (DataDictionary.Shortcuts.ShortcutFolder)DataDictionary.Generated.acceptor.getFactory().createShortcutFolder();
                        folder.Item.copyTo(otherFolder);
                        createFolder(otherFolder);

                        folder.Delete();
                    }
                }
                else if (SourceNode is DataDictionaryView.RuleTreeNode)
                {
                    DataDictionaryView.RuleTreeNode rule = SourceNode as DataDictionaryView.RuleTreeNode;

                    if (rule.Item.Dictionary == Item.Dictionary)
                    {
                        DataDictionary.Shortcuts.Shortcut shortcut = (DataDictionary.Shortcuts.Shortcut)DataDictionary.Generated.acceptor.getFactory().createShortcut();
                        shortcut.CopyFrom(rule.Item);
                        createShortcut(shortcut);
                    }
                }
                else if (SourceNode is DataDictionaryView.FunctionTreeNode)
                {
                    DataDictionaryView.FunctionTreeNode function = SourceNode as DataDictionaryView.FunctionTreeNode;

                    if (function.Item.Dictionary == Item.Dictionary)
                    {
                        DataDictionary.Shortcuts.Shortcut shortcut = (DataDictionary.Shortcuts.Shortcut)DataDictionary.Generated.acceptor.getFactory().createShortcut();
                        shortcut.CopyFrom(function.Item);
                        createShortcut(shortcut);
                    }
                }
                else if (SourceNode is DataDictionaryView.ProcedureTreeNode)
                {
                    DataDictionaryView.ProcedureTreeNode procedure = SourceNode as DataDictionaryView.ProcedureTreeNode;

                    if (procedure.Item.Dictionary == Item.Dictionary)
                    {
                        DataDictionary.Shortcuts.Shortcut shortcut = (DataDictionary.Shortcuts.Shortcut)DataDictionary.Generated.acceptor.getFactory().createShortcut();
                        shortcut.CopyFrom(procedure.Item);
                        createShortcut(shortcut);
                    }
                }
                else if (SourceNode is DataDictionaryView.VariableTreeNode)
                {
                    DataDictionaryView.VariableTreeNode variable = SourceNode as DataDictionaryView.VariableTreeNode;

                    if (variable.Item.Dictionary == Item.Dictionary)
                    {
                        DataDictionary.Shortcuts.Shortcut shortcut = (DataDictionary.Shortcuts.Shortcut)DataDictionary.Generated.acceptor.getFactory().createShortcut();
                        shortcut.CopyFrom(variable.Item);
                        createShortcut(shortcut);
                    }
                }
            }
        }