public void HandleTreeViewRightClick(TreeNode rightClickedTreeNode, ContextMenuStrip menuToModify)
        {
            ReferencedFileSave rfs;

            var getIfShouldShowMenu = GetIfShouldShowRightClickOption(rightClickedTreeNode, out rfs);

            List <string> availableAtlases = null;

            if (getIfShouldShowMenu)
            {
                string fullFileName = GlueCommands.Self.GetAbsoluteFileName(rfs);

                if (System.IO.File.Exists(fullFileName))
                {
                    // This might be slow, we may want to cache it:
                    TpsLoadResult tpsLoadResult;
                    var           model = TpsFileSave.Load(fullFileName, out tpsLoadResult);

                    var succeeded = string.IsNullOrEmpty(tpsLoadResult.ErrorMessage) &&
                                    string.IsNullOrEmpty(tpsLoadResult.MissingFile);

                    if (succeeded)
                    {
                        availableAtlases = model.AtlasFilters
                                           .Select(item =>
                        {
                            if (item.EndsWith("/"))
                            {
                                return(item.Substring(0, item.Length - 1));
                            }
                            else
                            {
                                return(item);
                            }
                        })
                                           .ToList();
                    }
                }
            }

            if (availableAtlases != null && availableAtlases.Count > 0)
            {
                var menuToAddTo = new ToolStripMenuItem("Include Atlas");
                menuToModify.Items.Add(menuToAddTo);

                foreach (var item in availableAtlases)
                {
                    var atlasMenuItem = new ToolStripMenuItem(item);
                    atlasMenuItem.Click += HandleScreenToAddClick;
                    menuToAddTo.DropDownItems.Add(atlasMenuItem);
                }
            }
        }
        private void LoadFileFromRfs(ReferencedFileSave referencedFile)
        {
            string absoluteFileName = GlueCommands.Self.GetAbsoluteFileName(referencedFile);

            if (System.IO.File.Exists(absoluteFileName))
            {
                TpsLoadResult result;
                loadedFile = TpsFileSave.Load(absoluteFileName, out result);
            }
            else
            {
                loadedFile = null;
            }
        }