Ejemplo n.º 1
0
        /// <summary>
        ///     Handles 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
            {
                Namable namable = sourceNode.Model as Namable;

                Shortcut shortcut = (Shortcut)acceptor.getFactory().createShortcut();
                shortcut.CopyFrom(namable);
                Item.appendShortcuts(shortcut);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new shortcut
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public ShortcutTreeNode createShortcut(DataDictionary.Shortcuts.Shortcut shortcut)
        {
            ShortcutTreeNode retVal;

            Item.appendShortcuts(shortcut);
            retVal = new ShortcutTreeNode(shortcut);
            Nodes.Add(retVal);
            SortSubNodes();

            return(retVal);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Handles 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);
                }
            }
        }
        /// <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);
                    }
                }
            }
        }